SRD Standelone programmation box: LTC4160.h 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
Enumerations | Functions
LTC4160.h File Reference

Headerfile for ltc4160 driver. More...

`#include "dsp.h"`
Include dependency graph for LTC4160.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Macros

#define | LTC4160_FAULT_SHIFT (12)
| Define the shift and mask of the IO used to controlled the LTC4160. More...
#define | LTC4160_FAULT_MASK (1<<LTC4160_FAULT_SHIFT)
| Define the shift and mask of the IO used to controlled the LTC4160. More...
#define | LTC4160_VBUSGD_SHIFT (13)
| Define the shift and mask of the IO used to controlled the LTC4160. More...
#define | LTC4160_VBUSGD_MASK (1<<LTC4160_VBUSGD_SHIFT)
| Define the shift and mask of the IO used to controlled the LTC4160. More...
#define | LTC4160_ILIM0_SHIFT (21)
| Define the shift and mask of the IO used to controlled the LTC4160. More...
#define | LTC4160_ILIM0_MASK (1<<LTC4160_ILIM0_SHIFT)
| Define the shift and mask of the IO used to controlled the LTC4160. More...
#define | LTC4160_ILIM1_SHIFT (22)
| Define the shift and mask of the IO used to controlled the LTC4160. More...
#define | LTC4160_ILIM1_MASK (1<<LTC4160_ILIM1_SHIFT)
| Define the shift and mask of the IO used to controlled the LTC4160. More...
#define | LTC4160_CHRG_SHIFT (29)
| Define the shift and mask of the IO used to controlled the LTC4160. More...
#define | LTC4160_CHRG_MASK (1<<LTC4160_CHRG_SHIFT)
| Define the shift and mask of the IO used to controlled the LTC4160. More...
#define | LTC4160_BATLOWGD_SHIFT (30)
| Define the shift and mask of the IO used to controlled the LTC4160. More...
#define | LTC4160_BATLOWGD_MASK (1<<LTC4160_BATLOWGD_SHIFT)
| Define the shift and mask of the IO used to controlled the LTC4160. More...
#define | LTC4160_ENCHARGER_SHIFT (31)
| Define the shift and mask of the IO used to controlled the LTC4160. More...
#define | LTC4160_ENCHARGER_MASK (1<<LTC4160_ENCHARGER_SHIFT)
| Define the shift and mask of the IO used to controlled the LTC4160. More...
#define | LTC4160EnableCharge() (PTE->PCOR |= (LTC4160_ENCHARGER_MASK))
| Enable/Disable the charging mode. More...
#define | LTC4160DisableCharge() (PTE->PSOR |= (LTC4160_ENCHARGER_MASK))
| Enable/Disable the charging mode. More...
#define | LTC4160GetVBusGood() ((PTA->PDIR & LTC4160_VBUSGD_MASK) >> LTC4160_VBUSGD_SHIFT)
| Functions used to get some informations on the LTC4160 device. More...
#define | LTC4160GetChargerState() ((PTE->PDIR & LTC4160_CHRG_MASK) >> LTC4160_CHRG_SHIFT)
| Functions used to get some informations on the LTC4160 device. More...
#define | LTC4160GetFaultState() ((PTA->PDIR & LTC4160_FAULT_MASK) >> LTC4160_FAULT_SHIFT)
| Functions used to get some informations on the LTC4160 device. More...

## Enumerations

enum | tLtcEncharger { LtcEncharger_ON = 0, LtcEncharger_OFF = 1 }
| enumeration to enable/disable the charge mode. More...
enum | tLtcUSBCurrentLimit { LTCUSBCurrent1xMode = 0b00, LTCUSBCurrent10xMode = 0b01, LTCUSBCurrentLPMode = 0b10, LTCUSBCurrent5xMode = 0b11 }
| Enumeration used to define the charge current limit. More...
enum | tLtcVBusState { LTC_VBUS_VBusGood = 0, LTC_VBUS_VBusError = 1 }
| State of the VBus. More...
enum | tLtcChargerState { LTC_CHARGER_isCharging = 0, LTC_CHARGER_isNotCharging = 1 }
| State of the charger. More...
enum | tLtcFaultState { LTC_FAULT_FaultPending = 0, LTC_FAULT_ok = 1 }
| enumerate the device status. More...

## Functions

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

## Detailed Description

Headerfile for ltc4160 driver.

Author
  Thibaut LALUQUE 3D-Ouest

Date
  26/09/2014

Version
  1.0

All Right Reserved.

Definition in file LTC4160.h.

## Macro Definition Documentation

#define LTC4160_BATLOWGD_MASK (1<<LTC4160_BATLOWGD_SHIFT)

Define the shift and mask of the IO used to controlled the LTC4160.

Definition at line 47 of file LTC4160.h.

Referenced by LTC4160Init().

#define LTC4160_BATLOWGD_SHIFT (30)

Define the shift and mask of the IO used to controlled the LTC4160.

Definition at line 46 of file LTC4160.h.

Referenced by LTC4160Init().

#define LTC4160_CHRG_MASK (1<<LTC4160_CHRG_SHIFT)

Define the shift and mask of the IO used to controlled the LTC4160.

Definition at line 45 of file LTC4160.h.

Referenced by LTC4160Init().

#define LTC4160_CHRG_SHIFT (29)

Define the shift and mask of the IO used to controlled the LTC4160.

Definition at line 44 of file LTC4160.h.

Referenced by LTC4160Init().

#define LTC4160_ENCHARGER_MASK (1<<LTC4160_ENCHARGER_SHIFT)

Define the shift and mask of the IO used to controlled the LTC4160.

Definition at line 49 of file LTC4160.h.

Referenced by LTC4160Init().

#define LTC4160_ENCHARGER_SHIFT (31)

Define the shift and mask of the IO used to controlled the LTC4160.

Definition at line 48 of file LTC4160.h.

Referenced by LTC4160Init().

#define LTC4160_FAULT_MASK (1<<LTC4160_FAULT_SHIFT)

Define the shift and mask of the IO used to controlled the LTC4160.

Definition at line 37 of file LTC4160.h.

Referenced by LTC4160Init().

#define LTC4160_FAULT_SHIFT (12)

Define the shift and mask of the IO used to controlled the LTC4160.

Definition at line 36 of file LTC4160.h.

Referenced by LTC4160Init().

#define LTC4160_ILIM0_MASK (1<<LTC4160_ILIM0_SHIFT)

Define the shift and mask of the IO used to controlled the LTC4160.

Definition at line 41 of file LTC4160.h.

Referenced by LTC4160Init(), and LTC4160SetILimit().

#define LTC4160_ILIM0_SHIFT (21)

Define the shift and mask of the IO used to controlled the LTC4160.

Definition at line 40 of file LTC4160.h.

Referenced by LTC4160Init(), and LTC4160SetILimit().

#define LTC4160_ILIM1_MASK (1<<LTC4160_ILIM1_SHIFT)

Define the shift and mask of the IO used to controlled the LTC4160.

Definition at line 43 of file LTC4160.h.

Referenced by LTC4160Init().

#define LTC4160_ILIM1_SHIFT (22)

Define the shift and mask of the IO used to controlled the LTC4160.

Definition at line 42 of file LTC4160.h.

Referenced by LTC4160Init().

#define LTC4160_VBUSGD_MASK (1<<LTC4160_VBUSGD_SHIFT)

Define the shift and mask of the IO used to controlled the LTC4160.

Definition at line 39 of file LTC4160.h.

Referenced by LTC4160Init().

#define LTC4160_VBUSGD_SHIFT (13)

Define the shift and mask of the IO used to controlled the LTC4160.

Definition at line 38 of file LTC4160.h.

Referenced by LTC4160Init(), PowerManagerClearWakeUpInterruptFlag(), PowerManagerDisableWakeUpInterrupt(), and PowerManagerEnableWakeUpInterrupt().

#define LTC4160DisableCharge | ( |  | ) | (PTE->PSOR |= (LTC4160_ENCHARGER_MASK))

Enable/Disable the charging mode.

Definition at line 153 of file LTC4160.h.

Referenced by PowerManager(), and PowerManagerEnterLPM().

#define LTC4160EnableCharge | ( |  | ) | (PTE->PCOR |= (LTC4160_ENCHARGER_MASK))

Enable/Disable the charging mode.

Definition at line 152 of file LTC4160.h.

Referenced by PowerManager().

#define LTC4160GetChargerState | ( |  | ) | ((PTE->PDIR & LTC4160_CHRG_MASK) >> LTC4160_CHRG_SHIFT)

Functions used to get some informations on the LTC4160 device.

These functions allow to read the VBus state / Charger state and the fault state.

Definition at line 173 of file LTC4160.h.

Referenced by PowerManager().

#define LTC4160GetFaultState | ( |  | ) | ((PTA->PDIR & LTC4160_FAULT_MASK) >> LTC4160_FAULT_SHIFT)

Functions used to get some informations on the LTC4160 device.

These functions allow to read the VBus state / Charger state and the fault state.

Definition at line 174 of file LTC4160.h.

Referenced by PowerManager().

#define LTC4160GetVBusGood | ( |  | ) | ((PTA->PDIR & LTC4160_VBUSGD_MASK) >> LTC4160_VBUSGD_SHIFT)

Functions used to get some informations on the LTC4160 device.

These functions allow to read the VBus state / Charger state and the fault state.

Definition at line 172 of file LTC4160.h.

Referenced by PowerManager(), and PowerManagerLPMController().

## Enumeration Type Documentation

enum tLtcChargerState

State of the charger.

Enumerator
LTC_CHARGER_isCharging | Charger is charging
LTC_CHARGER_isNotCharging | Charger is not charging

Definition at line 103 of file LTC4160.h.

103 {
104 LTC_CHARGER_isCharging = 0, /*!< Charger is charging */
105 LTC_CHARGER_isNotCharging = 1 /*!< Charger is not charging */
106 }tLtcChargerState;
LTC_CHARGER_isNotCharging
Definition: LTC4160.h:105
LTC_CHARGER_isCharging
Definition: LTC4160.h:104
tLtcChargerState
tLtcChargerState
State of the charger.
Definition: LTC4160.h:103

enum tLtcEncharger

enumeration to enable/disable the charge mode.

Enumerator
LtcEncharger_ON | Enable charge
LtcEncharger_OFF | Disable charge

Definition at line 68 of file LTC4160.h.

68 {
69 LtcEncharger_ON = 0, /*!< Enable charge */
70 LtcEncharger_OFF = 1 /*!< Disable charge */
71 }tLtcEncharger;
LtcEncharger_OFF
Definition: LTC4160.h:70
tLtcEncharger
tLtcEncharger
enumeration to enable/disable the charge mode.
Definition: LTC4160.h:68
LtcEncharger_ON
Definition: LTC4160.h:69

enum tLtcFaultState

enumerate the device status.

Enumerator
LTC_FAULT_FaultPending | Fault pending
LTC_FAULT_ok | Charger is working correctly

Definition at line 114 of file LTC4160.h.

114 {
115 LTC_FAULT_FaultPending = 0, /*!< Fault pending */
116 LTC_FAULT_ok = 1 /*!< Charger is working correctly */
117 }tLtcFaultState;
LTC_FAULT_ok
Definition: LTC4160.h:116
tLtcFaultState
tLtcFaultState
enumerate the device status.
Definition: LTC4160.h:114
LTC_FAULT_FaultPending
Definition: LTC4160.h:115

enum tLtcUSBCurrentLimit

Enumeration used to define the charge current limit.

Enumerator
LTCUSBCurrent1xMode | 1x mode
LTCUSBCurrent10xMode | 10x mode
LTCUSBCurrentLPMode | LP mode
LTCUSBCurrent5xMode | 5x mode

Definition at line 79 of file LTC4160.h.

79 {
80 LTCUSBCurrent1xMode= 0b00, /*!< 1x mode */
81 LTCUSBCurrent10xMode= 0b01, /*!< 10x mode */
82 LTCUSBCurrentLPMode= 0b10, /*!< LP mode */
83 LTCUSBCurrent5xMode= 0b11 /*!< 5x mode */
84 }tLtcUSBCurrentLimit;
LTCUSBCurrent10xMode
Definition: LTC4160.h:81
LTCUSBCurrentLPMode
Definition: LTC4160.h:82
LTCUSBCurrent1xMode
Definition: LTC4160.h:80
LTCUSBCurrent5xMode
Definition: LTC4160.h:83
tLtcUSBCurrentLimit
tLtcUSBCurrentLimit
Enumeration used to define the charge current limit.
Definition: LTC4160.h:79

enum tLtcVBusState

State of the VBus.

Enumerator
LTC_VBUS_VBusGood | VBus is ok
LTC_VBUS_VBusError | VBus is nok (not connected or to low to activate the charger)

Definition at line 92 of file LTC4160.h.

92 {
93 LTC_VBUS_VBusGood = 0, /*!< VBus is ok */
94 LTC_VBUS_VBusError = 1 /*!< VBus is nok (not connected or to low to activate the charger) */
95 }tLtcVBusState;
LTC_VBUS_VBusGood
Definition: LTC4160.h:93
LTC_VBUS_VBusError
Definition: LTC4160.h:94
tLtcVBusState
tLtcVBusState
State of the VBus.
Definition: LTC4160.h:92

## 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: