From 7ea44ed39c7c25ad0b3e1ad331dcdd70ca534bae Mon Sep 17 00:00:00 2001 From: Stephane D'Alu Date: Sun, 20 Nov 2016 13:25:25 +0100 Subject: Use active wait and perform extra toggle if needed. (same as the nrf_pwm) --- os/hal/ports/NRF5/NRF51822/hal_pwm_lld.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'os/hal/ports/NRF5/NRF51822/hal_pwm_lld.h') diff --git a/os/hal/ports/NRF5/NRF51822/hal_pwm_lld.h b/os/hal/ports/NRF5/NRF51822/hal_pwm_lld.h index cd64fa7..2cad6e7 100644 --- a/os/hal/ports/NRF5/NRF51822/hal_pwm_lld.h +++ b/os/hal/ports/NRF5/NRF51822/hal_pwm_lld.h @@ -34,8 +34,11 @@ /** * @brief Number of PWM channels per PWM driver. */ +#if NRF5_PWM_USE_GPIOTE_PPI +#define PWM_CHANNELS 2 +#else #define PWM_CHANNELS 3 - +#endif #define PWM_FREQUENCY_16MHZ 16000000 /** @brief 16MHz */ #define PWM_FREQUENCY_8MHZ 8000000 /** @brief 8MHz */ @@ -103,7 +106,7 @@ * @brief Allow driver to use GPIOTE/PPI to control PAL line */ #if !defined(NRF5_PWM_USE_GPIOTE_PPI) -#define NRF5_PWM_USE_GPIOTE_PPI FALSE +#define NRF5_PWM_USE_GPIOTE_PPI TRUE #endif /** @} */ @@ -177,6 +180,7 @@ typedef struct { pwmcallback_t callback; /* End of the mandatory fields.*/ +#if NRF5_PWM_USE_GPIOTE_PPI || defined(__DOXYGEN__) /** * @brief PAL line to toggle. * @note Only used if mode is PWM_OUTPUT_HIGH or PWM_OUTPUT_LOW. @@ -186,17 +190,14 @@ typedef struct { */ ioline_t ioline; -#if NRF5_PWM_USE_GPIOTE_PPI || defined(__DOXYGEN__) /** * @brief Unique GPIOTE channel to use. (1 channel) - * @note Only used if mode is PWM_OUTPUT_HIGH or PWM_OUTPUT_LOW. * @note Only 4 GPIOTE channels are available on nRF51. */ uint8_t gpiote_channel; /** * @brief Unique PPI channels to use. (2 channels) - * @note Only used if mode is PWM_OUTPUT_HIGH or PWM_OUTPUT_LOW. * @note Only 16 PPI channels are available on nRF51 * (When Softdevice is enabled, only channels 0-7 are available) */ -- cgit v1.2.3