bbe4e500c3
- Disable IDLE hook (it would wake the device up as soon as possible). - Logger task sleep for 100ms (disable logging for better battery life) - Logging is disabled by default - Apply fix for ERRATA 87 (clear FPU interrupt before going to sleep). Ports files from FreeRTOS are now in the sources (they where in the SDK before)
33 lines
758 B
C++
33 lines
758 B
C++
#include <libraries/log/nrf_log_ctrl.h>
|
|
#include <libraries/log/nrf_log_default_backends.h>
|
|
#include <FreeRTOS.h>
|
|
#include <task.h>
|
|
#include <libraries/log/nrf_log.h>
|
|
#include "NrfLogger.h"
|
|
|
|
using namespace Pinetime::Logging;
|
|
|
|
void NrfLogger::Init() {
|
|
auto result = NRF_LOG_INIT(nullptr);
|
|
APP_ERROR_CHECK(result);
|
|
|
|
NRF_LOG_DEFAULT_BACKENDS_INIT();
|
|
|
|
if (pdPASS != xTaskCreate(NrfLogger::Process, "LOGGER", 512, nullptr, 0, &m_logger_thread))
|
|
APP_ERROR_HANDLER(NRF_ERROR_NO_MEM);
|
|
}
|
|
|
|
void NrfLogger::Process(void*) {
|
|
NRF_LOG_INFO("Logger task started!");
|
|
while (1) {
|
|
NRF_LOG_FLUSH();
|
|
vTaskDelay(100); // Not good for power consumption, it will wake up every 100ms...
|
|
}
|
|
}
|
|
|
|
void NrfLogger::Resume() {
|
|
vTaskResume(m_logger_thread);
|
|
}
|
|
|
|
|