Go to the documentation of this file.
39 #ifdef PREINIT_SUPPORTED
43 #ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49 #include "drv_digital_out.h"
50 #include "drv_digital_in.h"
51 #include "drv_i2c_master.h"
73 #define JOYSTICK4_REG_INPUT 0x00
74 #define JOYSTICK4_REG_OUTPUT 0x01
75 #define JOYSTICK4_REG_POLARITY 0x02
76 #define JOYSTICK4_REG_CONFIG 0x03
94 #define JOYSTICK4_PIN_A 0x20
95 #define JOYSTICK4_PIN_B 0x08
96 #define JOYSTICK4_PIN_C 0x80
97 #define JOYSTICK4_PIN_D 0x10
98 #define JOYSTICK4_PIN_CE 0x40
104 #define JOYSTICK4_DEFAULT_PIN_CONFIG 0xFF
110 #define JOYSTICK4_PIN_STATE_LOW 0
111 #define JOYSTICK4_PIN_STATE_HIGH 1
117 #define JOYSTICK4_POSITION_IDLE 0
118 #define JOYSTICK4_POSITION_CENTER 1
119 #define JOYSTICK4_POSITION_CENTER_UP 2
120 #define JOYSTICK4_POSITION_CENTER_RIGHT 3
121 #define JOYSTICK4_POSITION_CENTER_DOWN 4
122 #define JOYSTICK4_POSITION_CENTER_LEFT 5
123 #define JOYSTICK4_POSITION_UP 6
124 #define JOYSTICK4_POSITION_UPPER_RIGHT 7
125 #define JOYSTICK4_POSITION_RIGHT 8
126 #define JOYSTICK4_POSITION_LOWER_RIGHT 9
127 #define JOYSTICK4_POSITION_DOWN 10
128 #define JOYSTICK4_POSITION_LOWER_LEFT 11
129 #define JOYSTICK4_POSITION_LEFT 12
130 #define JOYSTICK4_POSITION_UPPER_LEFT 13
137 #define JOYSTICK4_DEVICE_ADDRESS_0 0x20
138 #define JOYSTICK4_DEVICE_ADDRESS_1 0x21
156 #define JOYSTICK4_MAP_MIKROBUS( cfg, mikrobus ) \
157 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
158 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
159 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
160 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
345 #endif // JOYSTICK4_H
Joystick 4 Click context object.
Definition: joystick4.h:170
pin_name_t scl
Definition: joystick4.h:191
uint8_t joystick4_get_int_pin(joystick4_t *ctx)
Joystick 4 get INT pin function.
void joystick4_cfg_setup(joystick4_cfg_t *cfg)
Joystick 4 configuration object setup function.
uint8_t joystick4_get_position(uint8_t pin_mask)
Joystick 4 get position function.
Joystick 4 Click configuration object.
Definition: joystick4.h:190
i2c_master_t i2c
Definition: joystick4.h:178
void joystick4_reset_device(joystick4_t *ctx)
Joystick 4 reset device function.
@ JOYSTICK4_OK
Definition: joystick4.h:208
@ JOYSTICK4_ERROR
Definition: joystick4.h:209
err_t joystick4_get_pins(joystick4_t *ctx, uint8_t *pin_mask)
Joystick 4 get pins function.
joystick4_return_value_t
Joystick 4 Click return value data.
Definition: joystick4.h:207
pin_name_t sda
Definition: joystick4.h:192
uint32_t i2c_speed
Definition: joystick4.h:197
err_t joystick4_write_reg(joystick4_t *ctx, uint8_t reg, uint8_t data_in)
Joystick 4 write reg function.
uint8_t slave_address
Definition: joystick4.h:181
void joystick4_set_rst_pin(joystick4_t *ctx, uint8_t state)
Joystick 4 set RST pin function.
err_t joystick4_read_reg(joystick4_t *ctx, uint8_t reg, uint8_t *data_out)
Joystick 4 read reg function.
uint8_t i2c_address
Definition: joystick4.h:198
digital_out_t rst
Definition: joystick4.h:172
pin_name_t int_pin
Definition: joystick4.h:195
err_t joystick4_default_cfg(joystick4_t *ctx)
Joystick 4 default configuration function.
digital_in_t int_pin
Definition: joystick4.h:175
err_t joystick4_init(joystick4_t *ctx, joystick4_cfg_t *cfg)
Joystick 4 initialization function.
pin_name_t rst
Definition: joystick4.h:194