22#include "mmhal_flash.h"
23#include "mmhal_wlan.h"
214#define MMHAL_DEBUG_PIN(_pin_num) (1ul << (_pin_num))
217#define MMHAL_ALL_DEBUG_PINS (UINT32_MAX)
bool mmhal_get_hardware_version(char *version_buffer, size_t version_buffer_length)
Reads information that can be used to identify the hardware platform, such as hardware ID and version...
uint32_t mmhal_sleep(enum mmhal_sleep_state sleep_state, uint32_t expected_idle_time_ms)
Function to enter MCU sleep.
mmhal_sleep_state
Enumeration of MCU sleep state.
mmhal_isr_state
Enumeration of ISR states (i.e., whether in ISR or not).
void(* mmhal_button_state_cb_t)(enum mmhal_button_id button_id, enum mmhal_button_state button_state)
Button state callback function prototype.
void mmhal_set_deep_sleep_veto(uint8_t veto_id)
Sets a deep sleep veto that will prevent the device from entering deep sleep.
void mmhal_sleep_abort(enum mmhal_sleep_state sleep_state)
Function to abort the MCU sleep state.
void mmhal_sleep_cleanup(void)
Function to cleanup on exit from the MCU sleep state.
mmhal_led_id
Enumeration for different LED's on the board.
mmhal_button_state
Enumeration for button states.
bool mmhal_set_button_callback(enum mmhal_button_id button_id, mmhal_button_state_cb_t button_state_cb)
Registers a callback handler for button state changes.
void mmhal_log_write(const uint8_t *data, size_t len)
Write to the debug log.
void mmhal_log_flush(void)
Flush the debug log before returning.
void mmhal_set_time(time_t epoch)
Sets the RTC to the specified time in UTC.
mmhal_button_id
Enumeration for buttons on the board.
mmhal_veto_id
Enumeration of veto_id ranges for use with mmhal_set_deep_sleep_veto() and mmhal_clear_deep_sleep_vet...
mmhal_button_state_cb_t mmhal_get_button_callback(enum mmhal_button_id button_id)
Returns the registered callback handler for button state changes.
void mmhal_early_init(void)
Initialization before RTOS scheduler starts.
enum mmhal_sleep_state mmhal_sleep_prepare(uint32_t expected_idle_time_ms)
Function to prepare MCU to enter sleep.
void mmhal_set_error_led(bool state)
Set the error LED to the requested state.
void mmhal_set_led(uint8_t led, uint8_t level)
Set the specified LED to the requested level.
time_t mmhal_get_time(void)
Returns the time of day as set in the RTC.
enum mmhal_button_state mmhal_get_button(enum mmhal_button_id button_id)
Reads the state of the specified button.
uint32_t mmhal_random_u32(uint32_t min, uint32_t max)
Generate a random 32 bit integer within the given range.
enum mmhal_isr_state mmhal_get_isr_state(void)
Get the current ISR state (i.e., whether in ISR or not).
void mmhal_reset(void)
Reset the microcontroller.
void mmhal_clear_deep_sleep_veto(uint8_t veto_id)
Clears a deep sleep veto that was preventing the device from entering deep sleep (see mmhal_set_deep_...
void mmhal_init(void)
Initialization after RTOS scheduler started.
void mmhal_set_debug_pins(uint32_t mask, uint32_t values)
Set the value one or more debug pins.
@ MMHAL_SLEEP_DISABLED
Disable MCU sleep.
@ MMHAL_SLEEP_SHALLOW
MCU to enter shallow sleep.
@ MMHAL_SLEEP_DEEP
MCU can enter deep sleep.
@ MMHAL_ISR_STATE_UNKNOWN
The HAL does not support checking ISR state.
@ MMHAL_NOT_IN_ISR
The function was not executed from ISR context.
@ MMHAL_IN_ISR
The function was executed from ISR context.
@ MMHAL_VETO_ID_MORSELIB_MAX
End of deep sleep veto ID range that is allocated for morselib use.
@ MMHAL_VETO_ID_APP_MAX
End of deep sleep veto ID range that is available for application use.
@ MMHAL_VETO_ID_HAL_MAX
End of deep sleep veto ID range that is available for HAL use.
@ MMHAL_VETO_ID_MMCONFIG
Deep sleep veto ID allocated to Morse Micro Persistent Configuration Store.
@ MMHAL_VETO_ID_RESERVED_MIN
Start of deep sleep veto ID range reserved for future use.
@ MMHAL_VETO_ID_DATALINK
Deep sleep veto ID for data-link subsystem.
@ MMHAL_VETO_ID_MORSELIB_MIN
Start of deep sleep veto ID range that is allocated for morselib use.
@ MMHAL_VETO_ID_RESERVED_MAX
End of deep sleep veto ID range reserved for future use.
@ MMHAL_VETO_ID_HAL_MIN
Start of deep sleep veto ID range that is available for HAL use.
@ MMHAL_VETO_ID_APP_MIN
Start of deep sleep veto ID range that is available for application use.