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 Namespace Reference

Data Structures

struct  IoConfig
 IO Configuration Structure. More...
class  MeshXIoFactory
 IO Factory Class. More...
class  MeshXIoInterface
 Abstract IO Interface. More...
class  MeshXGpioImpl
 Concrete GPIO Implementation Class. More...
class  MeshXPwmImpl
 Concrete PWM Implementation Class. More...

Typedefs

using IoFactoryFunction = std::unique_ptr<MeshXIoInterface>(*)(uint8_t logical_pin, const char* name)
 IO Factory function type.

Enumerations

enum class  IoType {
  GPIO ,
  PWM ,
  ADC ,
  DAC ,
  CUSTOM
}
 IO Type enumeration. More...
enum class  IoFunction {
  SET_LEVEL = 0 ,
  GET_LEVEL ,
  TOGGLE ,
  SET_PWM_DUTY ,
  SET_PWM_FREQUENCY ,
  REGISTER_INTERRUPT ,
  UNREGISTER_INTERRUPT ,
  ENABLE_INTERRUPT ,
  CUSTOM_FUNCTION ,
  FUNCTION_MAX
}
 IO Function Types for function-based API. More...
enum class  GpioMode {
  INPUT = 0 ,
  OUTPUT ,
  INPUT_OUTPUT ,
  OPEN_DRAIN ,
  OPEN_DRAIN_INPUT_OUTPUT ,
  PWM_OUTPUT ,
  MODE_MAX
}
 GPIO Mode enumeration. More...
enum class  GpioPull {
  NONE = 0 ,
  PULL_UP ,
  PULL_DOWN ,
  PULL_UP_DOWN ,
  PULL_MAX
}
 GPIO Pull Resistor enumeration. More...
enum class  GpioDrive {
  WEAK = 0 ,
  MEDIUM ,
  STRONG ,
  MAX_STRONG ,
  DRIVE_MAX
}
 GPIO Drive Strength enumeration. More...
enum class  GpioIntrTrigger {
  DISABLED = 0 ,
  POSITIVE_EDGE ,
  NEGATIVE_EDGE ,
  ANY_EDGE ,
  LOW_LEVEL ,
  HIGH_LEVEL ,
  INTR_MAX
}
 GPIO Interrupt Trigger enumeration. More...
enum class  HostedMode {
  NON_HOSTED = 0 ,
  HOSTED ,
  TRANSITIONING
}
 Hosted Mode enumeration. More...
enum class  IoError {
  SUCCESS = 0 ,
  INVALID_PIN ,
  INVALID_MODE ,
  INVALID_LEVEL ,
  INVALID_ARG ,
  INTR_NOT_SUPPORTED ,
  INTR_ALREADY_REGISTERED ,
  PWM_NOT_SUPPORTED ,
  PWM_INVALID_PARAM ,
  NOT_SUPPORTED ,
  NOT_INITIALIZED ,
  CONFIG_INVALID ,
  HOSTED_MODE ,
  KV_STORAGE ,
  SERIALIZATION ,
  ERROR_MAX
}
 IO Error Codes. More...

Functions

const char * ioErrorToString (IoError error)
 Convert IO error to string.
const char * gpioModeToString (GpioMode mode)
 Convert GPIO mode to string.
GpioMode stringToGpioMode (const char *str)
 Convert string to GPIO mode.
const char * gpioPullToString (GpioPull pull)
 Convert GPIO pull to string.
GpioPull stringToGpioPull (const char *str)
 Convert string to GPIO pull.
const char * gpioDriveToString (GpioDrive drive)
 Convert GPIO drive to string.
GpioDrive stringToGpioDrive (const char *str)
 Convert string to GPIO drive.
const char * intrTriggerToString (GpioIntrTrigger trigger)
 Convert interrupt trigger to string.
GpioIntrTrigger stringToIntrTrigger (const char *str)
 Convert string to interrupt trigger.
static void meshx_gpio_intr_cb_wrapper (uint8_t logical_pin, void *user_data)
 Static interrupt callback wrapper for C API.
std::unique_ptr< MeshXIoInterfacecreateGpioInstance (uint8_t logical_pin, const char *name)
 Factory function for creating GPIO instances.
std::unique_ptr< MeshXIoInterfacecreatePwmInstance (uint8_t logical_pin, const char *name)
 Factory function for creating PWM instances.

Typedef Documentation

◆ IoFactoryFunction

using meshx::IoFactoryFunction = std::unique_ptr<MeshXIoInterface>(*)(uint8_t logical_pin, const char* name)

IO Factory function type.

Enumeration Type Documentation

◆ GpioDrive

enum class meshx::GpioDrive
strong

GPIO Drive Strength enumeration.

Enumerator
WEAK 

Weak drive strength

MEDIUM  

Medium drive strength

STRONG  

Strong drive strength

MAX_STRONG  

Maximum strong drive strength

DRIVE_MAX  

Maximum drive value

46 {
47 WEAK = 0, /**< Weak drive strength */
48 MEDIUM, /**< Medium drive strength */
49 STRONG, /**< Strong drive strength */
50 MAX_STRONG, /**< Maximum strong drive strength */
51 DRIVE_MAX /**< Maximum drive value */
52};
@ WEAK
Definition meshx_io_types.hpp:47
@ STRONG
Definition meshx_io_types.hpp:49
@ DRIVE_MAX
Definition meshx_io_types.hpp:51
@ MAX_STRONG
Definition meshx_io_types.hpp:50
@ MEDIUM
Definition meshx_io_types.hpp:48

◆ GpioIntrTrigger

enum class meshx::GpioIntrTrigger
strong

GPIO Interrupt Trigger enumeration.

Enumerator
DISABLED 

Interrupt disabled

POSITIVE_EDGE  

Positive edge trigger

NEGATIVE_EDGE  

Negative edge trigger

ANY_EDGE  

Any edge trigger

LOW_LEVEL  

Low level trigger

HIGH_LEVEL  

High level trigger

INTR_MAX  

Maximum interrupt type

57 {
58 DISABLED = 0, /**< Interrupt disabled */
59 POSITIVE_EDGE, /**< Positive edge trigger */
60 NEGATIVE_EDGE, /**< Negative edge trigger */
61 ANY_EDGE, /**< Any edge trigger */
62 LOW_LEVEL, /**< Low level trigger */
63 HIGH_LEVEL, /**< High level trigger */
64 INTR_MAX /**< Maximum interrupt type */
65};
@ DISABLED
Definition meshx_io_types.hpp:58
@ NEGATIVE_EDGE
Definition meshx_io_types.hpp:60
@ ANY_EDGE
Definition meshx_io_types.hpp:61
@ LOW_LEVEL
Definition meshx_io_types.hpp:62
@ HIGH_LEVEL
Definition meshx_io_types.hpp:63
@ POSITIVE_EDGE
Definition meshx_io_types.hpp:59
@ INTR_MAX
Definition meshx_io_types.hpp:64

◆ GpioMode

enum class meshx::GpioMode
strong

GPIO Mode enumeration.

Enumerator
INPUT 

Input only mode

OUTPUT  

Output only mode

INPUT_OUTPUT  

Input and output mode

OPEN_DRAIN  

Open drain output mode

OPEN_DRAIN_INPUT_OUTPUT  

Open drain input/output mode

PWM_OUTPUT  

PWM output mode

MODE_MAX  

Maximum mode value

22 {
23 INPUT = 0, /**< Input only mode */
24 OUTPUT, /**< Output only mode */
25 INPUT_OUTPUT, /**< Input and output mode */
26 OPEN_DRAIN, /**< Open drain output mode */
27 OPEN_DRAIN_INPUT_OUTPUT, /**< Open drain input/output mode */
28 PWM_OUTPUT, /**< PWM output mode */
29 MODE_MAX /**< Maximum mode value */
30};
@ MODE_MAX
Definition meshx_io_types.hpp:29
@ PWM_OUTPUT
Definition meshx_io_types.hpp:28
@ OUTPUT
Definition meshx_io_types.hpp:24
@ OPEN_DRAIN_INPUT_OUTPUT
Definition meshx_io_types.hpp:27
@ INPUT
Definition meshx_io_types.hpp:23
@ INPUT_OUTPUT
Definition meshx_io_types.hpp:25
@ OPEN_DRAIN
Definition meshx_io_types.hpp:26

◆ GpioPull

enum class meshx::GpioPull
strong

GPIO Pull Resistor enumeration.

Enumerator
NONE 

No pull resistor

PULL_UP  

Pull-up resistor

PULL_DOWN  

Pull-down resistor

PULL_UP_DOWN  

Both pull-up and pull-down

PULL_MAX  

Maximum pull value

35 {
36 NONE = 0, /**< No pull resistor */
37 PULL_UP, /**< Pull-up resistor */
38 PULL_DOWN, /**< Pull-down resistor */
39 PULL_UP_DOWN, /**< Both pull-up and pull-down */
40 PULL_MAX /**< Maximum pull value */
41};
@ PULL_UP
Definition meshx_io_types.hpp:37
@ PULL_DOWN
Definition meshx_io_types.hpp:38
@ PULL_MAX
Definition meshx_io_types.hpp:40
@ NONE
Definition meshx_io_types.hpp:36
@ PULL_UP_DOWN
Definition meshx_io_types.hpp:39

◆ HostedMode

enum class meshx::HostedMode
strong

Hosted Mode enumeration.

Enumerator
NON_HOSTED 

Non-hosted mode (direct IO access)

HOSTED  

Hosted mode (UART transport)

TRANSITIONING  

Mode transition in progress

70 {
71 NON_HOSTED = 0, /**< Non-hosted mode (direct IO access) */
72 HOSTED, /**< Hosted mode (UART transport) */
73 TRANSITIONING /**< Mode transition in progress */
74};
@ HOSTED
Definition meshx_io_types.hpp:72
@ NON_HOSTED
Definition meshx_io_types.hpp:71
@ TRANSITIONING
Definition meshx_io_types.hpp:73

◆ IoError

enum class meshx::IoError
strong

IO Error Codes.

Enumerator
SUCCESS 

Success

INVALID_PIN  

Invalid pin number

INVALID_MODE  

Invalid mode for operation

INVALID_LEVEL  

Invalid level value

INVALID_ARG  

Invalid argument

INTR_NOT_SUPPORTED  

Interrupt not supported

INTR_ALREADY_REGISTERED  

Interrupt already registered

PWM_NOT_SUPPORTED  

PWM not supported

PWM_INVALID_PARAM  

Invalid PWM parameter

NOT_SUPPORTED  

Operation not supported

NOT_INITIALIZED  

IO subsystem not initialized

CONFIG_INVALID  

Invalid configuration

HOSTED_MODE  

Operation not allowed in hosted mode

KV_STORAGE  

KV Engine storage error

SERIALIZATION  

Configuration serialization error

ERROR_MAX  

Maximum error value

79 {
80 SUCCESS = 0, /**< Success */
81 INVALID_PIN, /**< Invalid pin number */
82 INVALID_MODE, /**< Invalid mode for operation */
83 INVALID_LEVEL, /**< Invalid level value */
84 INVALID_ARG, /**< Invalid argument */
85 INTR_NOT_SUPPORTED, /**< Interrupt not supported */
86 INTR_ALREADY_REGISTERED, /**< Interrupt already registered */
87 PWM_NOT_SUPPORTED, /**< PWM not supported */
88 PWM_INVALID_PARAM, /**< Invalid PWM parameter */
89 NOT_SUPPORTED, /**< Operation not supported */
90 NOT_INITIALIZED, /**< IO subsystem not initialized */
91 CONFIG_INVALID, /**< Invalid configuration */
92 HOSTED_MODE, /**< Operation not allowed in hosted mode */
93 KV_STORAGE, /**< KV Engine storage error */
94 SERIALIZATION, /**< Configuration serialization error */
95 ERROR_MAX /**< Maximum error value */
96};
@ NOT_INITIALIZED
Definition meshx_io_types.hpp:90
@ PWM_NOT_SUPPORTED
Definition meshx_io_types.hpp:87
@ SERIALIZATION
Definition meshx_io_types.hpp:94
@ INVALID_MODE
Definition meshx_io_types.hpp:82
@ CONFIG_INVALID
Definition meshx_io_types.hpp:91
@ NOT_SUPPORTED
Definition meshx_io_types.hpp:89
@ INTR_ALREADY_REGISTERED
Definition meshx_io_types.hpp:86
@ INTR_NOT_SUPPORTED
Definition meshx_io_types.hpp:85
@ ERROR_MAX
Definition meshx_io_types.hpp:95
@ INVALID_ARG
Definition meshx_io_types.hpp:84
@ INVALID_PIN
Definition meshx_io_types.hpp:81
@ KV_STORAGE
Definition meshx_io_types.hpp:93
@ HOSTED_MODE
Definition meshx_io_types.hpp:92
@ SUCCESS
Definition meshx_io_types.hpp:80
@ PWM_INVALID_PARAM
Definition meshx_io_types.hpp:88
@ INVALID_LEVEL
Definition meshx_io_types.hpp:83

◆ IoFunction

enum class meshx::IoFunction
strong

IO Function Types for function-based API.

Enumerator
SET_LEVEL 

Set pin level function

GET_LEVEL  

Get pin level function

TOGGLE  

Toggle pin function

SET_PWM_DUTY  

Set PWM duty cycle function

SET_PWM_FREQUENCY  

Set PWM frequency function

REGISTER_INTERRUPT  

Register interrupt function

UNREGISTER_INTERRUPT  

Unregister interrupt function

ENABLE_INTERRUPT  

Enable/disable interrupt function

CUSTOM_FUNCTION  

Custom function (for extensibility)

FUNCTION_MAX  

Maximum function type

25 {
26 SET_LEVEL = 0, /**< Set pin level function */
27 GET_LEVEL, /**< Get pin level function */
28 TOGGLE, /**< Toggle pin function */
29 SET_PWM_DUTY, /**< Set PWM duty cycle function */
30 SET_PWM_FREQUENCY, /**< Set PWM frequency function */
31 REGISTER_INTERRUPT, /**< Register interrupt function */
32 UNREGISTER_INTERRUPT, /**< Unregister interrupt function */
33 ENABLE_INTERRUPT, /**< Enable/disable interrupt function */
34 CUSTOM_FUNCTION, /**< Custom function (for extensibility) */
35 FUNCTION_MAX /**< Maximum function type */
36};
@ REGISTER_INTERRUPT
Definition meshx_io_interface.hpp:31
@ FUNCTION_MAX
Definition meshx_io_interface.hpp:35
@ TOGGLE
Definition meshx_io_interface.hpp:28
@ UNREGISTER_INTERRUPT
Definition meshx_io_interface.hpp:32
@ SET_PWM_DUTY
Definition meshx_io_interface.hpp:29
@ SET_PWM_FREQUENCY
Definition meshx_io_interface.hpp:30
@ CUSTOM_FUNCTION
Definition meshx_io_interface.hpp:34
@ SET_LEVEL
Definition meshx_io_interface.hpp:26
@ GET_LEVEL
Definition meshx_io_interface.hpp:27
@ ENABLE_INTERRUPT
Definition meshx_io_interface.hpp:33

◆ IoType

enum class meshx::IoType
strong

IO Type enumeration.

Enumerator
GPIO 

General Purpose Input/Output

PWM 

Pulse Width Modulation

ADC 

Analog to Digital Converter (future)

DAC 

Digital to Analog Converter (future)

CUSTOM 

Custom IO type

24 {
25 GPIO, /**< General Purpose Input/Output */
26 PWM, /**< Pulse Width Modulation */
27 ADC, /**< Analog to Digital Converter (future) */
28 DAC, /**< Digital to Analog Converter (future) */
29 CUSTOM /**< Custom IO type */
30};
@ DAC
Definition meshx_io_factory.hpp:28
@ CUSTOM
Definition meshx_io_factory.hpp:29
@ ADC
Definition meshx_io_factory.hpp:27
@ PWM
Definition meshx_io_factory.hpp:26
@ GPIO
Definition meshx_io_factory.hpp:25

Function Documentation

◆ createGpioInstance()

std::unique_ptr< MeshXIoInterface > meshx::createGpioInstance ( uint8_t logical_pin,
const char * name )

Factory function for creating GPIO instances.

Parameters
logical_pinLogical pin number
namePin name
Returns
std::unique_ptr<MeshXIoInterface> IO interface instance
354 {
355 // Default to output mode for GPIO
356 return std::make_unique<MeshXGpioImpl>(logical_pin, name, GpioMode::OUTPUT);
357}

◆ createPwmInstance()

std::unique_ptr< MeshXIoInterface > meshx::createPwmInstance ( uint8_t logical_pin,
const char * name )

Factory function for creating PWM instances.

Parameters
logical_pinLogical pin number
namePin name
Returns
std::unique_ptr<MeshXIoInterface> IO interface instance
297 {
298 return std::make_unique<MeshXPwmImpl>(logical_pin, name);
299}

◆ gpioDriveToString()

const char * meshx::gpioDriveToString ( GpioDrive drive)

Convert GPIO drive to string.

Parameters
driveGPIO drive strength
Returns
const char* Drive string

◆ gpioModeToString()

const char * meshx::gpioModeToString ( GpioMode mode)

Convert GPIO mode to string.

Parameters
modeGPIO mode
Returns
const char* Mode string

◆ gpioPullToString()

const char * meshx::gpioPullToString ( GpioPull pull)

Convert GPIO pull to string.

Parameters
pullGPIO pull setting
Returns
const char* Pull string

◆ intrTriggerToString()

const char * meshx::intrTriggerToString ( GpioIntrTrigger trigger)

Convert interrupt trigger to string.

Parameters
triggerInterrupt trigger type
Returns
const char* Trigger string

◆ ioErrorToString()

const char * meshx::ioErrorToString ( IoError error)

Convert IO error to string.

Parameters
errorIO error code
Returns
const char* Error string

◆ meshx_gpio_intr_cb_wrapper()

void meshx::meshx_gpio_intr_cb_wrapper ( uint8_t logical_pin,
void * user_data )
static

Static interrupt callback wrapper for C API.

Parameters
logical_pinLogical pin number
user_dataUser data (pointer to MeshXGpioImpl instance)
340{
341 MeshXGpioImpl* instance = static_cast<MeshXGpioImpl*>(user_data);
342 if (instance != nullptr && instance->m_intr_callback != nullptr) {
343 instance->m_intr_callback(logical_pin, instance->m_intr_user_data);
344 }
345}
Concrete GPIO Implementation Class.
Definition meshx_gpio_impl.cpp:33
void(* m_intr_callback)(uint8_t, void *)
Definition meshx_gpio_impl.cpp:42
void * m_intr_user_data
Definition meshx_gpio_impl.cpp:43

◆ stringToGpioDrive()

GpioDrive meshx::stringToGpioDrive ( const char * str)

Convert string to GPIO drive.

Parameters
strDrive string
Returns
GpioDrive GPIO drive strength

◆ stringToGpioMode()

GpioMode meshx::stringToGpioMode ( const char * str)

Convert string to GPIO mode.

Parameters
strMode string
Returns
GpioMode GPIO mode

◆ stringToGpioPull()

GpioPull meshx::stringToGpioPull ( const char * str)

Convert string to GPIO pull.

Parameters
strPull string
Returns
GpioPull GPIO pull setting

◆ stringToIntrTrigger()

GpioIntrTrigger meshx::stringToIntrTrigger ( const char * str)

Convert string to interrupt trigger.

Parameters
strTrigger string
Returns
GpioIntrTrigger Interrupt trigger type