PebbleOS v4.43.0-108-gde23235b2
Loading...
Searching...
No Matches
nRF5 RTC PWM

PWM controller driver generating a PWM output with an nRF5 RTC. More...

Data Structures

struct  pbl_pwm_nrf5_rtc
 nRF5 RTC PWM controller. More...
 

Macros

#define PBL_PWM_NRF5_RTC_DEFINE(sym, _name, _rtc, _out, _deps)
 Define an nRF5 RTC PWM controller.
 

Detailed Description

PWM controller driver generating a PWM output with an nRF5 RTC.

One channel, generated without the CPU or the high-frequency clock: the RTC counts the 32768 Hz low-frequency clock, and PPI connects its compare events to GPIOTE tasks driving the output, one at the end of the period, which also clears the counter, and one at the end of the duty cycle. The period and duty cycle resolution is one RTC tick, about 30.5 us. A 0% or 100% duty cycle stops the RTC and holds the output.

PBL_PWM_NRF5_RTC_DEFINE(s_extcomin, "extcomin", 2, PBL_GPIO(NRF5_GPIO_P1, 15, 0), NULL);
#define NRF5_GPIO_P1
Port P1.
Definition nrf5.h:42
#define PBL_GPIO(_port, _pin, _flags)
Initializer for a struct pbl_gpio.
Definition gpio.h:148
#define PBL_PWM_NRF5_RTC_DEFINE(sym, _name, _rtc, _out, _deps)
Define an nRF5 RTC PWM controller.
Definition nrf5_rtc.h:61

Data Structure Documentation

◆ pbl_pwm_nrf5_rtc

struct pbl_pwm_nrf5_rtc

nRF5 RTC PWM controller.

Data Fields
struct pbl_pwm_controller ctrl PWM controller.
struct pbl_gpio out Output.
uint8_t rtc RTC instance, from 0, not used by anything else.
struct pbl_pwm_nrf5_rtc_state * state Driver runtime state.

Macro Definition Documentation

◆ PBL_PWM_NRF5_RTC_DEFINE

#define PBL_PWM_NRF5_RTC_DEFINE (   sym,
  _name,
  _rtc,
  _out,
  _deps 
)
Value:
static struct pbl_pwm_nrf5_rtc_state sym##_nrf5_rtc_state; \
const struct pbl_pwm_nrf5_rtc sym = { \
.ctrl = \
PBL_PWM_CONTROLLER_INIT(sym, _name, pbl_pwm_nrf5_rtc_init, _deps, &pbl_pwm_nrf5_rtc_ops), \
.state = &sym##_nrf5_rtc_state, \
.out = _out, \
.rtc = (_rtc), \
}; \
PBL_DEVICE_REGISTER(sym, &sym.ctrl.dev)
struct pbl_gpio out
Output.
Definition nrf5_rtc.h:42
struct pbl_pwm_controller ctrl
PWM controller.
Definition nrf5_rtc.h:38
nRF5 RTC PWM controller.
Definition nrf5_rtc.h:36
struct pbl_device dev
Device.
Definition pwm.h:112
#define PBL_PWM_CONTROLLER_STATE_DEFINE(sym, _num_channels)
Define the class state of PWM controller sym, for the driver's define macro.
Definition pwm.h:127

Define an nRF5 RTC PWM controller.

Parameters
symSymbol of the controller.
_nameName.
_rtcRTC instance generating the output, 0 to 2.
_outOutput, from PBL_GPIO().
_depsDependencies from PBL_DEVICE_DEPS(), or NULL.