HAL  v0.6.1
Hardware Abstraction Layer
Loading...
Searching...
No Matches
hal_pwm.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include "hal_gpio.h"
Include dependency graph for hal_pwm.h:

Data Structures

struct  pwm_channel_attr_t
 

Macros

#define PWM_MIN_PCNT   (0.0f)
 
#define PWM_MAX_PCNT   (100.0f)
 

Enumerations

enum  pwm_result_t {
  PWM_RESULT_OK ,
  PWM_RESULT_INVALID ,
  PWM_RESULT_UNSUPPORTED ,
  PWM_RESULT_BUSY ,
  PWM_RESULT_ERR ,
  TOTAL_PWM_RESULT
}
 
enum  pwm_alignment_t {
  PWM_ALIGNMENT_EDGE ,
  PWM_ALIGNMENT_CENTER ,
  TOTAL_PWM_ALIGNMENT
}
 

Functions

pwm_result_t hal_pwm_init (const pwm_channel_attr_t attr)
 Configure PWM channel with specific attributes.
 
pwm_result_t hal_pwm_start (const gpio_pin_t pin)
 Start generate PWM pulses.
 
pwm_result_t hal_pwm_update (const gpio_pin_t pin, const float duty_cycle_pcnt)
 Update PWM duty cycles.
 
pwm_result_t hal_pwm_stop (const gpio_pin_t pin)
 Stop PWM operation.
 
pwm_result_t hal_pwm_mutex_take (const gpio_pin_t pin, const uint32_t timeout_ms)
 Try acquire RTOS mutex for specified pin.
 
pwm_result_t hal_pwm_mutex_give (const gpio_pin_t pin)
 Release RTOS mutex for specified pin.