Contains FreeRTOS tasks and a pthread for sending and receiving messages between WASM app and CAN controllers.
More...
|
|
#define | NATIVE_STACK_SIZE (32*1024) |
| |
|
#define | NATIVE_HEAP_SIZE (32*1024) |
| |
|
#define | PTHREAD_STACK_SIZE 4096 |
| |
|
#define | MAX_DATA_LENGTH_BTYES 223 |
| |
|
#define | MSG_BUFFER_SIZE (10 + 223*2) |
| |
|
#define | MODE_BUFFER_SIZE 1 |
| |
|
#define | MY_ESP_LOG_LEVEL ESP_LOG_INFO |
| |
|
#define | STATS_TASK_PRIO tskIDLE_PRIORITY |
| |
|
#define | STATS_TICKS pdMS_TO_TICKS(1000) |
| |
|
#define | ARRAY_SIZE_OFFSET 5 |
| |
|
#define | TX_QUEUE_SIZE 100 |
| |
|
#define | RX_QUEUE_SIZE 100 |
| |
|
#define | MCP0_TX GPIO_NUM_22 |
| |
|
#define | MCP0_RX GPIO_NUM_23 |
| |
|
#define | MCP1_CS 16 |
| |
|
#define | MCP1_INT 10 |
| |
|
#define | MCP2_CS 17 |
| |
|
#define | MCP2_INT 11 |
| |
|
#define | ESP_INTR_FLAG_DEFAULT 0 |
| |
|
#define | MODE_SETTING_PIN_LSB GPIO_NUM_18 |
| |
|
#define | MODE_SETTING_PIN_MSB GPIO_NUM_19 |
| |
|
#define | MODE_SETTING_MASK ((1ULL<<MODE_SETTING_PIN_LSB) | (1ULL<<MODE_SETTING_PIN_MSB)) |
| |
|
#define | PRINT_STATS |
| |
|
|
tNMEA2000_esp32c6 | C0 (MCP0_TX, MCP0_RX) |
| | Controller 0 -> TWAI, (TX_PIN, RX_PIN)
|
| |
| void | HandleNMEA2000Msg (const tN2kMsg &N2kMsg) |
| | Creates a NMEA_msg object and adds it to.data the received messages queue. More...
|
| |
| std::string | nmea_to_string (NMEA_msg &msg) |
| | converts a NMEA_msg to a string More...
|
| |
|
void | uintArrToCharrArray (uint8_t(&data_uint8_arr)[MAX_DATA_LENGTH_BTYES], unsigned char(&data_char_arr)[MAX_DATA_LENGTH_BTYES]) |
| |
| void | PrintStr (wasm_exec_env_t exec_env, uint8_t *input, int32_t length) |
| | prints a uint8_t array to terminal More...
|
| |
| void | PrintInt32 (wasm_exec_env_t exec_env, int32_t number, int32_t hex) |
| | prints a integer to terminal More...
|
| |
|
int32_t | SendMsg (wasm_exec_env_t exec_env, int32_t controller_number, int32_t priority, int32_t PGN, int32_t source, uint8_t *data, int32_t data_length_bytes) |
| |
| void | uint8ArrayToCharrArray (uint8_t(&data_uint8_arr)[MAX_DATA_LENGTH_BTYES], unsigned char(&data_char_arr)[MAX_DATA_LENGTH_BTYES]) |
| | Fills a char array with values from a uint8_t array. More...
|
| |
|
void | configTConnectorModes () |
| | Configures GPIO used to read mode settings from the Raspberry Pi.
|
| |
| void | get_mode_task (void *pvParameters) |
| | Task to get the Controller Mode set by the Raspberry Pi. More...
|
| |
| bool | SendN2kMsg (NMEA_msg msg, int controller_num) |
| | Sends a message. More...
|
| |
| void | GetStatus (const char *TAG) |
| | Retrieves twai status and alerts. More...
|
| |
| void | C0_receive_task (void *pvParameters) |
| | FreeRTOS task for receiving messages from CAN controller. More...
|
| |
| void | C0_send_task (void *pvParameters) |
| | FreeRTOS task for processing and sending messages from CAN controller with NMEA2000 library. More...
|
| |
| void | C1_receive_task (void *pvParameters) |
| | FreeRTOS task for receiving messages from MCP CAN controller 1. More...
|
| |
| void | C1_send_task (void *pvParameters) |
| | FreeRTOS task for processing and sending messages from MCP CAN controller 1 with NMEA2000 library. More...
|
| |
| void | C2_receive_task (void *pvParameters) |
| | FreeRTOS task for receiving messages from MCP CAN controller 2. More...
|
| |
| void | C2_send_task (void *pvParameters) |
| | FreeRTOS task for processing and sending messages from MCP CAN controller 2 with NMEA2000 library. More...
|
| |
| void * | iwasm_main (void *arg) |
| | WASM pthread to host wasm app. More...
|
| |
| int | app_main (void) |
| | Creates a FreeRTOS task for sending and receiving to and from CAN Controller and creates a pthread to run WASM app. More...
|
| |
|
| spi_device_handle_t | spi1 |
| | MCP controller 1 spi handle. More...
|
| |
| spi_device_handle_t | spi2 |
| | MCP controller 2 spi handle. More...
|
| |
|
QueueHandle_t | C0_tx_queue |
| | Queue that stores messages to be sent out on controller 0.
|
| |
|
QueueHandle_t | C1_tx_queue |
| | Queue that stores messages to be sent out on controller 1.
|
| |
|
QueueHandle_t | C2_tx_queue |
| | Queue that stores messages to be sent out on controller 2.
|
| |
|
QueueHandle_t | rx_queue |
| | Queue that stores all messages received on all controllers.
|
| |
|
SemaphoreHandle_t | x_sem_mcp1 |
| | Semaphore handle for MCP1.
|
| |
|
SemaphoreHandle_t | x_sem_mcp2 |
| | Semaphore handle for MCP2.
|
| |
|
char * | wasm_buffer = NULL |
| | buffer allocated for wasm app, used to hold received messages so app can access them
|
| |
|
char * | wasm_mode_buffer = NULL |
| | buffer allocated for wasm app, used to hold current t connector mode set by Raspberry Pi
|
| |
|
int | read_msg_count = 0 |
| | Used to track messages read.
|
| |
|
int | send_msg_count = 0 |
| | Used to track messages sent.
|
| |
|
std::string | tc_mode = "1" |
| | Contains the T Connector mode-> 0 - OFF, 1 - PASSIVE, 2 - GPS_ATTACK, 3 - TBD.
|
| |
|
uint32_t | alerts_to_enable = TWAI_ALERT_RX_DATA | TWAI_ALERT_TX_FAILED | TWAI_ALERT_RX_QUEUE_FULL |
| | Sets which alerts to enable for TWAI controller.
|
| |
|
int | C0_rx_task_count = 0 |
| |
|
int | C0_tx_task_count = 0 |
| |
|
int | C1_rx_task_count = 0 |
| |
|
int | C1_tx_task_count = 0 |
| |
|
int | C2_rx_task_count = 0 |
| |
|
int | C2_tx_task_count = 0 |
| |
|
int | wasm_pthread_count = 0 |
| |
|
int | stats_task_count = 0 |
| |
|
double | wasm_main_duration |
| |
Contains FreeRTOS tasks and a pthread for sending and receiving messages between WASM app and CAN controllers.
- Todo:
- convert unessesary ESP_LOGI messages to ESP_LOGD
Definition in file main.cpp.
MCP controller 1 spi handle.
Controller 1 -> MCP, (spi_handle, CS_PIN, mcp_clk_freq, INT_PIN, _rx_frame_buf_size)
Definition at line 90 of file main.cpp.
MCP controller 2 spi handle.
Controller 2 -> MCP, (spi_handle, CS_PIN, mcp_clk_freq, INT_PIN, _rx_frame_buf_size)
Definition at line 91 of file main.cpp.