NHS31xx SW API
app.h
1 /*
2  * Copyright 2020 NXP
3  * This software is owned or controlled by NXP and may only be used strictly
4  * in accordance with the applicable license terms. By expressly accepting
5  * such terms or by downloading, installing, activating and/or otherwise using
6  * the software, you are agreeing that you have read, and that you agree to
7  * comply with and are bound by, such license terms. If you do not agree to
8  * be bound by the applicable license terms, then you may not retain, install,
9  * activate or otherwise use the software.
10  */
11 
12 #ifndef MEMORY_H_
13 #define MEMORY_H_
14 
15 #include <stdbool.h>
16 #include <stdint.h>
17 #include <stddef.h>
18 #include <stdlib.h>
19 #include <string.h>
20 #include "board.h"
21 #include "msg/msg.h"
22 #include "ndeft2t/ndeft2t.h"
23 #include "tmeas/tmeas.h"
24 #include "mac/mac.h"
25 #include "msghandler_protocol.h"
26 
27 /* -------------------------------------------------------------------------------- */
28 
30 #define EEPROM_POS_CONFIG 0 /* Row 0 */
31 
33 #define EEPROM_POS_BACKUP_CONFIG EEPROM_ROW_SIZE /* Row 1 */
34 
36 #define EEPROM_POS_QUERY (2 * EEPROM_ROW_SIZE) /* Row 2 and part of row 3 */
37 
42 #define EEPROM_POS_LENDOMAINPATH (4 * EEPROM_ROW_SIZE) /* Row 4 onwards */
43 
45 #define EEPROM_POS_DOMAINPATH (EEPROM_POS_LENDOMAINPATH + sizeof(unsigned int))
46 
47 /* -------------------------------------------------------------------------------- */
48 
50 #define LEN_DEFAULT_DOMAINPATH 18
51 
53 #define DEFAULT_DOMAINPATH "rebrand.ly/7t2rxu1"
54 /* 0123456789012345678
55  * 0 1
56  */
57 
59 #define DEFAULT_RESOLUTION TSEN_8BITS
60 
62 #define DEFAULT_FORMAT TMEAS_FORMAT_CELSIUS
63 
64 /* -------------------------------------------------------------------------------- */
65 
71 void MsgHandler_Init(void);
72 
73 /* -------------------------------------------------------------------------------- */
74 
78 typedef struct APP_CONFIG_S {
82  uint16_t count;
83 
88  uint8_t id[8];
89 
95  bool locked;
96 
102  int8_t offset;
103 
109 
114  uint16_t temperature;
115 
120  uint8_t unit;
121 } APP_CONFIG_T;
122 
127 void App_SetResolution(TSEN_RESOLUTION_T resolution);
128 
133 void App_SetUnit(uint8_t unit);
134 
141 void App_SetKey(const uint32_t key[4]);
142 
147 void App_SetOffset(int8_t offset);
148 
156 void App_Lock(void);
157 
162 void App_Commit(void);
163 
173 const APP_CONFIG_T * App_GetConfig(void);
174 
175 /* -------------------------------------------------------------------------------- */
176 
181 void Url_Init(void);
182 
188 unsigned int Url_GetDomainPath(uint8_t domainPath[APP_MSG_MAX_LEN_URL]);
189 
203 void Url_SetDomainPath(int len, const uint8_t * domainPath);
204 
215 void Url_SetQuery(void);
216 
232 void Url_SetUnit(uint8_t unit);
233 
245 void Url_SetId(const uint8_t id[8]);
246 
259 void Url_SetOffset(int8_t offset);
260 
274 void Url_SetVersion(uint16_t major, uint16_t minor);
275 
280 void Url_Commit(void);
281 
290 void Url_SetCount(unsigned int count);
291 
300 void Url_SetTemperature(unsigned int temperature);
301 
311 void Url_SetHash(const uint32_t key[4]);
312 
318 void Url_Copy(void);
319 
320 #endif
bool locked
Definition: app.h:95
#define APP_MSG_MAX_LEN_URL
Definition: app_demo_label_signedurl/inc/msghandler_protocol.h:133
int8_t offset
Definition: app.h:102
uint16_t count
Definition: app.h:82
Definition: app.h:78
TSEN_RESOLUTION_T
Definition: tsen_nss.h:104
uint16_t temperature
Definition: app.h:114
uint8_t unit
Definition: app.h:120
void MsgHandler_Init(void)
TSEN_RESOLUTION_T resolution
Definition: app.h:108