|
Swadge ESP32-S2
APIs to develop for the Magfest Swadge
|
Provides index-based usernames that will avoid the issues inherent in free text entry.
Go to the source code of this file.
Data Structures | |
| struct | nameData_t |
Macros | |
| #define | MAX_ADJ1_LEN 10 |
| #define | MAX_ADJ2_LEN 10 |
| #define | MAX_NOUN_LEN 10 |
| #define | USERNAME_MAX_LEN (MAX_ADJ1_LEN + MAX_ADJ2_LEN + MAX_NOUN_LEN + 7) |
| #define | GET_PACKED_USERNAME(nd) |
| Gets the packed 32 bit representation of a username. | |
Functions | |
| void | initUsernameSystem (void) |
| Call this to initialize the MAC variable. Call inside the swadge.h file. | |
| void | generateMACUsername (nameData_t *nd) |
| Generates a username based on the MAC of the swadge. | |
| void | generateRandUsername (nameData_t *nd) |
| Generates a random username. | |
| void | setUsernameFromND (nameData_t *nd) |
| Sets the username from a predefined nd. | |
| void | setUsernameFromIdxs (nameData_t *nd, int idx1, int idx2, int idx3, int randomCode) |
| Set the Username From indices. Useful for loading data from swadgepass. | |
| bool | handleUsernamePickerInput (buttonEvt_t *evt, nameData_t *nd) |
| Handles the input of the username. | |
| void | drawUsernamePicker (nameData_t *nd) |
| Draws the picker input. | |
| nameData_t * | getSystemUsername (void) |
| Get the System Username object. | |
| void | setSystemUsername (nameData_t *nd) |
| Saves the username to NVS. | |
| void | setUsernameFrom32 (nameData_t *nd, int32_t packed) |
| Set the Username from a int32. | |
| struct nameData_t |
| Data Fields | ||
|---|---|---|
| int8_t | idxs[3] | |
| uint8_t | randCode | |
| int | arrayIdx | |
| char | nameBuffer[USERNAME_MAX_LEN] | |
| bool | user | |
| #define MAX_ADJ1_LEN 10 |
| #define MAX_ADJ2_LEN 10 |
| #define MAX_NOUN_LEN 10 |
| #define USERNAME_MAX_LEN (MAX_ADJ1_LEN + MAX_ADJ2_LEN + MAX_NOUN_LEN + 7) |
| #define GET_PACKED_USERNAME | ( | nd | ) |
Gets the packed 32 bit representation of a username.
| nd | nameData_t pointer to pack |
| void initUsernameSystem | ( | void | ) |
Call this to initialize the MAC variable. Call inside the swadge.h file.
| void generateMACUsername | ( | nameData_t * | nd | ) |
Generates a username based on the MAC of the swadge.
| nd | Data struct the name is saved to |
| void generateRandUsername | ( | nameData_t * | nd | ) |
Generates a random username.
| nd | Data struct the name is saved to |
| void setUsernameFromND | ( | nameData_t * | nd | ) |
Sets the username from a predefined nd.
| nd | nd containing the data |
| void setUsernameFromIdxs | ( | nameData_t * | nd, |
| int | idx1, | ||
| int | idx2, | ||
| int | idx3, | ||
| int | randomCode ) |
Set the Username From indices. Useful for loading data from swadgepass.
| nd | Data struct to receive the objects |
| idx1 | First index |
| idx2 | Second index |
| idx3 | Third index |
| randomCode | numbers at the end of the swadge |
| bool handleUsernamePickerInput | ( | buttonEvt_t * | evt, |
| nameData_t * | nd ) |
Handles the input of the username.
| evt | The button event object |
| nd | Data structure to store data in |
| void drawUsernamePicker | ( | nameData_t * | nd | ) |
Draws the picker input.
| nd | The data |
| nameData_t * getSystemUsername | ( | void | ) |
Get the System Username object.
| void setSystemUsername | ( | nameData_t * | nd | ) |
Saves the username to NVS.
| nd | username to save |
| void setUsernameFrom32 | ( | nameData_t * | nd, |
| int32_t | packed ) |
Set the Username from a int32.
| nd | nameData_t to initialize |
| packed | int32_t to load name from |