|
| #define | TR_START_APP_TOKEN_DEFS typedef struct __attribute__((packed)) |
| | used to start the definition of the application tokens structure
|
| |
| #define | TR_END_APP_TOKEN_DEFS tr_app_token_struct_t; |
| | used to end the definition of the application tokens structure
|
| |
| #define | TR_CREATE_APP_TOKEN(token, type) type token; |
| | used to create a token which becomes an element in the application tokens structure with the passed in type and name
|
| |
| #define | tr_get_app_token_len(token) sizeof(((tr_app_token_struct_t*)0)->token) |
| | gets the size of an APP token
|
| |
| #define | tr_get_app_token_offset(token) ((uint32_t)(&((tr_app_token_struct_t*)0)->token)) |
| | gets the address offset to a specific APP token
|
| |
| #define | tr_get_app_token(data, token) |
| | copies the token data to the location pointed to by data
|
| |
| #define | tr_app_token_check_erased(token) |
| | checks if a specific APP token is erased
|
| |
| #define | tr_set_app_token(data, data_len, token) |
| | write token data to a specific APP token
|
| |
The TR_START_APP_TOKEN_DEFS and TR_END_APP_TOKEN_DEFS macros create a strucutre of all application tokens with defined element names and data types.
For example:
TR_START_APP_TOKEN_DEFS
{
TR_CREATE_APP_TOKEN(MY_APP_TOKEN, uint8_t)
}
TR_END_APP_TOKEN_DEFS
◆ tr_app_token_check_erased
| #define tr_app_token_check_erased |
( |
| token | ) |
|
Value: ({ \
bool is_erased = true; \
uint8_t count = 0; \
uint8_t data[200]; \
tr_get_app_token(data, token); \
if (data[i] == 0xFF) { \
count++; \
} \
} \
is_erased = false; \
} \
is_erased; \
})
#define tr_get_app_token_len(token)
gets the size of an APP token
Definition tr_app_tokens.h:51
checks if a specific APP token is erased
- Parameters
-
| token | name of APP token (ex. MY_APP_TOKEN) |
- Returns
- returns true if erased, false otherwise
◆ TR_CREATE_APP_TOKEN
| #define TR_CREATE_APP_TOKEN |
( |
| token, |
|
|
| type ) type token; |
used to create a token which becomes an element in the application tokens structure with the passed in type and name
- Parameters
-
| token | name of token to be created (ex. MY_APP_TOKEN) |
| type | data tyoe of token being created (ex. uint8_t) |
◆ TR_END_APP_TOKEN_DEFS
| #define TR_END_APP_TOKEN_DEFS tr_app_token_struct_t; |
used to end the definition of the application tokens structure
◆ tr_get_app_token
| #define tr_get_app_token |
( |
| data, |
|
|
| token ) |
Value:
#define tr_get_app_token_offset(token)
gets the address offset to a specific APP token
Definition tr_app_tokens.h:57
copies the token data to the location pointed to by data
- Parameters
-
| data | pointer to buffer to store the token data |
| token | name of APP token to read (ex. MY_APP_TOKEN) |
◆ tr_get_app_token_len
| #define tr_get_app_token_len |
( |
| token | ) |
sizeof(((tr_app_token_struct_t*)0)->token) |
gets the size of an APP token
- Parameters
-
| token | name of APP token (ex. MY_APP_TOKEN) |
- Returns
- returns the size of a specific element in the token structure
◆ tr_get_app_token_offset
| #define tr_get_app_token_offset |
( |
| token | ) |
((uint32_t)(&((tr_app_token_struct_t*)0)->token)) |
gets the address offset to a specific APP token
- Parameters
-
| token | name of APP token (ex. MY_APP_TOKEN) |
- Returns
- returns the address of the structure element referenced to 0
◆ tr_set_app_token
| #define tr_set_app_token |
( |
| data, |
|
|
| data_len, |
|
|
| token ) |
Value: do { \
tr_platform_token_write((uint8_t*)data, \
(uint8_t)data_len, \
} while (0)
write token data to a specific APP token
- Parameters
-
| data | pointer to buffer with the token data |
| data_len | number of bytes to write |
| token | name of APP token to write (ex. MY_APP_TOKEN) |
◆ TR_START_APP_TOKEN_DEFS
| #define TR_START_APP_TOKEN_DEFS typedef struct __attribute__((packed)) |
used to start the definition of the application tokens structure