SWE-350 TOTP Generator Milestone 5
The DE-10 board has six 7-segment displays, this can be used to display and generate a time based one-time pin (TOTP).
Loading...
Searching...
No Matches
qrcode.h
Go to the documentation of this file.
1
37#ifndef __QRCODE_H_
38#define __QRCODE_H_
39
40// #ifndef __cplusplus
41// typedef unsigned char bool;
42// static const bool false = 0;
43// static const bool true = 1;
44// #endif
45
46#include <stdbool.h>
47#include <stdint.h>
48
49
50// QR Code Format Encoding
51#define MODE_NUMERIC 0
52#define MODE_ALPHANUMERIC 1
53#define MODE_BYTE 2
54
55
56// Error Correction Code Levels
57#define ECC_LOW 0
58#define ECC_MEDIUM 1
59#define ECC_QUARTILE 2
60#define ECC_HIGH 3
61
62
63// If set to non-zero, this library can ONLY produce QR codes at that version
64// This saves a lot of dynamic memory, as the codeword tables are skipped
65#ifndef LOCK_VERSION
66#define LOCK_VERSION 0
67#endif
68
69
70typedef struct QRCode {
71 uint8_t version;
72 uint8_t size;
73 uint8_t ecc;
74 uint8_t mode;
75 uint8_t mask;
76 uint8_t *modules;
78
79
80#ifdef __cplusplus
81extern "C"{
82#endif /* __cplusplus */
83
84
85
86uint16_t qrcode_getBufferSize(uint8_t version);
87
88int8_t qrcode_initText(QRCode *qrcode, uint8_t *modules, uint8_t version, uint8_t ecc, const char *data);
89int8_t qrcode_initBytes(QRCode *qrcode, uint8_t *modules, uint8_t version, uint8_t ecc, uint8_t *data, uint16_t length);
90
91bool qrcode_getModule(QRCode *qrcode, uint8_t x, uint8_t y);
92
93
94
95#ifdef __cplusplus
96}
97#endif /* __cplusplus */
98
99
100#endif /* __QRCODE_H_ */
QRCode qrcode
Creates a QRCode object.
Definition main.c:190
bool qrcode_getModule(QRCode *qrcode, uint8_t x, uint8_t y)
Definition qrcode.c:860
struct QRCode QRCode
int8_t qrcode_initBytes(QRCode *qrcode, uint8_t *modules, uint8_t version, uint8_t ecc, uint8_t *data, uint16_t length)
Definition qrcode.c:780
uint16_t qrcode_getBufferSize(uint8_t version)
Definition qrcode.c:775
int8_t qrcode_initText(QRCode *qrcode, uint8_t *modules, uint8_t version, uint8_t ecc, const char *data)
Definition qrcode.c:856
uint8_t mode
Definition qrcode.h:72
uint8_t * modules
Definition qrcode.h:74
uint8_t mask
Definition qrcode.h:73
uint8_t version
Definition qrcode.h:69
uint8_t ecc
Definition qrcode.h:71
uint8_t size
Definition qrcode.h:70