peripherals: add logging

This commit is contained in:
Vasily Davydov 2023-05-12 01:12:26 +03:00
parent 49f8613166
commit 970081991d
2 changed files with 8 additions and 0 deletions

View File

@ -6,6 +6,7 @@
*/ */
#include "DigitalIoPin.h" #include "DigitalIoPin.h"
#include "Log.h"
DigitalIoPin::DigitalIoPin (int port, int pin, bool input, bool pullup, DigitalIoPin::DigitalIoPin (int port, int pin, bool input, bool pullup,
bool invert, bool isr, IRQn_Type isr_index) bool invert, bool isr, IRQn_Type isr_index)
@ -39,6 +40,8 @@ DigitalIoPin::~DigitalIoPin ()
void void
DigitalIoPin::setIoPin () DigitalIoPin::setIoPin ()
{ {
LOG_INFO("P%d_%d set as %s", _io._port, _io._port,
_io._input ? "input" : "output");
bool direction = true; bool direction = true;
if (_io._input) if (_io._input)
{ {
@ -62,6 +65,7 @@ DigitalIoPin::setIoPin ()
void void
DigitalIoPin::setIsr () DigitalIoPin::setIsr ()
{ {
LOG_INFO("P%d_%d set as ISR", _io._port, _io._port);
bool direction = true; bool direction = true;
if (_io._input) if (_io._input)
{ {

View File

@ -6,6 +6,7 @@
*/ */
#include <EEPROMio.h> #include <EEPROMio.h>
#include "Log.h"
static void static void
e_memcpy (void *from, void *to, unsigned int n) 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)); std::copy (str.begin (), str.end (), std::begin (buffer));
eeprom_use (buffer, addr, str.length (), WRITE); eeprom_use (buffer, addr, str.length (), WRITE);
LOG_INFO("%dB written to EEPROM", str.length ());
} }
void * void *
@ -64,6 +66,7 @@ EEPROMio::read_from (uint32_t addr, uint32_t amount)
{ {
eeprom_use (buffer, addr, amount, READ); eeprom_use (buffer, addr, amount, READ);
void *data = (void *)buffer; void *data = (void *)buffer;
LOG_INFO("%dB read from EEPROM", amount);
return data; return data;
} }
void 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); assert (size_of_data < EEPROM_MAX_BUFER_SIZE);
e_memcpy (data, buffer, size_of_data); e_memcpy (data, buffer, size_of_data);
eeprom_use (buffer, addr, size_of_data, WRITE); eeprom_use (buffer, addr, size_of_data, WRITE);
LOG_INFO("%dB written to EEPROM", size_of_data);
} }