From 970081991d4c8f3c5fa6a08766842fdbf16007a7 Mon Sep 17 00:00:00 2001 From: Vasily Davydov Date: Fri, 12 May 2023 01:12:26 +0300 Subject: [PATCH] peripherals: add logging --- source/shoh/src/peripherals/DigitalIoPin.cpp | 4 ++++ source/shoh/src/peripherals/EEPROMio.cpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/source/shoh/src/peripherals/DigitalIoPin.cpp b/source/shoh/src/peripherals/DigitalIoPin.cpp index 1028d3c..0110997 100644 --- a/source/shoh/src/peripherals/DigitalIoPin.cpp +++ b/source/shoh/src/peripherals/DigitalIoPin.cpp @@ -6,6 +6,7 @@ */ #include "DigitalIoPin.h" +#include "Log.h" DigitalIoPin::DigitalIoPin (int port, int pin, bool input, bool pullup, bool invert, bool isr, IRQn_Type isr_index) @@ -39,6 +40,8 @@ DigitalIoPin::~DigitalIoPin () void DigitalIoPin::setIoPin () { + LOG_INFO("P%d_%d set as %s", _io._port, _io._port, + _io._input ? "input" : "output"); bool direction = true; if (_io._input) { @@ -62,6 +65,7 @@ DigitalIoPin::setIoPin () void DigitalIoPin::setIsr () { + LOG_INFO("P%d_%d set as ISR", _io._port, _io._port); bool direction = true; if (_io._input) { diff --git a/source/shoh/src/peripherals/EEPROMio.cpp b/source/shoh/src/peripherals/EEPROMio.cpp index 26135a0..2e149e3 100644 --- a/source/shoh/src/peripherals/EEPROMio.cpp +++ b/source/shoh/src/peripherals/EEPROMio.cpp @@ -6,6 +6,7 @@ */ #include +#include "Log.h" static void e_memcpy (void *from, void *to, unsigned int n) @@ -57,6 +58,7 @@ EEPROMio::write_to (uint32_t addr, std::string str) { std::copy (str.begin (), str.end (), std::begin (buffer)); eeprom_use (buffer, addr, str.length (), WRITE); + LOG_INFO("%dB written to EEPROM", str.length ()); } void * @@ -64,6 +66,7 @@ EEPROMio::read_from (uint32_t addr, uint32_t amount) { eeprom_use (buffer, addr, amount, READ); void *data = (void *)buffer; + LOG_INFO("%dB read from EEPROM", amount); return data; } void @@ -72,5 +75,6 @@ EEPROMio::write_to (uint32_t addr, void *data, uint32_t size_of_data) assert (size_of_data < EEPROM_MAX_BUFER_SIZE); e_memcpy (data, buffer, size_of_data); eeprom_use (buffer, addr, size_of_data, WRITE); + LOG_INFO("%dB written to EEPROM", size_of_data); }