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

Header file of LTC7841 Driver. More...

#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include "no_os_i2c.h"
#include "no_os_irq.h"
#include "no_os_print_log.h"
#include "no_os_delay.h"
#include "no_os_error.h"
#include "no_os_util.h"
#include "no_os_units.h"
#include "no_os_alloc.h"
Include dependency graph for ltc7841.h:

Classes

struct  ltc7841_init_param
 Initialization parameter for the device descriptor. More...
 
struct  ltc7841_desc
 ltc7841 device descriptor More...
 

Macros

#define TWO_BYTES_LENGTH   2
 
#define REPEATED_START_MODE   1
 
#define I2C_WRITE_LENGTH_FOR_READ   1
 
#define I2C_DEFAULT_ARRAY_SIZE   2
 
#define STOP_MODE   0
 
#define LTC7841_DEFAULT_ADDRESS_0   0x5A
 
#define LTC7841_DEFAULT_ADDRESS_1   0x5B
 
#define LTC7841_TOTAL_REGISTERS   0x16
 
#define LTC7841_BYTE_LENGTH   1
 
#define LTC7841_WORD_LENGTH   2
 
#define LTC7841_I2C_WR_FRAME_SIZE   3
 
#define LTC7841_MAX_VOUT   48000
 
#define LTC7841_7_BIT_ADDRESS_MASK   0x7F
 
#define LTC7841_OPERATION_OFF   0x00
 
#define LTC7841_OPERATION_TURN_ON   0x80
 
#define LTC7841_OPERATION_MARGIN_LOW   0x98
 
#define LTC7841_OPERATION_MARGIN_HIGH   0xA8
 
#define LTC7841_NOMINAL_SLEW_RATE   0b00
 
#define LTC7841_SLOW_SLEW_RATE   0b01
 
#define LTC7841_FAST_SLEW_RATE   0b11
 
#define LTC7841_INTERNAL_DIE_TEMPERATURE   0b0
 
#define LTC7841_TSNS_PIN_VOLTAGE   0b1
 
#define READ_TEMPERATURE_1_BIT   2
 
#define MFR_MAX_VALUE   0x1FF
 
#define MFR_VOUT_INIT   0x0FF
 
#define WRITE_ONLY_REGISTERS_NUMBER   2
 
#define ECOMM   9
 
#define LTC7841_OPERATION   1
 
#define LTC7841_VOUT_MODE   0x20
 
#define LTC7841_STATUS_WORD   0x79
 
#define LTC7841_READ_VIN   0x88
 
#define LTC7841_READ_IIN   0x89
 
#define LTC7841_READ_VOUT   0x8B
 
#define LTC7841_READ_IOUT   0x8C
 
#define LTC7841_READ_TEMPERATURE_1   0x8D
 
#define LTC7841_PMBUS_REVISION   0x98
 
#define LTC7841_MFR_IOUT_PEAK   0xD7
 
#define LTC7841_MFR_VOUT_PEAK   0xDD
 
#define LTC7841_MFR_VIN_PEAK   0xDE
 
#define LTC7841_MFR_TEMEPRATURE1_PEAK   0xDF
 
#define LTC7841_MFR_IIN_PEAK   0xE1
 
#define LTC7841_MFR_CLEAR_PEAKS   0xE3
 
#define LTC7841_MFR_VOUT_MARGIN_HIGH   0xE5
 
#define LTC7841_MFR_SPECIAL_ID   0xE7
 
#define LTC7841_MFR_VOUT_COMMAND   0xE8
 
#define LTC7841_MFR_CONFIG   0xE9
 
#define LTC7841_MFR_VOUT_MARGIN_LOW   0xED
 
#define LTC7841_MFR_RAIL_ADDRESS   0xFA
 
#define LTC7841_MFR_RESET   0xFD
 

Enumerations

enum  ltc7841_status_word_bit_placement {
  LTC7841_COMMUNICATION_FAILURE = 1 ,
  LTC7841_TEMPERATURE_FAULT = 2 ,
  LTC7841_OUTPUT_OVERVOLTAGE_FAULT = 5 ,
  LTC7841_OFF = 6 ,
  LTC7841_PGOOD = 11 ,
  LTC7841_OUTPUT_VOLTAGE_FAULT = 15
}
 

Functions

int ltc7841_reg_read (struct ltc7841_desc *desc, uint8_t cmd, uint8_t *data)
 Read a raw value from a register.
 
int ltc7841_reg_write (struct ltc7841_desc *desc, uint8_t cmd, uint16_t value)
 Write a raw value to a register.
 
int ltc7841_init (struct ltc7841_desc **device, struct ltc7841_init_param *init_param)
 Initialize the device structure.
 
int ltc7841_remove (struct ltc7841_desc *)
 Free the device descriptor.
 
int ltc7841_reset (struct ltc7841_desc *desc)
 Perform a reset to the LTC7841.
 
int ltc7841_change_rail_address (struct ltc7841_desc *desc, uint8_t addr)
 Perform change of rail address of LTC7841.
 
int ltc7841_turn_off (struct ltc7841_desc *desc)
 Turn off LTC7841.
 
int ltc7841_turn_on (struct ltc7841_desc *desc)
 Turn on LTC7841.
 
int ltc7841_operation_margin_low (struct ltc7841_desc *desc)
 Margin Low for LTC7841 Operation.
 
int ltc7841_operation_margin_high (struct ltc7841_desc *desc)
 Margin High for LTC7841 Operation.
 
int ltc7841_change_to_nominal_slew_rate (struct ltc7841_desc *desc)
 Change to Nominal Slew Rate for LTC7841.
 
int ltc7841_change_to_slow_slew_rate (struct ltc7841_desc *desc)
 Change to Slow Slew Rate for LTC7841.
 
int ltc7841_change_to_fast_slew_rate (struct ltc7841_desc *desc)
 Change to Fast Slew Rate for LTC7841.
 
int ltc7841_change_to_internal_die_temperature (struct ltc7841_desc *desc)
 Change to Internal Die Temeperature Reading for LTC7841.
 
int ltc7841_change_to_tsns_pin_voltage (struct ltc7841_desc *desc)
 Change to TSNS PIN VOLTAGE for LTC7841.
 
int ltc7841_change_vout_command (struct ltc7841_desc *desc, uint16_t vout_level)
 Change Vout command.
 
int ltc7841_change_margin_low_command (struct ltc7841_desc *desc, uint16_t vout_level)
 Change margin low command.
 
int ltc7841_change_margin_high_command (struct ltc7841_desc *desc, uint16_t vout_level)
 Change margin high command.
 
int ltc7841_mfr_clear_peaks (struct ltc7841_desc *desc)
 This clears the MFR peak data values.
 
int ltc7841_clear_status_word_bits (struct ltc7841_desc *desc)
 This clears the STATUS_WORD BITS that are clearable.
 

Variables

const uint8_t ltc7841_write_only_registers [WRITE_ONLY_REGISTERS_NUMBER]
 

Detailed Description

Header file of LTC7841 Driver.

Author
Marvin Cabuenas (marvi.nosp@m.nnei.nosp@m.l.cab.nosp@m.uena.nosp@m.s@ana.nosp@m.log..nosp@m.com)

Copyright 2025(c) Analog Devices, Inc.

SPDX-License-Identifier: BSD-3-Clause

Macro Definition Documentation

◆ ECOMM

#define ECOMM   9

◆ I2C_DEFAULT_ARRAY_SIZE

#define I2C_DEFAULT_ARRAY_SIZE   2

◆ I2C_WRITE_LENGTH_FOR_READ

#define I2C_WRITE_LENGTH_FOR_READ   1

◆ LTC7841_7_BIT_ADDRESS_MASK

#define LTC7841_7_BIT_ADDRESS_MASK   0x7F

◆ LTC7841_BYTE_LENGTH

#define LTC7841_BYTE_LENGTH   1

◆ LTC7841_DEFAULT_ADDRESS_0

#define LTC7841_DEFAULT_ADDRESS_0   0x5A

◆ LTC7841_DEFAULT_ADDRESS_1

#define LTC7841_DEFAULT_ADDRESS_1   0x5B

◆ LTC7841_FAST_SLEW_RATE

#define LTC7841_FAST_SLEW_RATE   0b11

◆ LTC7841_I2C_WR_FRAME_SIZE

#define LTC7841_I2C_WR_FRAME_SIZE   3

◆ LTC7841_INTERNAL_DIE_TEMPERATURE

#define LTC7841_INTERNAL_DIE_TEMPERATURE   0b0

◆ LTC7841_MAX_VOUT

#define LTC7841_MAX_VOUT   48000

◆ LTC7841_MFR_CLEAR_PEAKS

#define LTC7841_MFR_CLEAR_PEAKS   0xE3

◆ LTC7841_MFR_CONFIG

#define LTC7841_MFR_CONFIG   0xE9

◆ LTC7841_MFR_IIN_PEAK

#define LTC7841_MFR_IIN_PEAK   0xE1

◆ LTC7841_MFR_IOUT_PEAK

#define LTC7841_MFR_IOUT_PEAK   0xD7

◆ LTC7841_MFR_RAIL_ADDRESS

#define LTC7841_MFR_RAIL_ADDRESS   0xFA

◆ LTC7841_MFR_RESET

#define LTC7841_MFR_RESET   0xFD

◆ LTC7841_MFR_SPECIAL_ID

#define LTC7841_MFR_SPECIAL_ID   0xE7

◆ LTC7841_MFR_TEMEPRATURE1_PEAK

#define LTC7841_MFR_TEMEPRATURE1_PEAK   0xDF

◆ LTC7841_MFR_VIN_PEAK

#define LTC7841_MFR_VIN_PEAK   0xDE

◆ LTC7841_MFR_VOUT_COMMAND

#define LTC7841_MFR_VOUT_COMMAND   0xE8

◆ LTC7841_MFR_VOUT_MARGIN_HIGH

#define LTC7841_MFR_VOUT_MARGIN_HIGH   0xE5

◆ LTC7841_MFR_VOUT_MARGIN_LOW

#define LTC7841_MFR_VOUT_MARGIN_LOW   0xED

◆ LTC7841_MFR_VOUT_PEAK

#define LTC7841_MFR_VOUT_PEAK   0xDD

◆ LTC7841_NOMINAL_SLEW_RATE

#define LTC7841_NOMINAL_SLEW_RATE   0b00

◆ LTC7841_OPERATION

#define LTC7841_OPERATION   1

◆ LTC7841_OPERATION_MARGIN_HIGH

#define LTC7841_OPERATION_MARGIN_HIGH   0xA8

◆ LTC7841_OPERATION_MARGIN_LOW

#define LTC7841_OPERATION_MARGIN_LOW   0x98

◆ LTC7841_OPERATION_OFF

#define LTC7841_OPERATION_OFF   0x00

◆ LTC7841_OPERATION_TURN_ON

#define LTC7841_OPERATION_TURN_ON   0x80

◆ LTC7841_PMBUS_REVISION

#define LTC7841_PMBUS_REVISION   0x98

◆ LTC7841_READ_IIN

#define LTC7841_READ_IIN   0x89

◆ LTC7841_READ_IOUT

#define LTC7841_READ_IOUT   0x8C

◆ LTC7841_READ_TEMPERATURE_1

#define LTC7841_READ_TEMPERATURE_1   0x8D

◆ LTC7841_READ_VIN

#define LTC7841_READ_VIN   0x88

◆ LTC7841_READ_VOUT

#define LTC7841_READ_VOUT   0x8B

◆ LTC7841_SLOW_SLEW_RATE

#define LTC7841_SLOW_SLEW_RATE   0b01

◆ LTC7841_STATUS_WORD

#define LTC7841_STATUS_WORD   0x79

◆ LTC7841_TOTAL_REGISTERS

#define LTC7841_TOTAL_REGISTERS   0x16

◆ LTC7841_TSNS_PIN_VOLTAGE

#define LTC7841_TSNS_PIN_VOLTAGE   0b1

◆ LTC7841_VOUT_MODE

#define LTC7841_VOUT_MODE   0x20

◆ LTC7841_WORD_LENGTH

#define LTC7841_WORD_LENGTH   2

◆ MFR_MAX_VALUE

#define MFR_MAX_VALUE   0x1FF

◆ MFR_VOUT_INIT

#define MFR_VOUT_INIT   0x0FF

◆ READ_TEMPERATURE_1_BIT

#define READ_TEMPERATURE_1_BIT   2

◆ REPEATED_START_MODE

#define REPEATED_START_MODE   1

◆ STOP_MODE

#define STOP_MODE   0

◆ TWO_BYTES_LENGTH

#define TWO_BYTES_LENGTH   2

X is set based on the pull configuration of the ADDR pin

◆ WRITE_ONLY_REGISTERS_NUMBER

#define WRITE_ONLY_REGISTERS_NUMBER   2

Enumeration Type Documentation

◆ ltc7841_status_word_bit_placement

Enumerator
LTC7841_COMMUNICATION_FAILURE 
LTC7841_TEMPERATURE_FAULT 
LTC7841_OUTPUT_OVERVOLTAGE_FAULT 
LTC7841_OFF 
LTC7841_PGOOD 
LTC7841_OUTPUT_VOLTAGE_FAULT 

Function Documentation

◆ ltc7841_change_margin_high_command()

int ltc7841_change_margin_high_command ( struct ltc7841_desc * desc,
uint16_t vout_level )

Change margin high command.

Change MFR MARGIN HIGH command for LTC7841

Parameters
desc- The device structure.
vout_level- value is from 0 to 0x1FF
Returns
0 in case of success, error code otherwise

◆ ltc7841_change_margin_low_command()

int ltc7841_change_margin_low_command ( struct ltc7841_desc * desc,
uint16_t vout_level )

Change margin low command.

Change MFR MARGIN LOW command for LTC7841

Parameters
desc- The device structure.
vout_level- value is from 0 to 0x1FF
Returns
0 in case of success, error code otherwise

◆ ltc7841_change_rail_address()

int ltc7841_change_rail_address ( struct ltc7841_desc * desc,
uint8_t addr )

Perform change of rail address of LTC7841.

Perform change of rail address of LTC7841

Parameters
desc- The device structure.
addr- 7 bit address
Returns
0 in case of success, error code otherwise

◆ ltc7841_change_to_fast_slew_rate()

int ltc7841_change_to_fast_slew_rate ( struct ltc7841_desc * desc)

Change to Fast Slew Rate for LTC7841.

Change to Fast Slew Rate for LTC7841

Parameters
desc- The device structure.
Returns
0 in case of success, error code otherwise

◆ ltc7841_change_to_internal_die_temperature()

int ltc7841_change_to_internal_die_temperature ( struct ltc7841_desc * desc)

Change to Internal Die Temeperature Reading for LTC7841.

Change to Internal Die Temeperature Reading for LTC7841

Parameters
desc- The device structure.
Returns
0 in case of success, error code otherwise

◆ ltc7841_change_to_nominal_slew_rate()

int ltc7841_change_to_nominal_slew_rate ( struct ltc7841_desc * desc)

Change to Nominal Slew Rate for LTC7841.

Change to Nominal Slew Rate for LTC7841

Parameters
desc- The device structure.
Returns
0 in case of success, error code otherwise

◆ ltc7841_change_to_slow_slew_rate()

int ltc7841_change_to_slow_slew_rate ( struct ltc7841_desc * desc)

Change to Slow Slew Rate for LTC7841.

Change to Slow Slew Rate for LTC7841

Parameters
desc- The device structure.
Returns
0 in case of success, error code otherwise

◆ ltc7841_change_to_tsns_pin_voltage()

int ltc7841_change_to_tsns_pin_voltage ( struct ltc7841_desc * desc)

Change to TSNS PIN VOLTAGE for LTC7841.

Change to TSNS PIN VOLTAGE for LTC7841

Parameters
desc- The device structure.
Returns
0 in case of success, error code otherwise

◆ ltc7841_change_vout_command()

int ltc7841_change_vout_command ( struct ltc7841_desc * desc,
uint16_t vout_level )

Change Vout command.

Change Vout command for LTC7841

Parameters
desc- The device structure.
vout_level- value is from 0 to 0x1FF
Returns
0 in case of success, error code otherwise

◆ ltc7841_clear_status_word_bits()

int ltc7841_clear_status_word_bits ( struct ltc7841_desc * desc)

This clears the STATUS_WORD BITS that are clearable.

Clears the STATUS_WORD BITS that are clearable of LTC7841

Parameters
desc- The device structure.
Returns
0 in case of success, error code otherwise

◆ ltc7841_init()

int ltc7841_init ( struct ltc7841_desc ** device,
struct ltc7841_init_param * init_param )

Initialize the device structure.

Initialize the device structure

Parameters
device- The device structure to be initialized.
init_param- Initialization parameter for the device descriptor.
Returns
0 in case of success, negative error code otherwise.

◆ ltc7841_mfr_clear_peaks()

int ltc7841_mfr_clear_peaks ( struct ltc7841_desc * desc)

This clears the MFR peak data values.

Clears the mfr peak data values of LTC7841

Parameters
desc- The device structure.
Returns
0 in case of success, error code otherwise

◆ ltc7841_operation_margin_high()

int ltc7841_operation_margin_high ( struct ltc7841_desc * desc)

Margin High for LTC7841 Operation.

Margin High Operation for LTC7841

Parameters
desc- The device structure.
Returns
0 in case of success, error code otherwise

◆ ltc7841_operation_margin_low()

int ltc7841_operation_margin_low ( struct ltc7841_desc * desc)

Margin Low for LTC7841 Operation.

Margin Low Operation for LTC7841

Parameters
desc- The device structure.
Returns
0 in case of success, error code otherwise

◆ ltc7841_reg_read()

int ltc7841_reg_read ( struct ltc7841_desc * desc,
uint8_t cmd,
uint8_t * data )

Read a raw value from a register.

Read a register value

Parameters
desc- The device structure.
cmd- PMBus command
data- Address of the byte read
Returns
0 in case of success, error code otherwise

◆ ltc7841_reg_write()

int ltc7841_reg_write ( struct ltc7841_desc * desc,
uint8_t cmd,
uint16_t value )

Write a raw value to a register.

Write a register value

Parameters
desc- The device structure.
cmd- PMBus command
value- Byte to be written
Returns
0 in case of success, error code otherwise

◆ ltc7841_remove()

int ltc7841_remove ( struct ltc7841_desc * desc)

Free the device descriptor.

Free the device descriptor

Parameters
desc- The device structure.
Returns
0 in case of success, -EINVAL otherwise.

◆ ltc7841_reset()

int ltc7841_reset ( struct ltc7841_desc * desc)

Perform a reset to the LTC7841.

Reset the LTC7841 device

Parameters
desc- The device structure.
Returns
0 in case of success, error code otherwise

◆ ltc7841_turn_off()

int ltc7841_turn_off ( struct ltc7841_desc * desc)

Turn off LTC7841.

Turn off LTC7841

Parameters
desc- The device structure.
Returns
0 in case of success, error code otherwise

◆ ltc7841_turn_on()

int ltc7841_turn_on ( struct ltc7841_desc * desc)

Turn on LTC7841.

Turn on LTC7841

Parameters
desc- The device structure.
Returns
0 in case of success, error code otherwise

Variable Documentation

◆ ltc7841_write_only_registers

const uint8_t ltc7841_write_only_registers[WRITE_ONLY_REGISTERS_NUMBER]
extern