| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- #include "serial_output.h"
- #include "hardware_seam.h"
- #include "numeric_conversion.h"
- #include "program_memory.h"
- namespace meCoffee {
- void writeRamText(const char* ramText) {
- if (ramText == nullptr) {
- return;
- }
- while (*ramText != '\0') {
- hardware::writeSerialByte(static_cast<uint8_t>(*ramText));
- ++ramText;
- }
- }
- void writeProgramMemoryText(const char* programMemoryText) {
- if (programMemoryText == nullptr) {
- return;
- }
- for (;;) {
- const uint8_t character = hardware::readProgramMemoryByte(programMemoryText);
- if (character == 0) {
- return;
- }
- hardware::writeSerialByte(character);
- ++programMemoryText;
- }
- }
- void writeSpace() { hardware::writeSerialByte(' '); }
- void writeCarriageReturnLineFeed() {
- hardware::writeSerialByte('\r');
- hardware::writeSerialByte('\n');
- }
- void writeSignedDecimalText(int32_t numericValue) {
- char digits[12];
- const uint8_t length = formatSignedDecimal(numericValue, digits);
- for (uint8_t position = 0; position < length; ++position) {
- hardware::writeSerialByte(static_cast<uint8_t>(digits[position]));
- }
- }
- void writeUnsignedDecimalText(uint32_t numericValue) {
- char digits[12];
- const uint8_t length = formatUnsignedDecimal(numericValue, digits);
- for (uint8_t position = 0; position < length; ++position) {
- hardware::writeSerialByte(static_cast<uint8_t>(digits[position]));
- }
- }
- } // namespace meCoffee
|