Friday, February 14, 2020

Using EmberZnet DynamicMultiprotocolLightSoc example showing how to use custom token in EFR32 NVM3.

You can follow the steps to use custom token (using EFR32 NVM3) on EmberZnet DynamicMultiprotocolLightSoc example.

1. Create customer-token.h with the following defines and place it to project folder.

#define NVM3KEY_APP_VERSION_INFO  (NVM3KEY_DOMAIN_USER | 0x000A)
#if defined(DEFINETYPES)
typedef uint16_t tokenTypeAppVersionInfo;
#endif //DEFINETYPES
#ifdef DEFINETOKENS
DEFINE_BASIC_TOKEN(APP_VERSION_INFO,
                    tokenTypeAppVersionInfo,
                    0x0000)
#endif

2. Add customer-token.h to project include path and press "Generate" to generate codes.


3. You can use the following code to write and read the custom token.

    tokenTypeAppVersionInfo tokenVerInfo = 0x0101;
    halCommonSetToken(TOKEN_APP_VERSION_INFO, &tokenVerInfo);
    tokenTypeAppVersionInfo tokenVerInfoR;
    halCommonGetToken(&tokenVerInfoR, TOKEN_APP_VERSION_INFO);

No comments:

Post a Comment