joystick4  2.1.0.0
Data Structures | Macros | Enumerations | Functions
joystick4.h File Reference

This file contains API for Joystick 4 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  joystick4_t
 Joystick 4 Click context object. More...
 
struct  joystick4_cfg_t
 Joystick 4 Click configuration object. More...
 

Macros

#define JOYSTICK4_REG_INPUT   0x00
 Joystick 4 registers. More...
 
#define JOYSTICK4_REG_OUTPUT   0x01
 
#define JOYSTICK4_REG_POLARITY   0x02
 
#define JOYSTICK4_REG_CONFIG   0x03
 
#define JOYSTICK4_PIN_A   0x20
 Joystick 4 pin mask. More...
 
#define JOYSTICK4_PIN_B   0x08
 
#define JOYSTICK4_PIN_C   0x80
 
#define JOYSTICK4_PIN_D   0x10
 
#define JOYSTICK4_PIN_CE   0x40
 
#define JOYSTICK4_DEFAULT_PIN_CONFIG   0xFF
 Joystick 4 pin direction config. More...
 
#define JOYSTICK4_PIN_STATE_LOW   0
 Joystick 4 pin logic state setting. More...
 
#define JOYSTICK4_PIN_STATE_HIGH   1
 
#define JOYSTICK4_POSITION_IDLE   0
 Joystick 4 position values. More...
 
#define JOYSTICK4_POSITION_CENTER   1
 
#define JOYSTICK4_POSITION_CENTER_UP   2
 
#define JOYSTICK4_POSITION_CENTER_RIGHT   3
 
#define JOYSTICK4_POSITION_CENTER_DOWN   4
 
#define JOYSTICK4_POSITION_CENTER_LEFT   5
 
#define JOYSTICK4_POSITION_UP   6
 
#define JOYSTICK4_POSITION_UPPER_RIGHT   7
 
#define JOYSTICK4_POSITION_RIGHT   8
 
#define JOYSTICK4_POSITION_LOWER_RIGHT   9
 
#define JOYSTICK4_POSITION_DOWN   10
 
#define JOYSTICK4_POSITION_LOWER_LEFT   11
 
#define JOYSTICK4_POSITION_LEFT   12
 
#define JOYSTICK4_POSITION_UPPER_LEFT   13
 
#define JOYSTICK4_DEVICE_ADDRESS_0   0x20
 Joystick 4 device address setting. More...
 
#define JOYSTICK4_DEVICE_ADDRESS_1   0x21
 
#define JOYSTICK4_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping. More...
 

Enumerations

enum  joystick4_return_value_t { JOYSTICK4_OK = 0, JOYSTICK4_ERROR = -1 }
 Joystick 4 Click return value data. More...
 

Functions

void joystick4_cfg_setup (joystick4_cfg_t *cfg)
 Joystick 4 configuration object setup function. More...
 
err_t joystick4_init (joystick4_t *ctx, joystick4_cfg_t *cfg)
 Joystick 4 initialization function. More...
 
err_t joystick4_default_cfg (joystick4_t *ctx)
 Joystick 4 default configuration function. More...
 
err_t joystick4_write_reg (joystick4_t *ctx, uint8_t reg, uint8_t data_in)
 Joystick 4 write reg function. More...
 
err_t joystick4_read_reg (joystick4_t *ctx, uint8_t reg, uint8_t *data_out)
 Joystick 4 read reg function. More...
 
void joystick4_reset_device (joystick4_t *ctx)
 Joystick 4 reset device function. More...
 
void joystick4_set_rst_pin (joystick4_t *ctx, uint8_t state)
 Joystick 4 set RST pin function. More...
 
uint8_t joystick4_get_int_pin (joystick4_t *ctx)
 Joystick 4 get INT pin function. More...
 
err_t joystick4_get_pins (joystick4_t *ctx, uint8_t *pin_mask)
 Joystick 4 get pins function. More...
 
uint8_t joystick4_get_position (uint8_t pin_mask)
 Joystick 4 get position function. More...
 

Detailed Description

This file contains API for Joystick 4 Click Driver.

Enumeration Type Documentation

◆ joystick4_return_value_t

Joystick 4 Click return value data.

Predefined enum values for driver return values.

Enumerator
JOYSTICK4_OK 
JOYSTICK4_ERROR