From 4a0ff5577363a1bd315693b41f448e3774de9e34 Mon Sep 17 00:00:00 2001 From: Wesley Ellis Date: Tue, 23 Nov 2021 21:37:54 -0500 Subject: Properly vendor TOTP-MCU temporarily --- movement/lib/TOTP-MCU | 1 - movement/lib/TOTP-MCU/blink.c | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) delete mode 160000 movement/lib/TOTP-MCU create mode 100644 movement/lib/TOTP-MCU/blink.c (limited to 'movement/lib/TOTP-MCU/blink.c') diff --git a/movement/lib/TOTP-MCU b/movement/lib/TOTP-MCU deleted file mode 160000 index 646474a8..00000000 --- a/movement/lib/TOTP-MCU +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 646474a8757e1fca490792e81082b2ad89b966a3 diff --git a/movement/lib/TOTP-MCU/blink.c b/movement/lib/TOTP-MCU/blink.c new file mode 100644 index 00000000..9ec14ec6 --- /dev/null +++ b/movement/lib/TOTP-MCU/blink.c @@ -0,0 +1,39 @@ +#include +#include +#include + +/** + * blink.c + */ +void main(void) +{ + WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer + P1DIR |= 0x01; // configure P1.0 as output + + uint8_t hmacKey[] = {0x4d, 0x79, 0x4c, 0x65, 0x67, 0x6f, 0x44, 0x6f, 0x6f, 0x72}; // Secret key + TOTP(hmacKey, 10, 7200); // Secret key, Key length, Timestep (7200s - 2hours) + + setTimezone(9); // Set timezone + uint32_t newCode = getCodeFromTimestamp(1557414000); // Timestamp Now + + ///////////////// For struct tm ////////////////// + // struct tm datetime; + // datetime.tm_hour = 9; + // datetime.tm_min = 0; + // datetime.tm_sec = 0; + // datetime.tm_mday = 13; + // datetime.tm_mon = 5; + // datetime.tm_year = 2019; + // uint32_t newCode = getCodeFromTimeStruct(datetime); + /////////////////////////////////////////////////// + + volatile unsigned int i; // volatile to prevent optimization + + while(1) + { + if (newCode == 0){ // 0 = INPUT HERE + P1OUT ^= 0x01; // toggle P1.0 + } + for(i=10000; i>0; i--); // delay + } +} -- cgit v1.2.3