Renamed Logging/ to logging/

This commit is contained in:
Avamander
2020-10-02 21:45:51 +03:00
parent e25c4edbcf
commit 30c261028e
5 changed files with 4 additions and 4 deletions

13
src/logging/DummyLogger.h Normal file
View File

@@ -0,0 +1,13 @@
#pragma once
#include "Logger.h"
namespace Pinetime {
namespace Logging{
class DummyLogger : public Logger {
public:
void Init() override {}
void Resume() override {}
};
}
}

11
src/logging/Logger.h Normal file
View File

@@ -0,0 +1,11 @@
#pragma once
namespace Pinetime {
namespace Logging {
class Logger {
public:
virtual void Init() = 0;
virtual void Resume() = 0;
};
}
}

32
src/logging/NrfLogger.cpp Normal file
View File

@@ -0,0 +1,32 @@
#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", 200, this, 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);
}

17
src/logging/NrfLogger.h Normal file
View File

@@ -0,0 +1,17 @@
#pragma once
#include "Logger.h"
namespace Pinetime {
namespace Logging{
class NrfLogger : public Logger {
public:
void Init() override;
void Resume() override;
private:
static void Process(void*);
TaskHandle_t m_logger_thread;
};
}
}