save some implementation
This commit is contained in:
48
main/main.c
48
main/main.c
@@ -15,6 +15,7 @@
|
||||
#include "esp_mac.h"
|
||||
#include <string.h>
|
||||
|
||||
#include "components/radio.h"
|
||||
#include "components/sensors.h"
|
||||
#include "components/util.h"
|
||||
#include "hw/bme680b.h"
|
||||
@@ -23,31 +24,70 @@
|
||||
#include "hw/ina260.h"
|
||||
#include "hw/mcp23018.h"
|
||||
#include "hw/mpu9250.h"
|
||||
#include "hw/buscfg.h"
|
||||
|
||||
#include "hw/gps.h"
|
||||
|
||||
#define TAG "cantest"
|
||||
|
||||
|
||||
#define CONFIG_FREERTOS_HZ 100
|
||||
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
|
||||
/* instantiate i2c master bus 0 */
|
||||
ESP_ERROR_CHECK(i2c_new_master_bus(&i2c0_bus_cfg, &i2c0_bus_hdl));
|
||||
|
||||
spi_bus_config_t MCPBusCfg = {
|
||||
.mosi_io_num = -1,
|
||||
.miso_io_num = MCP3550_MISO_GPIO,
|
||||
.sclk_io_num = MCP3550_SCK_GPIO,
|
||||
.quadwp_io_num = -1,
|
||||
.quadhd_io_num = -1,
|
||||
.max_transfer_sz = 4,
|
||||
};
|
||||
ESP_ERROR_CHECK(spi_bus_initialize(SPI2_HOST, &MCPBusCfg, SPI_DMA_DISABLED));
|
||||
|
||||
spi_bus_config_t HighSpeedBusCfg = {
|
||||
// CONNECTED to LoRa and SD card
|
||||
.mosi_io_num = HSPI_MOSI_GPIO,
|
||||
.miso_io_num = HSPI_MISO_GPIO,
|
||||
.sclk_io_num = HSPI_SCK_GPIO,
|
||||
.quadwp_io_num = -1,
|
||||
.quadhd_io_num = -1,
|
||||
.max_transfer_sz = 64, // probably change
|
||||
};
|
||||
ESP_ERROR_CHECK(spi_bus_initialize(SPI3_HOST, &HighSpeedBusCfg, SPI_DMA_CH_AUTO));
|
||||
|
||||
/* scan i2c devices on i2c master bus 0 and print results */
|
||||
ESP_ERROR_CHECK(i2c_master_bus_detect_devices(i2c0_bus_hdl));
|
||||
|
||||
mcp23018_init();
|
||||
|
||||
/* create task pinned to the app core */
|
||||
xTaskCreatePinnedToCore(
|
||||
xTaskCreate(
|
||||
i2c_sensors_task,
|
||||
"I2CTaskBME",
|
||||
8192,
|
||||
NULL,
|
||||
(tskIDLE_PRIORITY + 2),
|
||||
NULL);
|
||||
|
||||
xTaskCreate(
|
||||
lora_comms_task,
|
||||
"LoraCommsTask",
|
||||
8192,
|
||||
NULL,
|
||||
APP_CPU_NUM);
|
||||
(tskIDLE_PRIORITY + 2),
|
||||
NULL);
|
||||
|
||||
xTaskCreate(
|
||||
gps_task,
|
||||
"gps_task",
|
||||
8192,
|
||||
NULL,
|
||||
(tskIDLE_PRIORITY + 2),
|
||||
NULL);
|
||||
|
||||
while (1)
|
||||
{
|
||||
|
Reference in New Issue
Block a user