1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 05:32:45 +01:00

pkg/mynewt-core/contrib: use same initializaion as Nimble for timers

This commit is contained in:
Francisco Molina 2021-09-01 09:15:24 +02:00
parent ba3567ade6
commit f4a3af4c44

View File

@ -25,10 +25,17 @@
void mynewt_core_init(void)
{
#if (MYNEWT_VAL_OS_CPUTIME_TIMER_NUM >= 0) && (defined(CPU_NRF51) || defined(CPU_NRF52))
int rc = hal_timer_init(5, NULL);
/* in mynewt-nimble and uwb-core OS_CPUTIMER_TIMER_NUM == 5 is NRF_RTC0,
for nimble this must be used for the BLE stack and must go through
mynewt timer initialization for it to work properly. The RTC frequency
should be set to the highest possible value, so 32768Hz */
assert(MYNEWT_VAL_OS_CPUTIME_TIMER_NUM == 5);
assert(MYNEWT_VAL_OS_CPUTIME_FREQ == 32768);
int rc = hal_timer_init(MYNEWT_VAL_OS_CPUTIME_TIMER_NUM, NULL);
assert(rc == 0);
rc = os_cputime_init(MYNEWT_VAL_OS_CPUTIME_FREQ);
rc = hal_timer_config(MYNEWT_VAL_OS_CPUTIME_TIMER_NUM,
MYNEWT_VAL_OS_CPUTIME_FREQ);
assert(rc == 0);
(void) rc;
(void)rc;
#endif
}