SRD Standelone programmation box: LTC4160.c File Reference

| SRD Standelone programmation box 2.0 (16/11/15 10:00:00) Documentation of the SRD standelone programmation box

- Main Page
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Enumerations Enumerator Macros Pages
Functions
LTC4160.c File Reference

Source file for LTC4160 driver. More...

`#include "LTC4160.h"`
Include dependency graph for LTC4160.c:

Go to the source code of this file.

## Functions

void | LTC4160Init (void)
| Initialize the LTC4160 device. More...
void | LTC4160SetILimit (tLtcUSBCurrentLimit iLimit)
| Define the current limit drawn by the charger. More...

## Detailed Description

Source file for LTC4160 driver.

Author
  Thibaut LALUQUE 3D-Ouest

Date
  26/09/2014

Version
  1.0

All Right Reserved.

Definition in file LTC4160.c.

## Function Documentation

void LTC4160Init | ( | void |  | ) |

Initialize the LTC4160 device.

Definition at line 78 of file LTC4160.c.

References LTC4160_BATLOWGD_MASK, LTC4160_BATLOWGD_SHIFT, LTC4160_CHRG_MASK, LTC4160_CHRG_SHIFT, LTC4160_ENCHARGER_MASK, LTC4160_ENCHARGER_SHIFT, LTC4160_FAULT_MASK, LTC4160_FAULT_SHIFT, LTC4160_ILIM0_MASK, LTC4160_ILIM0_SHIFT, LTC4160_ILIM1_MASK, LTC4160_ILIM1_SHIFT, LTC4160_VBUSGD_MASK, and LTC4160_VBUSGD_SHIFT.

Referenced by PowerManagerInit().

78 {
79
80 /*=== portA pins configuration ===*/
81 SIM->SCGC5 |= SIM_SCGC5_PORTA_MASK;
82
83 PTA->PDDR &= ~(GPIO_PDDR_PDD(LTC4160_VBUSGD_MASK | LTC4160_FAULT_MASK)); //As input
84
85 PORTA->PCR[LTC4160_VBUSGD_SHIFT] = PORT_PCR_MUX(0x01); //IO config
86 PORTA->PCR[LTC4160_FAULT_SHIFT] = PORT_PCR_MUX(0x01);
87
88 /*=== portE pins configuration ===*/
89 SIM->SCGC5 |= SIM_SCGC5_PORTE_MASK;
90
91 PTE->PDDR |= GPIO_PDDR_PDD(LTC4160_ILIM0_MASK | LTC4160_ILIM1_MASK | LTC4160_ENCHARGER_MASK); //As output
92 PTE->PDDR &= ~(GPIO_PDDR_PDD(LTC4160_CHRG_MASK | LTC4160_BATLOWGD_MASK)); //As input
93
94 PTE->PCOR = LTC4160_ILIM0_MASK | LTC4160_ILIM1_MASK; //Default state is 0
95 PTE->PSOR = LTC4160_ENCHARGER_MASK; //Default state is 1
96
97 PORTE->PCR[LTC4160_ILIM0_SHIFT] = PORT_PCR_MUX(0x01); //IO config
98 PORTE->PCR[LTC4160_ILIM1_SHIFT] = PORT_PCR_MUX(0x01);
99 PORTE->PCR[LTC4160_ENCHARGER_SHIFT] = PORT_PCR_MUX(0x01);
100 PORTE->PCR[LTC4160_CHRG_SHIFT] = PORT_PCR_MUX(0x01);
101 PORTE->PCR[LTC4160_BATLOWGD_SHIFT] = PORT_PCR_MUX(0x01);
102
103 }
LTC4160_VBUSGD_MASK
#define LTC4160_VBUSGD_MASK
Define the shift and mask of the IO used to controlled the LTC4160.
Definition: LTC4160.h:39
LTC4160_VBUSGD_SHIFT
#define LTC4160_VBUSGD_SHIFT
Define the shift and mask of the IO used to controlled the LTC4160.
Definition: LTC4160.h:38
LTC4160_ILIM1_SHIFT
#define LTC4160_ILIM1_SHIFT
Define the shift and mask of the IO used to controlled the LTC4160.
Definition: LTC4160.h:42
LTC4160_ENCHARGER_SHIFT
#define LTC4160_ENCHARGER_SHIFT
Define the shift and mask of the IO used to controlled the LTC4160.
Definition: LTC4160.h:48
LTC4160_FAULT_MASK
#define LTC4160_FAULT_MASK
Define the shift and mask of the IO used to controlled the LTC4160.
Definition: LTC4160.h:37
LTC4160_ENCHARGER_MASK
#define LTC4160_ENCHARGER_MASK
Define the shift and mask of the IO used to controlled the LTC4160.
Definition: LTC4160.h:49
LTC4160_BATLOWGD_MASK
#define LTC4160_BATLOWGD_MASK
Define the shift and mask of the IO used to controlled the LTC4160.
Definition: LTC4160.h:47
LTC4160_ILIM1_MASK
#define LTC4160_ILIM1_MASK
Define the shift and mask of the IO used to controlled the LTC4160.
Definition: LTC4160.h:43
LTC4160_CHRG_MASK
#define LTC4160_CHRG_MASK
Define the shift and mask of the IO used to controlled the LTC4160.
Definition: LTC4160.h:45
LTC4160_ILIM0_SHIFT
#define LTC4160_ILIM0_SHIFT
Define the shift and mask of the IO used to controlled the LTC4160.
Definition: LTC4160.h:40
LTC4160_ILIM0_MASK
#define LTC4160_ILIM0_MASK
Define the shift and mask of the IO used to controlled the LTC4160.
Definition: LTC4160.h:41
LTC4160_FAULT_SHIFT
#define LTC4160_FAULT_SHIFT
Define the shift and mask of the IO used to controlled the LTC4160.
Definition: LTC4160.h:36
LTC4160_CHRG_SHIFT
#define LTC4160_CHRG_SHIFT
Define the shift and mask of the IO used to controlled the LTC4160.
Definition: LTC4160.h:44
LTC4160_BATLOWGD_SHIFT
#define LTC4160_BATLOWGD_SHIFT
Define the shift and mask of the IO used to controlled the LTC4160.
Definition: LTC4160.h:46

Here is the caller graph for this function:

void LTC4160SetILimit | ( | tLtcUSBCurrentLimit | iLimit | ) |

Define the current limit drawn by the charger.

Parameters

  [in] | iLimit | (tLtcUSBCurrentLimit) : current limit.

Definition at line 105 of file LTC4160.c.

References LTC4160_ILIM0_MASK, and LTC4160_ILIM0_SHIFT.

Referenced by PowerManagerInit().

105 {
106 PTE->PDOR = (PTE->PDOR & ~(LTC4160_ILIM0_MASK | LTC4160_ILIM0_MASK)) | (iLimit << LTC4160_ILIM0_SHIFT);
107 }
LTC4160_ILIM0_SHIFT
#define LTC4160_ILIM0_SHIFT
Define the shift and mask of the IO used to controlled the LTC4160.
Definition: LTC4160.h:40
LTC4160_ILIM0_MASK
#define LTC4160_ILIM0_MASK
Define the shift and mask of the IO used to controlled the LTC4160.
Definition: LTC4160.h:41

Here is the caller graph for this function: