no-OS
Loading...
Searching...
No Matches
ltm3360b.c File Reference

Source code of the LTM3360B driver. More...

#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include <errno.h>
#include "no_os_util.h"
#include "no_os_delay.h"
#include "no_os_alloc.h"
#include "no_os_i2c.h"
#include "no_os_error.h"
#include "ltm3360b.h"
Include dependency graph for ltm3360b.c:

Functions

int ltm3360b_reg_read (struct ltm3360b_dev *dev, uint8_t reg, uint8_t *data)
 Read register from LTM3360B device.
 
int ltm3360b_reg_write (struct ltm3360b_dev *dev, uint8_t reg, uint8_t data)
 Write register to LTM3360B device.
 
int ltm3360b_reg_update (struct ltm3360b_dev *dev, uint8_t reg, uint8_t mask, uint8_t val)
 Update register bits using mask - modifies only specified bits.
 
int ltm3360b_enable_device (struct ltm3360b_dev *dev, bool enable)
 Enable or disable LTM3360B device.
 
int ltm3360b_set_vout_mv (struct ltm3360b_dev *dev, uint16_t vout_mv)
 Set output voltage.
 
int ltm3360b_get_vout_mv (struct ltm3360b_dev *dev, uint16_t *vout_mv)
 Get current output voltage setting.
 
int ltm3360b_set_imon_threshold (struct ltm3360b_dev *dev, enum ltm3360b_imon_threshold threshold)
 Set IMON threshold for overcurrent detection.
 
int ltm3360b_adc_enable (struct ltm3360b_dev *dev, bool enable)
 Enable or disable ADC.
 
int ltm3360b_adc_read_raw (struct ltm3360b_dev *dev, enum ltm3360b_adc_channel channel, uint8_t *result)
 Read raw ADC value.
 
int ltm3360b_init (struct ltm3360b_dev **device, struct ltm3360b_init_param *init_param)
 Initialize LTM3360B device.
 
int ltm3360b_remove (struct ltm3360b_dev *dev)
 Remove LTM3360B device instance.
 

Detailed Description

Source code of the LTM3360B driver.

Author
Janani Sunil (janan.nosp@m.i.su.nosp@m.nil@a.nosp@m.nalo.nosp@m.g.com)

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

◆ ltm3360b_adc_enable()

int ltm3360b_adc_enable ( struct ltm3360b_dev * dev,
bool enable )

Enable or disable ADC.

Parameters
dev- LTM3360B device structure
enable- true to enable, false to disable
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ltm3360b_adc_read_raw()

int ltm3360b_adc_read_raw ( struct ltm3360b_dev * dev,
enum ltm3360b_adc_channel channel,
uint8_t * result )

Read raw ADC value.

Parameters
dev- LTM3360B device structure
channel- ADC channel to read
result- Pointer to store ADC result
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ltm3360b_enable_device()

int ltm3360b_enable_device ( struct ltm3360b_dev * dev,
bool enable )

Enable or disable LTM3360B device.

Parameters
dev- LTM3360B device structure
enable- true to enable, false to disable
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ltm3360b_get_vout_mv()

int ltm3360b_get_vout_mv ( struct ltm3360b_dev * dev,
uint16_t * vout_mv )

Get current output voltage setting.

Parameters
dev- LTM3360B device structure
vout_mv- Pointer to store output voltage in millivolts
Returns
0 in case of success, negative error code otherwise

◆ ltm3360b_init()

int ltm3360b_init ( struct ltm3360b_dev ** device,
struct ltm3360b_init_param * init_param )

Initialize LTM3360B device.

Parameters
device- Pointer to the device structure
init_param- Initialization parameters
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ltm3360b_reg_read()

int ltm3360b_reg_read ( struct ltm3360b_dev * dev,
uint8_t reg,
uint8_t * data )

Read register from LTM3360B device.

Parameters
dev- LTM3360B device structure
reg- Register address
data- Pointer to store read data
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ltm3360b_reg_update()

int ltm3360b_reg_update ( struct ltm3360b_dev * dev,
uint8_t reg,
uint8_t mask,
uint8_t val )

Update register bits using mask - modifies only specified bits.

Parameters
dev- LTM3360B device structure
reg- Register address
mask- Bit mask for bits to modify
val- New value for masked bits
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ltm3360b_reg_write()

int ltm3360b_reg_write ( struct ltm3360b_dev * dev,
uint8_t reg,
uint8_t data )

Write register to LTM3360B device.

Parameters
dev- LTM3360B device structure
reg- Register address
data- Data to write
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ltm3360b_remove()

int ltm3360b_remove ( struct ltm3360b_dev * dev)

Remove LTM3360B device instance.

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

◆ ltm3360b_set_imon_threshold()

int ltm3360b_set_imon_threshold ( struct ltm3360b_dev * dev,
enum ltm3360b_imon_threshold threshold )

Set IMON threshold for overcurrent detection.

Parameters
dev- LTM3360B device structure
threshold- IMON threshold setting
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ltm3360b_set_vout_mv()

int ltm3360b_set_vout_mv ( struct ltm3360b_dev * dev,
uint16_t vout_mv )

Set output voltage.

Parameters
dev- LTM3360B device structure
vout_mv- Output voltage in millivolts.
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function: