Change FreeRTOS tick source from systick to RTC for low-power mode

This commit is contained in:
hathach committed 2017-04-10 15:23:13 +07:00
1 parent 33a6bb3642
commit d2fc54fab9
3 files changed
+25 -10

No files matched your search

+8 -7
View File
@@ -6,6 +6,7 @@
- Add waitForEvent() as alias to __WFE() instruction
- Enable FreeRTOS's Idle hook, add rtos_idle_callback() as optional callback for user
- Add mutex to prevent uart conflict
- Change FreeRTOS tick source from systick to RTC for low-power mode
#### New Example
@@ -20,13 +21,13 @@
- Add BLEDiscovery
- Add BLEGap and BLEGatt to manage peripheral & central with Gatt client and server support
- BLE API changes
- connPaired(), requestPairing()
- rename BLEBas .update() to .write()
- change Bluefruit setConnInterval()/setConnIntervalMS() return type from `err_t` to `bool`
- change BLECentral startScanning()/stopScanning()/connect() return type from `err_t` to `bool`
- change BLECharacteristic notify() return type from `err_t` to `bool`
- change BLEHid report function return type from `err_t` to `bool`
- change BLEMid send/sendSplit return type from `err_t` to `bool`
- Add connPaired(), requestPairing()
- Rename BLEBas .update() to .write()
- Change Bluefruit setConnInterval()/setConnIntervalMS() return type from `err_t` to `bool`
- Change BLECentral startScanning()/stopScanning()/connect() return type from `err_t` to `bool`
- Change BLECharacteristic notify() return type from `err_t` to `bool`
- Change BLEHid report function return type from `err_t` to `bool`
- Change BLEMid send/sendSplit return type from `err_t` to `bool`
- New BLE Serivce
- Apple Notification Center Service (ANCS)
- Central BLE UART
+1 -1
View File
@@ -89,7 +89,7 @@
* See http://www.freertos.org/a00110.html.
*----------------------------------------------------------*/
#define configTICK_SOURCE FREERTOS_USE_SYSTICK
#define configTICK_SOURCE FREERTOS_USE_RTC
#define configUSE_PREEMPTION 1
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
@@ -153,9 +153,16 @@ void vPortSetupTimerInterrupt( void )
void xPortSysTickHandler( void )
{
nrf_rtc_event_clear(portNRF_RTC_REG, NRF_RTC_EVENT_TICK);
// nrf_rtc_event_clear(portNRF_RTC_REG, NRF_RTC_EVENT_TICK);
portNRF_RTC_REG->EVENTS_TICK = 0;
uint32_t dummy = portNRF_RTC_REG->EVENTS_TICK;
(void) dummy;
#if configUSE_TICKLESS_IDLE == 1
nrf_rtc_event_clear(portNRF_RTC_REG, NRF_RTC_EVENT_COMPARE_0);
// nrf_rtc_event_clear(portNRF_RTC_REG, NRF_RTC_EVENT_COMPARE_0);
portNRF_RTC_REG->EVENTS_COMPARE[0] = 0;
uint32_t dummy2 = portNRF_RTC_REG->EVENTS_COMPARE[0];
(void) dummy2;
#endif
/* The SysTick runs at the lowest interrupt priority, so when this interrupt
@@ -198,6 +205,7 @@ void xPortSysTickHandler( void )
*/
void vPortSetupTimerInterrupt( void )
{
#if 0
/* Request LF clock */
nrf_drv_clock_lfclk_request(NULL);
@@ -206,6 +214,12 @@ void vPortSetupTimerInterrupt( void )
nrf_rtc_int_enable (portNRF_RTC_REG, RTC_INTENSET_TICK_Msk);
nrf_rtc_task_trigger (portNRF_RTC_REG, NRF_RTC_TASK_CLEAR);
nrf_rtc_task_trigger (portNRF_RTC_REG, NRF_RTC_TASK_START);
#else
portNRF_RTC_REG->PRESCALER = portNRF_RTC_PRESCALER;
portNRF_RTC_REG->INTENSET = RTC_INTENSET_TICK_Msk;
portNRF_RTC_REG->TASKS_CLEAR = 1;
portNRF_RTC_REG->TASKS_START = 1;
#endif
NVIC_SetPriority(portNRF_RTC_IRQn, configKERNEL_INTERRUPT_PRIORITY);
NVIC_EnableIRQ(portNRF_RTC_IRQn);