Experience the future of navigation with the smart joystick concept, providing users with a seamless and intuitive way to explore digital worlds
A
A
Hardware Overview
How does it work?
Joystick 2 Click is based on the SKRHABE01, a 4-direction joystick switch with Center-push Function from Alps Alpine. It is positioned on the board so it is easily accessible for interacting and the lever could be pressed, activating the microswitch that way. The microswitch is actuated by applying very little physical force, using a tipping-point mechanism which results in fast and reliable snap-in action. It has both NO (Normal open) contacts routed to the mikroBUS™ over the port expander. The switch lines are equipped with the RC filters, which serve as debouncing
elements for the switch and also to pull-up the lines when they are left afloat. This way, the contact bouncing is reduced even further, resulting in an accurate detection of the switching event. As already mentioned above, this click board™ contains the port expander, relatively large number of needed GPIO pins for the joystick switch. Used IC is PCA9538A, Low-voltage 8-bit I2C-bus I/O port with interrupt and reset, from NXP Semiconductors. It uses the I2C communication for interfacing with the main MCU, which simplifies the number of needed pins,
and therefore the design itself. The Active LOW reset input (RESET) and Open-drain active LOW interrupt output (INT) pins helps simplifying the design even further. This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the VCC SEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. Also, this Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used as a reference for further development.
Features overview
Development board
Flip&Click PIC32MZ is a compact development board designed as a complete solution that brings the flexibility of add-on Click boards™ to your favorite microcontroller, making it a perfect starter kit for implementing your ideas. It comes with an onboard 32-bit PIC32MZ microcontroller, the PIC32MZ2048EFH100 from Microchip, four mikroBUS™ sockets for Click board™ connectivity, two USB connectors, LED indicators, buttons, debugger/programmer connectors, and two headers compatible with Arduino-UNO pinout. Thanks to innovative manufacturing technology,
it allows you to build gadgets with unique functionalities and features quickly. Each part of the Flip&Click PIC32MZ development kit contains the components necessary for the most efficient operation of the same board. In addition, there is the possibility of choosing the Flip&Click PIC32MZ programming method, using the chipKIT bootloader (Arduino-style development environment) or our USB HID bootloader using mikroC, mikroBasic, and mikroPascal for PIC32. This kit includes a clean and regulated power supply block through the USB Type-C (USB-C) connector. All communication
methods that mikroBUS™ itself supports are on this board, including the well-established mikroBUS™ socket, user-configurable buttons, and LED indicators. Flip&Click PIC32MZ development kit allows you to create a new application in minutes. Natively supported by Mikroe software tools, it covers many aspects of prototyping thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.
Microcontroller Overview
MCU Card / MCU
Architecture
PIC32
MCU Memory (KB)
2048
Silicon Vendor
Microchip
Pin count
100
RAM (Bytes)
524288
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Click board™ Schematic
Step by step
Project assembly
Track your results in real time
Application Output
This Click board can be interfaced and monitored in two ways:
Application Output
- Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
UART Terminal
- Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.
Software Support
Library Description
This library contains API for Joystick 2 Click driver.
Key functions:
joystick2_set_cfg_register
- Functions for configuration joystickjoystick2_get_position
- Functions for get Joystick positionjoystick2_get_interrupt_state
- Functions for read interrupt state
Open Source
Code example
The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.
/*!
* \file
* \brief Joystick2 Click example
*
* # Description
* The demo application shows reading the joistick position ..
*
* The demo application is composed of two sections :
*
* ## Application Init
* Configuring clicks and log objects.
* Reset device and settings the click in the default configuration.
*
* ## Application Task
* It reads the position of the joystick,
* if it detects that the joystick has moved from the zero position,
* it prints a message about the current position.
*
* @note: The I2C peripheral lines external pull up can be required.
*
* \author Katarina Perendic
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "joystick2.h"
// ------------------------------------------------------------------ VARIABLES
static joystick2_t joystick2;
static log_t logger;
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg;
joystick2_cfg_t cfg;
/**
* Logger initialization.
* Default baud rate: 115200
* Default log level: LOG_LEVEL_DEBUG
* @note If USB_UART_RX and USB_UART_TX
* are defined as HAL_PIN_NC, you will
* need to define them manually for log to work.
* See @b LOG_MAP_USB_UART macro definition for detailed explanation.
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
// Click initialization.
joystick2_cfg_setup( &cfg );
JOYSTICK2_MAP_MIKROBUS( cfg, MIKROBUS_1 );
joystick2_init( &joystick2, &cfg );
joystick2_reset( &joystick2 );
joystick2_default_cfg( &joystick2 );
log_info( &logger, "---- JOYSTICK START ----" );
}
void application_task ( void )
{
uint8_t joystick_pos;
// Task implementation.
joystick_pos = joystick2_get_position( &joystick2 );
switch ( joystick_pos )
{
case JOYSTICK2_BUTTON_ACTIVE:
{
log_info( &logger, "--- Button is pressed!!! ---" );
Delay_ms( 300 );
break;
}
case JOYSTICK2_POSITION_RIGHT:
{
log_info( &logger, "--- Joystick position [RIGHT] ---" );
Delay_ms( 300 );
break;
}
case JOYSTICK2_POSITION_LEFT:
{
log_info( &logger, "--- Joystick position [LEFT] ---" );
Delay_ms( 300 );
break;
}
case JOYSTICK2_POSITION_UP:
{
log_info( &logger, "--- Joystick position [UP] ---" );
Delay_ms( 300 );
break;
}
case JOYSTICK2_POSITION_DOWN:
{
log_info( &logger, "--- Joystick position [DOWN] ---" );
Delay_ms( 300 );
break;
}
}
}
void main ( void )
{
application_init( );
for ( ; ; )
{
application_task( );
}
}
// ------------------------------------------------------------------------ END