![]() |
no-OS
|
Implementation of AD7156 Driver. More...
Functions | |
| void | ad7156_get_register_value (struct ad7156_dev *dev, uint8_t *p_read_data, uint8_t register_address, uint8_t bytes_number) |
| Performs a burst read of a specified number of registers. | |
| void | ad7156_set_register_value (struct ad7156_dev *dev, uint16_t register_value, uint8_t register_address, uint8_t bytes_number) |
| Writes data into one or two registers. | |
| int8_t | ad7156_init (struct ad7156_dev **device, struct ad7156_init_param init_param) |
| Initializes the communication peripheral and the initial Values for AD7156 Board. | |
| int32_t | ad7156_remove (struct ad7156_dev *dev) |
| Free the resources allocated by ad7156_init(). | |
| void | ad7156_reset (struct ad7156_dev *dev) |
| Resets the device. | |
| void | ad7156_set_power_mode (struct ad7156_dev *dev, uint8_t pwr_mode) |
| Sets the converter mode of operation. | |
| void | ad7156_channel_state (struct ad7156_dev *dev, uint8_t channel, uint8_t enable_conv) |
| Enables or disables conversion on the selected channel. | |
| void | ad7156_set_range (struct ad7156_dev *dev, uint32_t channel, uint8_t range) |
| Sets the input range of the specified channel. | |
| float | ad7156_get_range (struct ad7156_dev *dev, uint32_t channel) |
| Reads the range bits from the device and returns the range in pF. | |
| void | ad7156_set_threshold_mode (struct ad7156_dev *dev, uint8_t thr_mode, uint8_t thr_fixed) |
| Selects the threshold mode of operation. | |
| void | ad7156_set_threshold (struct ad7156_dev *dev, uint8_t channel, float p_fthr) |
| Writes to the threshold register when threshold fixed mode is enabled. | |
| void | ad7156_set_sensitivity (struct ad7156_dev *dev, uint8_t channel, float p_fsensitivity) |
| Writes a value(pF) to the sensitivity register. This functions should be used when adaptive threshold mode is selected. | |
| uint16_t | ad7156_read_channel_data (struct ad7156_dev *dev, uint8_t channel) |
| Reads a 12-bit sample from the selected channel. | |
| uint16_t | ad7156_wait_read_channel_data (struct ad7156_dev *dev, uint8_t channel) |
| Waits for a finished CDC conversion and reads a 12-bit sample from the selected channel. | |
| float | ad7156_read_channel_capacitance (struct ad7156_dev *dev, uint8_t channel) |
| Reads a sample the selected channel and converts the data to picofarads(pF). | |
| float | ad7156_wait_read_channel_capacitance (struct ad7156_dev *dev, uint8_t channel) |
| Waits for a finished CDC conversion the selected channel, reads a sample and converts the data to picofarads(pF). | |
Implementation of AD7156 Driver.
Copyright 2013(c) Analog Devices, Inc.
SPDX-License-Identifier: BSD-3-Clause
| void ad7156_channel_state | ( | struct ad7156_dev * | dev, |
| uint8_t | channel, | ||
| uint8_t | enable_conv ) |
Enables or disables conversion on the selected channel.
| dev | - The device structure. |
| channel | - Channel option. Example: AD7156_CHANNEL1 AD7156_CHANNEL2 |
| enable_conv | - The state of channel activity. Example: 0 - disable conversion on selected channel. 1 - enable conversion on selected channel. |
| float ad7156_get_range | ( | struct ad7156_dev * | dev, |
| uint32_t | channel ) |
Reads the range bits from the device and returns the range in pF.
| dev | - The device structure. |
| channel | - Channel option. Example: AD7156_CHANNEL1 AD7156_CHANNEL2 |
| void ad7156_get_register_value | ( | struct ad7156_dev * | dev, |
| uint8_t * | p_read_data, | ||
| uint8_t | register_address, | ||
| uint8_t | bytes_number ) |
Performs a burst read of a specified number of registers.
| dev | - The device structure. |
| p_read_data | - The read values are stored in this buffer. |
| register_address | - The start address of the burst read. |
| bytes_number | - Number of bytes to read. |
| int8_t ad7156_init | ( | struct ad7156_dev ** | device, |
| struct ad7156_init_param | init_param ) |
Initializes the communication peripheral and the initial Values for AD7156 Board.
| device | - The device structure. |
| init_param | - The structure that contains the device initial parameters. |
| float ad7156_read_channel_capacitance | ( | struct ad7156_dev * | dev, |
| uint8_t | channel ) |
Reads a sample the selected channel and converts the data to picofarads(pF).
| dev | - The device structure. |
| channel | - Channel option. Example: AD7156_CHANNEL1 AD7156_CHANNEL2 |
| uint16_t ad7156_read_channel_data | ( | struct ad7156_dev * | dev, |
| uint8_t | channel ) |
Reads a 12-bit sample from the selected channel.
| dev | - The device structure. |
| channel | - Channel option. Example: AD7156_CHANNEL1 AD7156_CHANNEL2 |
| int32_t ad7156_remove | ( | struct ad7156_dev * | dev | ) |
Free the resources allocated by ad7156_init().
| dev | - The device structure. |
| void ad7156_reset | ( | struct ad7156_dev * | dev | ) |
Resets the device.
| dev | - The device structure. |
| void ad7156_set_power_mode | ( | struct ad7156_dev * | dev, |
| uint8_t | pwr_mode ) |
Sets the converter mode of operation.
| dev | - The device structure. |
| pwr_mode | - Mode of operation option. Example: AD7156_CONV_MODE_IDLE - Idle AD7156_CONV_MODE_CONT_CONV - Continuous conversion AD7156_CONV_MODE_SINGLE_CONV - Single conversion AD7156_CONV_MODE_PWR_DWN - Power-down |
| void ad7156_set_range | ( | struct ad7156_dev * | dev, |
| uint32_t | channel, | ||
| uint8_t | range ) |
Sets the input range of the specified channel.
| dev | - The device structure. |
| channel | - Channel option. Example: AD7156_CHANNEL1 AD7156_CHANNEL2 |
| range | - Input range option. Example: AD7156_CDC_RANGE_2_PF - 2pF input range. AD7156_CDC_RANGE_0_5_PF - 0.5pF input range. AD7156_CDC_RANGE_1_PF - 1pF input range. AD7156_CDC_RANGE_4_PF - 4pF input range. |
| void ad7156_set_register_value | ( | struct ad7156_dev * | dev, |
| uint16_t | register_value, | ||
| uint8_t | register_address, | ||
| uint8_t | bytes_number ) |
Writes data into one or two registers.
| dev | - The device structure. |
| register_value | - Data value to write. |
| register_address | - Address of the register. |
| bytes_number | - Number of bytes. Accepted values: 0 - 1. |
| void ad7156_set_sensitivity | ( | struct ad7156_dev * | dev, |
| uint8_t | channel, | ||
| float | p_fsensitivity ) |
Writes a value(pF) to the sensitivity register. This functions should be used when adaptive threshold mode is selected.
| dev | - The device structure. |
| channel | - Channel option. Example: AD7156_CHANNEL1 AD7156_CHANNEL2 |
| p_fsensitivity | - The sensitivity value in picofarads(pF). |
| void ad7156_set_threshold | ( | struct ad7156_dev * | dev, |
| uint8_t | channel, | ||
| float | p_fthr ) |
Writes to the threshold register when threshold fixed mode is enabled.
| dev | - The device structure. |
| channel | - Channel option. Example: AD7156_CHANNEL1 AD7156_CHANNEL2 |
| p_fthr | - The threshold value in picofarads(pF). The value must not be out of the selected input range. |
| void ad7156_set_threshold_mode | ( | struct ad7156_dev * | dev, |
| uint8_t | thr_mode, | ||
| uint8_t | thr_fixed ) |
Selects the threshold mode of operation.
| dev | - The device structure. |
| thr_mode | - Output comparator mode. Example: AD7156_THR_MODE_NEGATIVE AD7156_THR_MODE_POSITIVE AD7156_THR_MODE_IN_WINDOW AD7156_THR_MODE_OU_WINDOW |
| thr_fixed | - Selects the threshold mode. Example: AD7156_ADAPTIVE_THRESHOLD AD7156_FIXED_THRESHOLD |
| float ad7156_wait_read_channel_capacitance | ( | struct ad7156_dev * | dev, |
| uint8_t | channel ) |
Waits for a finished CDC conversion the selected channel, reads a sample and converts the data to picofarads(pF).
| dev | - The device structure. |
| channel | - Channel option. Example: AD7156_CHANNEL1 AD7156_CHANNEL2 |
| uint16_t ad7156_wait_read_channel_data | ( | struct ad7156_dev * | dev, |
| uint8_t | channel ) |
Waits for a finished CDC conversion and reads a 12-bit sample from the selected channel.
| dev | - The device structure. |
| channel | - Channel option. Example: AD7156_CHANNEL1 AD7156_CHANNEL2 |