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.
Loading...
Searching...
No Matches
meshx_platform.h
Go to the documentation of this file.
1/**
2 * @file meshx_platform.h
3 * @brief Platform abstraction layer for MeshX.
4 *
5 * This header provides initialization functions for the MeshX platform
6 * and its Bluetooth subsystem.
7 */
8
9#ifndef __MESHX_PLATFORM_H__
10#define __MESHX_PLATFORM_H__
11
12#include "meshx_err.h"
13#include "meshx_platform_ble_mesh.h"
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20/**
21 * @brief Initializes the MeshX platform.
22 *
23 * This function sets up the necessary hardware and software components
24 * required for the MeshX platform to function correctly.
25 *
26 * @return meshx_err_t Returns MESHX_OK on success, or an appropriate error code.
27 */
29
30/**
31 * @brief Resets the MeshX platform.
32 * This function performs a system reset, restarting the platform.
33 */
34
35__attribute__((noreturn)) void meshx_platform_reset(void);
36
37/**
38 * @brief Writes data to the serial interface.
39 *
40 * @param[in] data Pointer to the data buffer.
41 * @param[in] len Length of the data to write.
42 */
43void meshx_platform_serial_write(const uint8_t *data, uint16_t len);
44
45/**
46 * @brief Initializes the serial interface for communication.
47 *
48 * @return meshx_err_t Returns MESHX_OK on success, or an appropriate error code.
49 */
51
52/**
53 * @brief Reads data from the serial interface.
54 *
55 * @param[out] data Pointer to the data buffer.
56 * @param[in] len Length of the data to read.
57 * @return int32_t Number of bytes read, or negative error code.
58 */
59int32_t meshx_platform_serial_read(uint8_t *data, uint16_t len);
60
61/**
62 * @brief Writes data to the console interface.
63 *
64 * @param[in] data Pointer to the data buffer.
65 * @param[in] len Length of the data to write.
66 */
67void meshx_platform_console_write(const char *data, uint16_t len);
68
69/**
70 * @brief Reads data from the console interface.
71 *
72 * @param[out] data Pointer to the data buffer.
73 * @param[in] len Length of the data to read.
74 * @return int32_t Number of bytes read, or negative error code.
75 */
76int32_t meshx_platform_console_read(uint8_t *data, uint16_t len);
77
78/**
79 * @brief Initializes the console interface.
80 *
81 * @return meshx_err_t Returns MESHX_OK on success, or an appropriate error code.
82 */
84
85#ifdef __cplusplus
86}
87#endif
88
89#endif /* __MESHX_PLATFORM_H__ */
Common definitions for BLE Mesh models and opcodes in the MeshX framework.
MeshX Error Codes.
meshx_err_t
MeshX Error Codes.
Definition meshx_err.h:43
meshx_err_t meshx_platform_serial_init(void)
Initializes the serial interface for communication.
Definition esp_platform.c:104
int32_t meshx_platform_serial_read(uint8_t *data, uint16_t len)
Reads data from the serial interface.
Definition esp_platform.c:139
meshx_err_t meshx_platform_console_init(void)
Initializes the console interface.
Definition esp_platform.c:144
int32_t meshx_platform_console_read(uint8_t *data, uint16_t len)
Reads data from the console interface.
Definition esp_platform.c:190
void meshx_platform_console_write(const char *data, uint16_t len)
Writes data to the console interface.
Definition esp_platform.c:178
void meshx_platform_serial_write(const uint8_t *data, uint16_t len)
Writes data to the serial interface.
Definition esp_platform.c:131
void meshx_platform_reset(void)
Resets the MeshX platform. This function performs a system reset, restarting the platform.
Definition esp_platform.c:89
meshx_err_t meshx_platform_init(void)
Initializes the MeshX platform.
Definition esp_platform.c:60