no-OS
Functions
ltc2358.c File Reference

Implementation of LTC2358 Driver. More...

#include <stdlib.h>
#include "ltc2358.h"
#include "errno.h"
#include "no_os_alloc.h"
Include dependency graph for ltc2358.c:

Functions

void ltc2358_create_config_word (uint8_t channel, uint8_t config_number, uint32_t *config_word)
 Create 24-bit configuration word for the 8 channels. More...
 
int32_t ltc2358_channel_data (struct ltc2358_dev *dev, uint32_t config_word, uint8_t data_array[24], uint8_t channel, uint32_t *readval)
 Read single channel data. More...
 
int32_t ltc2358_init (struct ltc2358_dev **device, struct ltc2358_init_param *init_param)
 Initialize the device. More...
 
int32_t ltc2358_remove (struct ltc2358_dev *dev)
 Free memory allocated by ltc2358_init(). More...
 

Detailed Description

Implementation of LTC2358 Driver.

Author
Kim Seer Paller (kimse.nosp@m.er.p.nosp@m.aller.nosp@m.@ana.nosp@m.log.c.nosp@m.om)

Copyright 2022(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

◆ ltc2358_channel_data()

int32_t ltc2358_channel_data ( struct ltc2358_dev dev,
uint32_t  config_word,
uint8_t  data_array[24],
uint8_t  channel,
uint32_t *  readval 
)

Read single channel data.

Parameters
dev- Device handler.
config_word- 24-bit config word created.
data_array- 24 bytes of data from 8 channels.
channel- Selected channel (0-7).
readval- 3 bytes raw data for specific channel.
Returns
0 in case of success, negative error code otherwise.

◆ ltc2358_create_config_word()

void ltc2358_create_config_word ( uint8_t  channel,
uint8_t  config_number,
uint32_t *  config_word 
)

Create 24-bit configuration word for the 8 channels.

Parameters
channel- Channel number.
config_number- Configuration number for the channel.
config_word- 24-bit config word created.

◆ ltc2358_init()

int32_t ltc2358_init ( struct ltc2358_dev **  device,
struct ltc2358_init_param init_param 
)

Initialize the device.

Parameters
device- The device structure.
init_param- The structure that contains the device initial parameters.
Returns
0 in case of success, -1 otherwise.

◆ ltc2358_remove()

int32_t ltc2358_remove ( struct ltc2358_dev dev)

Free memory allocated by ltc2358_init().

Parameters
dev- Device handler.
Returns
0 in case of success, -1 otherwise.