KEYSCAN - Keyboard Scan#
Keyscan (KEYSCAN) Peripheral API.
This module contains functions to control the KEYSCAN peripheral of Silicon Labs 32-bit MCUs and SoCs. The KEYSCAN module connects through rows and columns of GPIOs to an external mechanical keypad.
Modules#
Enumerations#
KEYSCAN configuration delay values.
Functions#
Initializes KEYSCAN module.
Enables KEYSCAN module.
Disables KEYSCAN module.
Waits for the KEYSCAN to complete reseting or disabling procedure.
Waits for the KEYSCAN to complete all synchronization of register changes and commands.
Starts KEYSCAN scan.
Stops the KEYSCAN scan.
Restores KEYSCAN to its reset state.
Gets KEYSCAN STATUS register value.
Enables one or more KEYSCAN interrupts.
Disables one or more KEYSCAN interrupts.
Clears one or more pending KEYSCAN interrupts.
Gets pending KEYSCAN interrupt flags.
Gets enabled and pending KEYSCAN interrupt flags.
Sets one or more pending KEYSCAN interrupts from Software.
Macros#
Suggested default values for KEYSCAN configuration structure.
Enumeration Documentation#
sl_keyscan_delay_t#
sl_keyscan_delay_t
KEYSCAN configuration delay values.
Enumerator | |
---|---|
SL_KEYSCAN_DELAY_2MS | 2 ms delay. |
SL_KEYSCAN_DELAY_4MS | 4 ms delay. |
SL_KEYSCAN_DELAY_6MS | 6 ms delay. |
SL_KEYSCAN_DELAY_8MS | 8 ms delay. |
SL_KEYSCAN_DELAY_10MS | 10 ms delay. |
SL_KEYSCAN_DELAY_12MS | 12 ms delay. |
SL_KEYSCAN_DELAY_14MS | 14 ms delay. |
SL_KEYSCAN_DELAY_16MS | 16 ms delay. |
SL_KEYSCAN_DELAY_18MS | 18 ms delay. |
SL_KEYSCAN_DELAY_20MS | 20 ms delay. |
SL_KEYSCAN_DELAY_22MS | 22 ms delay. |
SL_KEYSCAN_DELAY_24MS | 24 ms delay. |
SL_KEYSCAN_DELAY_26MS | 26 ms delay. |
SL_KEYSCAN_DELAY_28MS | 28 ms delay. |
SL_KEYSCAN_DELAY_30MS | 30 ms delay. |
SL_KEYSCAN_DELAY_32MS | 32 ms delay. |
53
of file platform/peripheral/inc/peripheral_keyscan.h
Function Documentation#
sl_keyscan_init#
void sl_keyscan_init (const sl_keyscan_config_t * p_config)
Initializes KEYSCAN module.
[in] | p_config | A pointer to the KEYSCAN initialization structure variable. |
49
of file platform/peripheral/src/peripheral_keyscan.c
sl_keyscan_enable#
void sl_keyscan_enable (void )
Enables KEYSCAN module.
N/A |
85
of file platform/peripheral/src/peripheral_keyscan.c
sl_keyscan_disable#
void sl_keyscan_disable (void )
Disables KEYSCAN module.
N/A |
Note
The disabling of the module could take some time. This function will not wait for the disabling to finish before returning. Use the function sl_keyscan_wait_ready to wait for the module to be fully disable.
99
of file platform/peripheral/src/peripheral_keyscan.c
sl_keyscan_wait_ready#
void sl_keyscan_wait_ready (void )
Waits for the KEYSCAN to complete reseting or disabling procedure.
N/A |
130
of file platform/peripheral/inc/peripheral_keyscan.h
sl_keyscan_wait_sync#
void sl_keyscan_wait_sync (void )
Waits for the KEYSCAN to complete all synchronization of register changes and commands.
N/A |
141
of file platform/peripheral/inc/peripheral_keyscan.h
sl_keyscan_start_scan#
void sl_keyscan_start_scan (void )
Starts KEYSCAN scan.
N/A |
Note
This function will send a start command to the KEYSCAN peripheral. The sl_keyscan_wait_sync function can be used to wait for the start command to be executed.
This function requires the KEYSCAN to be enabled.
157
of file platform/peripheral/inc/peripheral_keyscan.h
sl_keyscan_stop_scan#
void sl_keyscan_stop_scan (void )
Stops the KEYSCAN scan.
N/A |
Note
This function will send a stop command to the KEYSCAN peripheral. The sl_keyscan_wait_sync function can be used to wait for the stop command to be executed.
This function requires the KEYSCAN to be enabled.
173
of file platform/peripheral/inc/peripheral_keyscan.h
sl_keyscan_reset#
void sl_keyscan_reset (void )
Restores KEYSCAN to its reset state.
N/A |
Note
The resetting of the module could take some time. This function will not wait for the resetting to finish before returning. Use the function sl_keyscan_wait_ready to wait for the module to be fully reset.
The register STATUS get reset value after enabling the module because it is of type RSYNC
125
of file platform/peripheral/src/peripheral_keyscan.c
sl_keyscan_get_status#
uint32_t sl_keyscan_get_status (void )
Gets KEYSCAN STATUS register value.
N/A |
Returns
Current STATUS register value.
194
of file platform/peripheral/inc/peripheral_keyscan.h
sl_keyscan_enable_interrupts#
void sl_keyscan_enable_interrupts (uint32_t flags)
Enables one or more KEYSCAN interrupts.
[in] | flags | KEYSCAN interrupt sources to enable. Use a set of interrupt flags OR-ed together to set multiple interrupt sources. |
Note
Depending on the use, a pending interrupt may already be set prior to enabling the interrupt. To ignore a pending interrupt, consider using sl_keyscan_clear_interrupts prior to enabling the interrupt.
210
of file platform/peripheral/inc/peripheral_keyscan.h
sl_keyscan_disable_interrupts#
void sl_keyscan_disable_interrupts (uint32_t flags)
Disables one or more KEYSCAN interrupts.
[in] | flags | KEYSCAN interrupt sources to disable. Use a set of interrupt flags OR-ed together to disable multiple interrupt sources. |
222
of file platform/peripheral/inc/peripheral_keyscan.h
sl_keyscan_clear_interrupts#
void sl_keyscan_clear_interrupts (uint32_t flags)
Clears one or more pending KEYSCAN interrupts.
[in] | flags | KEYSCAN interrupt sources to clear. Use a set of interrupt flags OR-ed together to clear multiple interrupt sources. |
234
of file platform/peripheral/inc/peripheral_keyscan.h
sl_keyscan_get_interrupts#
uint32_t sl_keyscan_get_interrupts (void )
Gets pending KEYSCAN interrupt flags.
N/A |
Note
Event bits are not cleared by using this function.
Returns
Pending KEYSCAN interrupt sources. Returns a set of interrupt flags OR-ed together for multiple interrupt sources.
248
of file platform/peripheral/inc/peripheral_keyscan.h
sl_keyscan_get_enabled_interrupts#
uint32_t sl_keyscan_get_enabled_interrupts (void )
Gets enabled and pending KEYSCAN interrupt flags.
N/A |
Useful for handling more interrupt sources in the same interrupt handler.
Note
Interrupt flags are not cleared by using this function.
Returns
Pending and enabled KEYSCAN interrupt sources. The return value is the bitwise AND of
the enabled interrupt sources in KEYSCAN_IEN and
the pending interrupt flags KEYSCAN_IF.
264
of file platform/peripheral/inc/peripheral_keyscan.h
sl_keyscan_set_interrupts#
void sl_keyscan_set_interrupts (uint32_t flags)
Sets one or more pending KEYSCAN interrupts from Software.
[in] | flags | KEYSCAN interrupt sources to set to pending. Use a set of interrupt flags OR-ed together to set multiple interrupt sources. |
276
of file platform/peripheral/inc/peripheral_keyscan.h