From b8de35658ffd78ad8b22f91ccbbd3d63663afda9 Mon Sep 17 00:00:00 2001 From: Alexsander Akers Date: Tue, 25 Jan 2022 15:03:22 -0500 Subject: Sensor Watch Simulator (#35) * Put something on screen * Use the 32bit watch_date_time repr to pass from JS * Implement periodic callbacks * Clear display on enabling * Hook up watch_set_led_color() to SVG (green-only) * Make debug output full-width * Remove default Emscripten canvas * Implement sleep and button clicks * Fix time zone conversion bug in beats-time app * Clean up warnings * Fix pin levels * Set time zone to browser value (if available) * Add basic backup data saving * Silence format specifier warnings in both targets * Remove unnecessary, copied files * Use RTC pointer to clear callbacks (if available) * Use preprocessor define to avoid hardcoding MOVEMENT_NUM_FACES * Change each face to const preprocessor definition * Remove Intl.DateTimeFormat usage * Update shell.html title, header * Add touch start/end event handlers on SVG buttons * Update shell.html * Update folder structure (shared, simulator, hardware under watch-library) * Tease out shared components from watch_slcd * Clean up simulator watch_slcd.c inline JS calls * Fix missing newlines at end of file * Add simulator warnings (except format, unused-paremter) * Implement remaining watch_rtc functions * Fix button bug on mouse down then drag out * Implement remaining watch_slcd functions * Link keyboard events to buttons (for keys A, L, M) * Rewrite event handling (mouse, touch, keyboard) in C * Set explicit text UTF-8 charset in shell.html * Address PR comments * Remove unused directories from include paths --- movement/lib/TOTP-MCU/TOTP.c | 2 +- movement/lib/TOTP-MCU/sha1.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'movement/lib') diff --git a/movement/lib/TOTP-MCU/TOTP.c b/movement/lib/TOTP-MCU/TOTP.c index d977d06e..02858611 100644 --- a/movement/lib/TOTP-MCU/TOTP.c +++ b/movement/lib/TOTP-MCU/TOTP.c @@ -17,7 +17,7 @@ void setTimezone(uint8_t timezone){ _timeZoneOffset = timezone; } -uint32_t TimeStruct2Timestamp(struct tm time){ +static uint32_t TimeStruct2Timestamp(struct tm time){ //time.tm_mon -= 1; //time.tm_year -= 1900; return mktime(&(time)) - (_timeZoneOffset * 3600) - 2208988800; diff --git a/movement/lib/TOTP-MCU/sha1.c b/movement/lib/TOTP-MCU/sha1.c index 3ac14856..21a24fa5 100644 --- a/movement/lib/TOTP-MCU/sha1.c +++ b/movement/lib/TOTP-MCU/sha1.c @@ -34,11 +34,11 @@ void init(void) { bufferOffset = 0; } -uint32_t rol32(uint32_t number, uint8_t bits) { +static uint32_t rol32(uint32_t number, uint8_t bits) { return ((number << bits) | (uint32_t)(number >> (32-bits))); } -void hashBlock(void) { +static void hashBlock(void) { uint8_t i; uint32_t a,b,c,d,e,t; @@ -75,7 +75,7 @@ void hashBlock(void) { state.w[4] += e; } -void addUncounted(uint8_t data) { +static void addUncounted(uint8_t data) { buffer.b[bufferOffset ^ 3] = data; bufferOffset++; if (bufferOffset == BLOCK_LENGTH) { @@ -97,7 +97,7 @@ void writeArray(uint8_t *buffer, uint8_t size){ } } -void pad(void) { +static void pad(void) { // Implement SHA-1 padding (fips180-2 ��5.1.1) // Pad with 0x80 followed by 0x00 until the end of the block -- cgit v1.2.3