Common Microcontroller Functions#
Microcontroller functions.
Many of the supplied example applications use these microcontroller functions. See hal/micro/micro.h for source code.
Note
The term SFD refers to the Start Frame Delimiter.
Functions#
Gets information about what caused the microcontroller to reset.
Calls halGetResetInfo() and supplies a string describing it.
Initializes microcontroller-specific peripherals.
Restarts the microcontroller and therefore everything else.
Enables the watchdog timer.
Disables the watchdog timer.
Determines whether the watchdog has been enabled or disabled.
hal Reset Watchdog
Change the CTUNE value. Involves switching to HFRCO and turning off the HFXO temporarily.
Get the CTUNE value.
Macros#
The value that must be passed as the single parameter to halInternalDisableWatchDog() in order to successfully disable the watchdog timer.
Function Documentation#
halGetResetInfo#
uint8_t halGetResetInfo (void )
Gets information about what caused the microcontroller to reset.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| void | N/A |
Returns
A code identifying the cause of the reset.
halGetResetString#
const char * halGetResetString (void )
Calls halGetResetInfo() and supplies a string describing it.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| void | N/A |
Useful for diagnostic printing of text just after program initialization.
Returns
A pointer to a program space string.
halInit#
void halInit (void )
Initializes microcontroller-specific peripherals.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| void | N/A |
halReboot#
void halReboot (void )
Restarts the microcontroller and therefore everything else.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| void | N/A |
halInternalEnableWatchDog#
void halInternalEnableWatchDog (void )
Enables the watchdog timer.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| void | N/A |
halInternalDisableWatchDog#
void halInternalDisableWatchDog (uint8_t magicKey)
Disables the watchdog timer.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| uint8_t | N/A | magicKey | A value (MICRO_DISABLE_WATCH_DOG_KEY) that enables the function. |
Note
To prevent the watchdog from being disabled accidentally, a magic key must be provided.
halInternalWatchDogEnabled#
bool halInternalWatchDogEnabled (void )
Determines whether the watchdog has been enabled or disabled.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| void | N/A |
Returns
A bool value indicating if the watchdog is current enabled.
halResetWatchdog#
void halResetWatchdog (void )
hal Reset Watchdog
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| void | N/A |
halInternalSetCtune#
void halInternalSetCtune (uint16_t tune)
Change the CTUNE value. Involves switching to HFRCO and turning off the HFXO temporarily.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| uint16_t | N/A | tune | Value to set CTUNE to. |
halInternalGetCtune#
uint16_t halInternalGetCtune (void )
Get the CTUNE value.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| void | N/A |
Returns
Current CTUNE value.