Defines | Functions
bat.h File Reference

Go to the source code of this file.

Defines

#define __MSP430_HAS_BATTERY_CHARGER__
#define __MSP430_HAS_BACKUP_RAM__
#define BAT_UNLOCKFAILURE   (0x0)
#define BAT_UNLOCKSUCCESS   (0x1)
#define BAT_CHARGERENDVOLTAGE_VCC   (BAKCHV0)
#define BAT_CHARGERENDVOLTAGE2_7V   (BAKCHV1)
#define BAT_CHARGECURRENT_5KOHM   (BAKCHC0)
#define BAT_CHARGECURRENT_10KOHM   (BAKCHC1)
#define BAT_CHARGECURRENT_20KOHM   (BAKCHC0 + BAKCHC1)
#define BAT_RAMSELECT_0   (0x0000)
#define BAT_RAMSELECT_1   (0x0002)
#define BAT_RAMSELECT_2   (0x0004)
#define BAT_RAMSELECT_3   (0x0006)

Functions

unsigned short BAT_unlockBackupSubSystem (unsigned int baseAddress)
void BAT_enableBackupSupplyToADC (unsigned int baseAddress)
void BAT_disableBackupSupplyToADC (unsigned int baseAddress)
void BAT_manuallySwitchToBackupSupply (unsigned int baseAddress)
void BAT_disable (unsigned int baseAddress)
void BAT_chargerInitAndEnable (unsigned int baseAddress, unsigned char chargerEndVoltage, unsigned char chargeCurrent)
void BAT_disableCharger (unsigned int baseAddress)
void BAT_setBackupRAMData (unsigned int baseAddress, unsigned char backupRAMSelect, unsigned int data)
unsigned int BAT_getBackupRAMData (unsigned int baseAddress, unsigned char backupRAMSelect)

Define Documentation

#define __MSP430_HAS_BATTERY_CHARGER__
#define __MSP430_HAS_BACKUP_RAM__
#define BAT_UNLOCKFAILURE   (0x0)
#define BAT_UNLOCKSUCCESS   (0x1)
#define BAT_CHARGERENDVOLTAGE_VCC   (BAKCHV0)
#define BAT_CHARGERENDVOLTAGE2_7V   (BAKCHV1)
#define BAT_CHARGECURRENT_5KOHM   (BAKCHC0)
#define BAT_CHARGECURRENT_10KOHM   (BAKCHC1)
#define BAT_CHARGECURRENT_20KOHM   (BAKCHC0 + BAKCHC1)
#define BAT_RAMSELECT_0   (0x0000)
#define BAT_RAMSELECT_1   (0x0002)
#define BAT_RAMSELECT_2   (0x0004)
#define BAT_RAMSELECT_3   (0x0006)

Function Documentation

unsigned short BAT_unlockBackupSubSystem ( unsigned int  baseAddress)

Unlocks any pending backup input pins and RTC_B interrupts to be serviced.

Parameters:
baseAddressis the base address of the BAT module.

This function unlocks the ability to view and service any pending backup input pin interrupts, as well as pending RTC_B interrupts. The backup sub-system can only be unlocked when the backup domain has settled, so this function returns the status of the unlock bit after it has been to be verified by user code. Please note, the backup sub-system should only be unlocked after modifying the RTC_B registers.

Returns:
BAT_UNLOCKSUCCESS if the backup subsystem has been successfully unlocked, or BAT_UNLOCKFAILURE if the backup subsystem has not yet settled.

References BAT_UNLOCKFAILURE, BAT_UNLOCKSUCCESS, and HWREGB.

void BAT_enableBackupSupplyToADC ( unsigned int  baseAddress)

Enables the backup supply to be measured by the ADC battery monitor input.

Parameters:
baseAddressis the base address of the BAT module.

This function enables the backup supply signal to be monitored by the ADC battery supply monitor input, to allow a measurement of the voltage from the backup battery.

Returns:
NONE

References HWREGB.

void BAT_disableBackupSupplyToADC ( unsigned int  baseAddress)

Disables the backup supply input to the ADC module.

Parameters:
baseAddressis the base address of the BAT module.

This function disables the ability to monitor the backup supply voltage from the ADC battery monitor input.

Returns:
NONE

References HWREGB.

void BAT_manuallySwitchToBackupSupply ( unsigned int  baseAddress)

Manually switches to backup supply.

Parameters:
baseAddressis the base address of the BAT module.

This function uses software to manually switch to the backup battery supply. Once this bit is set, it will be automatically reset by a POR and the system returns to an automatic switch to backup supply.

Returns:
NONE

References HWREGB.

void BAT_disable ( unsigned int  baseAddress)

Disables backup battery system.

Parameters:
baseAddressis the base address of the BAT module.

This function disables the battery backup system from being used. The battery backup system is reenabled after a power cycle.

Returns:
NONE

References HWREGB.

void BAT_chargerInitAndEnable ( unsigned int  baseAddress,
unsigned char  chargerEndVoltage,
unsigned char  chargeCurrent 
)

Initializes and enables the backup battery charger.

Parameters:
baseAddressis the base address of the BAT module.
chargerEndVoltageis the maximum voltage to charge the backup battery to. Valid values are BAT_CHARGERENDVOLTAGE_VCC - charges backup battery up to Vcc BAT_CHARGERENDVOLTAGE2_7V - charges backup battery up to 2.7V OR up to Vcc if Vcc is less than 2.7V. Modified bits are BAKCHVx of BAKCHCTL register.
chargeCurrentis the maximum current to charge the backup battery at. Valid values are BAT_CHARGECURRENT_5KOHM BAT_CHARGECURRENT_10KOHM BAT_CHARGECURRENT_20KOHM Modified bits are BAKCHCx of BAKCHCTL register.

This function initializes the backup battery charger with the selected settings.

Returns:
NONE

References HWREG.

void BAT_disableCharger ( unsigned int  baseAddress)

Disables and resets backup battery charger settings.

Parameters:
baseAddressis the base address of the BAT module.

This function clears all backup battery charger settings and disabes it. To renable the charger, a call to BAT_chargerInitAndEnable() is required.

Returns:
NONE

References HWREG.

void BAT_setBackupRAMData ( unsigned int  baseAddress,
unsigned char  backupRAMSelect,
unsigned int  data 
)

Sets data into the selected backup RAM space.

Parameters:
baseAddressis the base address of the BAT module.
backupRAMSelectis the backup RAM space to set data into. Valid values are BAT_RAMSELECT_0 BAT_RAMSELECT_1 BAT_RAMSELECT_2 BAT_RAMSELECT_3
datais the data to set into the selected backup RAM space.

This function sets the given 16-bit data into the selected backup RAM space.

Returns:
NONE

References HWREG.

unsigned int BAT_getBackupRAMData ( unsigned int  baseAddress,
unsigned char  backupRAMSelect 
)

Returns the data from the selected backup RAM space.

Parameters:
baseAddressis the base address of the BAT module.
backupRAMSelectis the backup RAM space to read out from. Valid values are BAT_RAMSELECT_0 BAT_RAMSELECT_1 BAT_RAMSELECT_2 BAT_RAMSELECT_3

This function returns the 16-bit data currently residing in the selected backup RAM space.

Returns:
Data residing in the selected backup RAM space.

References HWREG.


Copyright 2012, Texas Instruments Incorporated