- Main Page
- Data Structures
- Files

- File List
- Globals

# main.h

Go to the documentation of this file.

    00001 //******************************************************************************
    00002 //THIS PROGRAM IS PROVIDED "AS IS". TI MAKES NO WARRANTIES OR
    00003 //REPRESENTATIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
    00004 //INCLUDING ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
    00005 //FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR
    00006 //COMPLETENESS OF RESPONSES, RESULTS AND LACK OF NEGLIGENCE.
    00007 //TI DISCLAIMS ANY WARRANTY OF TITLE, QUIET ENJOYMENT, QUIET
    00008 //POSSESSION, AND NON-INFRINGEMENT OF ANY THIRD PARTY
    00009 //INTELLECTUAL PROPERTY RIGHTS WITH REGARD TO THE PROGRAM OR
    00010 //YOUR USE OF THE PROGRAM.
    00011 //
    00012 //IN NO EVENT SHALL TI BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
    00013 //CONSEQUENTIAL OR INDIRECT DAMAGES, HOWEVER CAUSED, ON ANY
    00014 //THEORY OF LIABILITY AND WHETHER OR NOT TI HAS BEEN ADVISED
    00015 //OF THE POSSIBILITY OF SUCH DAMAGES, ARISING IN ANY WAY OUT
    00016 //OF THIS AGREEMENT, THE PROGRAM, OR YOUR USE OF THE PROGRAM.
    00017 //EXCLUDED DAMAGES INCLUDE, BUT ARE NOT LIMITED TO, COST OF
    00018 //REMOVAL OR REINSTALLATION, COMPUTER TIME, LABOR COSTS, LOSS
    00019 //OF GOODWILL, LOSS OF PROFITS, LOSS OF SAVINGS, OR LOSS OF
    00020 //USE OR INTERRUPTION OF BUSINESS. IN NO EVENT WILL TI'S
    00021 //AGGREGATE LIABILITY UNDER THIS AGREEMENT OR ARISING OUT OF
    00022 //YOUR USE OF THE PROGRAM EXCEED FIVE HUNDRED DOLLARS
    00023 //(U.S.$500).
    00024 //
    00025 //Unless otherwise stated, the Program written and copyrighted
    00026 //by Texas Instruments is distributed as "freeware".  You may,
    00027 //only under TI's copyright in the Program, use and modify the
    00028 //Program without any charge or restriction.  You may
    00029 //distribute to third parties, provided that you transfer a
    00030 //copy of this license to the third party and the third party
    00031 //agrees to these terms by its first use of the Program. You
    00032 //must reproduce the copyright notice and any other legend of
    00033 //ownership on each copy or partial copy, of the Program.
    00034 //
    00035 //You acknowledge and agree that the Program contains
    00036 //copyrighted material, trade secrets and other TI proprietary
    00037 //information and is protected by copyright laws,
    00038 //international copyright treaties, and trade secret laws, as
    00039 //well as other intellectual property laws.  To protect TI's
    00040 //rights in the Program, you agree not to decompile, reverse
    00041 //engineer, disassemble or otherwise translate any object code
    00042 //versions of the Program to a human-readable form.  You agree
    00043 //that in no event will you alter, remove or destroy any
    00044 //copyright notice included in the Program.  TI reserves all
    00045 //rights not specifically granted under this license. Except
    00046 //as specifically provided herein, nothing in this agreement
    00047 //shall be construed as conferring by implication, estoppel,
    00048 //or otherwise, upon you, any license or other right under any
    00049 //TI patents, copyrights or trade secrets.
    00050 //
    00051 //You may not use the Program in non-TI devices.
    00052 //
    00053 //This software has been submitted to export control regulations
    00054 //The ECCN is EAR99
    00055 //*****************************************************************************
    00069 #ifndef _MAIN_H_
    00070 #define _MAIN_H_
    00071
    00072 #ifdef __cplusplus
    00073 extern "C"
    00074 {
    00075 #endif
    00076
    00077 #include "types.h"
    00078
    00079 //*****************************************************************************
    00083 //*****************************************************************************
    00084
    00086 #define LOW_POWER_MODE            LPM0_bits //MCLK, SMCLK = OFF, CPUOFF
    00087 //definitions for the 1sec timer
    00088 #define Timer1Sec_TAxCTL                      TA0CTL
    00089 #define Timer1Sec_TAxR                        TA0R
    00090 #define Timer1Sec_TAxCCTLx            TA0CCTL0
    00091 #define Timer1Sec_TAxCCRx         TA0CCR0
    00092 #define Timer1Sec_TAxIV               TA0IV
    00093 #define Timer1Sec_TIMER_VECTOR    TIMER0_A0_VECTOR
    00094
    00095 //communication protocol define
    00096 //#define UART_COMM
    00097 #define USB_COMM
    00098 #define MAX_STR_LENGTH 128
    00099 //definitions for the UART
    00100 #ifdef UART_COMM
    00101   #include "UART.h"
    00102 #define MCLK_FREQ 8000000 // MCLK frequency of MCU, in Hz
    00103 #endif
    00104 //definitions for the USB files
    00105 #ifdef USB_COMM
    00106 #include "..\SourceCode\USB_Common\descriptors.h"
    00107 #include "USB_Common\usb.h"        // USB-specific functions
    00108 #include "USBCDC_constructs.h"
    00109 #define MCLK_FREQ USB_MCLK_FREQ   // MCLK frequency of MCU, in Hz
    00110   #ifdef _CDC_
    00111     #include "USB_CDC_API\UsbCdc.h"
    00112   #endif
    00113 #endif
    00114
    00115
    00116 //*****************************************************************************
    00120 //*****************************************************************************
    00121
    00122 //buffer used to send outgoing messages
    00123 #ifdef USB_COMM
    00124 extern  char OutputString[MAX_STR_LENGTH];   // Holds the outgoing string
    00125 #endif
    00126
    00127 #ifdef UART_COMM
    00128 extern char OutputString[MAX_STR_LENGTH];   // Holds the outgoing string
    00129 #endif
    00130
    00131 //*****************************************************************************
    00135 //*****************************************************************************
    00136 extern void Init100mSecTimer(void);
    00137 extern void Disable100mSecTimer(void);
    00138
    00139 //*****************************************************************************
    00143 //*****************************************************************************
    00144 void InitMCU(void);
    00145 void Init_Ports(void);
    00146 BYTE retInString(char*);
    00147 void InitMCU(void);
    00148 void Init_Clock(void);
    00149 void InitBQ76PL536ports(void);
    00150 void Init1SecTimer(void);
    00151 void Disable1SecTimer(void);
    00152 void GoToLowPowerMode(void);
    00153 void BQFaultSignalTask(void);
    00154 void BQAlertSignalTask(void);
    00155 void Timer1SecExpiredTask(void);
    00156 void DRDYSignalTask(void);
    00157 void USBCommunicationTask(void);
    00158 void UARTCommunicationTask(void);
    00159 void HostCommunicationTask(void);
    00160 void SendFaultMessageToHost(void);
    00161 void SendAlertMessageToHost(void);
    00162
    00163 #ifdef __cplusplus
    00164 }
    00165 #endif
    00166 #endif /* _MAIN_H_ */
    00167 /*------------------------ Nothing Below This Line --------------------------*/
    00168