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

Header file of the LTM3360B driver. More...

#include <stdint.h>
#include <stdbool.h>
#include "no_os_util.h"
#include "no_os_i2c.h"
Include dependency graph for ltm3360b.h:

Classes

struct  ltm3360b_dev
 LTM3360B Device Descriptor. More...
 
struct  ltm3360b_init_param
 LTM3360B Initialization Parameters. More...
 

Macros

#define LTM3360B_I2C_ADDR   0x69
 
#define LTM3360B_EN_IMON_CTRL   0x01
 
#define LTM3360B_VOUT_SETTING   0x03
 
#define LTM3360B_ADC_SELECT   0x04
 
#define LTM3360B_ADC_CTRL   0x05
 
#define LTM3360B_ADC_OUTPUT   0x06
 
#define LTM3360B_IGNORE_EN_IN_BIT   NO_OS_BIT(0)
 
#define LTM3360B_EN_I2C_BIT   NO_OS_BIT(1)
 
#define LTM3360B_OPT_IMON_TH_MSK   NO_OS_GENMASK(3, 2)
 
#define LTM3360B_ADC_SEL_IN(x)
 
#define LTM3360B_OPT_IMON_TH(x)
 
#define LTM3360B_VOUT_LSB_MV   4
 
#define LTM3360B_VOUT_MV_TO_CODE(mv)
 
#define LTM3360B_VOUT_CODE_TO_MV(code)
 
#define LTM3360B_EN_ADC_BIT   NO_OS_BIT(0)
 
#define LTM3360B_ADC_CONV_TIME_MS   4
 
#define LTM3360B_VOUT_MIN_MV   297
 
#define LTM3360B_VOUT_MAX_MV   1000
 

Enumerations

enum  ltm3360b_imon_threshold {
  LTM3360B_IMON_TH_99_PERCENT ,
  LTM3360B_IMON_TH_89_PERCENT ,
  LTM3360B_IMON_TH_79_PERCENT ,
  LTM3360B_IMON_TH_69_PERCENT
}
 IMON Threshold settings. More...
 
enum  ltm3360b_adc_channel {
  LTM3360B_ADC_IMON ,
  LTM3360B_ADC_TEMP ,
  LTM3360B_ADC_VOUT_P ,
  LTM3360B_ADC_VOUT_N ,
  LTM3360B_ADC_VIN
}
 ADC Input selection. More...
 

Functions

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

Detailed Description

Header file 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

Macro Definition Documentation

◆ LTM3360B_ADC_CONV_TIME_MS

#define LTM3360B_ADC_CONV_TIME_MS   4

◆ LTM3360B_ADC_CTRL

#define LTM3360B_ADC_CTRL   0x05

◆ LTM3360B_ADC_OUTPUT

#define LTM3360B_ADC_OUTPUT   0x06

◆ LTM3360B_ADC_SEL_IN

#define LTM3360B_ADC_SEL_IN ( x)
Value:
((x) & NO_OS_GENMASK(2, 0))
#define NO_OS_GENMASK(h, l)
Definition no_os_util.h:60

◆ LTM3360B_ADC_SELECT

#define LTM3360B_ADC_SELECT   0x04

◆ LTM3360B_EN_ADC_BIT

#define LTM3360B_EN_ADC_BIT   NO_OS_BIT(0)

◆ LTM3360B_EN_I2C_BIT

#define LTM3360B_EN_I2C_BIT   NO_OS_BIT(1)

◆ LTM3360B_EN_IMON_CTRL

#define LTM3360B_EN_IMON_CTRL   0x01

◆ LTM3360B_I2C_ADDR

#define LTM3360B_I2C_ADDR   0x69

◆ LTM3360B_IGNORE_EN_IN_BIT

#define LTM3360B_IGNORE_EN_IN_BIT   NO_OS_BIT(0)

◆ LTM3360B_OPT_IMON_TH

#define LTM3360B_OPT_IMON_TH ( x)
Value:
#define LTM3360B_OPT_IMON_TH_MSK
Definition ltm3360b.h:28

◆ LTM3360B_OPT_IMON_TH_MSK

#define LTM3360B_OPT_IMON_TH_MSK   NO_OS_GENMASK(3, 2)

◆ LTM3360B_VOUT_CODE_TO_MV

#define LTM3360B_VOUT_CODE_TO_MV ( code)
Value:
#define LTM3360B_VOUT_LSB_MV
Definition ltm3360b.h:31

◆ LTM3360B_VOUT_LSB_MV

#define LTM3360B_VOUT_LSB_MV   4

◆ LTM3360B_VOUT_MAX_MV

#define LTM3360B_VOUT_MAX_MV   1000

◆ LTM3360B_VOUT_MIN_MV

#define LTM3360B_VOUT_MIN_MV   297

◆ LTM3360B_VOUT_MV_TO_CODE

#define LTM3360B_VOUT_MV_TO_CODE ( mv)
Value:

◆ LTM3360B_VOUT_SETTING

#define LTM3360B_VOUT_SETTING   0x03

Enumeration Type Documentation

◆ ltm3360b_adc_channel

ADC Input selection.

Enumerator
LTM3360B_ADC_IMON 
LTM3360B_ADC_TEMP 
LTM3360B_ADC_VOUT_P 
LTM3360B_ADC_VOUT_N 
LTM3360B_ADC_VIN 

◆ ltm3360b_imon_threshold

IMON Threshold settings.

Enumerator
LTM3360B_IMON_TH_99_PERCENT 
LTM3360B_IMON_TH_89_PERCENT 
LTM3360B_IMON_TH_79_PERCENT 
LTM3360B_IMON_TH_69_PERCENT 

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