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#
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.
Get the CTUNE value.
Gets information about what caused the microcontroller to reset.
Calls halGetResetInfo() and supplies a string describing it.
Macros#
The value that must be passed as the single parameter to halInternalDisableWatchDog() in order to successfully disable the watchdog timer.
Function Documentation#
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.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| uint16_t | N/A | tune | Value to set CTUNE to. |
Involves switching to HFRCO and turning off the HFXO temporarily.
halInternalGetCtune#
uint16_t halInternalGetCtune (void )
Get the CTUNE value.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| void | N/A |
Returns
Current CTUNE value.
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.