joystick3 2.1.0.0
Joystick 3 Click Driver

API for configuring and manipulating Joystick 3 Click driver. More...

Topics

 Joystick 3 Registers Settings
 Settings for registers of Joystick 3 Click driver.
 
 Joystick 3 MikroBUS Map
 MikroBUS pin mapping of Joystick 3 Click driver.
 

Functions

void joystick3_cfg_setup (joystick3_cfg_t *cfg)
 Joystick 3 configuration object setup function.
 
err_t joystick3_init (joystick3_t *ctx, joystick3_cfg_t *cfg)
 Joystick 3 initialization function.
 
err_t joystick3_read_raw_adc (joystick3_t *ctx, uint16_t *raw_x, uint16_t *raw_y)
 Joystick 3 read raw adc function.
 
float joystick3_get_angle (uint16_t raw_x, uint16_t raw_y)
 Joystick 3 get angle function.
 
uint8_t joystick3_get_position (uint16_t raw_x, uint16_t raw_y)
 Joystick 3 get position function.
 

Detailed Description

API for configuring and manipulating Joystick 3 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ joystick3_cfg_setup()

void joystick3_cfg_setup ( joystick3_cfg_t * cfg)

Joystick 3 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See joystick3_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ joystick3_get_angle()

float joystick3_get_angle ( uint16_t raw_x,
uint16_t raw_y )

Joystick 3 get angle function.

This function calculates and returns joystick angle in degrees from raw ADC values for X and Y axis.

Parameters
[in]raw_x: RAW X axis data (0-4095).
[in]raw_y: RAW Y axis data (0-4095).
Returns
Joystick angle in degrees.
Note
None.

◆ joystick3_get_position()

uint8_t joystick3_get_position ( uint16_t raw_x,
uint16_t raw_y )

Joystick 3 get position function.

This function calculates and returns joystick position flag from raw ADC values for X and Y axis.

Parameters
[in]raw_x: RAW X axis data (0-4095).
[in]raw_y: RAW Y axis data (0-4095).
Returns
Joystick position flag. Refer to the position values macro definitions.
Note
None.

◆ joystick3_init()

err_t joystick3_init ( joystick3_t * ctx,
joystick3_cfg_t * cfg )

Joystick 3 initialization function.

This function initializes all necessary pins and peripherals used for this click board.

Parameters
[out]ctx: Click context object. See joystick3_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See joystick3_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ joystick3_read_raw_adc()

err_t joystick3_read_raw_adc ( joystick3_t * ctx,
uint16_t * raw_x,
uint16_t * raw_y )

Joystick 3 read raw adc function.

This function reads the raw ADC for X and Y axis by using SPI serial interface.

Parameters
[in]ctx: Click context object. See joystick3_t object definition for detailed explanation.
[out]raw_x: RAW X axis data (0-4095).
[out]raw_y: RAW Y axis data (0-4095).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.