Miscellaneous
Miscellaneous system functions. More...
Macros | |
#define | ZOS_RTOS_DEFINE_ISR(function) |
This macro allows for an interrupt callback to use RTOS structures such as semaphores and event flags. | |
Enumerations | |
enum | zos_factory_reset_t { ZOS_FACTORY_RESET_BACKUP = 0, ZOS_FACTORY_RESET_FACTORY = 1, ZOS_FACTORY_RESET_CACHE_ONLY = 2 } |
Factory reset type. More... | |
Functions | |
zos_result_t | zn_system_reboot (void) |
Reboot the device. More... | |
char * | zn_system_get_version_str (char *version_str_buffer) |
Return the current firmware version as a string. More... | |
uint32_t | zn_system_get_version_uint32 (void) |
Return the current firmware version as uint32. More... | |
void | zn_system_register_irq_callback (zos_platform_irq_t irq, void(*callback)(void)) |
Register an interrupt callback. More... | |
void | zn_system_register_system_tick_callback (void(*callback)(void)) |
Register a system tick callback. More... | |
void | zn_system_force_command_mode (void) |
Force the system to use 'Command Mode' on the NEXT reboot. More... | |
zos_result_t | zn_system_factory_reset (zos_factory_reset_t reset_type) |
Factory reset the device's settings. More... | |
void | zn_system_reset_faults (void) |
Clear all system faults. More... | |
zos_result_t | zn_system_retrieve_faults (char *buffer) |
Populate the given buffer with the current system faults string. More... | |
uint32_t | zn_system_get_faults_count (void) |
Return the number of system faults. More... | |
void | zn_system_reset_safemode_app_counters (uint32_t mask) |
Clear a safemode app counter. More... | |
uint32_t | zn_system_get_safemode_app_counters (void) |
Get the current safemode app counters. More... | |
void | zn_system_kick_watchdog (void) |
Kick the watchdog timer. More... | |
Detailed Description
Miscellaneous system functions.
Enumeration Type Documentation
enum zos_factory_reset_t |
Factory reset type.
Function Documentation
zos_result_t zn_system_factory_reset | ( | zos_factory_reset_t | reset_type | ) |
Factory reset the device's settings.
Refer to zos_factory_reset_t for the various reset types.
- Note
- This API does NOT return when ZOS_FACTORY_RESET_FACTORY is used.
- Parameters
-
reset_type
The factory reset type, see zos_factory_reset_t
- Returns
- The result of the API, see zos_result_t
void zn_system_force_command_mode | ( | void |
| ) |
Force the system to use 'Command Mode' on the NEXT reboot.
Once called, the API forces the system to use 'Command Mode' on the NEXT system reboot.
This can be useful if the system typically uses 'Packet Mode' and an external host needs the 'Command Mode' API.
- Note
- 'Command Mode' will be forced on the NEXT reboot only, a subsequent reboot/reset/powercycle will clear the forced command mode.
The following is an example of how this may be used in a ZAP:
0. Some event tells ZAP to reboot into 'Command Mode'
- Zap calls: zn_system_force_command_mode()
- Zap reboots system by calling: zn_system_reboot()
- System reboots and is forced to use 'Command Mode' regardless of bus settings External host uses ZentriOS's 'Command Mode'
- Once finished, Zap or host reboots/resets system
- System boots normally using configured bus settings
uint32_t zn_system_get_faults_count | ( | void |
| ) |
Return the number of system faults.
See ZentriOS Command API documentation: faults_reset
uint32_t zn_system_get_safemode_app_counters | ( | void |
| ) |
Get the current safemode app counters.
See the Safemode app documentation for more details:Safemode App
char* zn_system_get_version_str | ( | char * | version_str_buffer | ) |
Return the current firmware version as a string.
This returns the current firmware version as a string. See ZentriOS Command API documentation: version.
The supplied version_str_buffer
should be a buffer of at least 96 bytes.
- Parameters
-
[out] version_str_buffer
Buffer to hold version string
- Returns
- Currnet firmware version string (this is the same pointer as the supplied
version_str_buffer
argument)
uint32_t zn_system_get_version_uint32 | ( | void |
| ) |
Return the current firmware version as uint32.
This returns the current firmware version as a uint32. See ZentriOS Command API documentation: version.
- Note
- This returns the version of device's product's
bundle
which may be different than the ZentriOS version.
- Returns
- Current firmware version as uint32
void zn_system_kick_watchdog | ( | void |
| ) |
Kick the watchdog timer.
zos_result_t zn_system_reboot | ( | void |
| ) |
Reboot the device.
See ZentriOS Command API documentation: reboot.
void zn_system_register_irq_callback | ( | zos_platform_irq_t | irq, |
void(*)(void) | callback |
||
) |
Register an interrupt callback.
This registers an interrupt handler for the specificied interrupt vector.
The corresponding interrupt must be enabled using the appropriate MCU registers before the callback is triggered.
- Note
- Extreme care should be taken when registering an irq callback. The stability of the OS cannot be guaranteed with this is used.
void zn_system_register_system_tick_callback | ( | void(*)(void) | callback | ) |
Register a system tick callback.
Register a callback to be called every system tick = 1 millisecond.
- Note
- The callback MUST be extremely simple as the system tick is used by the RTOS scheduler.
void zn_system_reset_faults | ( | void |
| ) |
Clear all system faults.
See ZentriOS Command API documentation: faults_reset
void zn_system_reset_safemode_app_counters | ( | uint32_t | mask | ) |
Clear a safemode app counter.
See the Safemode app documentation for more details:Safemode App
- Note
- Extreme caution should be used with this API!
To clear all counters, use the mask: ZOS_SAFEMODE_COUNTER_ALL,e.g.
zos_result_t zn_system_retrieve_faults | ( | char * | buffer | ) |
Populate the given buffer with the current system faults string.
- Parameters
-
buffer
Buffer to hold faults string, this buffer but be at least 512 bytes
- Returns
- The result of the API, see zos_result_t