joystick 2.0.0.0
|
Functions | |
void | joystick_cfg_setup (joystick_cfg_t *cfg) |
Config Object Initialization function. | |
JOYSTCIK_RETVAL | joystick_init (joystick_t *ctx, joystick_cfg_t *cfg) |
Initialization function. | |
void | joystick_default_cfg (joystick_t *ctx) |
Click Default Configuration function. | |
void | joystick_generic_write (joystick_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len) |
Generic write function. | |
void | joystick_generic_read (joystick_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len) |
Generic read function. | |
void | joystick_set_default_configuration (joystick_t *ctx) |
Set default configuration function. | |
uint8_t | joystick_check_id_code (joystick_t *ctx) |
Check sensor ID code function. | |
uint8_t | joystick_check_id_version (joystick_t *ctx) |
Check sensor ID version function. | |
void | joystick_set_low_power_mode (joystick_t *ctx, uint8_t timings) |
Set Low Power Mode function. | |
void | joystick_set_scaling_factor (joystick_t *ctx, uint8_t scaling_factor) |
Set scaling factor function. | |
void | joystick_disabled_interrupt (joystick_t *ctx) |
Set interrupt disabled function. | |
void | joystick_enabled_interrupt (joystick_t *ctx) |
Set interrupt enabled function. | |
void | joystick_invert_spinning (joystick_t *ctx) |
Invert the channel voltage function. | |
uint8_t | joystick_get_position (joystick_t *ctx) |
Get joystick position function. | |
uint8_t | joystick_get_interrupt (joystick_t *ctx) |
Get state of interrupt pin function. | |
uint8_t | joystick_press_button (joystick_t *ctx) |
Get state of Joystick button function. | |
void | joystick_soft_reset (joystick_t *ctx) |
General soft reset function. | |
void | joystick_hardware_reset (joystick_t *ctx) |
General hardware reset function. | |
void joystick_cfg_setup | ( | joystick_cfg_t * | cfg | ) |
Config Object Initialization function.
cfg | Click configuration structure. |
@description This function initializes click configuration structure to init state.
uint8_t joystick_check_id_code | ( | joystick_t * | ctx | ) |
Check sensor ID code function.
ctx | Click object. |
- 1 : OK - 0 : ERROR
@description Function read and return sensor ID code from ID Code register.
uint8_t joystick_check_id_version | ( | joystick_t * | ctx | ) |
Check sensor ID version function.
ctx | Click object. |
- 1 : OK - 0 : ERROR
@description Function read and return sensor ID version from ID Version register.
void joystick_default_cfg | ( | joystick_t * | ctx | ) |
Click Default Configuration function.
ctx | Click object. |
@description This function executes default configuration for Joystick click.
void joystick_disabled_interrupt | ( | joystick_t * | ctx | ) |
Set interrupt disabled function.
ctx | Click object. |
Set interrupt disabled function
@description Function set interrupt output is disabled.
void joystick_enabled_interrupt | ( | joystick_t * | ctx | ) |
Set interrupt enabled function.
ctx | Click object. |
@description Function set interrupt output is enabled.
void joystick_generic_read | ( | joystick_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_buf, | ||
uint8_t | len ) |
Generic read function.
ctx | Click object. |
reg | Register address. |
data_buf | Output data buf |
len | Number of the bytes to be read |
@description This function reads data from the desired register.
void joystick_generic_write | ( | joystick_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_buf, | ||
uint8_t | len ) |
Generic write function.
ctx | Click object. |
reg | Register address. |
data_buf | Data buf to be written. |
len | Number of the bytes in data buf. |
@description This function writes data to the desired register.
uint8_t joystick_get_interrupt | ( | joystick_t * | ctx | ) |
Get state of interrupt pin function.
ctx | Click object. |
- 0 : active low; - 1 : open drain;
@description Function read state of interrupt ( INT ) pin, and return 0 or 1.
uint8_t joystick_get_position | ( | joystick_t * | ctx | ) |
Get joystick position function.
ctx | Click object. |
- 0 : Start Position; - 1 : Top Position; - 2 : Top-Right Position; - 3 : Right Position; - 4 : Bottom-Right Position; - 5 : Bottom Position; - 6 : Bottom-Left Position; - 7 : Left Position; - 8 : Top-Left Position;
@description Function get position of miniature joystick module ( N50P105 ), return position state value from 0 to 8 that calculeted by the value read from the register of the AS5013 Hall IC.
void joystick_hardware_reset | ( | joystick_t * | ctx | ) |
General hardware reset function.
ctx | Click object. |
@description Function hardware reset register of the AS5013 Hall IC, by set RST pin high.
JOYSTCIK_RETVAL joystick_init | ( | joystick_t * | ctx, |
joystick_cfg_t * | cfg ) |
Initialization function.
joystick | Click object. |
cfg | Click configuration structure. |
@description This function initializes all necessary pins and peripherals used for this click.
void joystick_invert_spinning | ( | joystick_t * | ctx | ) |
Invert the channel voltage function.
ctx | Click object. |
@description Function set invert the channel voltage, set to invert the magnet polarity.
uint8_t joystick_press_button | ( | joystick_t * | ctx | ) |
Get state of Joystick button function.
ctx | Click object. |
- 0 : not active; - 1 : active;
@description Function read state of Joystick button ( CS ) pin, and return 0 or 1.
void joystick_set_default_configuration | ( | joystick_t * | ctx | ) |
Set default configuration function.
ctx | Click object. |
@description Function set default configuration, set required Test bits of Control Register 2, set maximum sensitivity, set scaling Factor to 90.8% and reset read value by writing configuration 1 register.
void joystick_set_low_power_mode | ( | joystick_t * | ctx, |
uint8_t | timings ) |
Set Low Power Mode function.
ctx | Click object. |
timings | timings by setting the low power timebase |
@description Function set default configuration, The measurements are triggered with an internal low power oscillator the user can select between 8 different timings by setting the low power timebase.
- 0 : 20 ms; - 1 : 40 ms; - 2 : 80 ms; - 3 : 100 ms; - 4 : 140 ms; - 5 : 200 ms; - 6 : 260 ms; - 7 : 320 ms;
void joystick_set_scaling_factor | ( | joystick_t * | ctx, |
uint8_t | scaling_factor ) |
Set scaling factor function.
ctx | Click object. | |
[in] | scalingFactor | scaling factor |
@description Function set scaling factor value of the XY coordinates to fit to the 8-bit X and Y_res_int register (full dynamic range);
- 31 : 31.3 %; - 30 : 32.2 %; - 29 : 33.4 %; - 28 : 34.6 %; - 27 : 35.7 %; - 26 : 37.1 %; - 25 : 38.5 %; - 24 : 40.0 %; - 23 : 41.6 %; - 22 : 43.6 %; - 21 : 45.5 %; - 20 : 47.7 %; - 19 : 50.0 %; - 18 : 52.5 %; - 17 : 55.5 %; - 16 : 58.8 %; - 15 : 62.5 %; - 14 : 66.6 %; - 13 : 71.5 %; - 12 : 77.0 %; - 11 : 83.4 %; - 10 : 90.8 %; - 9 : 100.0 %; - 8 : 111.1 %; - 7 : 125.0 %; - 6 : 142.8 %; - 5 : 166.6 %; - 4 : 200.0 %; - 3 : 250.0 %; - 2 : 333.4 %; - 1 : 500.0 %;
void joystick_soft_reset | ( | joystick_t * | ctx | ) |
General soft reset function.
ctx | Click object. |
@description Function soft reset register of the AS5013 Hall IC. All the internal registers are loaded with their reset value. The Control Register 1 is loaded as well with the value 0xF0, then the Soft_rst bit goes back to 0 (Normal mode) once the internal reset sequence is finished.