|
MeshX 0.4
This repository provides an implementation for Bluetooth Low Energy (BLE) Mesh network nodes. The project allows you to create BLE mesh nodes that can communicate with each other, enabling the development of smart home solutions or other IoT-based applications.
|
MeshX Serial Protocol (MXSP) Definitions. More...
Go to the source code of this file.
Data Structures | |
| struct | mxsp_gpio_cmd_payload_t |
| GPIO Command Payload (Host -> Engine). More... | |
| struct | mxsp_gpio_rsp_payload_t |
| GPIO Response Payload (Engine -> Host). More... | |
| struct | mxsp_gpio_evt_payload_t |
| GPIO Event Payload (Engine -> Host, async). More... | |
| struct | mxsp_frame_t |
| MXSP Frame structure. More... | |
Macros | |
| #define | MXSP_SOF 0xFE |
| #define | MXSP_EOF 0xEF |
| #define | MXSP_PAYLOAD_MAX_SIZE 255 |
Enumerations | |
| enum | mxsp_msg_type_t { MXSP_MSG_TYPE_SYS_EVT_NOTIFY = 0xB1 , MXSP_MSG_TYPE_DATA_EVT_NOTIFY = 0xB2 , MXSP_MSG_TYPE_EL_CMD_SEND = 0xC1 , MXSP_MSG_TYPE_SYS_CMD_SEND = 0xC2 , MXSP_MSG_TYPE_HOSTED_MODE = 0x03 , MXSP_MSG_TYPE_GPIO_CMD = 0xD1 , MXSP_MSG_TYPE_GPIO_RSP = 0xD2 , MXSP_MSG_TYPE_GPIO_EVT = 0xD3 } |
| enum | mxsp_gpio_cmd_t { MXSP_GPIO_CMD_SET_LEVEL = 0x01 , MXSP_GPIO_CMD_GET_LEVEL = 0x02 , MXSP_GPIO_CMD_TOGGLE = 0x03 , MXSP_GPIO_CMD_SET_PWM_DUTY = 0x04 , MXSP_GPIO_CMD_SET_PWM_FREQ = 0x05 , MXSP_GPIO_CMD_INTR_ENABLE = 0x06 , MXSP_GPIO_CMD_INTR_DISABLE = 0x07 , MXSP_GPIO_CMD_GET_CONFIG = 0x08 , MXSP_GPIO_CMD_GET_STATE = 0x09 } |
| GPIO Command Types (Host -> Engine). More... | |
| enum | mxsp_gpio_evt_t { MXSP_GPIO_EVT_LEVEL_CHANGE = 0x01 , MXSP_GPIO_EVT_INTERRUPT = 0x02 , MXSP_GPIO_EVT_MODE_CHANGE = 0x03 , MXSP_GPIO_EVT_ERROR = 0xFF } |
| GPIO Event Types (Engine -> Host, async). More... | |
Functions | |
| void | meshx_serial_set_hosted_mode (bool enabled) |
| Set the hosted mode state. | |
| bool | meshx_serial_is_hosted_mode_enabled (void) |
| Check if hosted mode is enabled. | |
| meshx_err_t | meshx_serial_init (void) |
| Initialize the MeshX Serial Protocol handler. | |
| void | meshx_serial_parse_byte (uint8_t data) |
| Parse incoming byte stream for MXSP frames. | |
| meshx_err_t | mxsp_send_ctrl_event (const meshx_ctrl_msg_header_t *evt_header, const meshx_ctrl_payload_t *payload) |
| Send a control event via MXSP. | |
| meshx_err_t | mxsp_send_data_event (const meshx_app_element_msg_header_t *msg_hdr, const meshx_data_payload_t *payload) |
| Send data event via MXSP. | |
| meshx_err_t | mxsp_send_gpio_rsp (uint8_t cmd, uint8_t logical_pin, uint8_t status, const uint8_t *response, uint8_t response_len) |
| Send GPIO response via MXSP. | |
| meshx_err_t | mxsp_send_gpio_evt (uint8_t event_type, uint8_t logical_pin, uint8_t value) |
| Send GPIO async event via MXSP. | |
MeshX Serial Protocol (MXSP) Definitions.
This file defines the frame structure and APIs for the MeshX Serial Protocol, used for communication between the Mesh engine and an external Host MCU.
| #define MXSP_EOF 0xEF |
| #define MXSP_PAYLOAD_MAX_SIZE 255 |
| #define MXSP_SOF 0xFE |
| enum mxsp_gpio_cmd_t |
GPIO Command Types (Host -> Engine).
| enum mxsp_gpio_evt_t |
GPIO Event Types (Engine -> Host, async).
| Enumerator | ||
|---|---|---|
| MXSP_GPIO_EVT_LEVEL_CHANGE | 0x01 | Pin level changed |
| MXSP_GPIO_EVT_INTERRUPT | 0x02 | Interrupt triggered |
| MXSP_GPIO_EVT_MODE_CHANGE | 0x03 | Mode changed |
| MXSP_GPIO_EVT_ERROR | 0xFF | Error event |
| enum mxsp_msg_type_t |
| meshx_err_t meshx_serial_init | ( | void | ) |
Initialize the MeshX Serial Protocol handler.
Initialize the MeshX Serial Protocol handler.
| bool meshx_serial_is_hosted_mode_enabled | ( | void | ) |
Check if hosted mode is enabled.
| void meshx_serial_parse_byte | ( | uint8_t | data | ) |
Parse incoming byte stream for MXSP frames.
| data | Byte to parse |
| void meshx_serial_set_hosted_mode | ( | bool | enabled | ) |
Set the hosted mode state.
| enabled | True to enable, false to disable |
| meshx_err_t mxsp_send_ctrl_event | ( | const meshx_ctrl_msg_header_t * | evt_header, |
| const meshx_ctrl_payload_t * | payload ) |
Send a control event via MXSP.
| evt_header | Control message header |
| payload | Control message payload |
| meshx_err_t mxsp_send_data_event | ( | const meshx_app_element_msg_header_t * | msg_hdr, |
| const meshx_data_payload_t * | payload ) |
Send data event via MXSP.
| msg_hdr | Data message header |
| payload | Data message payload |
| meshx_err_t mxsp_send_gpio_evt | ( | uint8_t | event_type, |
| uint8_t | logical_pin, | ||
| uint8_t | value ) |
Send GPIO async event via MXSP.
| event_type | Event type (mxsp_gpio_evt_t) |
| logical_pin | Logical pin number |
| value | Event value |
| meshx_err_t mxsp_send_gpio_rsp | ( | uint8_t | cmd, |
| uint8_t | logical_pin, | ||
| uint8_t | status, | ||
| const uint8_t * | response, | ||
| uint8_t | response_len ) |
Send GPIO response via MXSP.
| cmd | Original command type |
| logical_pin | Logical pin number |
| status | Status code (0 = success) |
| response | Response data |
| response_len | Response data length |