Joystick#
Introduction#
The SI91x joystick driver is a platform-level software module responsible for managing the control of joystick. All joystick functions are called through the generic driver.
Configuration#
The sl_joystick_state_t enumeration defines the states of the joystick data acquisition, either disabled or enabled. This allows for controlling when joystick input is actively monitored. The sl_joystick_position_t This enumeration defines the possible positions of the joystick, including not pressed, center, north, east, south, and west. These positions correspond to the physical orientation of the joystick and can be used to determine the direction or action indicated by the joystick's current position.
For more information on configuring available parameters refer to the respective peripheral example readme document and refer here https://docs.silabs.com/wiseconnect/latest/wiseconnect-api-reference-guide-si91x-peripherals/disable-uc-config.
Usage#
The common functions include the following:
sl_si91x_joystick_init initialises the joystick. Sets the operation mode and initialises the ADC channel.
sl_si91x_joystick_get_position can be implemented by the application if required. This function returns the position corresponding to the physical orientation of the joystick. sl_si91x_joystick_start and sl_si91x_joystick_stop both can be implemented by the application. These functions are used to start and stop the data acquisition from the joystick respectively.
Enumerations#
Enumeration for finding the position of the Joystick.
Enumeration for the Joystick state (ENABLE/DISABLE) enum.
Functions#
Initialize the Joystick.
Getting the direction/position of Joystick.
Start/Enable the Joystick.
Stop/Disable the Joystick.
Enumeration Documentation#
sl_joystick_position_t#
sl_joystick_position_t
Enumeration for finding the position of the Joystick.
Enumerator | |
---|---|
SL_JOYSTICK_NONE | Not pressed. |
SL_JOYSTICK_C | Center. |
SL_JOYSTICK_N | North. |
SL_JOYSTICK_E | East. |
SL_JOYSTICK_S | South. |
SL_JOYSTICK_W | West. |
58
of file components/device/silabs/si91x/mcu/drivers/hardware_drivers/sl_joystick/inc/sl_si91x_joystick.h
sl_joystick_state_t#
sl_joystick_state_t
Enumeration for the Joystick state (ENABLE/DISABLE) enum.
Enumerator | |
---|---|
SL_JOYSTICK_DISABLED | Joystick data acquisition is disabled. |
SL_JOYSTICK_ENABLED | Joystick data acquisition is enabled. |
68
of file components/device/silabs/si91x/mcu/drivers/hardware_drivers/sl_joystick/inc/sl_si91x_joystick.h
Function Documentation#
sl_si91x_joystick_init#
sl_status_t sl_si91x_joystick_init (void )
Initialize the Joystick.
N/A |
ADC will configure here to read the different voltage based on different Joystick position.
Returns
If successful
SL_STATUS_OK (0x0000) - Success
85
of file components/device/silabs/si91x/mcu/drivers/hardware_drivers/sl_joystick/inc/sl_si91x_joystick.h
sl_si91x_joystick_get_position#
sl_status_t sl_si91x_joystick_get_position (sl_joystick_state_t state, sl_joystick_position_t * pos)
Getting the direction/position of Joystick.
[in] | state | : Joystick enable/disable ( sl_joystick_state_t ) |
[out] | pos | : position of joystick. ( sl_joystick_position_t) |
Pre-conditions:
Returns
Error code as follow:
SL_STATUS_OK (0x0000) - Success
SL_STATUS_NOT_READY (0x0003) - Module is not ready for requested operation.
102
of file components/device/silabs/si91x/mcu/drivers/hardware_drivers/sl_joystick/inc/sl_si91x_joystick.h
sl_si91x_joystick_start#
sl_status_t sl_si91x_joystick_start (sl_joystick_state_t state)
Start/Enable the Joystick.
[in] | state | : Joystick enable/disable. ( sl_joystick_state_t ) |
Pre-conditions:
Returns
Error code as follow:
SL_STATUS_OK (0x0000) - Success
SL_STATUS_ABORT (0x0006) - Operation aborted.
116
of file components/device/silabs/si91x/mcu/drivers/hardware_drivers/sl_joystick/inc/sl_si91x_joystick.h
sl_si91x_joystick_stop#
sl_status_t sl_si91x_joystick_stop (sl_joystick_state_t state)
Stop/Disable the Joystick.
[in] | state | : Joystick enable/disable. ( sl_joystick_state_t ) |
Pre-conditions:
Returns
Error code as follow:
SL_STATUS_OK (0x0000) - Success
SL_STATUS_BUSY (0x0004) - Module is busy.
131
of file components/device/silabs/si91x/mcu/drivers/hardware_drivers/sl_joystick/inc/sl_si91x_joystick.h