format code

This commit is contained in:
Martin Brodbeck 2024-02-29 09:27:59 +01:00
parent da54029403
commit 3311e7d790
2 changed files with 115 additions and 111 deletions

View file

@ -1,5 +1,5 @@
#include <cstring>
#include <cstdio>
#include <cstring>
#include "pico/stdio.h"
@ -7,7 +7,8 @@
MorseCode::MorseCode() { buildMap(); }
bool MorseCode::charToMorse(const unsigned char ch, char *morseSymbols) {
bool MorseCode::charToMorse(const unsigned char ch, char *morseSymbols)
{
size_t index {0};
if (ch != ' ' && morseMap[ch] == nullptr) {
@ -35,7 +36,8 @@ bool MorseCode::charToMorse(const unsigned char ch, char *morseSymbols) {
return true;
}
void MorseCode::sendCharacter(const char ch) {
void MorseCode::sendCharacter(const char ch)
{
char morseSymbols[32] {0};
if (!charToMorse(ch, morseSymbols)) {
@ -47,7 +49,8 @@ void MorseCode::sendCharacter(const char ch) {
}
}
void MorseCode::buildMap() {
void MorseCode::buildMap()
{
for (size_t i = 0; i < 256; i++) {
if (i == '\"')
morseMap[i] = morseTable[0];

View file

@ -1,6 +1,7 @@
#pragma once
class MorseCode final {
class MorseCode final
{
public:
MorseCode();
void sendCharacter(const char ch);