this file contains the state machine fuctions and the console functions, It also contains the appliaction functions and interrupt service routines.
More...
#include <intrinsics.h>
#include <cstring>
#include <cstdio>
#include "MSP430.h"
#include "main.h"
#include "spi_if.h"
#include "data_flash.h"
#include "bq_pack.h"
#include "USBCDC_constructs.h"
#include "Common\types.h"
#include "Common\hal_macros.h"
#include "Common\hal_UCS.h"
#include "Common\hal_pmm.h"
Go to the source code of this file.
Typedefs |
|
typedef void(* | pt2Func )(void) |
Functions |
| void | main (void) |
| | Function Name: main.
|
| void | GoToLowPowerMode (void) |
| | State Machine tasks.
|
| void | BQFaultSignalTask (void) |
| | Function Name: BQFaultSignalTask.
|
| void | BQAlertSignalTask (void) |
| | Function Name: BQAlertSignalTask.
|
| void | Timer1SecExpiredTask (void) |
| | Function Name: Timer1SecExpiredTask.
|
| void | DRDYSignalTask (void) |
| | Function Name: DRDYSignalTask .
|
| void | HostCommunicationTask (void) |
| | Function Name: HostCommunicationTask.
|
| void | SendFaultMessageToHost (void) |
| | Function Name: SendFaultMessageToHost.
|
| void | SendAlertMessageToHost (void) |
| | Function Name: SendAlertMessageToHost .
|
|
void | BQCommunicationProblemTask (void) |
|
void | USBCommunicationTask (void) |
| __interrupt void | Timer1SecISR (void) |
| | Function Name : USCI1RX_ISR .
|
| __interrupt void | PORT_ISR (void) |
| | Function Name: PORT_ISR .
|
| __interrupt VOID | UNMI_ISR (VOID) |
| | Function Name: UNMI_ISR .
|
| void | InitMCU (void) |
| | Local functions.
|
| VOID | Init_Clock (VOID) |
| | Function Name: Init_Clock .
|
| void | InitBQ76PL536ports (void) |
| | Function Name: InitBQ76PL536ports .
|
| void | Init1SecTimer (void) |
| | Function Name: Init1SecTimer .
|
| void | Disable1SecTimer (void) |
| | Function Name: Disable1SecTimer.
|
| VOID | Init_Ports (VOID) |
| | Function Name: Init_Ports.
|
Variables |
| char | OutputString [MAX_STR_LENGTH] = "" |
| | Global Variables .
|
|
void(* | StateMachineTaskPointer )(void) |
| | Local Variables .
|
|
volatile BYTE | bDataReceived_event = FALSE |
|
volatile BYTE | bDataReceiveCompleted_event = FALSE |
|
volatile BYTE | bDataSendCompleted_event = FALSE |
|
char | wholeString [MAX_STR_LENGTH] = "" |
|
unsigned char | TEST = 0x0 |
| pt2Func | pBQ76PL536PortsISR [] |
Detailed Description
this file contains the state machine fuctions and the console functions, It also contains the appliaction functions and interrupt service routines.
- Author:
- Daniel Torres - Texas Instruments, Inc
- Date:
- November 2010
- Version:
- 1.0 Initial version
- Note:
- Built with IAR for MSP430 Version: 5.1
Definition in file main.c.
Function Documentation
| void BQAlertSignalTask |
( |
void |
|
) |
|
Function Name: BQAlertSignalTask.
Description : This function executes the corrective actions to be taken when an alert condition is detected by asserting the FAULT line on any of the 'PL536 devices.
- Parameters:
-
- Returns:
- Value :
Definition at line 240 of file main.c.
| void BQFaultSignalTask |
( |
void |
|
) |
|
Function Name: BQFaultSignalTask.
Description : This function executes the corrective actions to be taken when a fault condition is detected by asserting the FAULT line on any of the 'PL536 devices.
- Parameters:
-
- Returns:
- Value : none
Definition at line 204 of file main.c.
| void Disable1SecTimer |
( |
void |
|
) |
|
Function Name: Disable1SecTimer.
Description : Disables the 1 sec timer.
- Parameters:
-
- Returns:
- Value : none
Definition at line 1216 of file main.c.
| void DRDYSignalTask |
( |
void |
|
) |
|
Function Name: DRDYSignalTask .
Description : This is the service routine for the DRDY line .
- Parameters:
-
- Returns:
- Value : none
*BQ76PL536-ADC conversion ready*/
Definition at line 293 of file main.c.
| void GoToLowPowerMode |
( |
void |
|
) |
|
State Machine tasks.
Function Name: GoToLowPowerMode. Description : This function sets the MSP430 in low power mode.
- Parameters:
-
- Returns:
- Value : none
Definition at line 188 of file main.c.
| void HostCommunicationTask |
( |
void |
|
) |
|
Function Name: HostCommunicationTask.
Description : It takes care of the communication interface (UART or USB) with the host, it could be a PC or other MCU.
- Parameters:
-
- Returns:
- Value : none
Definition at line 315 of file main.c.
| void Init1SecTimer |
( |
void |
|
) |
|
Function Name: Init1SecTimer .
Description : initializes the 1 sec timer, TimeAx used to create a 1Sec delay.
- Parameters:
-
- Returns:
- Value : none
Definition at line 1195 of file main.c.
Function Name: Init_Clock .
Description : Initializes MSP430 clock module.
- Parameters:
-
- Returns:
- Value : none
Definition at line 1108 of file main.c.
Function Name: Init_Ports.
Description : Configures IO ports
- Parameters:
-
- Returns:
- Value : none
Definition at line 1229 of file main.c.
| void InitBQ76PL536ports |
( |
void |
|
) |
|
Function Name: InitBQ76PL536ports .
Description : init IO ports to connect the FAULT,CONV,DRDY & ALERT signals comming from the 'PL536 device.
- Parameters:
-
- Returns:
- Value : none
Definition at line 1128 of file main.c.
Local functions.
Local Functions.
Function Name: InitMCU. Description : Initializes the MSP430 peripherals and modules.
- Parameters:
-
- Returns:
- Value : none
Definition at line 1061 of file main.c.
Function Name: main.
Description: this function is the main routine It controls the SW flow and the state machine It also initializes the system.
- Parameters:
-
- Returns:
- none
Definition at line 139 of file main.c.
| __interrupt void PORT_ISR |
( |
void |
|
) |
|
Function Name: PORT_ISR .
Description : IO interrupt service.
- Parameters:
-
- Returns:
- Value : none
Definition at line 1001 of file main.c.
| void SendAlertMessageToHost |
( |
void |
|
) |
|
Function Name: SendAlertMessageToHost .
Description : Send message to host when alert condition occurs.
- Parameters:
-
- Returns:
- Value : none
Definition at line 459 of file main.c.
| void SendFaultMessageToHost |
( |
void |
|
) |
|
Function Name: SendFaultMessageToHost.
Description : Sends a fault message to the host when a fault condition occurs.
- Parameters:
-
- Returns:
- Value : none
Definition at line 343 of file main.c.
| void Timer1SecExpiredTask |
( |
void |
|
) |
|
Function Name: Timer1SecExpiredTask.
Description : Service routine for the 1sec timer it triggers the ADC conversion on the 'PL536 devices.
- Parameters:
-
- Returns:
- Value : none
Definition at line 277 of file main.c.
| __interrupt void Timer1SecISR |
( |
void |
|
) |
|
Function Name : USCI1RX_ISR .
description: USCI1RX_ISR interrupt service routine, this ISR is called when a byte is receveid in the USCI-UART, It detects the SLIP packets and identify the start/end of a message.
- Parameters:
-
- Returns:
- Value : none Function Name: Timer1SecISR . Description : Timer 1Sec interrupt service routine.
- Parameters:
-
- Returns:
- Value : none
Definition at line 977 of file main.c.
| __interrupt VOID UNMI_ISR |
( |
VOID |
|
) |
|
Function Name: UNMI_ISR .
Description : Service Routine for the UNMI vector.
- Parameters:
-
- Returns:
- Value : none
Definition at line 1022 of file main.c.
Variable Documentation
Global Variables .
Global variables.
Definition at line 93 of file main.c.
| pt2Func pBQ76PL536PortsISR[] |
Initial value:{
NotUsedPortISR,
NotUsedPortISR,
BQ76PL536_FAULT_ISR,
BQ76PL536_ALERT_ISR,
BQ76PL536_DRDY_ISR,
NotUsedPortISR,
NotUsedPortISR,
NotUsedPortISR,
NotUsedPortISR,
}
Definition at line 863 of file main.c.