NHS31xx SW API

Detailed Description

The application can adapt the Event module to better fit the different application scenarios through the use of diversity flags in the form of defines below. Sensible defaults are chosen; to override the default settings, place the defines with their desired values in the application app_sel.h header file: the compiler will pick up your defines before parsing this file.

Additional notes regarding some flags:

These flags may be overridden/set:

These defines are fixed or derived from the above flags and may not be defined or redefined in an application:

Macros

#define EVENT_EEPROM_FIRST_ROW   (1024 / EEPROM_ROW_SIZE)
 
#define EVENT_EEPROM_LAST_ROW   (EVENT_EEPROM_FIRST_ROW + (1024 / EEPROM_ROW_SIZE) - 1)
 
#define EVENT_EEPROM_ROW_COUNT   (EVENT_EEPROM_LAST_ROW - EVENT_EEPROM_FIRST_ROW + 1)
 
#define EVENT_EEPROM_SIZE   (EVENT_EEPROM_ROW_COUNT * EEPROM_ROW_SIZE)
 
#define EVENT_CB_SELF_DEFINED   1
 
#define EVENT_CB   DummyEventCb
 
#define EVENT_CB_OPENING_INDEX   0xFFFFFFFE
 
#define EVENT_CB_OPENING_CALL   0
 
#define EVENT_CB_CLOSING_INDEX   0xFFFFFFFF
 
#define EVENT_CB_CLOSING_CALL   0
 
#define EVENT_OVERHEAD_CHOICE_A   0x41
 
#define EVENT_OVERHEAD_CHOICE_B   0x42
 
#define EVENT_OVERHEAD_CHOICE_C   0x43
 
#define EVENT_OVERHEAD_CHOICE_D   0x44
 
#define EVENT_OVERHEAD_CHOICE_E   0x45
 
#define EVENT_OVERHEAD_CHOICE   EVENT_OVERHEAD_CHOICE_A
 
#define EVENT_OVERHEAD   6
 

Macro Definition Documentation

◆ EVENT_EEPROM_FIRST_ROW

#define EVENT_EEPROM_FIRST_ROW   (1024 / EEPROM_ROW_SIZE)

The first EEPROM row assigned for storing events. Starting from the first byte in this row, until the last byte in EVENT_EEPROM_LAST_ROW, the event bookkeeping module has full control: no other code may touch this EEPROM region.

Note
By default, the EEPROM row one kB above the start of the EEPROM will be chosen.

◆ EVENT_EEPROM_LAST_ROW

#define EVENT_EEPROM_LAST_ROW   (EVENT_EEPROM_FIRST_ROW + (1024 / EEPROM_ROW_SIZE) - 1)

The last EEPROM row assigned for storing events. Starting from the first byte in EVENT_EEPROM_FIRST_ROW, until the last byte in this row, the event bookkeeping module has full control: no other code may touch this EEPROM region.

Note
By default, the total assigned size will occupy 1 kB.

◆ EVENT_EEPROM_ROW_COUNT

#define EVENT_EEPROM_ROW_COUNT   (EVENT_EEPROM_LAST_ROW - EVENT_EEPROM_FIRST_ROW + 1)

The number of EEPROM rows assigned for event bookkeeping.

◆ EVENT_EEPROM_SIZE

#define EVENT_EEPROM_SIZE   (EVENT_EEPROM_ROW_COUNT * EEPROM_ROW_SIZE)

The size in bytes of the EEPROM region assigned for event bookkeeping.

◆ EVENT_CB_SELF_DEFINED

#define EVENT_CB_SELF_DEFINED   1

Used internally to know when to use a dummy callback for this.

◆ EVENT_CB

#define EVENT_CB   DummyEventCb

The name of the function - not a function pointer - of type pEvent_Cb_t that is able to receive the events requested by calling Event_GetByIndex, Event_GetByTime or Event_GetByTag.

Note
Not defining this callback results in a fine FINO buffer: First-In, Never-Out.
The callback can also be overridden dynamically using Event_SetCb

◆ EVENT_CB_OPENING_INDEX

#define EVENT_CB_OPENING_INDEX   0xFFFFFFFE

Used as special index value when making an opening call.

See also
EVENT_CB_OPENING_CALL
pEvent_Cb_t

◆ EVENT_CB_OPENING_CALL

#define EVENT_CB_OPENING_CALL   0

By default, the callback function defined by EVENT_CB or as set by Event_SetCb is called once per found event. Define this to have the event bookkeeping module call the callback function one extra time, before the first event is searched for and reported. This opening call then acts as a start-of-search signal to allow the application to prepare his activities.

Note
An opening call will have the values 0, -1, 0, EVENT_CB_OPENING_INDEX, 0 for the arguments tag, offset, len, index, timestamp, respectively.
The returnvalue for in the opening call is checked for: returning false aborts the retrieval.
See also
pEvent_Cb_t

◆ EVENT_CB_CLOSING_INDEX

#define EVENT_CB_CLOSING_INDEX   0xFFFFFFFF

Used as special index value when making an opening call.

See also
EVENT_CB_CLOSING_CALL
pEvent_Cb_t

◆ EVENT_CB_CLOSING_CALL

#define EVENT_CB_CLOSING_CALL   0

By default, the callback function defined by EVENT_CB or as set by Event_SetCb is called once per found event. Define this to have the event bookkeeping module call the callback function one extra time, after all events have been searched for and reported. This last call then acts as an end-of-search signal to allow the application to conclude his activities.

Note
An closing call will have the values 0, -1, 0, EVENT_CB_CLOSING_INDEX, 0 for the arguments tag, offset, len, index, timestamp, respectively.
The returnvalue for in the closing call is ignored.
See also
pEvent_Cb_t

◆ EVENT_OVERHEAD_CHOICE_A

#define EVENT_OVERHEAD_CHOICE_A   0x41

When EVENT_OVERHEAD_CHOICE is assigned this value, the overhead - defined in EVENT_OVERHEAD - is 6 This is the default value when EVENT_OVERHEAD_CHOICE is not defined in the application's app_sel.h file.

  • All timestamps are stored with full resolution (seconds).
  • No restrictions on the use case are in effect.

◆ EVENT_OVERHEAD_CHOICE_B

#define EVENT_OVERHEAD_CHOICE_B   0x42

When EVENT_OVERHEAD_CHOICE is assigned this value, the overhead - defined in EVENT_OVERHEAD - is 5 The overhead - defined in EVENT_OVERHEAD - is 5

  • All timestamps are stored with full resolution (second).
  • Events are spaced maximally 194 days apart.

◆ EVENT_OVERHEAD_CHOICE_C

#define EVENT_OVERHEAD_CHOICE_C   0x43

When EVENT_OVERHEAD_CHOICE is assigned this value, the overhead - defined in EVENT_OVERHEAD - is 5 The overhead - defined in EVENT_OVERHEAD - is 5

  • All timestamps are stored with reduced resolution (~minute).
  • No restrictions on the use case are in effect.

◆ EVENT_OVERHEAD_CHOICE_D

#define EVENT_OVERHEAD_CHOICE_D   0x44

When EVENT_OVERHEAD_CHOICE is assigned this value, the overhead - defined in EVENT_OVERHEAD - is 4 The overhead - defined in EVENT_OVERHEAD - is 4

  • All timestamps are stored with reduced resolution (~minute).
  • Events are spaced maximally 48 days apart.

◆ EVENT_OVERHEAD_CHOICE_E

#define EVENT_OVERHEAD_CHOICE_E   0x45

When EVENT_OVERHEAD_CHOICE is assigned this value, the overhead - defined in EVENT_OVERHEAD - is 4 The overhead - defined in EVENT_OVERHEAD - is 4

  • All timestamps are stored with low resolution (~hour).
  • No restrictions on the use case are in effect.

◆ EVENT_OVERHEAD_CHOICE

#define EVENT_OVERHEAD_CHOICE   EVENT_OVERHEAD_CHOICE_A

For each event, a minimum number of bytes is required to correctly store the data. Depending on the needs of the application, this size can be reduced by assigning this define to one of the allowed choices:

Note
The order in which the events are stored - reflected in the index passed to the caller upon retrieval - will always correctly reflect the timing order in which they occurred, regardless of the resolution of the timestamp.
Warning
Regardless of the resolution of the storage of the timestamp, upon retrieval it will be converted back to an epoch time in seconds. In case of a resolution of an hour, the exact time when the event occurred can be exactly at the reported value, or up to 1 hour later.

◆ EVENT_OVERHEAD

#define EVENT_OVERHEAD   6

The number of bytes that are required to be stored in excess of the extra optional data provided, per event. This value includes the space for the tag value and the timestamp. Use this value to estimate the number of events that can be stored.

Note
This value can be reduced by defining EVENT_OVERHEAD_CHOICE differently.