73 #define HW_REGS_BASE ( ALT_STM_OFST )
74 #define HW_REGS_SPAN ( 0x04000000 )
75 #define HW_REGS_MASK ( HW_REGS_SPAN - 1 )
85 #define HEX3_HEX0_BASE 0x00000020
94 #define HEX5_HEX4_BASE 0x00000030
266 printf(
"Wrote value of %d\r\n", og);
284 char totpSetupURIinit[100] =
"otpauth://totp/EG:MS?secret=";
289 printf(
"Setup key: %s\n", totpSetupURIinit);
298 TOTP(decoded_array, 20, 30);
328 if( (
fd = open(
"/dev/mem", ( O_RDWR | O_SYNC ) ) ) == -1 ) {
329 printf(
"ERROR: could not open \"/dev/mem\"...\n" );
336 printf(
"ERROR: mmap() failed...\n" );
349 printf(
"failed to allocate lcd frame buffer\r\n");
367 printf(
"Key URI: %s\n", totpSetupURIinit);
406 printf(
"\nThe init Code is: %d\n",
newCode);
424 printf(
"The code in dec form: %d",
newCode);
431 printf(
"The Code is: %s\n",
codeStr);
void LCDHW_Init(void *virtual_base)
void LCDHW_BackLight(bool bON)
void TOTP(uint8_t *hmacKey, uint8_t keyLength, uint32_t timeStep)
TOTP Object, main object for the code generator.
uint32_t getCodeFromTimestamp(uint32_t timeStamp)
Accepts a timestamp from uint32_t, returns the code in uint32_t.
void setTimezone(uint8_t timezone)
Set the timezone from UTC, Arizona is always -7, so this is what is hard encoded into main.
int increment_leds(int total)
int unmap_physical(void *, unsigned int)
void * map_physical(int, unsigned int, unsigned int)
void DRAW_PrintString(LCD_CANVAS *pCanvas, int X0, int Y0, char *pText, int Color, FONT_TABLE *font_table)
void DRAW_Clear(LCD_CANVAS *pCanvas, int nValue)
void DRAW_Pixel(LCD_CANVAS *pCanvas, int X, int Y, int Color)
void DRAW_Refresh(LCD_CANVAS *pCanvas)
size_t output_len
The length of the uint_8 key in bytes.
volatile int * HEX45_ptr
Virtual address pointer Pointer for the 1-2 7-segment display lights Used to define the address of th...
volatile int * KEY_ptr
Pointer to the buttons on the board.
void runTests()
Main Unit Testing function This function is run initially at runtime, tests all features made by Eric...
char codeStr[6]
Stores the 6-digit code in a string format.
volatile int * HEX_ptr
Virtual address pointer Pointer for the 3-6 7-segment display lights Used to define the address of th...
QRCode qrcode
Creates a QRCode object.
uint32_t newCode
Code as a byte array.
GpioRegister * gpioRegister
LCD_CANVAS LcdCanvas
Creates a LCD_CANVAS object.
int secondsRemaining
Seconds remaining.
char knownKey[32]
Holds the key in a human readable format.
time_t seconds
Used to return the time.
int main()
Main Function Runs all other code.
volatile unsigned int * JP1_ptr
bool qrcode_getModule(QRCode *qrcode, uint8_t x, uint8_t y)
uint16_t qrcode_getBufferSize(uint8_t version)
int8_t qrcode_initText(QRCode *qrcode, uint8_t *modules, uint8_t version, uint8_t ecc, const char *data)
uint8_t * base32_decode2(const char *input, size_t *output_len)
Decodes a Base32-encoded string into a binary byte array.
void generateStringKey(char *keyString, int length)
Generates a full string of random characters.