joystick2 2.0.0.0
joystick2.h File Reference

This file contains API for Joystick 2 Click driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  joystick2_t
 Click ctx object definition. More...
 
struct  joystick2_cfg_t
 Click configuration structure definition. More...
 

Macros

#define JOYSTICK2_MAP_MIKROBUS(cfg, mikrobus)
 
#define JOYSTICK2_RETVAL   uint8_t
 
#define JOYSTICK2_OK   0x00
 
#define JOYSTICK2_INIT_ERROR   0xFF
 
#define JOYSTICK2_DEVICE_SLAVE_ADDR_0_0   0x70
 
#define JOYSTICK2_DEVICE_SLAVE_ADDR_0_1   0x71
 
#define JOYSTICK2_DEVICE_SLAVE_ADDR_1_0   0x72
 
#define JOYSTICK2_DEVICE_SLAVE_ADDR_1_1   0x73
 
#define JOYSTICK2_CMD_INPUT_PORT   0x00
 
#define JOYSTICK2_CMD_OUTPUT_PORT   0x01
 
#define JOYSTICK2_CMD_POLARITY_INVERSION   0x02
 
#define JOYSTICK2_CMD_CONFIGURATION   0x03
 
#define JOYSTICK2_CFG_ENABLE_ALL_PORT   0xFF
 
#define JOYSTICK2_CFG_DISABLE_ALL_PORT   0x00
 
#define JOYSTICK2_CFG_ENABLE_BUTTON   0x02
 
#define JOYSTICK2_CFG_ENABLE_LEFT_POS   0x01
 
#define JOYSTICK2_CFG_ENABLE_RIGHT_POS   0x10
 
#define JOYSTICK2_CFG_ENABLE_UP_POS   0x08
 
#define JOYSTICK2_CFG_ENABLE_DOWN_POS   0x04
 
#define JOYSTICK2_POSITION_LEFT   0x01
 
#define JOYSTICK2_POSITION_RIGHT   0x10
 
#define JOYSTICK2_POSITION_UP   0x08
 
#define JOYSTICK2_POSITION_DOWN   0x04
 
#define JOYSTICK2_BUTTON_ACTIVE   0x02
 

Functions

void joystick2_cfg_setup (joystick2_cfg_t *cfg)
 Config Object Initialization function.
 
JOYSTICK2_RETVAL joystick2_init (joystick2_t *ctx, joystick2_cfg_t *cfg)
 Initialization function.
 
void joystick2_default_cfg (joystick2_t *ctx)
 Click Default Configuration function.
 
void joystick2_generic_write (joystick2_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void joystick2_generic_read (joystick2_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
void joystick2_reset (joystick2_t *ctx)
 Functions for reset module.
 
uint8_t joystick2_get_interrupt_state (joystick2_t *ctx)
 Functions for read interrupt state.
 
void joystick2_set_cfg_register (joystick2_t *ctx, uint8_t cfg_data)
 Functions for configuration joystick.
 
uint8_t joystick2_get_position (joystick2_t *ctx)
 Functions for get Joystick position.
 

Detailed Description

This file contains API for Joystick 2 Click driver.