fix commands and add encoding

This commit is contained in:
Elizabeth Cray
2025-01-19 16:45:29 -05:00
parent e10e6eddbf
commit f0ea6b2707
3 changed files with 131 additions and 14 deletions

37
src/cw.cpp Normal file
View File

@@ -0,0 +1,37 @@
#include <Arduino.h>
#include <ctype.h>
uint8_t convertASCII(char c){
uint8_t result;
if(isalpha(c)){
if(islower(c)){
result = (uint8_t)c - 97;
}else{
result = (uint8_t)c - 65;
}
} else if (isdigit(c)){
result = (uint8_t)c - 22;
} else {
switch (c) {
case '-':
result = 36;
break;
case '.':
result = 36;
break;
case ',':
result = 36;
break;
case '?':
result = 36;
break;
case '/' || '\\':
result = 36;
break;
default:
result = 41;
break;
}
}
return result;
}