tdc2 2.1.0.0
|
API for configuring and manipulating TDC 2 Click driver. More...
Topics | |
TDC 2 Registers List | |
List of registers of TDC 2 Click driver. | |
TDC 2 Registers Settings | |
Settings for registers of TDC 2 Click driver. | |
TDC 2 MikroBUS Map | |
MikroBUS pin mapping of TDC 2 Click driver. | |
Functions | |
void | tdc2_cfg_setup (tdc2_cfg_t *cfg) |
TDC 2 configuration object setup function. | |
err_t | tdc2_init (tdc2_t *ctx, tdc2_cfg_t *cfg) |
TDC 2 initialization function. | |
err_t | tdc2_default_cfg (tdc2_t *ctx) |
TDC 2 default configuration function. | |
err_t | tdc2_generic_write (tdc2_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len) |
TDC 2 data writing function. | |
err_t | tdc2_generic_read (tdc2_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len) |
TDC 2 data reading function. | |
err_t | tdc2_write_config (tdc2_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len) |
TDC 2 config data writing function. | |
err_t | tdc2_read_config (tdc2_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len) |
TDC 2 config data reading function. | |
err_t | tdc2_read_results (tdc2_t *ctx, uint8_t reg, uint32_t *reference_index, uint32_t *stop_result) |
TDC 2 results data reading function. | |
err_t | tdc2_send_command (tdc2_t *ctx, uint8_t command) |
TDC 2 send command function. | |
err_t | tdc2_sw_reset (tdc2_t *ctx) |
TDC 2 software reset function. | |
err_t | tdc2_start_measuring (tdc2_t *ctx) |
TDC 2 start measuring function. | |
err_t | tdc2_set_resolution (tdc2_t *ctx, uint32_t resolution) |
TDC 2 set resolution function. | |
err_t | tdc2_get_resolution (tdc2_t *ctx, uint32_t *resolution) |
TDC 2 set resolution function. | |
void | tdc2_reset_index (tdc2_t *ctx) |
TDC 2 reset reference index function. | |
void | tdc2_disable_stop_channels (tdc2_t *ctx) |
TDC 2 disable stop channels function. | |
void | tdc2_enable_stop_channels (tdc2_t *ctx) |
TDC 2 enable stop channels function. | |
uint8_t | tdc2_get_int_state (tdc2_t *ctx) |
TDC 2 get int state function. | |
err_t | tdc2_get_time_between_stops (tdc2_t *ctx, uint32_t stop_result1, uint32_t reference_index1, uint32_t stop_result2, uint32_t reference_index2, uint32_t *time_in_us) |
TDC 2 get time between stops function. | |
API for configuring and manipulating TDC 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 tdc2_cfg_setup | ( | tdc2_cfg_t * | cfg | ) |
TDC 2 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See tdc2_cfg_t object definition for detailed explanation. |
err_t tdc2_default_cfg | ( | tdc2_t * | ctx | ) |
TDC 2 default configuration function.
This function executes a default configuration of TDC 2 click board.
[in] | ctx | : Click context object. See tdc2_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void tdc2_disable_stop_channels | ( | tdc2_t * | ctx | ) |
TDC 2 disable stop channels function.
This function is used to disable STOP channels of the device.
[in] | ctx | : Click context object. See tdc2_t object definition for detailed explanation. |
void tdc2_enable_stop_channels | ( | tdc2_t * | ctx | ) |
TDC 2 enable stop channels function.
This function is used to enable STOP channels of the device.
[in] | ctx | : Click context object. See tdc2_t object definition for detailed explanation. |
err_t tdc2_generic_read | ( | tdc2_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out, | ||
uint8_t | len ) |
TDC 2 data reading function.
This function reads a desired number of data bytes starting from the selected register by using SPI serial interface.
[in] | ctx | : Click context object. See tdc2_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[out] | data_out | : Output read data. |
[in] | len | : Number of bytes to be read. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t tdc2_generic_write | ( | tdc2_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_in, | ||
uint8_t | len ) |
TDC 2 data writing function.
This function writes a desired number of data bytes starting from the selected register by using SPI serial interface.
[in] | ctx | : Click context object. See tdc2_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[in] | data_in | : Data to be written. |
[in] | len | : Number of bytes to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. uint8_t tdc2_get_int_state | ( | tdc2_t * | ctx | ) |
TDC 2 get int state function.
This function is used to read SPI interrupt state of the device.
[in] | ctx | : Click context object. See tdc2_t object definition for detailed explanation. |
0
- Int pin is low, 1
- Int pin is high. err_t tdc2_get_resolution | ( | tdc2_t * | ctx, |
uint32_t * | resolution ) |
TDC 2 set resolution function.
This function is used to read resolution of the device.
[in] | ctx | : Click context object. See tdc2_t object definition for detailed explanation. |
[out] | resolution | : Resolution of the device. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t tdc2_get_time_between_stops | ( | tdc2_t * | ctx, |
uint32_t | stop_result1, | ||
uint32_t | reference_index1, | ||
uint32_t | stop_result2, | ||
uint32_t | reference_index2, | ||
uint32_t * | time_in_us ) |
TDC 2 get time between stops function.
This function is used to get time between two stops in uS.
[in] | ctx | : Click context object. See tdc2_t object definition for detailed explanation. |
[in] | stop_result1 | : Stop result of first event. |
[in] | reference_index1 | : Reference index of first event. |
[in] | stop_result2 | : Stop result of second event. |
[in] | reference_index2 | : Reference index of second event. |
[out] | time_in_us | : Calculated time in uS. |
0
- Success, -1
- Error. err_t tdc2_init | ( | tdc2_t * | ctx, |
tdc2_cfg_t * | cfg ) |
TDC 2 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See tdc2_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See tdc2_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t tdc2_read_config | ( | tdc2_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out, | ||
uint8_t | len ) |
TDC 2 config data reading function.
This function reads a desired number of configuration data bytes starting from the selected register by using SPI serial interface.
[in] | ctx | : Click context object. See tdc2_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[out] | data_out | : Output read configuration data. |
[in] | len | : Number of bytes to be read. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t tdc2_read_results | ( | tdc2_t * | ctx, |
uint8_t | reg, | ||
uint32_t * | reference_index, | ||
uint32_t * | stop_result ) |
TDC 2 results data reading function.
This function reads a reference index and stop result data from FIFO by using SPI serial interface.
[in] | ctx | : Click context object. See tdc2_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[out] | reference_index | : Reference index output data. |
[out] | stop_result | : Stop result read data. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void tdc2_reset_index | ( | tdc2_t * | ctx | ) |
TDC 2 reset reference index function.
This function is used to reset reference index of the device.
[in] | ctx | : Click context object. See tdc2_t object definition for detailed explanation. |
err_t tdc2_send_command | ( | tdc2_t * | ctx, |
uint8_t | command ) |
TDC 2 send command function.
This function is used to send byte of command data by using SPI serial interface.
[in] | ctx | : Click context object. See tdc2_t object definition for detailed explanation. |
[in] | command | : Command to be sent. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t tdc2_set_resolution | ( | tdc2_t * | ctx, |
uint32_t | resolution ) |
TDC 2 set resolution function.
This function is used to write resolution of the device.
[in] | ctx | : Click context object. See tdc2_t object definition for detailed explanation. |
[in] | resolution | : Resolution of the device. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t tdc2_start_measuring | ( | tdc2_t * | ctx | ) |
TDC 2 start measuring function.
This function is used to configure the device into reading mode.
[in] | ctx | : Click context object. See tdc2_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t tdc2_sw_reset | ( | tdc2_t * | ctx | ) |
TDC 2 software reset function.
This function is used to perform a software reset of the device.
[in] | ctx | : Click context object. See tdc2_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t tdc2_write_config | ( | tdc2_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_in, | ||
uint8_t | len ) |
TDC 2 config data writing function.
This function writes a desired number of configuration data bytes starting from the selected register by using SPI serial interface.
[in] | ctx | : Click context object. See tdc2_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[in] | data_in | : Configuration data to be written. |
[in] | len | : Number of bytes to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation.