Eck-Eck/src/cw.cpp
2025-01-19 16:45:29 -05:00

37 lines
747 B
C++

#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;
}