sync
This commit is contained in:
25
firmware/include/utils.h
Normal file
25
firmware/include/utils.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef UTILS_H
|
||||
#define UTILS_H
|
||||
|
||||
#include <zephyr/kernel.h>
|
||||
|
||||
enum RebootStatus {
|
||||
REBOOT_STATUS_NORMAL = 0x00,
|
||||
REBOOT_STATUS_FIRMWARE_UPDATE = 0xA1,
|
||||
REBOOT_STATUS_FIRMWARE_CONFIRMED = 0xB2
|
||||
};
|
||||
/**
|
||||
* @brief Reboots the controller with a specific status code.
|
||||
* On reboot, you can read this status code in the bootloader to determine the reason for the reboot (e.g., normal restart, firmware update, error state).
|
||||
* @param status_code A user-defined code indicating the reason for the reboot.
|
||||
*/
|
||||
void reboot_with_status(uint8_t status_code);
|
||||
|
||||
/**
|
||||
* @brief Retrieves the reboot status code set before the last reboot.
|
||||
* This can be used in the bootloader to determine why the device was rebooted and take appropriate actions (e.g., enter firmware update mode if the status indicates a failed update).
|
||||
* @return The reboot status code set before the last reboot, or 0 if no status was set.
|
||||
*/
|
||||
uint8_t get_reboot_status();
|
||||
|
||||
#endif // UTILS_H
|
||||
Reference in New Issue
Block a user