added debug printing for arduino

This commit is contained in:
dario 2023-11-26 18:37:50 +01:00
parent 63c8d06525
commit 3150ad000b
2 changed files with 50 additions and 0 deletions

View File

@ -0,0 +1,29 @@
#ifndef STA_CORE_PRINTABLE_SERIAL_HPP
#define STA_CORE_PRINTABLE_SERIAL_HPP
#include <sta/debug/printing/printable.hpp>
#ifdef STA_PLATFORM_ARDUINO
namespace sta
{
class PrintableSerial: public sta::BasePrintable
{
public:
/**
* @brief Construct a new Printable Serial object
*/
PrintableSerial(unsigned long baud);
/**
* @brief Print string.
*
* @param str String buffer
* @param length String length
*/
void print(const char * str, size_t length) override;
};
} // namespace sta
#endif // STA_PLATFORM_ARDUINO
#endif // STA_CORE_PRINTABLE_SERIAL_HPP

View File

@ -0,0 +1,21 @@
#include <sta/debug/printing/printable_serial.hpp>
#ifdef STA_PLATFORM_ARDUINO
#include <sta/devices/arduino/hal.hpp>
namespace sta
{
PrintableSerial::PrintableSerial(unsigned long baud)
: BasePrintable()
{
Serial.begin(baud);
}
void PrintableSerial::print(const char * str, size_t length)
{
Serial.write(str);
}
} // namespace sta
#endif // STA_PLATFORM_ARDUINO