![]() |
no-OS
|
Implementation of ltc2672 Driver. More...
#include <errno.h>#include <stdlib.h>#include <string.h>#include <stdint.h>#include <stdbool.h>#include "ltc2672.h"#include "no_os_spi.h"#include "no_os_gpio.h"#include "no_os_delay.h"#include "no_os_error.h"#include "no_os_util.h"#include "no_os_alloc.h"Functions | |
| int | ltc2672_remove (struct ltc2672_dev *device) |
| Remove resources allocated by the init function. | |
| int | ltc2672_reset (struct ltc2672_dev *device) |
| Perform reset using clear GPIO. | |
| int | ltc2672_transaction (struct ltc2672_dev *device, uint32_t comm, bool is_32) |
| Write raw register value. | |
| uint32_t | ltc2672_current_to_code (struct ltc2672_dev *device, uint32_t dac_current, enum ltc2672_dac_ch out_ch) |
| get dac code value from current of a selected DAC channel | |
| int | ltc2672_set_code_channel (struct ltc2672_dev *device, uint16_t code, enum ltc2672_dac_ch out_ch) |
| sets the dac code for channel | |
| int | ltc2672_set_current_channel (struct ltc2672_dev *device, uint32_t current, enum ltc2672_dac_ch out_ch) |
| set the current for a selected DAC channel | |
| int | ltc2672_set_code_all_channels (struct ltc2672_dev *device, uint16_t code) |
| sets the same dac code for all channels | |
| int | ltc2672_set_current_all_channels (struct ltc2672_dev *device, uint32_t current) |
| sets the same current for all channels | |
| int | ltc2672_set_span_channel (struct ltc2672_dev *device, enum ltc2672_out_range ch_span, enum ltc2672_dac_ch out_ch) |
| sets output span for channel | |
| int | ltc2672_set_span_all_channels (struct ltc2672_dev *device, enum ltc2672_out_range ch_span) |
| sets the same output span for all channels | |
| int | ltc2672_chip_power_down (struct ltc2672_dev *device) |
| power down ltc2672 | |
| int | ltc2672_power_down_channel (struct ltc2672_dev *device, enum ltc2672_dac_ch out_ch) |
| power down a channel | |
| int | ltc2672_power_down_all_channels (struct ltc2672_dev *device) |
| power down ALL channels | |
| int | ltc2672_monitor_mux (struct ltc2672_dev *device, enum ltc2672_mux_commands mux_comm) |
| configures mux output depending on target measurement | |
| int | ltc2672_setup_toggle_channel (struct ltc2672_dev *device, enum ltc2672_dac_ch out_ch, uint32_t current_reg_a, uint32_t current_reg_b) |
| setup toggle parameters for a channel | |
| int | ltc2672_write_input_register_channel (struct ltc2672_dev *device, enum ltc2672_dac_ch out_ch, uint32_t current_reg, bool is_reg_a) |
| writes to the input register of a channel | |
| int | ltc2672_write_input_register_all_channels (struct ltc2672_dev *device, uint32_t current_reg, bool is_reg_a) |
| writes to the input registers of all channels | |
| int | ltc2672_enable_toggle_channel (struct ltc2672_dev *device, uint32_t mask) |
| enables or disables selected channel/s for toggling | |
| int | ltc2672_global_toggle (struct ltc2672_dev *device, bool is_enable) |
| enables or disables global toggle bit | |
| int | ltc2672_config_command (struct ltc2672_dev *device, uint8_t mask) |
| configures the fault detection bits | |
| int | ltc2672_update_channel (struct ltc2672_dev *device, enum ltc2672_dac_ch out_ch) |
| updates the channel | |
| int | ltc2672_update_all_channels (struct ltc2672_dev *device) |
| updates all the channels | |
| int | ltc2672_hw_ldac_update (struct ltc2672_dev *device) |
| updates all the channels using the LDAC pin | |
| int | ltc2672_init (struct ltc2672_dev **device, struct ltc2672_init_param *init_param) |
| Device and communication init function. | |
Implementation of ltc2672 Driver.
Copyright 2023(c) Analog Devices, Inc.
SPDX-License-Identifier: BSD-3-Clause
| int ltc2672_chip_power_down | ( | struct ltc2672_dev * | device | ) |
power down ltc2672
| device | - ltc2672 descriptor |
| int ltc2672_config_command | ( | struct ltc2672_dev * | device, |
| uint8_t | mask ) |
configures the fault detection bits
| device | - ltc2672 descriptor |
| mask | - mask that describes desired configuration |
| uint32_t ltc2672_current_to_code | ( | struct ltc2672_dev * | device, |
| uint32_t | dac_current, | ||
| enum ltc2672_dac_ch | out_ch ) |
get dac code value from current of a selected DAC channel
| device | - ltc2672 descriptor |
| dac_current | - current in uA |
| out_ch | - DAC channel |
| int ltc2672_enable_toggle_channel | ( | struct ltc2672_dev * | device, |
| uint32_t | mask ) |
enables or disables selected channel/s for toggling
| device | - ltc2672 descriptor |
| mask | - mask that describes which channel/s to toggle |
| int ltc2672_global_toggle | ( | struct ltc2672_dev * | device, |
| bool | is_enable ) |
enables or disables global toggle bit
| device | - ltc2672 descriptor |
| is_enable | - sets or resets the global toggle bit |
| int ltc2672_hw_ldac_update | ( | struct ltc2672_dev * | device | ) |
updates all the channels using the LDAC pin
| device | - ltc2672 descriptor |
| int ltc2672_init | ( | struct ltc2672_dev ** | device, |
| struct ltc2672_init_param * | init_param ) |
Device and communication init function.
| device | - ltc2672 descriptor to be initialized |
| init_param | - Initial parameter for descriptor |
| int ltc2672_monitor_mux | ( | struct ltc2672_dev * | device, |
| enum ltc2672_mux_commands | mux_comm ) |
configures mux output depending on target measurement
| device | - ltc2672 descriptor |
| mux_comm | - multiplexer command code |
| int ltc2672_power_down_all_channels | ( | struct ltc2672_dev * | device | ) |
power down ALL channels
| device | - ltc2672 descriptor |
| int ltc2672_power_down_channel | ( | struct ltc2672_dev * | device, |
| enum ltc2672_dac_ch | out_ch ) |
power down a channel
| device | - ltc2672 descriptor |
| out_ch | - DAC channel output to set |
| int ltc2672_remove | ( | struct ltc2672_dev * | device | ) |
Remove resources allocated by the init function.
| device | - ltc2672 descriptor |
| int ltc2672_reset | ( | struct ltc2672_dev * | device | ) |
Perform reset using clear GPIO.
| device | - ltc2672 descriptor |
| int ltc2672_set_code_all_channels | ( | struct ltc2672_dev * | device, |
| uint16_t | code ) |
sets the same dac code for all channels
| device | - ltc2672 descriptor |
| code | - The code to be written |
| int ltc2672_set_code_channel | ( | struct ltc2672_dev * | device, |
| uint16_t | code, | ||
| enum ltc2672_dac_ch | out_ch ) |
sets the dac code for channel
| device | - ltc2672 descriptor |
| code | - The code to be written |
| out_ch | - channel to set the code |
| int ltc2672_set_current_all_channels | ( | struct ltc2672_dev * | device, |
| uint32_t | current ) |
sets the same current for all channels
| device | - ltc2672 descriptor |
| current | - current to set in uA |
| int ltc2672_set_current_channel | ( | struct ltc2672_dev * | device, |
| uint32_t | current, | ||
| enum ltc2672_dac_ch | out_ch ) |
set the current for a selected DAC channel
| device | - ltc2672 descriptor |
| current | - current to set in uA |
| out_ch | - channel to set the current |
| int ltc2672_set_span_all_channels | ( | struct ltc2672_dev * | device, |
| enum ltc2672_out_range | ch_span ) |
sets the same output span for all channels
| device | - ltc2672 descriptor |
| ch_span | - max current span |
| int ltc2672_set_span_channel | ( | struct ltc2672_dev * | device, |
| enum ltc2672_out_range | ch_span, | ||
| enum ltc2672_dac_ch | out_ch ) |
sets output span for channel
| device | - ltc2672 descriptor |
| ch_span | - max current span |
| out_ch | - DAC channel output to set |
| int ltc2672_setup_toggle_channel | ( | struct ltc2672_dev * | device, |
| enum ltc2672_dac_ch | out_ch, | ||
| uint32_t | current_reg_a, | ||
| uint32_t | current_reg_b ) |
setup toggle parameters for a channel
| device | - ltc2672 descriptor |
| out_ch | - channel to toggle |
| current_reg_a | - current to write in register A |
| current_reg_b | - current to write in register B |
| int ltc2672_transaction | ( | struct ltc2672_dev * | device, |
| uint32_t | comm, | ||
| bool | is_32 ) |
Write raw register value.
| device | - ltc2672 descriptor |
| comm | - command byte to send |
| is_32 | - flag if command is 32 bit (True) or 24 bit (False) format |
| int ltc2672_update_all_channels | ( | struct ltc2672_dev * | device | ) |
updates all the channels
| device | - ltc2672 descriptor |
| int ltc2672_update_channel | ( | struct ltc2672_dev * | device, |
| enum ltc2672_dac_ch | out_ch ) |
updates the channel
| device | - ltc2672 descriptor |
| out_ch | - channel to update |
| int ltc2672_write_input_register_all_channels | ( | struct ltc2672_dev * | device, |
| uint32_t | current_reg, | ||
| bool | is_reg_a ) |
writes to the input registers of all channels
| device | - ltc2672 descriptor |
| current_reg | - current to write in register |
| is_reg_a | - flag to select register A or B |
| int ltc2672_write_input_register_channel | ( | struct ltc2672_dev * | device, |
| enum ltc2672_dac_ch | out_ch, | ||
| uint32_t | current_reg, | ||
| bool | is_reg_a ) |
writes to the input register of a channel
| device | - ltc2672 descriptor |
| out_ch | - channel to set the current |
| current_reg | - current to write in register |
| is_reg_a | - flag to select register A or B |