Microcontroller functions#
See also hal/micro/cortexm3/micro.h for source code.
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.
Vector Table Index Definitions#
These are numerical definitions for vector table.Only Cortex-M standard exception vectors (indices 0 through 15) are represented since device specific vectors can be (and often are) different across dies.
A numerical definition for a vector.
reset vector index
nmi vector index
hard fault vector index
memory fault vector index
bus fault vector index
usage fault vector index
reserved07 vector index
reserved08 vector index
reserved09 vector index
reserved10 vector index
svcall vector index
debug monitor vector index
reserved13 vector index
pendsv vector index
systick vector index
Utility macro to convert from IRQ numbers to exception numbers/ vector indices.
Number of vectors.
Functions#
Initializes microcontroller-specific peripherals.
Restarts the microcontroller and therefore everything else.
Change the CTUNE value.
Get the CTUNE value.
Records the specified reset cause then forces a reboot.
Returns the Extended Reset Cause information.
Calls halGetExtendedResetInfo() and translates the EM35x reset code to the corresponding value used by the EM2XX HAL.
Calls halGetExtendedResetInfo() and supplies a string describing the extended cause of the reset.
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.
EM2xx-compatible reset code returned by halGetEm2xxResetInfo()
EM2XX reports POWERON instead.
EM2XX reset poweron.
EM2XX reset watchdog.
EM2XX reset assert.
EM2XX reset bootloader.
EM2XX reset software.
Vector Table Index Definitions Documentation#
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 |
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.
halInternalSysReset#
void halInternalSysReset (uint16_t extendedCause)
Records the specified reset cause then forces a reboot.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint16_t | N/A | extendedCause |
halGetExtendedResetInfo#
uint16_t halGetExtendedResetInfo (void )
Returns the Extended Reset Cause information.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Returns
A 16-bit code identifying the base and extended cause of the reset
halGetEm2xxResetInfo#
uint8_t halGetEm2xxResetInfo (void )
Calls halGetExtendedResetInfo() and translates the EM35x reset code to the corresponding value used by the EM2XX HAL.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Any reset codes not present in the EM2XX are returned after being OR'ed with 0x80.
Used by the EZSP host as a platform-independent NCP reset code.
Returns
The EM2XX-compatible reset code. If not supported by the EM2XX, return the platform-specific code with B7 set.
halGetExtendedResetString#
const char * halGetExtendedResetString (void )
Calls halGetExtendedResetInfo() and supplies a string describing the extended cause of the reset.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
halGetResetString() should also be called to get the string for the base reset cause
Useful for diagnostic printing of text just after program initialization.
Returns
A pointer to a program space string.
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.