We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]
Rating:
Author: MIKROE
Last Updated: 2019-08-19
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: Pushbutton/Switches
Downloaded: 2567 times
Not followed.
License: MIT license
Joystick 2 Click is a smart navigation key concept based on SKRHABE010 by Alps, a 4-direction joystick switch with Center-push Function. Alps switches, also known as microswitches, are well renowned for their reliability and endurance.
Do you want to subscribe in order to receive notifications regarding "Joystick 2 click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "Joystick 2 click" changes.
Do you want to report abuse regarding "Joystick 2 click".
Library Description
The library initializes and defines the I2C bus driver and drivers that offer a choice for writing data in register and reads data from register. The library includes function for Joystick position. The user also has the function for configuration joystick, reset module and function for read interrupt state.
Key functions:
uint8_t joystick2_getJoystickPosition()
- Functions for get Joystick positionvoid joystick2_configuration(uint8_t cfgData)
- Functions for configuration joystickvoid joystick2_reset()
- Functions for reset moduleExamples description
The application is composed of three sections :
void applicationTask()
{
uint8_t joystickPos;
char demoText[ 50 ];
joystickPos = joystick2_getJoystickPosition();
switch(joystickPos)
{
case _JOYSTICK2_BUTTON_ACTIVE:
{
mikrobus_logWrite("--- Button is pressed!!! ---", _LOG_LINE );
Delay_ms( 300 );
break;
}
case _JOYSTICK2_POSITION_RIGHT:
{
mikrobus_logWrite("--- Joystick position [RIGHT] ---", _LOG_LINE );
Delay_ms( 300 );
break;
}
case _JOYSTICK2_POSITION_LEFT:
{
mikrobus_logWrite("--- Joystick position [LEFT] ---", _LOG_LINE );
Delay_ms( 300 );
break;
}
case _JOYSTICK2_POSITION_UP:
{
mikrobus_logWrite("--- Joystick position [UP] ---", _LOG_LINE );
Delay_ms( 300 );
break;
}
case _JOYSTICK2_POSITION_DOWN:
{
mikrobus_logWrite("--- Joystick position [DOWN] ---", _LOG_LINE );
Delay_ms( 300 );
break;
}
}
}
Other mikroE Libraries used in the example:
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 click or RS232 click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.