|
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 PWM Runtime Implementation (Updated to reduce log verbosity). More...
#include <string.h>#include <stdbool.h>#include "interface/gpio/meshx_pwm.h"#include "interface/gpio/meshx_gpio_platform.h"#include "../../inc/meshx_err.h"#include "../../interface/logging/meshx_log.h"#include "../../inc/module_id.h"Data Structures | |
| struct | meshx_pwm_config_t |
| PWM configuration structure. More... | |
| struct | meshx_pwm_state_t |
| PWM runtime state structure. More... | |
| struct | meshx_pwm_runtime_t |
| PWM runtime state structure. More... | |
Functions | |
| meshx_err_t | meshx_pwm_init (void) |
| Initialize PWM subsystem. | |
| meshx_err_t | meshx_pwm_deinit (void) |
| Deinitialize PWM subsystem. | |
| static meshx_err_t | validate_pwm_logical_pin (uint8_t logical_pin) |
| Validate logical pin number for PWM. | |
| static meshx_err_t | validate_pwm_frequency (uint32_t frequency) |
| Validate PWM frequency. | |
| static meshx_err_t | validate_pwm_duty_cycle (uint8_t duty_cycle) |
| Validate PWM duty cycle. | |
| static meshx_err_t | validate_pwm_resolution (uint8_t resolution) |
| Validate PWM resolution. | |
| static meshx_err_t | allocate_pwm_channel (uint8_t logical_pin, uint8_t *channel) |
| Allocate PWM channel. | |
| meshx_err_t | meshx_pwm_start (uint8_t logical_pin) |
| Start PWM output on pin. | |
| meshx_err_t | meshx_pwm_stop (uint8_t logical_pin) |
| Stop PWM output on pin. | |
| meshx_err_t | meshx_pwm_set_duty_cycle (uint8_t logical_pin, uint8_t duty_cycle) |
| Set PWM duty cycle. | |
| meshx_err_t | meshx_pwm_get_duty_cycle (uint8_t logical_pin, uint8_t *duty_cycle) |
| Get PWM duty cycle. | |
| meshx_err_t | meshx_pwm_set_frequency (uint8_t logical_pin, uint32_t frequency) |
| Set PWM frequency. | |
| meshx_err_t | meshx_pwm_get_frequency (uint8_t logical_pin, uint32_t *frequency) |
| Get PWM frequency. | |
| meshx_err_t | meshx_pwm_set_resolution (uint8_t logical_pin, uint8_t resolution) |
| Set PWM resolution. | |
| meshx_err_t | meshx_pwm_get_resolution (uint8_t logical_pin, uint8_t *resolution) |
| Get PWM resolution. | |
| bool | meshx_pwm_is_initialized (void) |
| Check if PWM subsystem is initialized. | |
| uint8_t | meshx_pwm_get_pin_count (void) |
| Get number of configured PWM pins. | |
| uint8_t | meshx_pwm_get_allocated_channels (void) |
| Get number of allocated PWM channels. | |
| bool | meshx_pwm_is_started (uint8_t logical_pin) |
| Check if PWM is started on pin. | |
| void | meshx_pwm_test_set_pin_count (uint8_t count) |
Variables | |
| static meshx_pwm_runtime_t | pwm_runtime |
| static meshx_pwm_config_t | test_pwm_configs [128] |
| static meshx_pwm_state_t | test_pwm_states [128] |
MeshX PWM Runtime Implementation (Updated to reduce log verbosity).
This file implements the PWM runtime subsystem for MeshX. It provides the runtime API for PWM operations with parameter validation, hardware channel allocation, and PWM state management.
|
static |
Allocate PWM channel.
| logical_pin | Logical pin number | |
| [out] | channel | Allocated channel number |
| meshx_err_t meshx_pwm_deinit | ( | void | ) |
Deinitialize PWM subsystem.
This function deinitializes the PWM subsystem and releases all resources. It stops all PWM outputs, deconfigures channels, and cleans up platform resources.
| uint8_t meshx_pwm_get_allocated_channels | ( | void | ) |
Get number of allocated PWM channels.
| meshx_err_t meshx_pwm_get_duty_cycle | ( | uint8_t | logical_pin, |
| uint8_t * | duty_cycle ) |
Get PWM duty cycle.
| logical_pin | Logical pin number (0-255) | |
| [out] | duty_cycle | Pointer to store duty cycle |
| meshx_err_t meshx_pwm_get_frequency | ( | uint8_t | logical_pin, |
| uint32_t * | frequency ) |
Get PWM frequency.
| logical_pin | Logical pin number (0-255) | |
| [out] | frequency | Pointer to store frequency |
| uint8_t meshx_pwm_get_pin_count | ( | void | ) |
Get number of configured PWM pins.
| meshx_err_t meshx_pwm_get_resolution | ( | uint8_t | logical_pin, |
| uint8_t * | resolution ) |
Get PWM resolution.
| logical_pin | Logical pin number (0-255) | |
| [out] | resolution | Pointer to store resolution |
| meshx_err_t meshx_pwm_init | ( | void | ) |
Initialize PWM subsystem.
This function initializes the PWM subsystem based on compiled configuration. It sets up hardware PWM channels and configures all PWM pins according to their YAML configuration.
| bool meshx_pwm_is_initialized | ( | void | ) |
Check if PWM subsystem is initialized.
| bool meshx_pwm_is_started | ( | uint8_t | logical_pin | ) |
Check if PWM is started on pin.
| logical_pin | Logical pin number |
| meshx_err_t meshx_pwm_set_duty_cycle | ( | uint8_t | logical_pin, |
| uint8_t | duty_cycle ) |
Set PWM duty cycle.
| logical_pin | Logical pin number (0-255) |
| duty_cycle | Duty cycle (0-100%) |
| meshx_err_t meshx_pwm_set_frequency | ( | uint8_t | logical_pin, |
| uint32_t | frequency ) |
Set PWM frequency.
| logical_pin | Logical pin number (0-255) |
| frequency | Frequency in Hz |
| meshx_err_t meshx_pwm_set_resolution | ( | uint8_t | logical_pin, |
| uint8_t | resolution ) |
Set PWM resolution.
| logical_pin | Logical pin number (0-255) |
| resolution | Resolution in bits (typically 8-16) |
| meshx_err_t meshx_pwm_start | ( | uint8_t | logical_pin | ) |
Start PWM output on pin.
| logical_pin | Logical pin number (0-255) |
| meshx_err_t meshx_pwm_stop | ( | uint8_t | logical_pin | ) |
Stop PWM output on pin.
| logical_pin | Logical pin number (0-255) |
| void meshx_pwm_test_set_pin_count | ( | uint8_t | count | ) |
|
static |
Validate PWM duty cycle.
| duty_cycle | Duty cycle (0-100%) |
|
static |
Validate PWM frequency.
| frequency | Frequency in Hz |
|
static |
Validate logical pin number for PWM.
| logical_pin | Logical pin number to validate |
|
static |
Validate PWM resolution.
| resolution | Resolution in bits |
|
static |
|
static |
|
static |