keylock  2.0.0.0
Functions
Public function

Functions

void keylock_cfg_setup (keylock_cfg_t *cfg)
 Config Object Initialization function. More...
 
KEYLOCK_RETVAL keylock_init (keylock_t *ctx, keylock_cfg_t *cfg)
 Initialization function. More...
 
uint8_t keylock_check_pin (keylock_t *ctx, uint8_t pin)
 Checks pin state. More...
 
uint8_t keylock_get_position (keylock_t *ctx)
 Gets key position. More...
 
uint8_t keylock_check_an_state (keylock_t *ctx)
 Checks AN pin state. More...
 
uint8_t keylock_check_pwm_state (keylock_t *ctx)
 Checks PWM pin state. More...
 
uint8_t keylock_check_int_state (keylock_t *ctx)
 Checks INT pin state. More...
 

Detailed Description

Function Documentation

◆ keylock_cfg_setup()

void keylock_cfg_setup ( keylock_cfg_t cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ keylock_check_an_state()

uint8_t keylock_check_an_state ( keylock_t ctx)

Checks AN pin state.

Parameters
ctxClick object.
Returns
0 pin State is not set.
1 Pin State is set.

Function checks the state of AN pin.

◆ keylock_check_int_state()

uint8_t keylock_check_int_state ( keylock_t ctx)

Checks INT pin state.

Parameters
ctxClick object.
Returns
0 pin State is not set.
1 Pin State is set.

Function checks the state of INT pin.

◆ keylock_check_pin()

uint8_t keylock_check_pin ( keylock_t ctx,
uint8_t  pin 
)

Checks pin state.

Parameters
ctxClick object.
pin8-bit data that defines which pins state should be checked.
Returns
value that represent the state of a chosen pin or an error flag if pin is not chosen corectly.

Function is used to check the state of the pin chosen by the user.

Note
In order for function to work properly use:
  • 1 : To check AN pin state
  • 2 : To check PWM pin state
  • 3 : To check INT pin state
  • Any other value will cause function to return an error flag.

◆ keylock_check_pwm_state()

uint8_t keylock_check_pwm_state ( keylock_t ctx)

Checks PWM pin state.

Parameters
ctxClick object.
Returns
0 pin State is not set.
1 Pin State is set.

Function checks the state of PWM pin.

◆ keylock_get_position()

uint8_t keylock_get_position ( keylock_t ctx)

Gets key position.

Parameters
ctxClick object.
Returns
value that represent the current position of the key.

Function is used to check in which position the key currently is.

◆ keylock_init()

KEYLOCK_RETVAL keylock_init ( keylock_t ctx,
keylock_cfg_t cfg 
)

Initialization function.

Parameters
keylockClick object.
cfgClick configuration structure.

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