opto7 2.1.0.0
|
API for configuring and manipulating Opto 7 Click driver. More...
Topics | |
Opto 7 Device Settings | |
Settings for registers of Opto 7 Click driver. | |
Opto 7 MikroBUS Map | |
MikroBUS pin mapping of Opto 7 Click driver. | |
Functions | |
void | opto7_cfg_setup (opto7_cfg_t *cfg) |
Opto 7 configuration object setup function. | |
void | opto7_drv_interface_selection (opto7_cfg_t *cfg, opto7_drv_t drv_sel) |
Opto 7 driver interface setup function. | |
err_t | opto7_init (opto7_t *ctx, opto7_cfg_t *cfg) |
Opto 7 initialization function. | |
err_t | opto7_default_cfg (opto7_t *ctx) |
Opto 7 default configuration function. | |
err_t | opto7_generic_write (opto7_t *ctx, uint8_t *data_in, uint16_t len) |
Opto 7 data writing function. | |
err_t | opto7_generic_read (opto7_t *ctx, uint8_t *data_out, uint16_t len) |
Opto 7 data reading function. | |
void | opto7_set_gp1_pin (opto7_t *ctx, uint8_t pin_state) |
Opto 7 set GP1 pin function. | |
uint8_t | opto7_get_gp2_pin (opto7_t *ctx) |
Opto 7 get GP2 pin function. | |
API for configuring and manipulating Opto 7 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void opto7_cfg_setup | ( | opto7_cfg_t * | cfg | ) |
Opto 7 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See opto7_cfg_t object definition for detailed explanation. |
err_t opto7_default_cfg | ( | opto7_t * | ctx | ) |
Opto 7 default configuration function.
This function executes a default configuration of Opto 7 click board.
[in] | ctx | : Click context object. See opto7_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void opto7_drv_interface_selection | ( | opto7_cfg_t * | cfg, |
opto7_drv_t | drv_sel ) |
Opto 7 driver interface setup function.
This function sets a serial driver interface which will be used further in the click driver.
[out] | cfg | : Click configuration structure. See opto7_cfg_t object definition for detailed explanation. |
[in] | drv_sel | : Driver interface selection. See opto7_drv_t object definition for detailed explanation. |
err_t opto7_generic_read | ( | opto7_t * | ctx, |
uint8_t * | data_out, | ||
uint16_t | len ) |
Opto 7 data reading function.
This function reads a desired number of data bytes by using UART serial interface.
[in] | ctx | : Click context object. See opto7_t object definition for detailed explanation. |
[out] | data_out | : Output read data. |
[in] | len | : Number of bytes to be read. |
>0
- Number of data bytes read, <=0
- Error/Empty Ring buffer. See #err_t definition for detailed explanation. err_t opto7_generic_write | ( | opto7_t * | ctx, |
uint8_t * | data_in, | ||
uint16_t | len ) |
Opto 7 data writing function.
This function writes a desired number of data bytes by using UART serial interface.
[in] | ctx | : Click context object. See opto7_t object definition for detailed explanation. |
[in] | data_in | : Data buffer for sending. |
[in] | len | : Number of bytes for sending. |
>=0
- Success, <0
- Error. See #err_t definition for detailed explanation. uint8_t opto7_get_gp2_pin | ( | opto7_t * | ctx | ) |
Opto 7 get GP2 pin function.
This function is used to get GP2 pin state.
[in] | ctx | : Click context object. See opto7_t object definition for detailed explanation. |
1
- Pin state high, 0
- Pin state low. err_t opto7_init | ( | opto7_t * | ctx, |
opto7_cfg_t * | cfg ) |
Opto 7 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See opto7_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See opto7_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation.