no-OS
|
Implementation of LTC6953 Driver. More...
#include <errno.h>
#include <math.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include "ltc6953.h"
#include "no_os_spi.h"
#include "no_os_error.h"
#include "no_os_util.h"
#include "no_os_alloc.h"
Functions | |
int | ltc6953_init (struct ltc6953_dev **device, struct ltc6953_init_param *init_param) |
Initializes the SPI communication with LTC6953. More... | |
int | ltc6953_reset (struct ltc6953_dev *device) |
Software reset of the device. More... | |
int | ltc6953_write (struct ltc6953_dev *dev, uint8_t reg_addr, uint16_t data) |
Writes data to LTC6953 over SPI. More... | |
int | ltc6953_read (struct ltc6953_dev *dev, uint8_t reg_addr, uint8_t *data) |
Read device register. More... | |
int | ltc6953_update (struct ltc6953_dev *dev, uint8_t reg_addr, uint8_t mask, uint8_t data) |
Update LTC6953 register. More... | |
int | ltc6953_remove (struct ltc6953_dev *dev) |
Free resources allocated for LTC6953. More... | |
int | ltc6953_power_down_all (struct ltc6953_dev *dev, bool is_pwdn) |
Powers down all LTC6953 output channels. More... | |
int | ltc6953_enable_filter (struct ltc6953_dev *dev, bool is_en) |
Enable LTC6953 VCO Input filter. More... | |
int | ltc6953_power_down_vco (struct ltc6953_dev *dev, bool is_pwdn) |
Powers down LTC6953 VCO Input channel. More... | |
int | ltc6953_set_output_divider (struct ltc6953_dev *dev, uint32_t channel, uint32_t divider) |
Set output divider for LTC6953 output channel. More... | |
int | ltc6953_power_mode (struct ltc6953_dev *dev, uint32_t channel, int32_t mode) |
Set LTC6953 Channel Power Mode. More... | |
int | ltc6953_enable_sync (struct ltc6953_dev *dev, uint32_t channel, bool enable) |
Set LTC6953 Channel Sync mode. More... | |
int | ltc6953_set_digital_delay (struct ltc6953_dev *dev, uint32_t channel, uint16_t delay) |
Set digital delay/phase of LTC6953 output channel. More... | |
int | ltc6953_set_analog_delay (struct ltc6953_dev *dev, uint32_t channel, uint16_t delay) |
Set analog delay/phase of LTC6953 output channel. More... | |
int | ltc6953_set_mode (struct ltc6953_dev *dev, uint32_t channel, uint8_t mode) |
Set LTC6953 output channel mode. More... | |
int | ltc6953_invert_output (struct ltc6953_dev *dev, uint32_t channel, bool is_invert) |
Set LTC6953 output channel inversion. More... | |
int | ltc6953_ezsync_mode (struct ltc6953_dev *dev, bool is_en) |
Set LTC6953 EZSYNC mode. More... | |
int | ltc6953_sync_mode (struct ltc6953_dev *dev, bool is_en) |
Set LTC6953 SRQ mode. More... | |
int | ltc6953_ssrq_mode (struct ltc6953_dev *dev, bool is_en) |
Set LTC6953 SSRQ mode. More... | |
int | ltc6953_num_pulse (struct ltc6953_dev *dev, uint8_t num_pulse) |
Set LTC6953 SYSCT/Num pulse value. More... | |
int | ltc6953_enable_temp_stat (struct ltc6953_dev *dev, bool is_en) |
Set LTC6953 TEMPO value. More... | |
int | ltc6953_vco_status (struct ltc6953_dev *dev, bool *is_ok) |
Read LTC6953 Check VCO Input stats. More... | |
int | ltc6953_get_invstat (struct ltc6953_dev *dev, bool *status) |
Read LTC6953 INVSTAT bit. More... | |
int | ltc6953_set_invstat (struct ltc6953_dev *dev, bool status) |
Write LTC6953 INVSTAT bit. More... | |
int | ltc6953_set_x (struct ltc6953_dev *dev, uint8_t x) |
Set LTC6953 x bitfield status. More... | |
int | ltc6953_get_x (struct ltc6953_dev *dev, uint8_t *x) |
Set LTC6953 x bitfield status. More... | |
int | ltc6953_read_rev (struct ltc6953_dev *dev, uint8_t *rev) |
Read LTC6953 Part number. More... | |
int | ltc6953_read_part (struct ltc6953_dev *dev, uint8_t *part) |
Read LTC6953 Part number. More... | |
Implementation of LTC6953 Driver.
Copyright 2023-2024(c) Analog Devices, Inc.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
int ltc6953_enable_filter | ( | struct ltc6953_dev * | dev, |
bool | is_en | ||
) |
Enable LTC6953 VCO Input filter.
dev | - The device structure. |
is_en | - Set to True to enable input filter. |
int ltc6953_enable_sync | ( | struct ltc6953_dev * | dev, |
uint32_t | channel, | ||
bool | enable | ||
) |
Set LTC6953 Channel Sync mode.
dev | - The device structure. |
channel | - Output channel [0-10] |
enable | - Set to True to enable synchronization mode [SRQMD] |
int ltc6953_enable_temp_stat | ( | struct ltc6953_dev * | dev, |
bool | is_en | ||
) |
Set LTC6953 TEMPO value.
dev | - The device structure. |
is_en | - TEMPO setting. |
int ltc6953_ezsync_mode | ( | struct ltc6953_dev * | dev, |
bool | is_en | ||
) |
Set LTC6953 EZSYNC mode.
dev | - The device structure. |
is_en | - Synchronization setting. |
int ltc6953_get_invstat | ( | struct ltc6953_dev * | dev, |
bool * | status | ||
) |
Read LTC6953 INVSTAT bit.
dev | - The device structure. |
status | - Container variable for INVSTAT pin. |
int ltc6953_get_x | ( | struct ltc6953_dev * | dev, |
uint8_t * | x | ||
) |
Set LTC6953 x bitfield status.
dev | - The device structure. |
x | - Container value for x bitfield. |
int ltc6953_init | ( | struct ltc6953_dev ** | device, |
struct ltc6953_init_param * | init_param | ||
) |
Initializes the SPI communication with LTC6953.
device | - the device structure. |
init_param | - the initialization parameters. |
int ltc6953_invert_output | ( | struct ltc6953_dev * | dev, |
uint32_t | channel, | ||
bool | is_invert | ||
) |
Set LTC6953 output channel inversion.
dev | - The device structure. |
channel | - Output channel [0-10]. |
is_invert | - Inversion setting. |
int ltc6953_num_pulse | ( | struct ltc6953_dev * | dev, |
uint8_t | num_pulse | ||
) |
Set LTC6953 SYSCT/Num pulse value.
dev | - The device structure. |
num_pulse | - Number of pulses. |
int ltc6953_power_down_all | ( | struct ltc6953_dev * | dev, |
bool | is_pwdn | ||
) |
Powers down all LTC6953 output channels.
dev | - The device structure. |
is_pwdn | - Set to True to power down all channels. |
int ltc6953_power_down_vco | ( | struct ltc6953_dev * | dev, |
bool | is_pwdn | ||
) |
Powers down LTC6953 VCO Input channel.
dev | - The device structure. |
is_pwdn | - Set to True to power down input channel. |
int ltc6953_power_mode | ( | struct ltc6953_dev * | dev, |
uint32_t | channel, | ||
int32_t | mode | ||
) |
Set LTC6953 Channel Power Mode.
dev | - The device structure. |
channel | - Output channel [0-10] |
mode | - Power mode [0-3] |
int ltc6953_read | ( | struct ltc6953_dev * | dev, |
uint8_t | reg_addr, | ||
uint8_t * | data | ||
) |
Read device register.
dev | - The device structure. |
reg_addr | - The register address. |
data | - The data read from the register. |
int ltc6953_read_part | ( | struct ltc6953_dev * | dev, |
uint8_t * | part | ||
) |
Read LTC6953 Part number.
dev | - The device structure. |
part | - container variable for Part number. |
int ltc6953_read_rev | ( | struct ltc6953_dev * | dev, |
uint8_t * | rev | ||
) |
Read LTC6953 Part number.
dev | - The device structure. |
rev | - container variable for Revision number. |
int ltc6953_remove | ( | struct ltc6953_dev * | dev | ) |
Free resources allocated for LTC6953.
dev | - The device structure. |
int ltc6953_reset | ( | struct ltc6953_dev * | device | ) |
Software reset of the device.
device | - The device structure. |
int ltc6953_set_analog_delay | ( | struct ltc6953_dev * | dev, |
uint32_t | channel, | ||
uint16_t | delay | ||
) |
Set analog delay/phase of LTC6953 output channel.
dev | - The device structure. |
channel | - Output channel [0-10] |
delay | - 16-bit word for delay value |
int ltc6953_set_digital_delay | ( | struct ltc6953_dev * | dev, |
uint32_t | channel, | ||
uint16_t | delay | ||
) |
Set digital delay/phase of LTC6953 output channel.
dev | - The device structure. |
channel | - Output channel [0-10] |
delay | - 16-bit word for delay value |
int ltc6953_set_invstat | ( | struct ltc6953_dev * | dev, |
bool | status | ||
) |
Write LTC6953 INVSTAT bit.
dev | - The device structure. |
status | - Container for INVSTAT value |
int ltc6953_set_mode | ( | struct ltc6953_dev * | dev, |
uint32_t | channel, | ||
uint8_t | mode | ||
) |
Set LTC6953 output channel mode.
dev | - The device structure. |
channel | - Output channel [0-10] |
mode | - Output channel mode [0-3] |
int ltc6953_set_output_divider | ( | struct ltc6953_dev * | dev, |
uint32_t | channel, | ||
uint32_t | divider | ||
) |
Set output divider for LTC6953 output channel.
dev | - The device structure. |
channel | - Output channel [0-10] |
divider | - Divider setting |
int ltc6953_set_x | ( | struct ltc6953_dev * | dev, |
uint8_t | x | ||
) |
Set LTC6953 x bitfield status.
dev | - The device structure. |
x | - Value for x bitfield |
int ltc6953_ssrq_mode | ( | struct ltc6953_dev * | dev, |
bool | is_en | ||
) |
Set LTC6953 SSRQ mode.
dev | - The device structure. |
is_en | - Synchronization setting. |
int ltc6953_sync_mode | ( | struct ltc6953_dev * | dev, |
bool | is_en | ||
) |
Set LTC6953 SRQ mode.
dev | - The device structure. |
is_en | - Synchronization setting. |
int ltc6953_update | ( | struct ltc6953_dev * | dev, |
uint8_t | reg_addr, | ||
uint8_t | mask, | ||
uint8_t | data | ||
) |
Update LTC6953 register.
dev | - The device structure. |
reg_addr | - The register address. |
mask | - Mask for specific register bits to be updated. |
data | - Data read from the device. |
int ltc6953_vco_status | ( | struct ltc6953_dev * | dev, |
bool * | is_ok | ||
) |
Read LTC6953 Check VCO Input stats.
dev | - The device structure. |
is_ok | - True if VCOOK bit is 1, False if VCOOK bit is 0 |
int ltc6953_write | ( | struct ltc6953_dev * | dev, |
uint8_t | reg_addr, | ||
uint16_t | data | ||
) |
Writes data to LTC6953 over SPI.
dev | - The device structure. |
reg_addr | - The register address. |
data | - Data value to write. |