no-OS
Functions
ltc6953.c File Reference

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"
Include dependency graph for ltc6953.c:

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...
 

Detailed Description

Implementation of LTC6953 Driver.

Author
MTinaco (marie.nosp@m.l.ti.nosp@m.naco@.nosp@m.anal.nosp@m.og.co.nosp@m.m)

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:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of Analog Devices, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

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.

Function Documentation

◆ ltc6953_enable_filter()

int ltc6953_enable_filter ( struct ltc6953_dev dev,
bool  is_en 
)

Enable LTC6953 VCO Input filter.

Parameters
dev- The device structure.
is_en- Set to True to enable input filter.
Returns
Returns 0 in case of success or negative error code otherwise.

◆ ltc6953_enable_sync()

int ltc6953_enable_sync ( struct ltc6953_dev dev,
uint32_t  channel,
bool  enable 
)

Set LTC6953 Channel Sync mode.

Parameters
dev- The device structure.
channel- Output channel [0-10]
enable- Set to True to enable synchronization mode [SRQMD]
Returns
Returns 0 in case of success or negative error code.

◆ ltc6953_enable_temp_stat()

int ltc6953_enable_temp_stat ( struct ltc6953_dev dev,
bool  is_en 
)

Set LTC6953 TEMPO value.

Parameters
dev- The device structure.
is_en- TEMPO setting.
Returns
Returns 0 in case of success or negative error code.

◆ ltc6953_ezsync_mode()

int ltc6953_ezsync_mode ( struct ltc6953_dev dev,
bool  is_en 
)

Set LTC6953 EZSYNC mode.

Parameters
dev- The device structure.
is_en- Synchronization setting.
Returns
Returns 0 in case of success or negative error code.

◆ ltc6953_get_invstat()

int ltc6953_get_invstat ( struct ltc6953_dev dev,
bool status 
)

Read LTC6953 INVSTAT bit.

Parameters
dev- The device structure.
status- Container variable for INVSTAT pin.
Returns
Returns 0 in case of success or negative error code.

◆ ltc6953_get_x()

int ltc6953_get_x ( struct ltc6953_dev dev,
uint8_t *  x 
)

Set LTC6953 x bitfield status.

Parameters
dev- The device structure.
x- Container value for x bitfield.
Returns
Returns 0 in case of success or negative error code.

◆ ltc6953_init()

int ltc6953_init ( struct ltc6953_dev **  device,
struct ltc6953_init_param init_param 
)

Initializes the SPI communication with LTC6953.

Parameters
device- the device structure.
init_param- the initialization parameters.
Returns
0 in case of success, negative error code otherwise.

◆ ltc6953_invert_output()

int ltc6953_invert_output ( struct ltc6953_dev dev,
uint32_t  channel,
bool  is_invert 
)

Set LTC6953 output channel inversion.

Parameters
dev- The device structure.
channel- Output channel [0-10].
is_invert- Inversion setting.
Returns
Returns 0 in case of success or negative error code.

◆ ltc6953_num_pulse()

int ltc6953_num_pulse ( struct ltc6953_dev dev,
uint8_t  num_pulse 
)

Set LTC6953 SYSCT/Num pulse value.

Parameters
dev- The device structure.
num_pulse- Number of pulses.
Returns
Returns 0 in case of success or negative error code.

◆ ltc6953_power_down_all()

int ltc6953_power_down_all ( struct ltc6953_dev dev,
bool  is_pwdn 
)

Powers down all LTC6953 output channels.

Parameters
dev- The device structure.
is_pwdn- Set to True to power down all channels.
Returns
Returns 0 in case of success or negative error code otherwise.

◆ ltc6953_power_down_vco()

int ltc6953_power_down_vco ( struct ltc6953_dev dev,
bool  is_pwdn 
)

Powers down LTC6953 VCO Input channel.

Parameters
dev- The device structure.
is_pwdn- Set to True to power down input channel.
Returns
Returns 0 in case of success or negative error code otherwise.

◆ ltc6953_power_mode()

int ltc6953_power_mode ( struct ltc6953_dev dev,
uint32_t  channel,
int32_t  mode 
)

Set LTC6953 Channel Power Mode.

Parameters
dev- The device structure.
channel- Output channel [0-10]
mode- Power mode [0-3]
Returns
Returns 0 in case of success or negative error code.

◆ ltc6953_read()

int ltc6953_read ( struct ltc6953_dev dev,
uint8_t  reg_addr,
uint8_t *  data 
)

Read device register.

Parameters
dev- The device structure.
reg_addr- The register address.
data- The data read from the register.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ltc6953_read_part()

int ltc6953_read_part ( struct ltc6953_dev dev,
uint8_t *  part 
)

Read LTC6953 Part number.

Parameters
dev- The device structure.
part- container variable for Part number.
Returns
Returns 0 in case of success or negative error code.

◆ ltc6953_read_rev()

int ltc6953_read_rev ( struct ltc6953_dev dev,
uint8_t *  rev 
)

Read LTC6953 Part number.

Parameters
dev- The device structure.
rev- container variable for Revision number.
Returns
Returns 0 in case of success or negative error code.

◆ ltc6953_remove()

int ltc6953_remove ( struct ltc6953_dev dev)

Free resources allocated for LTC6953.

Parameters
dev- The device structure.
Returns
Returns 0 in case of success or negative error code.

◆ ltc6953_reset()

int ltc6953_reset ( struct ltc6953_dev device)

Software reset of the device.

Parameters
device- The device structure.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ltc6953_set_analog_delay()

int ltc6953_set_analog_delay ( struct ltc6953_dev dev,
uint32_t  channel,
uint16_t  delay 
)

Set analog delay/phase of LTC6953 output channel.

Parameters
dev- The device structure.
channel- Output channel [0-10]
delay- 16-bit word for delay value
Returns
Returns 0 in case of success or negative error code.

◆ ltc6953_set_digital_delay()

int ltc6953_set_digital_delay ( struct ltc6953_dev dev,
uint32_t  channel,
uint16_t  delay 
)

Set digital delay/phase of LTC6953 output channel.

Parameters
dev- The device structure.
channel- Output channel [0-10]
delay- 16-bit word for delay value
Returns
Returns 0 in case of success or negative error code.

◆ ltc6953_set_invstat()

int ltc6953_set_invstat ( struct ltc6953_dev dev,
bool  status 
)

Write LTC6953 INVSTAT bit.

Parameters
dev- The device structure.
status- Container for INVSTAT value
Returns
Returns 0 in case of success or negative error code.

◆ ltc6953_set_mode()

int ltc6953_set_mode ( struct ltc6953_dev dev,
uint32_t  channel,
uint8_t  mode 
)

Set LTC6953 output channel mode.

Parameters
dev- The device structure.
channel- Output channel [0-10]
mode- Output channel mode [0-3]
Returns
Returns 0 in case of success or negative error code.

◆ ltc6953_set_output_divider()

int ltc6953_set_output_divider ( struct ltc6953_dev dev,
uint32_t  channel,
uint32_t  divider 
)

Set output divider for LTC6953 output channel.

Parameters
dev- The device structure.
channel- Output channel [0-10]
divider- Divider setting
Returns
Returns 0 in case of success or negative error code.

◆ ltc6953_set_x()

int ltc6953_set_x ( struct ltc6953_dev dev,
uint8_t  x 
)

Set LTC6953 x bitfield status.

Parameters
dev- The device structure.
x- Value for x bitfield
Returns
Returns 0 in case of success or negative error code.

◆ ltc6953_ssrq_mode()

int ltc6953_ssrq_mode ( struct ltc6953_dev dev,
bool  is_en 
)

Set LTC6953 SSRQ mode.

Parameters
dev- The device structure.
is_en- Synchronization setting.
Returns
Returns 0 in case of success or negative error code.

◆ ltc6953_sync_mode()

int ltc6953_sync_mode ( struct ltc6953_dev dev,
bool  is_en 
)

Set LTC6953 SRQ mode.

Parameters
dev- The device structure.
is_en- Synchronization setting.
Returns
Returns 0 in case of success or negative error code.

◆ ltc6953_update()

int ltc6953_update ( struct ltc6953_dev dev,
uint8_t  reg_addr,
uint8_t  mask,
uint8_t  data 
)

Update LTC6953 register.

Parameters
dev- The device structure.
reg_addr- The register address.
mask- Mask for specific register bits to be updated.
data- Data read from the device.
Returns
Returns 0 in case of success or negative error code otherwise.
Here is the caller graph for this function:

◆ ltc6953_vco_status()

int ltc6953_vco_status ( struct ltc6953_dev dev,
bool is_ok 
)

Read LTC6953 Check VCO Input stats.

Parameters
dev- The device structure.
is_ok- True if VCOOK bit is 1, False if VCOOK bit is 0
Returns
Returns 0 in case of success or negative error code.

◆ ltc6953_write()

int ltc6953_write ( struct ltc6953_dev dev,
uint8_t  reg_addr,
uint16_t  data 
)

Writes data to LTC6953 over SPI.

Parameters
dev- The device structure.
reg_addr- The register address.
data- Data value to write.
Returns
Returns 0 in case of success or negative error code otherwise.
Here is the caller graph for this function: