silence warnings around morsecalc

This commit is contained in:
joeycastillo
2023-04-16 10:56:08 -04:00
parent e083f9b386
commit bfeca93008
4 changed files with 28 additions and 56 deletions

View File

@@ -116,6 +116,19 @@ To see all the calculator operations and their token aliases, see the `calc_dict
#include "morsecalc_face.h"
#include "morsecalc_display.h"
/* mc_input Read an input into a morse code buffer
* Input: mc = index of MORSECODE_TREE[]
* len = max morse code char length
* in = character to read into buffer (0='.', 1='-', ignored otherwise).
* If the buffer is full, reset it instead of entering the new character.
*/
static void morsecode_input(unsigned int *mc, unsigned int len, char in) {
if(*mc >= (unsigned int) ((1<<len)-1)) *mc = 0;
else if((in == 0) | (in == 1)) *mc = (*mc)*2+in+1;
return;
}
// Clear token buffer
void morsecalc_reset_token(morsecalc_state_t *mcs) {
memset(mcs->token, '\0', MORSECALC_TOKEN_LEN*sizeof(mcs->token[0]));

View File

@@ -30,7 +30,21 @@
#include "movement.h"
#include "calc.h"
#include "morsecode.c"
/*
* MC International Morse Code binary tree
* Levels of the tree are concatenated.
* '.' = 0 and '-' = 1.
*
* Capitals denote special characters:
* C = Ch digraph
* V = VERIFY (ITU-R "UNDERSTOOD")
* R = REPEAT
* W = WAIT
* S = START TRANSMISSION
* E = END OF WORK
*/
static const char MORSECODE_TREE[] = " etianmsurwdkgohvf\0l\0pjbxcyzq\0C\x35\x34V\x33\0R\0\x32W\0+\0\0\0\0\x31\x36=/\0\0S(\0\x37\0\0\0\x38\0\x39\x30\0\0\0\0\0E\0\0\0\0\0\0?_\0\0\0\0\"\0\0.\0\0\0\0@\0\0\0'\0\0-\0\0\0\0\0\0\0\0;!\0)\0\0\0\0\0,\0\0\0\0:\0\0\0\0\0\0";
void morsecalc_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
void morsecalc_face_activate(movement_settings_t *settings, void *context);