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_io_platform.h
Go to the documentation of this file.
1/**
2 * @file meshx_io_platform.h
3 * @brief MeshX IO Platform Interface
4 *
5 * This file defines the platform-specific interface for IO implementations.
6 *
7 * @author MeshX Team
8 * @date 2024
9 */
10
11#ifndef __MESHX_IO_PLATFORM_H
12#define __MESHX_IO_PLATFORM_H
13
14#include "meshx_err.h"
15#include <stdint.h>
16#include <stdbool.h>
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22/**
23 * @brief Initialize platform IO subsystem
24 *
25 * @return meshx_err_t Error code
26 */
28
29/**
30 * @brief Deinitialize platform IO subsystem
31 *
32 * @return meshx_err_t Error code
33 */
35
36/**
37 * @brief Create platform-specific GPIO instance
38 *
39 * @param logical_pin Logical pin number
40 * @param name Pin name
41 * @param mode GPIO mode
42 * @param pull Pull resistor setting
43 * @param drive Drive strength
44 * @param initial_level Initial output level
45 * @param signal_inversion Signal inversion flag
46 * @return void* Platform-specific GPIO instance handle
47 */
48void* meshx_io_platform_create_gpio(uint8_t logical_pin,
49 const char* name,
50 uint8_t mode,
51 uint8_t pull,
52 uint8_t drive,
53 uint8_t initial_level,
54 bool signal_inversion);
55
56/**
57 * @brief Create platform-specific PWM instance
58 *
59 * @param logical_pin Logical pin number
60 * @param name Pin name
61 * @param frequency PWM frequency
62 * @param duty_cycle Initial duty cycle
63 * @param resolution PWM resolution
64 * @param channel Hardware channel
65 * @return void* Platform-specific PWM instance handle
66 */
67void* meshx_io_platform_create_pwm(uint8_t logical_pin,
68 const char* name,
69 uint32_t frequency,
70 uint8_t duty_cycle,
71 uint8_t resolution,
72 uint8_t channel);
73
74/**
75 * @brief Destroy platform-specific IO instance
76 *
77 * @param handle Platform-specific IO instance handle
78 */
79void meshx_io_platform_destroy(void* handle);
80
81/**
82 * @brief Execute platform-specific IO function
83 *
84 * @param handle Platform-specific IO instance handle
85 * @param function IO function to execute
86 * @param args Function arguments
87 * @param arg_count Number of arguments
88 * @return meshx_err_t Error code
89 */
91 uint8_t function,
92 const uint32_t* args,
93 uint8_t arg_count);
94
95/**
96 * @brief Set hosted mode
97 *
98 * @param mode Hosted mode (0 = non-hosted, 1 = hosted)
99 * @return meshx_err_t Error code
100 */
102
103/**
104 * @brief Get current hosted mode
105 *
106 * @return uint8_t Current hosted mode
107 */
109
110/**
111 * @brief Send hosted mode event
112 *
113 * @param event_type Event type
114 * @param logical_pin Logical pin number
115 * @param value Event value
116 * @return meshx_err_t Error code
117 */
119 uint8_t logical_pin,
120 uint8_t value);
121
122#ifdef __cplusplus
123}
124#endif
125
126#endif /* __MESHX_IO_PLATFORM_H */
MeshX Error Codes.
meshx_err_t
MeshX Error Codes.
Definition meshx_err.h:43
uint8_t meshx_io_platform_get_hosted_mode(void)
Get current hosted mode.
void * meshx_io_platform_create_gpio(uint8_t logical_pin, const char *name, uint8_t mode, uint8_t pull, uint8_t drive, uint8_t initial_level, bool signal_inversion)
Create platform-specific GPIO instance.
meshx_err_t meshx_io_platform_deinit(void)
Deinitialize platform IO subsystem.
meshx_err_t meshx_io_platform_send_hosted_event(uint8_t event_type, uint8_t logical_pin, uint8_t value)
Send hosted mode event.
meshx_err_t meshx_io_platform_init(void)
Initialize platform IO subsystem.
meshx_err_t meshx_io_platform_execute(void *handle, uint8_t function, const uint32_t *args, uint8_t arg_count)
Execute platform-specific IO function.
meshx_err_t meshx_io_platform_set_hosted_mode(uint8_t mode)
Set hosted mode.
void * meshx_io_platform_create_pwm(uint8_t logical_pin, const char *name, uint32_t frequency, uint8_t duty_cycle, uint8_t resolution, uint8_t channel)
Create platform-specific PWM instance.
void meshx_io_platform_destroy(void *handle)
Destroy platform-specific IO instance.