PWM controller driver generating a PWM output with an nRF5 RTC.
More...
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.
#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
◆ pbl_pwm_nrf5_rtc
| 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. |
◆ 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; \
PBL_PWM_CONTROLLER_INIT(sym, _name, pbl_pwm_nrf5_rtc_init, _deps, &pbl_pwm_nrf5_rtc_ops), \
.state = &sym##_nrf5_rtc_state, \
.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
-
| sym | Symbol of the controller. |
| _name | Name. |
| _rtc | RTC instance generating the output, 0 to 2. |
| _out | Output, from PBL_GPIO(). |
| _deps | Dependencies from PBL_DEVICE_DEPS(), or NULL. |