[core] Split reboot reasons due to wakeup (#254)
* Updates to break out wakeup reasons. Per https://github.com/libretiny-eu/libretiny/issues/234 * Update cores/common/base/api/lt_device.h Co-authored-by: Kuba Szczodrzyński <kuba@szczodrzynski.pl> * fix clang-format * Fix formatting of python files. * Update lt_device.h --------- Co-authored-by: Kuba Szczodrzyński <kuba@szczodrzynski.pl>
This commit is contained in:
@@ -89,15 +89,17 @@ def env_add_arduino_libraries(env: Environment, queue, name: str, path: str) ->
|
|||||||
srcs=[
|
srcs=[
|
||||||
"+<**/*.c*>",
|
"+<**/*.c*>",
|
||||||
],
|
],
|
||||||
includes=[
|
includes=(
|
||||||
"!<*/.>",
|
[
|
||||||
"!<*/*>",
|
"!<*/.>",
|
||||||
]
|
"!<*/*>",
|
||||||
if name.startswith("common")
|
]
|
||||||
else [
|
if name.startswith("common")
|
||||||
"!<.>",
|
else [
|
||||||
"!<*>",
|
"!<.>",
|
||||||
],
|
"!<*>",
|
||||||
|
]
|
||||||
|
),
|
||||||
)
|
)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|||||||
@@ -31,10 +31,12 @@ lt_reboot_reason_t lt_get_reboot_reason() {
|
|||||||
case RESET_SOURCE_CRASH_UNUSED:
|
case RESET_SOURCE_CRASH_UNUSED:
|
||||||
case RESET_SOURCE_CRASH_PER_XAT0:
|
case RESET_SOURCE_CRASH_PER_XAT0:
|
||||||
return REBOOT_REASON_CRASH;
|
return REBOOT_REASON_CRASH;
|
||||||
case RESET_SOURCE_DEEPPS_GPIO:
|
|
||||||
case RESET_SOURCE_DEEPPS_RTC:
|
|
||||||
case RESET_SOURCE_DEEPPS_USB:
|
case RESET_SOURCE_DEEPPS_USB:
|
||||||
return REBOOT_REASON_SLEEP;
|
return REBOOT_REASON_SLEEP_USB;
|
||||||
|
case RESET_SOURCE_DEEPPS_GPIO:
|
||||||
|
return REBOOT_REASON_SLEEP_GPIO;
|
||||||
|
case RESET_SOURCE_DEEPPS_RTC:
|
||||||
|
return REBOOT_REASON_SLEEP_RTC;
|
||||||
default:
|
default:
|
||||||
return REBOOT_REASON_UNKNOWN;
|
return REBOOT_REASON_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,8 +62,12 @@ const char *lt_get_reboot_reason_name(lt_reboot_reason_t reason) {
|
|||||||
return "WDT Reset";
|
return "WDT Reset";
|
||||||
case REBOOT_REASON_CRASH:
|
case REBOOT_REASON_CRASH:
|
||||||
return "Crash";
|
return "Crash";
|
||||||
case REBOOT_REASON_SLEEP:
|
case REBOOT_REASON_SLEEP_GPIO:
|
||||||
return "Sleep Wakeup";
|
return "Sleep Wakeup (GPIO)";
|
||||||
|
case REBOOT_REASON_SLEEP_RTC:
|
||||||
|
return "Sleep Wakeup (RTC)";
|
||||||
|
case REBOOT_REASON_SLEEP_USB:
|
||||||
|
return "Sleep Wakeup (USB)";
|
||||||
case REBOOT_REASON_DEBUGGER:
|
case REBOOT_REASON_DEBUGGER:
|
||||||
return "Debugger";
|
return "Debugger";
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -4,32 +4,40 @@
|
|||||||
|
|
||||||
#include <libretiny.h>
|
#include <libretiny.h>
|
||||||
|
|
||||||
#define RESET_REASON_UNKNOWN REBOOT_REASON_UNKNOWN
|
#define RESET_REASON_UNKNOWN REBOOT_REASON_UNKNOWN
|
||||||
#define RESET_REASON_POWER REBOOT_REASON_POWER
|
#define RESET_REASON_POWER REBOOT_REASON_POWER
|
||||||
#define RESET_REASON_BROWNOUT REBOOT_REASON_BROWNOUT
|
#define RESET_REASON_BROWNOUT REBOOT_REASON_BROWNOUT
|
||||||
#define RESET_REASON_HARDWARE REBOOT_REASON_HARDWARE
|
#define RESET_REASON_HARDWARE REBOOT_REASON_HARDWARE
|
||||||
#define RESET_REASON_SOFTWARE REBOOT_REASON_SOFTWARE
|
#define RESET_REASON_SOFTWARE REBOOT_REASON_SOFTWARE
|
||||||
#define RESET_REASON_WATCHDOG REBOOT_REASON_WATCHDOG
|
#define RESET_REASON_WATCHDOG REBOOT_REASON_WATCHDOG
|
||||||
#define RESET_REASON_CRASH REBOOT_REASON_CRASH
|
#define RESET_REASON_CRASH REBOOT_REASON_CRASH
|
||||||
#define RESET_REASON_SLEEP REBOOT_REASON_SLEEP
|
#define RESET_REASON_SLEEP_GPIO REBOOT_REASON_SLEEP_GPIO
|
||||||
#define RESET_REASON_MAX REBOOT_REASON_MAX
|
#define RESET_REASON_SLEEP_RTC REBOOT_REASON_SLEEP_RTC
|
||||||
|
#define RESET_REASON_SLEEP_USB REBOOT_REASON_SLEEP_USB
|
||||||
|
#define RESET_REASON_MAX REBOOT_REASON_MAX
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Reset reason enumeration.
|
* @brief Reset reason enumeration.
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
REBOOT_REASON_UNKNOWN = 1,
|
REBOOT_REASON_UNKNOWN = 1,
|
||||||
REBOOT_REASON_POWER = 2,
|
REBOOT_REASON_POWER = 2,
|
||||||
REBOOT_REASON_BROWNOUT = 3,
|
REBOOT_REASON_BROWNOUT = 3,
|
||||||
REBOOT_REASON_HARDWARE = 4,
|
REBOOT_REASON_HARDWARE = 4,
|
||||||
REBOOT_REASON_SOFTWARE = 5,
|
REBOOT_REASON_SOFTWARE = 5,
|
||||||
REBOOT_REASON_WATCHDOG = 6,
|
REBOOT_REASON_WATCHDOG = 6,
|
||||||
REBOOT_REASON_CRASH = 7,
|
REBOOT_REASON_CRASH = 7,
|
||||||
REBOOT_REASON_SLEEP = 8,
|
REBOOT_REASON_SLEEP_GPIO = 8,
|
||||||
REBOOT_REASON_DEBUGGER = 9,
|
REBOOT_REASON_SLEEP_RTC = 9,
|
||||||
REBOOT_REASON_MAX = 10,
|
REBOOT_REASON_SLEEP_USB = 10,
|
||||||
|
REBOOT_REASON_DEBUGGER = 11,
|
||||||
|
REBOOT_REASON_MAX = 12,
|
||||||
} lt_reboot_reason_t;
|
} lt_reboot_reason_t;
|
||||||
|
|
||||||
|
// RESET_REASON_SLEEP deprecated, kept for compatibility
|
||||||
|
#define RESET_REASON_SLEEP REBOOT_REASON_SLEEP_GPIO
|
||||||
|
#define REBOOT_REASON_SLEEP REBOOT_REASON_SLEEP_GPIO
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Debugging mode enumeration.
|
* @brief Debugging mode enumeration.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -285,12 +285,14 @@ def write_families(supported: list[Family]):
|
|||||||
docs = get_readme_family_link(family)
|
docs = get_readme_family_link(family)
|
||||||
row = [
|
row = [
|
||||||
# Title
|
# Title
|
||||||
"[{}]({})".format(
|
(
|
||||||
family.description,
|
"[{}]({})".format(
|
||||||
docs,
|
family.description,
|
||||||
)
|
docs,
|
||||||
if docs
|
)
|
||||||
else family.description,
|
if docs
|
||||||
|
else family.description
|
||||||
|
),
|
||||||
# Name
|
# Name
|
||||||
family.is_supported and f"`{family.name}`" or "`-`",
|
family.is_supported and f"`{family.name}`" or "`-`",
|
||||||
# Code
|
# Code
|
||||||
@@ -301,16 +303,22 @@ def write_families(supported: list[Family]):
|
|||||||
family.id,
|
family.id,
|
||||||
),
|
),
|
||||||
# Arduino Core
|
# Arduino Core
|
||||||
"✔️"
|
(
|
||||||
if family in supported and family.is_supported and family.has_arduino_core
|
"✔️"
|
||||||
else "❌",
|
if family in supported
|
||||||
|
and family.is_supported
|
||||||
|
and family.has_arduino_core
|
||||||
|
else "❌"
|
||||||
|
),
|
||||||
# Source SDK
|
# Source SDK
|
||||||
"[`{}`]({})".format(
|
(
|
||||||
family.target_package,
|
"[`{}`]({})".format(
|
||||||
f"https://github.com/libretiny-eu/{family.target_package}",
|
family.target_package,
|
||||||
)
|
f"https://github.com/libretiny-eu/{family.target_package}",
|
||||||
if family.target_package
|
)
|
||||||
else "-",
|
if family.target_package
|
||||||
|
else "-"
|
||||||
|
),
|
||||||
]
|
]
|
||||||
rows.append(row)
|
rows.append(row)
|
||||||
md.add_table(header, *rows)
|
md.add_table(header, *rows)
|
||||||
|
|||||||
Reference in New Issue
Block a user