diff options
author | Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com> | 2024-02-20 23:12:53 -0300 |
---|---|---|
committer | Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com> | 2024-02-20 23:12:53 -0300 |
commit | 8a7d9326cf274003a6e92c9ca800173ec7292fec (patch) | |
tree | e523be2227be413a544ea7e3fb332343ade80f5d | |
parent | 67907e4e5c2b3347a37e9488549216f71e1a57b2 (diff) | |
download | Sensor-Watch-8a7d9326cf274003a6e92c9ca800173ec7292fec.tar.gz Sensor-Watch-8a7d9326cf274003a6e92c9ca800173ec7292fec.tar.bz2 Sensor-Watch-8a7d9326cf274003a6e92c9ca800173ec7292fec.zip |
faces/totp: define TOTP struct initializer macro
Generates a compound initializer for the given TOTP parameters.
Lessens repetition and allows functional definitions of TOTP records.
-rw-r--r-- | movement/watch_faces/complication/totp_face.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/movement/watch_faces/complication/totp_face.c b/movement/watch_faces/complication/totp_face.c index d634baa3..89619208 100644 --- a/movement/watch_faces/complication/totp_face.c +++ b/movement/watch_faces/complication/totp_face.c @@ -37,6 +37,15 @@ typedef struct { uint8_t *key; } totp_t; +#define TOTP_INITIALIZER(label_1, label_2, key_array, algo, timestep) \ + (const totp_t) { \ + .key = (key_array), \ + .key_length = sizeof(key_array), \ + .period = (timestep), \ + .labels = { (label_1), (label_2) }, \ + .algorithm = (algo), \ + } + //////////////////////////////////////////////////////////////////////////////// // Enter your TOTP key data below static const uint8_t num_keys = 2; |