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.

SPDX-License-Identifier: BSD-3-Clause

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

◆ 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

◆ 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

◆ 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

◆ 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

◆ 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

◆ 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

◆ 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

◆ 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

◆ 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