|
counter2 2.2.0
|
API for configuring and manipulating Counter 2 Click driver. More...
Topics | |
| Counter 2 Settings | |
| Settings of Counter 2 Click driver. | |
| Counter 2 MikroBUS Map | |
| MikroBUS pin mapping of Counter 2 Click driver. | |
Functions | |
| void | counter2_cfg_setup (counter2_cfg_t *cfg) |
| Counter 2 configuration object setup function. | |
| err_t | counter2_init (counter2_t *ctx, counter2_cfg_t *cfg) |
| Counter 2 initialization function. | |
| void | counter2_set_rst_pin (counter2_t *ctx, uint8_t state) |
| Counter 2 set RST pin state function. | |
| void | counter2_reset_counter (counter2_t *ctx) |
| Counter 2 reset counter function. | |
| uint8_t | counter2_get_loop_pin (counter2_t *ctx) |
| Counter 2 get LOOP pin function. | |
| uint8_t | counter2_check_loop (counter2_t *ctx) |
| Counter 2 check loop toggle function. | |
| err_t | counter2_get_counter (counter2_t *ctx, uint32_t *counter) |
| Counter 2 get counter value function. | |
| err_t | counter2_read_free_data (counter2_t *ctx, uint32_t *free_data) |
| Counter 2 read free data register function. | |
| err_t | counter2_write_free_data (counter2_t *ctx, uint32_t free_data) |
| Counter 2 write free data register function. | |
| err_t | counter2_sw_reset_counter (counter2_t *ctx) |
| Counter 2 software counter reset function. | |
API for configuring and manipulating Counter 2 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
| void counter2_cfg_setup | ( | counter2_cfg_t * | cfg | ) |
Counter 2 configuration object setup function.
This function initializes Click configuration structure to initial values.
| [out] | cfg | : Click configuration structure. See counter2_cfg_t object definition for detailed explanation. |
| uint8_t counter2_check_loop | ( | counter2_t * | ctx | ) |
Counter 2 check loop toggle function.
This function checks if the LOOP pin state has changed since the last call.
| [in] | ctx | : Click context object. See counter2_t object definition for detailed explanation. |
0 - LOOP pin did not change, 1 - LOOP pin changed (toggled). | err_t counter2_get_counter | ( | counter2_t * | ctx, |
| uint32_t * | counter ) |
Counter 2 get counter value function.
This function reads the current 24-bit counter value via I2C.
| [in] | ctx | : Click context object. See counter2_t object definition for detailed explanation. |
| [out] | counter | : Pointer to variable where 24-bit counter value will be stored. |
0 - Success, -1 - Error. | uint8_t counter2_get_loop_pin | ( | counter2_t * | ctx | ) |
Counter 2 get LOOP pin function.
This function reads the logic level of the LOOP pin.
| [in] | ctx | : Click context object. See counter2_t object definition for detailed explanation. |
| err_t counter2_init | ( | counter2_t * | ctx, |
| counter2_cfg_t * | cfg ) |
Counter 2 initialization function.
This function initializes all necessary pins and peripherals used for this Click board.
| [out] | ctx | : Click context object. See counter2_t object definition for detailed explanation. |
| [in] | cfg | : Click configuration structure. See counter2_cfg_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t counter2_read_free_data | ( | counter2_t * | ctx, |
| uint32_t * | free_data ) |
Counter 2 read free data register function.
This function reads a 21-bit value from the free data register of the device.
| [in] | ctx | : Click context object. See counter2_t object definition for detailed explanation. |
| [out] | free_data | : Pointer to variable where free data will be stored. |
0 - Success, -1 - Error. | void counter2_reset_counter | ( | counter2_t * | ctx | ) |
Counter 2 reset counter function.
This function performs a hardware counter reset by toggling the RST pin and synchronizing with the LOOP pin.
| [in] | ctx | : Click context object. See counter2_t object definition for detailed explanation. |
| void counter2_set_rst_pin | ( | counter2_t * | ctx, |
| uint8_t | state ) |
Counter 2 set RST pin state function.
This function sets the RST (reset) pin to the specified logic level.
| [in] | ctx | : Click context object. See counter2_t object definition for detailed explanation. |
| [in] | state | : Logic level to set (0 or 1). |
| err_t counter2_sw_reset_counter | ( | counter2_t * | ctx | ) |
Counter 2 software counter reset function.
This function performs a software counter reset by modifying and writing the free data register.
| [in] | ctx | : Click context object. See counter2_t object definition for detailed explanation. |
0 - Success, -1 - Error. | err_t counter2_write_free_data | ( | counter2_t * | ctx, |
| uint32_t | free_data ) |
Counter 2 write free data register function.
This function writes a 21-bit value to the free data register of the device.
| [in] | ctx | : Click context object. See counter2_t object definition for detailed explanation. |
| [in] | free_data | : 21-bit value to be written. |
0 - Success, -1 - Error.