| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

Functions | Variables
LTC4155.c File Reference
Switching Regulators, Battery Chargers, and LED Drivers » LTC4155: Dual-Input Power Manager / 3.5A Li-Ion Battery Charger with I²C Control and USB OTG

LTC4155 lightweight, hardware ambiguous, embeddable C Communication Library. More...

## Detailed Description

LTC4155 lightweight, hardware ambiguous, embeddable C Communication Library.

Communication is bit-field based as well as whole-register based. This library automatically masks and right-justifies bit fields to ease programmer workload.

This C library provides a header file with the complete definitions of registers and bit fields within those registers, and routines to read and write those registers and individual bit-fields.

Outside of the Linduino environment, this library can be built with any standard C compiler and can be used with different I2C/SMBus communication hardware simply by swapping out the pointers to appropriate user-supplied functions *smbus_write_register and *smbus_read_register. An example is provided using the i2c-tools Linux kernel driver which has been tested on the BeagleBone Black Linux single board computer. It can also be readily adapted to common microcontrollers with minimal memory impact on embedded systems.

A higher level hardware ambiguous Python communication library is also available.

Please visit http://www.linear.com/product/LTC4155#code or contact the factory at 408-432-1900 or www.linear.com for further information.

Definition in file LTC4155.c.

Go to the source code of this file.

## Functions
LTC4155 | LTC4155_alloc (void)
LTC4155 | LTC4155_init (LTC4155_chip_cfg_t *cfg)
| Returns a pointer to a LTC4155 structure used by LTC4155_write_register and LTC4155_read_register. More...
static uint8_t | get_size (uint16_t registerinfo)
static uint8_t | get_subaddr (uint16_t registerinfo)
static uint8_t | get_offset (uint16_t registerinfo)
static uint8_t | get_mask (uint16_t registerinfo)
int | LTC4155_write_register (LTC4155 chip_handle, uint16_t registerinfo, uint8_t data)
| Function to modify a bit field within a register while preserving the unaddressed bit fields. More...
int | LTC4155_read_register (LTC4155 chip_handle, uint16_t registerinfo, uint8_t *data)
| Retrieves a bit field data into *data. More...

## Variables
int | LTC4155_instances = 0
LTC4155_chip_cfg_t | LTC4155_chip_array [MAX_NUM_LTC4155_INSTANCES]

## Function Documentation

## ◆ get_mask()

static uint8_t get_mask | ( | uint16_t | registerinfo | ) |
| static

Definition at line 135 of file LTC4155.c.

## ◆ get_offset()

static uint8_t get_offset | ( | uint16_t | registerinfo | ) |
| static

Definition at line 131 of file LTC4155.c.

## ◆ get_size()

static uint8_t get_size | ( | uint16_t | registerinfo | ) |
| static

Definition at line 123 of file LTC4155.c.

## ◆ get_subaddr()

static uint8_t get_subaddr | ( | uint16_t | registerinfo | ) |
| static

Definition at line 127 of file LTC4155.c.

## ◆ LTC4155_alloc()

LTC4155 LTC4155_alloc | ( | void |  | ) |

Definition at line 94 of file LTC4155.c.

## ◆ LTC4155_init()

LTC4155 LTC4155_init | ( | LTC4155_chip_cfg_t * | cfg | ) |

Returns a pointer to a LTC4155 structure used by LTC4155_write_register and LTC4155_read_register.

Parameters

  cfg | Information required to access hardware SMBus port

Definition at line 112 of file LTC4155.c.

## ◆ LTC4155_read_register()

int LTC4155_read_register | ( | LTC4155 | chip_handle,
|  | uint16_t | registerinfo,
|  | uint8_t * | data
| ) |  |

Retrieves a bit field data into *data.

Right shifts the addressed portion down to the 0 position

Parameters

  chip_handle | Struct returned by LTC4155_init
  registerinfo | Register name from LTC4155_regdefs.h
  data | Pointer to the data destination

Definition at line 164 of file LTC4155.c.

## ◆ LTC4155_write_register()

int LTC4155_write_register | ( | LTC4155 | chip_handle,
|  | uint16_t | registerinfo,
|  | uint8_t | data
| ) |  |

Function to modify a bit field within a register while preserving the unaddressed bit fields.

Parameters

  chip_handle | Struct returned by LTC4155_init
  registerinfo | Bit field name from LTC4155_regdefs.h
  data | Data to be written

Definition at line 147 of file LTC4155.c.

## Variable Documentation

## ◆ LTC4155_chip_array

LTC4155_chip_cfg_t LTC4155_chip_array[MAX_NUM_LTC4155_INSTANCES]

Definition at line 89 of file LTC4155.c.

## ◆ LTC4155_instances

int LTC4155_instances = 0

Definition at line 88 of file LTC4155.c.