123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720 |
- #ifndef NRF_TIMER_H__
- #define NRF_TIMER_H__
- #include <nrfx.h>
- #ifdef __cplusplus
- extern "C" {
- #endif
- #define TIMER_MAX_SIZE(id) NRFX_CONCAT_3(TIMER, id, _MAX_SIZE)
- #define TIMER_BIT_WIDTH_MAX(id, bit_width) \
- (TIMER_MAX_SIZE(id) == 8 ? (bit_width == NRF_TIMER_BIT_WIDTH_8) : \
- (TIMER_MAX_SIZE(id) == 16 ? (bit_width == NRF_TIMER_BIT_WIDTH_8) || \
- (bit_width == NRF_TIMER_BIT_WIDTH_16) : \
- (TIMER_MAX_SIZE(id) == 24 ? (bit_width == NRF_TIMER_BIT_WIDTH_8) || \
- (bit_width == NRF_TIMER_BIT_WIDTH_16) || \
- (bit_width == NRF_TIMER_BIT_WIDTH_24) : \
- (TIMER_MAX_SIZE(id) == 32 ? (bit_width == NRF_TIMER_BIT_WIDTH_8) || \
- (bit_width == NRF_TIMER_BIT_WIDTH_16) || \
- (bit_width == NRF_TIMER_BIT_WIDTH_24) || \
- (bit_width == NRF_TIMER_BIT_WIDTH_32) : \
- false))))
- #if (TIMER_COUNT == 3) || defined(__NRFX_DOXYGEN__)
- #define NRF_TIMER_IS_BIT_WIDTH_VALID(p_reg, bit_width) ( \
- ((p_reg == NRF_TIMER0) && TIMER_BIT_WIDTH_MAX(0, bit_width)) \
- || ((p_reg == NRF_TIMER1) && TIMER_BIT_WIDTH_MAX(1, bit_width)) \
- || ((p_reg == NRF_TIMER2) && TIMER_BIT_WIDTH_MAX(2, bit_width)))
- #elif (TIMER_COUNT == 4)
- #define NRF_TIMER_IS_BIT_WIDTH_VALID(p_reg, bit_width) ( \
- ((p_reg == NRF_TIMER0) && TIMER_BIT_WIDTH_MAX(0, bit_width)) \
- || ((p_reg == NRF_TIMER1) && TIMER_BIT_WIDTH_MAX(1, bit_width)) \
- || ((p_reg == NRF_TIMER2) && TIMER_BIT_WIDTH_MAX(2, bit_width)) \
- || ((p_reg == NRF_TIMER3) && TIMER_BIT_WIDTH_MAX(3, bit_width)))
- #elif (TIMER_COUNT == 5)
- #define NRF_TIMER_IS_BIT_WIDTH_VALID(p_reg, bit_width) ( \
- ((p_reg == NRF_TIMER0) && TIMER_BIT_WIDTH_MAX(0, bit_width)) \
- || ((p_reg == NRF_TIMER1) && TIMER_BIT_WIDTH_MAX(1, bit_width)) \
- || ((p_reg == NRF_TIMER2) && TIMER_BIT_WIDTH_MAX(2, bit_width)) \
- || ((p_reg == NRF_TIMER3) && TIMER_BIT_WIDTH_MAX(3, bit_width)) \
- || ((p_reg == NRF_TIMER4) && TIMER_BIT_WIDTH_MAX(4, bit_width)))
- #else
- #error "Not supported timer count"
- #endif
- #define NRF_TIMER_CC_CHANNEL_COUNT(id) NRFX_CONCAT_3(TIMER, id, _CC_NUM)
- typedef enum
- {
- NRF_TIMER_TASK_START = offsetof(NRF_TIMER_Type, TASKS_START),
- NRF_TIMER_TASK_STOP = offsetof(NRF_TIMER_Type, TASKS_STOP),
- NRF_TIMER_TASK_COUNT = offsetof(NRF_TIMER_Type, TASKS_COUNT),
- NRF_TIMER_TASK_CLEAR = offsetof(NRF_TIMER_Type, TASKS_CLEAR),
- NRF_TIMER_TASK_SHUTDOWN = offsetof(NRF_TIMER_Type, TASKS_SHUTDOWN),
- NRF_TIMER_TASK_CAPTURE0 = offsetof(NRF_TIMER_Type, TASKS_CAPTURE[0]),
- NRF_TIMER_TASK_CAPTURE1 = offsetof(NRF_TIMER_Type, TASKS_CAPTURE[1]),
- NRF_TIMER_TASK_CAPTURE2 = offsetof(NRF_TIMER_Type, TASKS_CAPTURE[2]),
- NRF_TIMER_TASK_CAPTURE3 = offsetof(NRF_TIMER_Type, TASKS_CAPTURE[3]),
- #if defined(TIMER_INTENSET_COMPARE4_Msk) || defined(__NRFX_DOXYGEN__)
- NRF_TIMER_TASK_CAPTURE4 = offsetof(NRF_TIMER_Type, TASKS_CAPTURE[4]),
- #endif
- #if defined(TIMER_INTENSET_COMPARE5_Msk) || defined(__NRFX_DOXYGEN__)
- NRF_TIMER_TASK_CAPTURE5 = offsetof(NRF_TIMER_Type, TASKS_CAPTURE[5]),
- #endif
- } nrf_timer_task_t;
- typedef enum
- {
- NRF_TIMER_EVENT_COMPARE0 = offsetof(NRF_TIMER_Type, EVENTS_COMPARE[0]),
- NRF_TIMER_EVENT_COMPARE1 = offsetof(NRF_TIMER_Type, EVENTS_COMPARE[1]),
- NRF_TIMER_EVENT_COMPARE2 = offsetof(NRF_TIMER_Type, EVENTS_COMPARE[2]),
- NRF_TIMER_EVENT_COMPARE3 = offsetof(NRF_TIMER_Type, EVENTS_COMPARE[3]),
- #if defined(TIMER_INTENSET_COMPARE4_Msk) || defined(__NRFX_DOXYGEN__)
- NRF_TIMER_EVENT_COMPARE4 = offsetof(NRF_TIMER_Type, EVENTS_COMPARE[4]),
- #endif
- #if defined(TIMER_INTENSET_COMPARE5_Msk) || defined(__NRFX_DOXYGEN__)
- NRF_TIMER_EVENT_COMPARE5 = offsetof(NRF_TIMER_Type, EVENTS_COMPARE[5]),
- #endif
- } nrf_timer_event_t;
- typedef enum
- {
- NRF_TIMER_SHORT_COMPARE0_STOP_MASK = TIMER_SHORTS_COMPARE0_STOP_Msk,
- NRF_TIMER_SHORT_COMPARE1_STOP_MASK = TIMER_SHORTS_COMPARE1_STOP_Msk,
- NRF_TIMER_SHORT_COMPARE2_STOP_MASK = TIMER_SHORTS_COMPARE2_STOP_Msk,
- NRF_TIMER_SHORT_COMPARE3_STOP_MASK = TIMER_SHORTS_COMPARE3_STOP_Msk,
- #if defined(TIMER_INTENSET_COMPARE4_Msk) || defined(__NRFX_DOXYGEN__)
- NRF_TIMER_SHORT_COMPARE4_STOP_MASK = TIMER_SHORTS_COMPARE4_STOP_Msk,
- #endif
- #if defined(TIMER_INTENSET_COMPARE5_Msk) || defined(__NRFX_DOXYGEN__)
- NRF_TIMER_SHORT_COMPARE5_STOP_MASK = TIMER_SHORTS_COMPARE5_STOP_Msk,
- #endif
- NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK = TIMER_SHORTS_COMPARE0_CLEAR_Msk,
- NRF_TIMER_SHORT_COMPARE1_CLEAR_MASK = TIMER_SHORTS_COMPARE1_CLEAR_Msk,
- NRF_TIMER_SHORT_COMPARE2_CLEAR_MASK = TIMER_SHORTS_COMPARE2_CLEAR_Msk,
- NRF_TIMER_SHORT_COMPARE3_CLEAR_MASK = TIMER_SHORTS_COMPARE3_CLEAR_Msk,
- #if defined(TIMER_INTENSET_COMPARE4_Msk) || defined(__NRFX_DOXYGEN__)
- NRF_TIMER_SHORT_COMPARE4_CLEAR_MASK = TIMER_SHORTS_COMPARE4_CLEAR_Msk,
- #endif
- #if defined(TIMER_INTENSET_COMPARE5_Msk) || defined(__NRFX_DOXYGEN__)
- NRF_TIMER_SHORT_COMPARE5_CLEAR_MASK = TIMER_SHORTS_COMPARE5_CLEAR_Msk,
- #endif
- } nrf_timer_short_mask_t;
- typedef enum
- {
- NRF_TIMER_MODE_TIMER = TIMER_MODE_MODE_Timer,
- NRF_TIMER_MODE_COUNTER = TIMER_MODE_MODE_Counter,
- #if defined(TIMER_MODE_MODE_LowPowerCounter) || defined(__NRFX_DOXYGEN__)
- NRF_TIMER_MODE_LOW_POWER_COUNTER = TIMER_MODE_MODE_LowPowerCounter,
- #endif
- } nrf_timer_mode_t;
- typedef enum
- {
- NRF_TIMER_BIT_WIDTH_8 = TIMER_BITMODE_BITMODE_08Bit,
- NRF_TIMER_BIT_WIDTH_16 = TIMER_BITMODE_BITMODE_16Bit,
- NRF_TIMER_BIT_WIDTH_24 = TIMER_BITMODE_BITMODE_24Bit,
- NRF_TIMER_BIT_WIDTH_32 = TIMER_BITMODE_BITMODE_32Bit
- } nrf_timer_bit_width_t;
- typedef enum
- {
- NRF_TIMER_FREQ_16MHz = 0,
- NRF_TIMER_FREQ_8MHz,
- NRF_TIMER_FREQ_4MHz,
- NRF_TIMER_FREQ_2MHz,
- NRF_TIMER_FREQ_1MHz,
- NRF_TIMER_FREQ_500kHz,
- NRF_TIMER_FREQ_250kHz,
- NRF_TIMER_FREQ_125kHz,
- NRF_TIMER_FREQ_62500Hz,
- NRF_TIMER_FREQ_31250Hz
- } nrf_timer_frequency_t;
- typedef enum
- {
- NRF_TIMER_CC_CHANNEL0 = 0,
- NRF_TIMER_CC_CHANNEL1,
- NRF_TIMER_CC_CHANNEL2,
- NRF_TIMER_CC_CHANNEL3,
- #if defined(TIMER_INTENSET_COMPARE4_Msk) || defined(__NRFX_DOXYGEN__)
- NRF_TIMER_CC_CHANNEL4,
- #endif
- #if defined(TIMER_INTENSET_COMPARE5_Msk) || defined(__NRFX_DOXYGEN__)
- NRF_TIMER_CC_CHANNEL5,
- #endif
- } nrf_timer_cc_channel_t;
- typedef enum
- {
- NRF_TIMER_INT_COMPARE0_MASK = TIMER_INTENSET_COMPARE0_Msk,
- NRF_TIMER_INT_COMPARE1_MASK = TIMER_INTENSET_COMPARE1_Msk,
- NRF_TIMER_INT_COMPARE2_MASK = TIMER_INTENSET_COMPARE2_Msk,
- NRF_TIMER_INT_COMPARE3_MASK = TIMER_INTENSET_COMPARE3_Msk,
- #if defined(TIMER_INTENSET_COMPARE4_Msk) || defined(__NRFX_DOXYGEN__)
- NRF_TIMER_INT_COMPARE4_MASK = TIMER_INTENSET_COMPARE4_Msk,
- #endif
- #if defined(TIMER_INTENSET_COMPARE5_Msk) || defined(__NRFX_DOXYGEN__)
- NRF_TIMER_INT_COMPARE5_MASK = TIMER_INTENSET_COMPARE5_Msk,
- #endif
- } nrf_timer_int_mask_t;
- __STATIC_INLINE void nrf_timer_task_trigger(NRF_TIMER_Type * p_reg,
- nrf_timer_task_t task);
- __STATIC_INLINE uint32_t * nrf_timer_task_address_get(NRF_TIMER_Type * p_reg,
- nrf_timer_task_t task);
- __STATIC_INLINE void nrf_timer_event_clear(NRF_TIMER_Type * p_reg,
- nrf_timer_event_t event);
- __STATIC_INLINE bool nrf_timer_event_check(NRF_TIMER_Type * p_reg,
- nrf_timer_event_t event);
- __STATIC_INLINE uint32_t * nrf_timer_event_address_get(NRF_TIMER_Type * p_reg,
- nrf_timer_event_t event);
- __STATIC_INLINE void nrf_timer_shorts_enable(NRF_TIMER_Type * p_reg,
- uint32_t mask);
- __STATIC_INLINE void nrf_timer_shorts_disable(NRF_TIMER_Type * p_reg,
- uint32_t mask);
- __STATIC_INLINE void nrf_timer_int_enable(NRF_TIMER_Type * p_reg,
- uint32_t mask);
- __STATIC_INLINE void nrf_timer_int_disable(NRF_TIMER_Type * p_reg,
- uint32_t mask);
- __STATIC_INLINE bool nrf_timer_int_enable_check(NRF_TIMER_Type * p_reg,
- uint32_t timer_int);
- #if defined(DPPI_PRESENT) || defined(__NRFX_DOXYGEN__)
- __STATIC_INLINE void nrf_timer_subscribe_set(NRF_TIMER_Type * p_reg,
- nrf_timer_task_t task,
- uint8_t channel);
- __STATIC_INLINE void nrf_timer_subscribe_clear(NRF_TIMER_Type * p_reg,
- nrf_timer_task_t task);
- __STATIC_INLINE void nrf_timer_publish_set(NRF_TIMER_Type * p_reg,
- nrf_timer_event_t event,
- uint8_t channel);
- __STATIC_INLINE void nrf_timer_publish_clear(NRF_TIMER_Type * p_reg,
- nrf_timer_event_t event);
- #endif
- __STATIC_INLINE void nrf_timer_mode_set(NRF_TIMER_Type * p_reg,
- nrf_timer_mode_t mode);
- __STATIC_INLINE nrf_timer_mode_t nrf_timer_mode_get(NRF_TIMER_Type * p_reg);
- __STATIC_INLINE void nrf_timer_bit_width_set(NRF_TIMER_Type * p_reg,
- nrf_timer_bit_width_t bit_width);
- __STATIC_INLINE nrf_timer_bit_width_t nrf_timer_bit_width_get(NRF_TIMER_Type * p_reg);
- __STATIC_INLINE void nrf_timer_frequency_set(NRF_TIMER_Type * p_reg,
- nrf_timer_frequency_t frequency);
- __STATIC_INLINE nrf_timer_frequency_t nrf_timer_frequency_get(NRF_TIMER_Type * p_reg);
- __STATIC_INLINE void nrf_timer_cc_write(NRF_TIMER_Type * p_reg,
- nrf_timer_cc_channel_t cc_channel,
- uint32_t cc_value);
- __STATIC_INLINE uint32_t nrf_timer_cc_read(NRF_TIMER_Type * p_reg,
- nrf_timer_cc_channel_t cc_channel);
- __STATIC_INLINE nrf_timer_task_t nrf_timer_capture_task_get(uint32_t channel);
- __STATIC_INLINE nrf_timer_event_t nrf_timer_compare_event_get(uint32_t channel);
- __STATIC_INLINE nrf_timer_int_mask_t nrf_timer_compare_int_get(uint32_t channel);
- __STATIC_INLINE uint32_t nrf_timer_us_to_ticks(uint32_t time_us,
- nrf_timer_frequency_t frequency);
- __STATIC_INLINE uint32_t nrf_timer_ms_to_ticks(uint32_t time_ms,
- nrf_timer_frequency_t frequency);
- #ifndef SUPPRESS_INLINE_IMPLEMENTATION
- __STATIC_INLINE void nrf_timer_task_trigger(NRF_TIMER_Type * p_reg,
- nrf_timer_task_t task)
- {
- *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)task)) = 0x1UL;
- }
- __STATIC_INLINE uint32_t * nrf_timer_task_address_get(NRF_TIMER_Type * p_reg,
- nrf_timer_task_t task)
- {
- return (uint32_t *)((uint8_t *)p_reg + (uint32_t)task);
- }
- __STATIC_INLINE void nrf_timer_event_clear(NRF_TIMER_Type * p_reg,
- nrf_timer_event_t event)
- {
- *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event)) = 0x0UL;
- #if __CORTEX_M == 0x04
- volatile uint32_t dummy = *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event));
- (void)dummy;
- #endif
- }
- __STATIC_INLINE bool nrf_timer_event_check(NRF_TIMER_Type * p_reg,
- nrf_timer_event_t event)
- {
- return (bool)*(volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event);
- }
- __STATIC_INLINE uint32_t * nrf_timer_event_address_get(NRF_TIMER_Type * p_reg,
- nrf_timer_event_t event)
- {
- return (uint32_t *)((uint8_t *)p_reg + (uint32_t)event);
- }
- __STATIC_INLINE void nrf_timer_shorts_enable(NRF_TIMER_Type * p_reg,
- uint32_t mask)
- {
- p_reg->SHORTS |= mask;
- }
- __STATIC_INLINE void nrf_timer_shorts_disable(NRF_TIMER_Type * p_reg,
- uint32_t mask)
- {
- p_reg->SHORTS &= ~(mask);
- }
- __STATIC_INLINE void nrf_timer_int_enable(NRF_TIMER_Type * p_reg,
- uint32_t mask)
- {
- p_reg->INTENSET = mask;
- }
- __STATIC_INLINE void nrf_timer_int_disable(NRF_TIMER_Type * p_reg,
- uint32_t mask)
- {
- p_reg->INTENCLR = mask;
- }
- __STATIC_INLINE bool nrf_timer_int_enable_check(NRF_TIMER_Type * p_reg,
- uint32_t timer_int)
- {
- return (bool)(p_reg->INTENSET & timer_int);
- }
- #if defined(DPPI_PRESENT)
- __STATIC_INLINE void nrf_timer_subscribe_set(NRF_TIMER_Type * p_reg,
- nrf_timer_task_t task,
- uint8_t channel)
- {
- *((volatile uint32_t *) ((uint8_t *) p_reg + (uint32_t) task + 0x80uL)) =
- ((uint32_t)channel | TIMER_SUBSCRIBE_START_EN_Msk);
- }
- __STATIC_INLINE void nrf_timer_subscribe_clear(NRF_TIMER_Type * p_reg,
- nrf_timer_task_t task)
- {
- *((volatile uint32_t *) ((uint8_t *) p_reg + (uint32_t) task + 0x80uL)) = 0;
- }
- __STATIC_INLINE void nrf_timer_publish_set(NRF_TIMER_Type * p_reg,
- nrf_timer_event_t event,
- uint8_t channel)
- {
- *((volatile uint32_t *) ((uint8_t *) p_reg + (uint32_t) event + 0x80uL)) =
- ((uint32_t)channel | TIMER_PUBLISH_COMPARE_EN_Msk);
- }
- __STATIC_INLINE void nrf_timer_publish_clear(NRF_TIMER_Type * p_reg,
- nrf_timer_event_t event)
- {
- *((volatile uint32_t *) ((uint8_t *) p_reg + (uint32_t) event + 0x80uL)) = 0;
- }
- #endif
- __STATIC_INLINE void nrf_timer_mode_set(NRF_TIMER_Type * p_reg,
- nrf_timer_mode_t mode)
- {
- p_reg->MODE = (p_reg->MODE & ~TIMER_MODE_MODE_Msk) |
- ((mode << TIMER_MODE_MODE_Pos) & TIMER_MODE_MODE_Msk);
- }
- __STATIC_INLINE nrf_timer_mode_t nrf_timer_mode_get(NRF_TIMER_Type * p_reg)
- {
- return (nrf_timer_mode_t)(p_reg->MODE);
- }
- __STATIC_INLINE void nrf_timer_bit_width_set(NRF_TIMER_Type * p_reg,
- nrf_timer_bit_width_t bit_width)
- {
- p_reg->BITMODE = (p_reg->BITMODE & ~TIMER_BITMODE_BITMODE_Msk) |
- ((bit_width << TIMER_BITMODE_BITMODE_Pos) &
- TIMER_BITMODE_BITMODE_Msk);
- }
- __STATIC_INLINE nrf_timer_bit_width_t nrf_timer_bit_width_get(NRF_TIMER_Type * p_reg)
- {
- return (nrf_timer_bit_width_t)(p_reg->BITMODE);
- }
- __STATIC_INLINE void nrf_timer_frequency_set(NRF_TIMER_Type * p_reg,
- nrf_timer_frequency_t frequency)
- {
- p_reg->PRESCALER = (p_reg->PRESCALER & ~TIMER_PRESCALER_PRESCALER_Msk) |
- ((frequency << TIMER_PRESCALER_PRESCALER_Pos) &
- TIMER_PRESCALER_PRESCALER_Msk);
- }
- __STATIC_INLINE nrf_timer_frequency_t nrf_timer_frequency_get(NRF_TIMER_Type * p_reg)
- {
- return (nrf_timer_frequency_t)(p_reg->PRESCALER);
- }
- __STATIC_INLINE void nrf_timer_cc_write(NRF_TIMER_Type * p_reg,
- nrf_timer_cc_channel_t cc_channel,
- uint32_t cc_value)
- {
- p_reg->CC[cc_channel] = cc_value;
- }
- __STATIC_INLINE uint32_t nrf_timer_cc_read(NRF_TIMER_Type * p_reg,
- nrf_timer_cc_channel_t cc_channel)
- {
- return (uint32_t)p_reg->CC[cc_channel];
- }
- __STATIC_INLINE nrf_timer_task_t nrf_timer_capture_task_get(uint32_t channel)
- {
- return (nrf_timer_task_t)NRFX_OFFSETOF(NRF_TIMER_Type, TASKS_CAPTURE[channel]);
- }
- __STATIC_INLINE nrf_timer_event_t nrf_timer_compare_event_get(uint32_t channel)
- {
- return (nrf_timer_event_t)NRFX_OFFSETOF(NRF_TIMER_Type, EVENTS_COMPARE[channel]);
- }
- __STATIC_INLINE nrf_timer_int_mask_t nrf_timer_compare_int_get(uint32_t channel)
- {
- return (nrf_timer_int_mask_t)
- ((uint32_t)NRF_TIMER_INT_COMPARE0_MASK << channel);
- }
- __STATIC_INLINE uint32_t nrf_timer_us_to_ticks(uint32_t time_us,
- nrf_timer_frequency_t frequency)
- {
-
-
- uint32_t prescaler = (uint32_t)frequency;
- uint64_t ticks = ((time_us * 16ULL) >> prescaler);
- NRFX_ASSERT(ticks <= UINT32_MAX);
- return (uint32_t)ticks;
- }
- __STATIC_INLINE uint32_t nrf_timer_ms_to_ticks(uint32_t time_ms,
- nrf_timer_frequency_t frequency)
- {
-
-
- uint32_t prescaler = (uint32_t)frequency;
- uint64_t ticks = ((time_ms * 16000ULL) >> prescaler);
- NRFX_ASSERT(ticks <= UINT32_MAX);
- return (uint32_t)ticks;
- }
- #endif
- #ifdef __cplusplus
- }
- #endif
- #endif
|