Add TI library files necessary to build MSP430X demo. Still a work in progress.

pull/4/head
Richard Barry 14 years ago
parent b236356621
commit 7bc73115a5

@ -0,0 +1,267 @@
//*******************************************************************************
// Provides Functions to Initialize the UCS/FLL and clock sources
// File: hal_ucs.c
//
// Texas Instruments
//
// Version 1.2
// 11/24/09
//
// V1.0 Initial Version
// V1.1 Added timeout function
// V1.1 Added parameter for XTDrive
//*******************************************************************************
#include "msp430.h"
#include "hal_UCS.h"
//************************************************************************
// Check and define required Defines
//************************************************************************
#ifndef XT1LFOFFG // Defines if not available in header file
#define XT1LFOFFG 0
#endif
#ifndef XT1HFOFFG // Defines if not available in header file
#define XT1HFOFFG 0
#endif
#ifndef XT2OFFG // Defines if not available in header file
#define XT2OFFG 0
#endif
#ifndef XTS // Defines if not available in header file
#define XTS 0
#endif
#ifndef XT2DRIVE_3 // Defines if not available in header file
#define XT2DRIVE_3 0
#endif
//====================================================================
/**
* Startup routine for 32kHz Cristal on LFXT1
*
*/
void LFXT_Start(uint16_t xtdrive)
{
UCSCTL6_L |= XT1DRIVE1_L+XT1DRIVE0_L; // Highest drive setting for XT1 startup
while (SFRIFG1 & OFIFG) { // check OFIFG fault flag
UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags fault flags
SFRIFG1 &= ~OFIFG; // Clear OFIFG fault flag
}
UCSCTL6 = (UCSCTL6 & ~(XT1DRIVE_3)) |(xtdrive); // set Drive mode
}
//====================================================================
/**
* Startup routine for 32kHz Cristal on LFXT1 with timeout counter
*
*/
uint16_t LFXT_Start_Timeout(uint16_t xtdrive, uint16_t timeout)
{
UCSCTL6_L |= XT1DRIVE1_L+XT1DRIVE0_L; // Highest drive setting for XT1 startup
while ((SFRIFG1 & OFIFG) && timeout--){ // check OFIFG fault flag
UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags fault flags
SFRIFG1 &= ~OFIFG; // Clear OFIFG fault flag
}
UCSCTL6 = (UCSCTL6 & ~(XT1DRIVE_3)) |(xtdrive); // set Drive mode
if (timeout)
return (UCS_STATUS_OK);
else
return (UCS_STATUS_ERROR);
}
//====================================================================
/**
* Startup routine for XT1
*
*/
void XT1_Start(uint16_t xtdrive)
{
UCSCTL6 &= ~(XT1OFF | XT1DRIVE_3); // enable XT1
UCSCTL6 |= (XTS | xtdrive); // enable XT1 and set XT1Drive
while (SFRIFG1 & OFIFG) { // check OFIFG fault flag
UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags
SFRIFG1 &= ~OFIFG; // Clear OFIFG fault flag
}
}
//====================================================================
/**
* Startup routine for XT1 with timeout counter
*
*/
uint16_t XT1_Start_Timeout(uint16_t xtdrive, uint16_t timeout)
{
UCSCTL6 &= ~(XT1OFF | XT1DRIVE_3); // enable XT1
UCSCTL6 |= (XTS | xtdrive); // enable XT1 and set XT1Drive
while ((SFRIFG1 & OFIFG) && timeout--) { // check OFIFG fault flag
UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags
SFRIFG1 &= ~OFIFG; // Clear OFIFG fault flag
}
if (timeout)
return (UCS_STATUS_OK);
else
return (UCS_STATUS_ERROR);
}
//====================================================================
/**
* Use XT1 in Bypasss mode
*
*/
void XT1_Bypass(void)
{
UCSCTL6 |= XT1BYPASS;
while (SFRIFG1 & OFIFG) { // check OFIFG fault flag
UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags
SFRIFG1 &= ~OFIFG; // Clear OFIFG fault flag
}
}
//====================================================================
/**
* Startup routine for XT2
*
*/
void XT2_Start(uint16_t xtdrive)
{
UCSCTL6 &= ~(XT2OFF | XT2DRIVE_3); // enable XT2
UCSCTL6 |= (xtdrive); // Set XT2Drive
while (SFRIFG1 & OFIFG) { // check OFIFG fault flag
UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags
SFRIFG1 &= ~OFIFG; // Clear OFIFG fault flag
}
}
//====================================================================
/**
* Startup routine for XT2 with timeout counter
*
*/
uint16_t XT2_Start_Timeout(uint16_t xtdrive, uint16_t timeout)
{
UCSCTL6 &= ~XT2OFF; // Set XT2 On
UCSCTL6 &= ~XT2DRIVE_3; // enable XT2
UCSCTL6 |= (xtdrive); // Set XT2Drive
while ((SFRIFG1 & OFIFG) && timeout--){ // check OFIFG fault flag
UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags
SFRIFG1 &= ~OFIFG; // Clear OFIFG fault flag
}
if (timeout)
return (UCS_STATUS_OK);
else
return (UCS_STATUS_ERROR);
}
//====================================================================
/**
* Use XT2 in Bypasss mode
*
*/
void XT2_Bypass(void)
{
#ifdef XT2BYPASS // on devices without XT2 this function will be empty
UCSCTL6 |= XT2BYPASS;
while (SFRIFG1 & OFIFG) { // check OFIFG fault flag
UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags
SFRIFG1 &= ~OFIFG; // Clear OFIFG fault flag
}
#endif
}
//====================================================================
/**
* Initializes FLL of the UCS and wait till settled
*
* \param fsystem required system frequency (MCLK) in kHz
* \param ratio ratio between MCLK and FLLREFCLK
*/
void Init_FLL_Settle(uint16_t fsystem, uint16_t ratio)
{
volatile uint16_t x = ratio * 32;
// save actual state of FLL loop control
uint16_t globalInterruptState = __get_SR_register() & SCG0;
__bic_SR_register(SCG0); // Enable FLL loop control
Init_FLL(fsystem, ratio);
while(x--)
{
__delay_cycles(30);
}
__bis_SR_register(globalInterruptState); // restore previous state
}
//====================================================================
/**
* Initializes FLL of the UCS
*
* \param fsystem required system frequency (MCLK) in kHz
* \param ratio ratio between fsystem and FLLREFCLK
*/
static void Init_FLL(uint16_t fsystem, uint16_t ratio)
{
uint16_t d, dco_div_bits;
uint16_t mode = 0;
d = ratio;
dco_div_bits = FLLD__2; // Have at least a divider of 2
if (fsystem > 16000){
d >>= 1 ;
mode = 1;
}
else
fsystem <<= 1; // fsystem = fsystem * 2
while (d > 512)
{
dco_div_bits = dco_div_bits + FLLD0; // set next higher div level
d >>= 1;
}
UCSCTL0 = 0x000; // Set DCO to lowest Tap
UCSCTL2 &= ~(0x3FF); // Reset FN bits
UCSCTL2 = dco_div_bits | (d - 1);
if (fsystem <= 630) // fsystem < 0.63MHz
UCSCTL1= DCORSEL_0 ;
else if (fsystem < 1250) // 0.63MHz < fsystem < 1.25MHz
UCSCTL1= DCORSEL_1 ;
else if (fsystem < 2500) // 1.25MHz < fsystem < 2.5MHz
UCSCTL1= DCORSEL_2 ;
else if (fsystem < 5000) // 2.5MHz < fsystem < 5MHz
UCSCTL1= DCORSEL_3 ;
else if (fsystem < 10000) // 5MHz < fsystem < 10MHz
UCSCTL1= DCORSEL_4 ;
else if (fsystem < 20000) // 10MHz < fsystem < 20MHz
UCSCTL1= DCORSEL_5 ;
else if (fsystem < 40000) // 20MHz < fsystem < 40MHz
UCSCTL1= DCORSEL_6 ;
else
UCSCTL1= DCORSEL_7 ;
while (SFRIFG1 & OFIFG) { // check OFIFG fault flag
UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags
SFRIFG1 &= ~OFIFG; // Clear OFIFG fault flag
}
if (mode == 1) // fsystem > 16000
SELECT_MCLK_SMCLK(SELM__DCOCLK + SELS__DCOCLK); // select DCOCLK
else
SELECT_MCLK_SMCLK(SELM__DCOCLKDIV + SELS__DCOCLKDIV); // selcet DCODIVCLK
} // End of fll_init()

@ -0,0 +1,143 @@
//*******************************************************************************
// Provides Functions to Initialize the UCS/FLL and clock sources
// File: hal_ucs.c
//
// Texas Instruments
//
// Version 1.2
// 11/24/09
//
// V1.0 Initial Version
// V1.1 Added timeout function
// V1.1 Added parameter for XTDrive
//*******************************************************************************
#ifndef __hal_UCS
#define __hal_UCS
#include <stdint.h>
#include "hal_macros.h"
/*************************************************************************
* MACROS
**************************************************************************/
/* Select source for FLLREF e.g. SELECT_FLLREF(SELREF__XT1CLK) */
#define SELECT_FLLREF(source) st(UCSCTL3 = (UCSCTL3 & ~(SELREF_7)) | (source);)
/* Select source for ACLK e.g. SELECT_ACLK(SELA__XT1CLK) */
#define SELECT_ACLK(source) st(UCSCTL4 = (UCSCTL4 & ~(SELA_7)) | (source);)
/* Select source for MCLK e.g. SELECT_MCLK(SELM__XT2CLK) */
#define SELECT_MCLK(source) st(UCSCTL4 = (UCSCTL4 & ~(SELM_7)) | (source);)
/* Select source for SMCLK e.g. SELECT_SMCLK(SELS__XT2CLK) */
#define SELECT_SMCLK(source) st(UCSCTL4 = (UCSCTL4 & ~(SELS_7)) | (source);)
/* Select source for MCLK and SMCLK e.g. SELECT_MCLK_SMCLK(SELM__DCOCLK + SELS__DCOCLK) */
#define SELECT_MCLK_SMCLK(sources) st(UCSCTL4 = (UCSCTL4 & ~(SELM_7 + SELS_7)) | (sources);)
/* set ACLK/x */
#define ACLK_DIV(x) st(UCSCTL5 = (UCSCTL5 & ~(DIVA_7)) | (DIVA__##x);)
/* set MCLK/x */
#define MCLK_DIV(x) st(UCSCTL5 = (UCSCTL5 & ~(DIVM_7)) | (DIVM__##x);)
/* set SMCLK/x */
#define SMCLK_DIV(x) st(UCSCTL5 = (UCSCTL5 & ~(DIVS_7)) | (DIVS__##x);)
/* Select divider for FLLREF e.g. SELECT_FLLREFDIV(2) */
#define SELECT_FLLREFDIV(x) st(UCSCTL3 = (UCSCTL3 & ~(FLLREFDIV_7))|(FLLREFDIV__##x);)
//************************************************************************
// Defines
//************************************************************************
#define UCS_STATUS_OK 0
#define UCS_STATUS_ERROR 1
//====================================================================
/**
* Startup routine for 32kHz Cristal on LFXT1
*
* \param xtdrive: Bits defining the LFXT drive mode after startup
*
*/
extern void LFXT_Start(uint16_t xtdrive);
//====================================================================
/**
* Startup routine for 32kHz Cristal on LFXT1 with timeout counter
*
* \param xtdrive: Bits defining the LFXT drive mode after startup
* \param timeout: value for the timeout counter
*
*/
extern uint16_t LFXT_Start_Timeout(uint16_t xtdrive, uint16_t timeout);
//====================================================================
/**
* Startup routine for XT1
*
* \param xtdrive: Bits defining the XT drive mode
*
*/
extern void XT1_Start(uint16_t xtdrive);
//====================================================================
/**
* Startup routine for XT1 with timeout counter
*
* \param xtdrive: Bits defining the XT drive mode
* \param timeout: value for the timeout counter
*
*/
extern uint16_t XT1_Start_Timeout(uint16_t xtdrive, uint16_t timeout);
//====================================================================
/**
* Use XT1 in Bypasss mode
*
*/
extern void XT1_Bypass(void);
//====================================================================
/**
* Startup routine for XT2
*
* \param xtdrive: Bits defining the XT drive mode
*
*/
extern void XT2_Start(uint16_t xtdrive);
//====================================================================
/**
* Startup routine for XT2 with timeout counter
*
* \param xtdrive: Bits defining the XT drive mode
* \param timeout: value for the timeout counter
*
*/
extern uint16_t XT2_Start_Timeout(uint16_t xtdrive, uint16_t timeout);
//====================================================================
/**
* Use XT2 in Bypasss mode for MCLK
*
*/
extern void XT2_Bypass(void);
//====================================================================
/**
* Initializes FLL of the UCS and wait till settled
*
* \param fsystem required system frequency (MCLK) in kHz
* \param ratio ratio between fsystem and FLLREFCLK
*/
extern void Init_FLL_Settle(uint16_t fsystem, uint16_t ratio);
//====================================================================
/**
* Initializes FLL of the UCS
*
* \param fsystem required system frequency (MCLK) in kHz
* \param ratio ratio between fsystem and FLLREFCLK
*/
static void Init_FLL(uint16_t fsystem, uint16_t ratio);
#endif /* __hal_UCS */

@ -0,0 +1,4 @@
/*
* This macro is for use by other macros to form a fully valid C statement.
*/
#define st(x) do { x } while (__LINE__ == -1)

@ -0,0 +1,27 @@
/*******************************************************************************
Filename: hal_MSP-EXP430F5438.h
Copyright 2010 Texas Instruments, Inc.
This is the master header file and also the only necessary file to be included
in order to use MSP-EXP430F5438 HAL.
***************************************************************************/
#ifndef HAL_MSP_EXP430F5438_H
#define HAL_MSP_EXP430F5438_H
#include "msp430.h"
#include "hal_PMM.h"
#include "hal_UCS.h"
#include "hal_lcd.h"
#include "hal_buttons.h"
#include "hal_adc.h"
#include "hal_board.h"
#include "hal_usb.h"
#include "hal_buttons.h"
#include "hal_rf.h"
#include "hal_rtc.h"
#include "hal_tlv.h"
#endif /* HAL_MSP_EXP430F5438_H */

@ -0,0 +1,74 @@
/**
* @file hal_board.c
*
* Copyright 2010 Texas Instruments, Inc.
******************************************************************************/
#include "msp430.h"
#include "hal_MSP-EXP430F5438.h"
/**********************************************************************//**
* @brief Initializes ACLK, MCLK, SMCLK outputs on P11.0, P11.1,
* and P11.2, respectively.
*
* @param none
*
* @return none
*************************************************************************/
void halBoardOutputSystemClock(void) //outputs clock to testpoints
{
CLK_PORT_DIR |= 0x07;
CLK_PORT_SEL |= 0x07;
}
/**********************************************************************//**
* @brief Stops the output of ACLK, MCLK, SMCLK on P11.0, P11.1, and P11.2.
*
* @param none
*
* @return none
*************************************************************************/
void halBoardStopOutputSystemClock(void)
{
CLK_PORT_OUT &= ~0x07;
CLK_PORT_DIR |= 0x07;
CLK_PORT_SEL &= ~0x07;
}
/**********************************************************************//**
* @brief Initializes all GPIO configurations.
*
* @param none
*
* @return none
*************************************************************************/
void halBoardInit(void)
{
//Tie unused ports
PAOUT = 0;
PADIR = 0xFFFF;
PASEL = 0;
PBOUT = 0;
PBDIR = 0xFFFF;
PBSEL = 0;
PCOUT = 0;
PCDIR = 0xFFFF;
PCSEL = 0;
PDOUT = 0;
PDDIR = 0xFFFF;
PDSEL = 0x0003;
PEOUT = 0;
PEDIR = 0xFEFF; // P10.0 to USB RST pin,
// ...if enabled with J5
PESEL = 0;
P11OUT = 0;
P11DIR = 0xFF;
PJOUT = 0;
PJDIR = 0xFF;
P11SEL = 0;
AUDIO_PORT_OUT = AUDIO_OUT_PWR_PIN ;
USB_PORT_DIR &= ~USB_PIN_RXD; // USB RX Pin, Input with
// ...pulled down Resistor
USB_PORT_OUT &= ~USB_PIN_RXD;
USB_PORT_REN |= USB_PIN_RXD;
}

@ -0,0 +1,31 @@
/**********************************************************************//**
Filename: hal_board.h
Copyright 2010 Texas Instruments, Inc.
***************************************************************************/
#ifndef HAL_BOARD_H
#define HAL_BOARD_H
#define LED_PORT_DIR P1DIR
#define LED_PORT_OUT P1OUT
#define LED_1 BIT0
#define LED_2 BIT1
#define CLK_PORT_DIR P11DIR //outputs clocks to testpoints
#define CLK_PORT_OUT P11OUT
#define CLK_PORT_SEL P11SEL
/*----------------------------------------------------------------
* Function Prototypes
*----------------------------------------------------------------
*/
static void halBoardGetSystemClockSettings(unsigned char systemClockSpeed,
unsigned char *setDcoRange,
unsigned char *setVCore,
unsigned int *setMultiplier);
extern void halBoardOutputSystemClock(void);
extern void halBoardStopOutputSystemClock(void);
extern void halBoardInit(void);
#endif /* HAL_BOARD_H */

@ -0,0 +1,76 @@
/**
* @file hal_buttons.c
*
* Copyright 2010 Texas Instruments, Inc.
***************************************************************************/
#include "msp430.h"
#include "hal_MSP-EXP430F5438.h"
/**********************************************************************//**
* @brief Initializes the GPIO ports to act as buttons.
*
* @param buttonsMask The mask that specifies the button pins.
*
* @return none
*************************************************************************/
void halButtonsInit(unsigned char buttonsMask)
{
BUTTON_PORT_OUT |= buttonsMask;
BUTTON_PORT_DIR &= ~buttonsMask;
BUTTON_PORT_REN |= buttonsMask;
BUTTON_PORT_SEL &= ~buttonsMask;
}
/**********************************************************************//**
* @brief Returns LOW for the buttons pressed.
*
* @param none
*
* @return The buttons that have been pressed, identified by a bit = 0.
*************************************************************************/
unsigned char halButtonsPressed(void)
{
unsigned char value;
value = BUTTON_PORT_IN;
return (0xFF - value); //Low==ButtonPressed
}
/**********************************************************************//**
* @brief Enables button interrupt(s) with low to high transitions.
*
* @param buttonIntEnableMask The button pin(s) for which the interrupt(s)
* should be enabled.
*
* @return none
*************************************************************************/
void halButtonsInterruptEnable(unsigned char buttonIntEnableMask)
{
BUTTON_PORT_IES &= ~buttonIntEnableMask;
BUTTON_PORT_IFG &= ~buttonIntEnableMask;
BUTTON_PORT_IE |= buttonIntEnableMask;
}
/**********************************************************************//**
* @brief Disables button interrupts
*
* @param buttonIntEnableMask The button pin(s) for which the interrupt(s)
* should be disabled.
*
* @return none
*************************************************************************/
void halButtonsInterruptDisable(unsigned char buttonIntEnableMask)
{
BUTTON_PORT_IE &= ~buttonIntEnableMask;
}
/**********************************************************************//**
* @brief Clears the button GPIO settings, disables the buttons.
*
* @param none
*************************************************************************/
void halButtonsShutDown()
{
//All output, outputting 0s
BUTTON_PORT_OUT &= ~(BUTTON_ALL);
BUTTON_PORT_DIR |= BUTTON_ALL;
}

@ -0,0 +1,38 @@
/*******************************************************************************
Filename: hal_buttons.h
Copyright 2010 Texas Instruments, Inc.
***************************************************************************/
#ifndef HAL_BUTTONS_H
#define HAL_BUTTONS_H
#define BUTTON_PORT_DIR P2DIR
#define BUTTON_PORT_SEL P2SEL
#define BUTTON_PORT_OUT P2OUT
#define BUTTON_PORT_REN P2REN
#define BUTTON_PORT_IE P2IE
#define BUTTON_PORT_IES P2IES
#define BUTTON_PORT_IFG P2IFG
#define BUTTON_PORT_IN P2IN
#define BUTTON_SELECT BIT3
#define BUTTON_DOWN BIT5
#define BUTTON_UP BIT4
#define BUTTON_RIGHT BIT2
#define BUTTON_LEFT BIT1
#define BUTTON_S1 BIT6
#define BUTTON_S2 BIT7
#define BUTTON_ALL 0xFE
extern volatile unsigned char buttonsPressed;
/*-------------------------------------------------------------
* Function Prototypes
* ------------------------------------------------------------*/
extern void halButtonsInit(unsigned char buttonsMask);
extern unsigned char halButtonsPressed(void);
extern void halButtonsInterruptEnable(unsigned char buttonIntEnableMask);
extern void halButtonsInterruptDisable(unsigned char buttonIntEnableMask);
extern void halButtonsShutDown();
#endif /* HAL_BUTTONS_H */

File diff suppressed because it is too large Load Diff

@ -0,0 +1,122 @@
/*******************************************************************************
Filename: hal_lcd.h
Copyright 2010 Texas Instruments, Inc.
***************************************************************************/
#ifndef HAL_LCD_H
#define HAL_LCD_H
#ifndef MIN
#define MIN(n,m) (((n) < (m)) ? (n) : (m))
#endif
#ifndef MAX
#define MAX(n,m) (((n) < (m)) ? (m) : (n))
#endif
#ifndef ABS
#define ABS(n) (((n) < 0) ? -(n) : (n))
#endif
#define LCD_BACKLT_OUT P8OUT
#define LCD_BACKLT_DIR P8DIR
#define LCD_BACKLT_SEL P8SEL
#define LCD_BACKLIGHT_PIN BIT3
#define LCD_CS_RST_DIR P9DIR
#define LCD_CS_RST_OUT P9OUT
#define LCD_CS_PIN BIT6
#define LCD_RESET_PIN BIT7
#define LCD_SPI_SEL P9SEL
#define LCD_SPI_DIR P9DIR
#define LCD_MOSI_PIN BIT1
#define LCD_MISO_PIN BIT2
#define LCD_CLK_PIN BIT3
#define LCD_ROW 110
#define LCD_COL 138
#define LCD_Size 3505
#define LCD_MEM_Size 110*17
#define LCD_Max_Column_Offset 0x10
#define LCD_Last_Pixel 3505
#define LCD_MEM_Row 0x11
#define LCD_Row 0x20
// Grayscale level definitions
#define PIXEL_OFF 0
#define PIXEL_LIGHT 1
#define PIXEL_DARK 2
#define PIXEL_ON 3
#define INVERT_TEXT BIT0
#define OVERWRITE_TEXT BIT2
#define GRAYSCALE_TEXT BIT1
/*-------------------------------------------------------------
* Function Prototypes
* ------------------------------------------------------------*/
extern void halLcdInit(void);
extern void halLcdShutDown(void);
extern void halLcdBackLightInit(void);
extern void halLcdSetBackLight(unsigned char BackLightLevel);
extern unsigned int halLcdGetBackLight(void);
extern void halLcdShutDownBackLight(void);
extern void halLcdSendCommand(unsigned char Data[]) ;
extern void halLcdSetContrast(unsigned char ContrastLevel);
extern unsigned char halLcdGetContrast(void);
extern void halLcdStandby(void);
extern void halLcdActive(void);
//Move to specified LCD address
extern void halLcdSetAddress(int Address);
//Draw at current segment location
extern void halLcdDrawCurrentBlock(unsigned int Value);
extern void halLcdDrawCurrentLine(const unsigned int *value, int length);
//Draw at specified location by calling
//LCD_Set_Address(Address) & LCD_Draw_Current_Block( value )
extern void halLcdDrawBlock(unsigned int Address, unsigned int Value);
//Read value from LCD CGRAM
extern int halLcdReadBlock(unsigned int Address);
//Clear LCD Screen
extern void halLcdClearScreen(void);
//Invert black to white and vice versa
extern void halLcdReverse(void);
// Draw a Pixel @ (x,y) with GrayScale level
extern void halLcdPixel( int x, int y, unsigned char GrayScale);
//Draw Line from (x1,y1) to (x2,y2) with GrayScale level
extern void halLcdLine( int x1, int y1, int x2, int y2, unsigned char GrayScale);
extern void halLcdHLine( int x1, int x2, int y, unsigned char GrayScale);
extern void halLcdVLine( int x1, int x2, int y, unsigned char GrayScale);
extern void halLcdCircle(int x, int y, int Radius, int GrayScale);
extern void halLcdImage(const unsigned int Image[], int Columns, int Rows, int x, int y);
extern void halLcdClearImage(int Columns, int Rows, int x, int y);
//Print String of Length starting at current LCD location
extern void halLcdPrint(char String[], unsigned char TextStyle) ;
//Print String of Length starting at (x,y)
extern void halLcdPrintXY(char String[], int x, int y, unsigned char TextStyle);
//Print String of Length starting at (x,y)
extern void halLcdPrintLine(char String[], unsigned char Line, unsigned char TextStyle);
extern void halLcdPrintLineCol(char String[], unsigned char Line, unsigned char Col, unsigned char TextStyle);
extern void halLcdCursor(void);
extern void halLcdCursorOff(void);
//Scroll a single row of pixels
extern void halLcdScrollRow(int y);
//Scroll a number of consecutive rows from yStart to yEnd
extern void halLcdHScroll(int yStart, int yEnd);
//Scroll a line of text
extern void halLcdScrollLine(int Line);
#endif /* HAL_LCD_H */

@ -0,0 +1,323 @@
/**********************************************************************//**
* @file UserExperienceGraphics.c
*
* Copyright 2010 Texas Instruments, Inc.
***************************************************************************/
const unsigned char fonts_lookup[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,63,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
64,65,0,69,0,68,67,0,0,1, //'0' = 48 = 0x30
2,3,4,5,6,7,8,9,66,0, //'9' = 57 = 0x39
0,70,0,62,0,10,11,12,13,14, //'A' --> 'Z'
15,16,17,18,19,20,21,22,23,24,
25,26,27,28,29,30,31,32,33,34,
35,0,0,0,71,0,0,36,37,38, //'a' = 97
39,40,41,42,43,44,45,46,47,48,
49,50,51,52,53,54,55,56,57,58,
59,60,61,62,0 ,0, 0, 72,73,74,
75,76,77,78,79,80,81 //'z' = 122
};
const unsigned int fonts[]= {
0x0000, 0x0ffc, 0x3c0f, 0x3f0f, 0x3fcf, 0x3ccf, 0x3cff, 0x3c3f,
0x3c0f, 0x0ffc, 0x0000, 0x0000, 0x0000, 0x0000, 0x00c0, 0x00f0,
0x00ff, 0x00f0, 0x00f0, 0x00f0, 0x00f0, 0x00f0, 0x0fff, 0x0000,
0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f00, 0x03c0,
0x00f0, 0x003c, 0x0f0f, 0x0fff, 0x0000, 0x0000, 0x0000, 0x0000,
0x03fc, 0x0f0f, 0x0f00, 0x0f00, 0x03f0, 0x0f00, 0x0f00, 0x0f0f,
0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f00, 0x0fc0, 0x0ff0,
0x0f3c, 0x0f0f, 0x3fff, 0x0f00, 0x0f00, 0x3fc0, 0x0000, 0x0000,
0x0000, 0x0000, 0x0fff, 0x000f, 0x000f, 0x000f, 0x03ff, 0x0f00,
0x0f00, 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x03f0,
0x003c, 0x000f, 0x000f, 0x03ff, 0x0f0f, 0x0f0f, 0x0f0f, 0x03fc,
0x0000, 0x0000, 0x0000, 0x0000, 0x3fff, 0x3c0f, 0x3c0f, 0x3c00,
0x0f00, 0x03c0, 0x00f0, 0x00f0, 0x00f0, 0x0000, 0x0000, 0x0000,
0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f3f, 0x03fc, 0x0fcf, 0x0f0f,
0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f,
0x0f0f, 0x0f0f, 0x0ffc, 0x03c0, 0x03c0, 0x00f0, 0x00fc, 0x0000,
0x0000, 0x0000, 0x0000, 0x00f0, 0x03fc, 0x0f0f, 0x0f0f, 0x0f0f,
0x0fff, 0x0f0f, 0x0f0f, 0x0f0f, 0x0000, 0x0000, 0x0000, 0x0000,
0x0fff, 0x3c3c, 0x3c3c, 0x3c3c, 0x0ffc, 0x3c3c, 0x3c3c, 0x3c3c,
0x0fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0ff0, 0x3c3c, 0x3c0f,
0x000f, 0x000f, 0x000f, 0x3c0f, 0x3c3c, 0x0ff0, 0x0000, 0x0000,
0x0000, 0x0000, 0x03ff, 0x0f3c, 0x3c3c, 0x3c3c, 0x3c3c, 0x3c3c,
0x3c3c, 0x0f3c, 0x03ff, 0x0000, 0x0000, 0x0000, 0x0000, 0x3fff,
0x303c, 0x003c, 0x0c3c, 0x0ffc, 0x0c3c, 0x003c, 0x303c, 0x3fff,
0x0000, 0x0000, 0x0000, 0x0000, 0x3fff, 0x3c3c, 0x303c, 0x0c3c,
0x0ffc, 0x0c3c, 0x003c, 0x003c, 0x00ff, 0x0000, 0x0000, 0x0000,
0x0000, 0x0ff0, 0x3c3c, 0x3c0f, 0x000f, 0x000f, 0x3f0f, 0x3c0f,
0x3c3c, 0x3ff0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f, 0x0f0f,
0x0f0f, 0x0f0f, 0x0fff, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0000,
0x0000, 0x0000, 0x0000, 0x03fc, 0x00f0, 0x00f0, 0x00f0, 0x00f0,
0x00f0, 0x00f0, 0x00f0, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000,
0x3fc0, 0x0f00, 0x0f00, 0x0f00, 0x0f00, 0x0f0f, 0x0f0f, 0x0f0f,
0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x3c3f, 0x3c3c, 0x0f3c,
0x0f3c, 0x03fc, 0x0f3c, 0x0f3c, 0x3c3c, 0x3c3f, 0x0000, 0x0000,
0x0000, 0x0000, 0x00ff, 0x003c, 0x003c, 0x003c, 0x003c, 0x303c,
0x3c3c, 0x3c3c, 0x3fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x3c0f,
0x3f3f, 0x3fff, 0x3fff, 0x3ccf, 0x3c0f, 0x3c0f, 0x3c0f, 0x3c0f,
0x0000, 0x0000, 0x0000, 0x0000, 0x3c0f, 0x3c0f, 0x3c3f, 0x3cff,
0x3fff, 0x3fcf, 0x3f0f, 0x3c0f, 0x3c0f, 0x0000, 0x0000, 0x0000,
0x0000, 0x03f0, 0x0f3c, 0x3c0f, 0x3c0f, 0x3c0f, 0x3c0f, 0x3c0f,
0x0f3c, 0x03f0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0fff, 0x3c3c,
0x3c3c, 0x3c3c, 0x0ffc, 0x003c, 0x003c, 0x003c, 0x00ff, 0x0000,
0x0000, 0x0000, 0x0000, 0x03f0, 0x0f3c, 0x3c0f, 0x3c0f, 0x3c0f,
0x3f0f, 0x3fcf, 0x0ffc, 0x0f00, 0x3fc0, 0x0000, 0x0000, 0x0000,
0x0fff, 0x3c3c, 0x3c3c, 0x3c3c, 0x0ffc, 0x0f3c, 0x3c3c, 0x3c3c,
0x3c3f, 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f, 0x0f0f,
0x000f, 0x00fc, 0x03c0, 0x0f0f, 0x0f0f, 0x03fc, 0x0000, 0x0000,
0x0000, 0x0000, 0x0fff, 0x0cf3, 0x00f0, 0x00f0, 0x00f0, 0x00f0,
0x00f0, 0x00f0, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f,
0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x03fc,
0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f,
0x0f0f, 0x0f0f, 0x0f0f, 0x03fc, 0x00f0, 0x0000, 0x0000, 0x0000,
0x0000, 0x3c0f, 0x3c0f, 0x3c0f, 0x3c0f, 0x3ccf, 0x3ccf, 0x0f3c,
0x0f3c, 0x0f3c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f, 0x0f0f,
0x0f0f, 0x03fc, 0x00f0, 0x03fc, 0x0f0f, 0x0f0f, 0x0f0f, 0x0000,
0x0000, 0x0000, 0x0000, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x03fc,
0x00f0, 0x00f0, 0x00f0, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000,
0x3fff, 0x3f0f, 0x03c3, 0x03c0, 0x00f0, 0x003c, 0x303c, 0x3c0f,
0x3fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x03fc, 0x0f00, 0x0ffc, 0x0f0f, 0x0f0f, 0x3cfc, 0x0000, 0x0000,
0x0000, 0x0000, 0x003f, 0x003c, 0x003c, 0x0ffc, 0x3c3c, 0x3c3c,
0x3c3c, 0x3c3c, 0x0fcf, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x03fc, 0x0f0f, 0x000f, 0x000f, 0x0f0f, 0x03fc,
0x0000, 0x0000, 0x0000, 0x0000, 0x0fc0, 0x0f00, 0x0f00, 0x0ffc,
0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x3cfc, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f, 0x0fff, 0x000f,
0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x03f0, 0x0f3c,
0x003c, 0x003c, 0x03ff, 0x003c, 0x003c, 0x003c, 0x00ff, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3cfc, 0x0f0f,
0x0f0f, 0x0f0f, 0x0ffc, 0x0f00, 0x0f0f, 0x03fc, 0x0000, 0x0000,
0x003f, 0x003c, 0x003c, 0x0f3c, 0x3cfc, 0x3c3c, 0x3c3c, 0x3c3c,
0x3c3f, 0x0000, 0x0000, 0x0000, 0x0000, 0x03c0, 0x03c0, 0x0000,
0x03fc, 0x03c0, 0x03c0, 0x03c0, 0x03c0, 0x3ffc, 0x0000, 0x0000,
0x0000, 0x0000, 0x0f00, 0x0f00, 0x0000, 0x0ff0, 0x0f00, 0x0f00,
0x0f00, 0x0f00, 0x0f0f, 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x003f,
0x003c, 0x003c, 0x3c3c, 0x0f3c, 0x03fc, 0x0f3c, 0x3c3c, 0x3c3f,
0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x03c0, 0x03c0, 0x03c0,
0x03c0, 0x03c0, 0x03c0, 0x03c0, 0x3ffc, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0fff, 0x3ccf, 0x3ccf, 0x3ccf,
0x3ccf, 0x3c0f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x03ff, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f,
0x0f0f, 0x0f0f, 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0fcf, 0x3c3c, 0x3c3c, 0x3c3c, 0x3c3c,
0x0ffc, 0x003c, 0x00ff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3cfc, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0ffc, 0x0f00, 0x3fc0,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f3f, 0x3f3c, 0x3cfc,
0x003c, 0x003c, 0x00ff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x03fc, 0x0f0f, 0x003c, 0x03c0, 0x0f0f, 0x03fc,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0030, 0x003c, 0x0fff,
0x003c, 0x003c, 0x003c, 0x0f3c, 0x03f0, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f,
0x0f0f, 0x3cfc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x03fc, 0x00f0, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3c0f, 0x3c0f,
0x3ccf, 0x3ccf, 0x0f3c, 0x0f3c, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3c0f, 0x0f3c, 0x03f0, 0x03f0, 0x0f3c,
0x3c0f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3c3c, 0x3c3c, 0x3c3c, 0x3c3c, 0x0ff0, 0x0f00, 0x03c0, 0x00ff,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0fff, 0x0f03, 0x03c0,
0x003c, 0x0c0f, 0x0fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc,
0x0f0f, 0x0f00, 0x03c0, 0x00f0, 0x00f0, 0x0000, 0x00f0, 0x00f0,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0f00, 0x03c0, 0x00f0, 0x003c, 0x003c, 0x003c, 0x00f0,
0x03c0, 0x0f00, 0x0000, 0x0000, 0x0000, 0x0000, 0x003c, 0x00f0,
0x03c0, 0x0f00, 0x0f00, 0x0f00, 0x03c0, 0x00f0, 0x003c, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03f0, 0x03f0, 0x0000,
0x0000, 0x03f0, 0x03f0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03f0,
0x03f0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3ffc, 0x3ffc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x03c0, 0x03c0, 0x3ffc, 0x3ffc,
0x03c0, 0x03c0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3ffc, 0x0000, 0x0000, 0x3ffc, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f0f,
0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
//0---------------------------
0x0000, 0x0ffc, 0x3c0f, 0x3f0f, 0x3fcf, 0x3ccf, 0x3cff, 0x3c3f,
0x3c0f, 0x0ffc, 0x0000, 0x0000, 0x0000,
//1---------------------------
0x0000, 0x00c0, 0x00f0, 0x00ff, 0x00f0, 0x00f0, 0x00f0, 0x00f0,
0x00f0, 0x0fff, 0x0000, 0x0000, 0x0000,
//2---------------------------
0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f00, 0x03c0, 0x00f0, 0x003c,
0x0f0f, 0x0fff, 0x0000, 0x0000, 0x0000,
//3---------------------------
0x0000, 0x03fc, 0x0f0f, 0x0f00, 0x0f00, 0x03f0, 0x0f00, 0x0f00,
0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000,
//4---------------------------
0x0000, 0x0f00, 0x0fc0, 0x0ff0, 0x0f3c, 0x0f0f, 0x3fff, 0x0f00,
0x0f00, 0x3fc0, 0x0000, 0x0000, 0x0000,
//5---------------------------
0x0000, 0x0fff, 0x000f, 0x000f, 0x000f, 0x03ff, 0x0f00, 0x0f00,
0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000,
//6---------------------------
0x0000, 0x03f0, 0x003c, 0x000f, 0x000f, 0x03ff, 0x0f0f, 0x0f0f,
0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000,
//7---------------------------
0x0000, 0x3fff, 0x3c0f, 0x3c0f, 0x3c00, 0x0f00, 0x03c0, 0x00f0,
0x00f0, 0x00f0, 0x0000, 0x0000, 0x0000,
//8---------------------------
0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f3f, 0x03fc, 0x0fcf, 0x0f0f,
0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000,
//9---------------------------
0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f0f, 0x0ffc, 0x03c0, 0x03c0,
0x00f0, 0x00fc, 0x0000, 0x0000, 0x0000,
} ;
const unsigned int GrayScale_fonts[]= {
0x0000, 0x0aa8, 0x280a, 0x2a0a, 0x2a8a, 0x288a, 0x28aa, 0x282a,
0x280a, 0x0aa8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0080, 0x00a0,
0x00aa, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x0aaa, 0x0000,
0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a00, 0x0280,
0x00a0, 0x0028, 0x0a0a, 0x0aaa, 0x0000, 0x0000, 0x0000, 0x0000,
0x02a8, 0x0a0a, 0x0a00, 0x0a00, 0x02a0, 0x0a00, 0x0a00, 0x0a0a,
0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0a00, 0x0a80, 0x0aa0,
0x0a28, 0x0a0a, 0x2aaa, 0x0a00, 0x0a00, 0x2a80, 0x0000, 0x0000,
0x0000, 0x0000, 0x0aaa, 0x000a, 0x000a, 0x000a, 0x02aa, 0x0a00,
0x0a00, 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a0,
0x0028, 0x000a, 0x000a, 0x02aa, 0x0a0a, 0x0a0a, 0x0a0a, 0x02a8,
0x0000, 0x0000, 0x0000, 0x0000, 0x2aaa, 0x280a, 0x280a, 0x2800,
0x0a00, 0x0280, 0x00a0, 0x00a0, 0x00a0, 0x0000, 0x0000, 0x0000,
0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a2a, 0x02a8, 0x0a8a, 0x0a0a,
0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a,
0x0a0a, 0x0a0a, 0x0aa8, 0x0280, 0x0280, 0x00a0, 0x00a8, 0x0000,
0x0000, 0x0000, 0x0000, 0x00a0, 0x02a8, 0x0a0a, 0x0a0a, 0x0a0a,
0x0aaa, 0x0a0a, 0x0a0a, 0x0a0a, 0x0000, 0x0000, 0x0000, 0x0000,
0x0aaa, 0x2828, 0x2828, 0x2828, 0x0aa8, 0x2828, 0x2828, 0x2828,
0x0aaa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0aa0, 0x2828, 0x280a,
0x000a, 0x000a, 0x000a, 0x280a, 0x2828, 0x0aa0, 0x0000, 0x0000,
0x0000, 0x0000, 0x02aa, 0x0a28, 0x2828, 0x2828, 0x2828, 0x2828,
0x2828, 0x0a28, 0x02aa, 0x0000, 0x0000, 0x0000, 0x0000, 0x2aaa,
0x2028, 0x0028, 0x0828, 0x0aa8, 0x0828, 0x0028, 0x2028, 0x2aaa,
0x0000, 0x0000, 0x0000, 0x0000, 0x2aaa, 0x2828, 0x2028, 0x0828,
0x0aa8, 0x0828, 0x0028, 0x0028, 0x00aa, 0x0000, 0x0000, 0x0000,
0x0000, 0x0aa0, 0x2828, 0x280a, 0x000a, 0x000a, 0x2a0a, 0x280a,
0x2828, 0x2aa0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0a0a, 0x0a0a,
0x0a0a, 0x0a0a, 0x0aaa, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0000,
0x0000, 0x0000, 0x0000, 0x02a8, 0x00a0, 0x00a0, 0x00a0, 0x00a0,
0x00a0, 0x00a0, 0x00a0, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000,
0x2a80, 0x0a00, 0x0a00, 0x0a00, 0x0a00, 0x0a0a, 0x0a0a, 0x0a0a,
0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x282a, 0x2828, 0x0a28,
0x0a28, 0x02a8, 0x0a28, 0x0a28, 0x2828, 0x282a, 0x0000, 0x0000,
0x0000, 0x0000, 0x00aa, 0x0028, 0x0028, 0x0028, 0x0028, 0x2028,
0x2828, 0x2828, 0x2aaa, 0x0000, 0x0000, 0x0000, 0x0000, 0x280a,
0x2a2a, 0x2aaa, 0x2aaa, 0x288a, 0x280a, 0x280a, 0x280a, 0x280a,
0x0000, 0x0000, 0x0000, 0x0000, 0x280a, 0x280a, 0x282a, 0x28aa,
0x2aaa, 0x2a8a, 0x2a0a, 0x280a, 0x280a, 0x0000, 0x0000, 0x0000,
0x0000, 0x02a0, 0x0a28, 0x280a, 0x280a, 0x280a, 0x280a, 0x280a,
0x0a28, 0x02a0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0aaa, 0x2828,
0x2828, 0x2828, 0x0aa8, 0x0028, 0x0028, 0x0028, 0x00aa, 0x0000,
0x0000, 0x0000, 0x0000, 0x02a0, 0x0a28, 0x280a, 0x280a, 0x280a,
0x2a0a, 0x2a8a, 0x0aa8, 0x0a00, 0x2a80, 0x0000, 0x0000, 0x0000,
0x0aaa, 0x2828, 0x2828, 0x2828, 0x0aa8, 0x0a28, 0x2828, 0x2828,
0x282a, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a, 0x0a0a,
0x000a, 0x00a8, 0x0280, 0x0a0a, 0x0a0a, 0x02a8, 0x0000, 0x0000,
0x0000, 0x0000, 0x0aaa, 0x08a2, 0x00a0, 0x00a0, 0x00a0, 0x00a0,
0x00a0, 0x00a0, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0a0a,
0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x02a8,
0x0000, 0x0000, 0x0000, 0x0000, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a,
0x0a0a, 0x0a0a, 0x0a0a, 0x02a8, 0x00a0, 0x0000, 0x0000, 0x0000,
0x0000, 0x280a, 0x280a, 0x280a, 0x280a, 0x288a, 0x288a, 0x0a28,
0x0a28, 0x0a28, 0x0000, 0x0000, 0x0000, 0x0000, 0x0a0a, 0x0a0a,
0x0a0a, 0x02a8, 0x00a0, 0x02a8, 0x0a0a, 0x0a0a, 0x0a0a, 0x0000,
0x0000, 0x0000, 0x0000, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x02a8,
0x00a0, 0x00a0, 0x00a0, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000,
0x2aaa, 0x2a0a, 0x0282, 0x0280, 0x00a0, 0x0028, 0x2028, 0x280a,
0x2aaa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x02a8, 0x0a00, 0x0aa8, 0x0a0a, 0x0a0a, 0x28a8, 0x0000, 0x0000,
0x0000, 0x0000, 0x002a, 0x0028, 0x0028, 0x0aa8, 0x2828, 0x2828,
0x2828, 0x2828, 0x0a8a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x02a8, 0x0a0a, 0x000a, 0x000a, 0x0a0a, 0x02a8,
0x0000, 0x0000, 0x0000, 0x0000, 0x0a80, 0x0a00, 0x0a00, 0x0aa8,
0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x28a8, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a, 0x0aaa, 0x000a,
0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a0, 0x0a28,
0x0028, 0x0028, 0x02aa, 0x0028, 0x0028, 0x0028, 0x00aa, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x28a8, 0x0a0a,
0x0a0a, 0x0a0a, 0x0aa8, 0x0a00, 0x0a0a, 0x02a8, 0x0000, 0x0000,
0x002a, 0x0028, 0x0028, 0x0a28, 0x28a8, 0x2828, 0x2828, 0x2828,
0x282a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0280, 0x0280, 0x0000,
0x02a8, 0x0280, 0x0280, 0x0280, 0x0280, 0x2aa8, 0x0000, 0x0000,
0x0000, 0x0000, 0x0a00, 0x0a00, 0x0000, 0x0aa0, 0x0a00, 0x0a00,
0x0a00, 0x0a00, 0x0a0a, 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x002a,
0x0028, 0x0028, 0x2828, 0x0a28, 0x02a8, 0x0a28, 0x2828, 0x282a,
0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0280, 0x0280, 0x0280,
0x0280, 0x0280, 0x0280, 0x0280, 0x2aa8, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0aaa, 0x288a, 0x288a, 0x288a,
0x288a, 0x280a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x02aa, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a,
0x0a0a, 0x0a0a, 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0a8a, 0x2828, 0x2828, 0x2828, 0x2828,
0x0aa8, 0x0028, 0x00aa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x28a8, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0aa8, 0x0a00, 0x2a80,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0a2a, 0x2a28, 0x28a8,
0x0028, 0x0028, 0x00aa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x02a8, 0x0a0a, 0x0028, 0x0280, 0x0a0a, 0x02a8,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0020, 0x0028, 0x0aaa,
0x0028, 0x0028, 0x0028, 0x0a28, 0x02a0, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a,
0x0a0a, 0x28a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x02a8, 0x00a0, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x280a, 0x280a,
0x288a, 0x288a, 0x0a28, 0x0a28, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x280a, 0x0a28, 0x02a0, 0x02a0, 0x0a28,
0x280a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x2828, 0x2828, 0x2828, 0x2828, 0x0aa0, 0x0a00, 0x0280, 0x00aa,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0aaa, 0x0a02, 0x0280,
0x0028, 0x080a, 0x0aaa, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8,
0x0a0a, 0x0a00, 0x0280, 0x00a0, 0x00a0, 0x0000, 0x00a0, 0x00a0,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0a00, 0x0280, 0x00a0, 0x0028, 0x0028, 0x0028, 0x00a0,
0x0280, 0x0a00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0028, 0x00a0,
0x0280, 0x0a00, 0x0a00, 0x0a00, 0x0280, 0x00a0, 0x0028, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a0, 0x02a0, 0x0000,
0x0000, 0x02a0, 0x02a0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a0,
0x02a0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x2aa8, 0x2aa8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0280, 0x0280, 0x2aa8, 0x2aa8,
0x0280, 0x0280, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x2aa8, 0x0000, 0x0000, 0x2aa8, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a0a,
0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
//0---------------------------
0x0000, 0x0aa8, 0x280a, 0x2a0a, 0x2a8a, 0x288a, 0x28aa, 0x282a,
0x280a, 0x0aa8, 0x0000, 0x0000, 0x0000,
//1---------------------------
0x0000, 0x0080, 0x00a0, 0x00aa, 0x00a0, 0x00a0, 0x00a0, 0x00a0,
0x00a0, 0x0aaa, 0x0000, 0x0000, 0x0000,
//2---------------------------
0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a00, 0x0280, 0x00a0, 0x0028,
0x0a0a, 0x0aaa, 0x0000, 0x0000, 0x0000,
//2---------------------------
0x0000, 0x02a8, 0x0a0a, 0x0a00, 0x0a00, 0x02a0, 0x0a00, 0x0a00,
0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000,
//4---------------------------
0x0000, 0x0a00, 0x0a80, 0x0aa0, 0x0a28, 0x0a0a, 0x2aaa, 0x0a00,
0x0a00, 0x2a80, 0x0000, 0x0000, 0x0000,
//5---------------------------
0x0000, 0x0aaa, 0x000a, 0x000a, 0x000a, 0x02aa, 0x0a00, 0x0a00,
0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000,
//6---------------------------
0x0000, 0x02a0, 0x0028, 0x000a, 0x000a, 0x02aa, 0x0a0a, 0x0a0a,
0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000,
//7---------------------------
0x0000, 0x2aaa, 0x280a, 0x280a, 0x2800, 0x0a00, 0x0280, 0x00a0,
0x00a0, 0x00a0, 0x0000, 0x0000, 0x0000,
//8---------------------------
0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a2a, 0x02a8, 0x0a8a, 0x0a0a,
0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000,
//9---------------------------
0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a0a, 0x0aa8, 0x0280, 0x0280,
0x00a0, 0x00a8, 0x0000, 0x0000, 0x0000,
} ;

@ -0,0 +1,15 @@
/*******************************************************************************
Filename: hal_lcd_fonts.h
Copyright 2010 Texas Instruments, Inc.
***************************************************************************/
#ifndef FONTS_H
#define FONTS_H
#define FONT_HEIGHT 12 // Each character has 13 lines
extern const unsigned char fonts_lookup[];
extern const unsigned int fonts[];
extern const unsigned int GrayScale_fonts[];
#endif /* FONTS_H */

@ -1851,18 +1851,12 @@
</file>
<file>
<name>$PROJ_DIR$\MSP-EXP430F5438_HAL\hal_lcd.c</name>
<excluded>
<configuration>Debug</configuration>
</excluded>
</file>
<file>
<name>$PROJ_DIR$\MSP-EXP430F5438_HAL\hal_lcd.h</name>
</file>
<file>
<name>$PROJ_DIR$\MSP-EXP430F5438_HAL\hal_lcd_fonts.c</name>
<excluded>
<configuration>Debug</configuration>
</excluded>
</file>
<file>
<name>$PROJ_DIR$\MSP-EXP430F5438_HAL\hal_lcd_fonts.h</name>
@ -1915,6 +1909,12 @@
<file>
<name>$PROJ_DIR$\..\Common\Minimal\comtest.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\dynamic.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\GenQTest.c</name>
</file>
</group>
<group>
<name>UserExperienceDemo</name>

@ -65,7 +65,9 @@
/* Standard demo includes. */
#include "ParTest.h"
#include "dynamic.h"
#include "comtest2.h"
#include "GenQTest.h"
/* Codes sent within messages to the LCD task so the LCD task can interpret
exactly what the message it just received was. These are sent in the
@ -88,13 +90,15 @@ to send messages from tasks and interrupts the the LCD task. */
#define mainLCD_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 )
#define mainGENERIC_QUEUE_TEST_PRIORITY ( tskIDLE_PRIORITY )
/* The LED used by the comtest tasks. See the comtest.c file for more
information. In this case it is deliberately out of range as there are only
two LEDs, and they are both already in use. */
#define mainCOM_TEST_LED ( 3 )
#define mainCOM_TEST_LED ( 3 )
/* The baud rate used by the comtest tasks described at the top of this file. */
#define mainCOM_TEST_BAUD_RATE ( 9600 )
/*-----------------------------------------------------------*/
extern void vRegTest1Task( void *pvParameters );
@ -137,13 +141,16 @@ void main( void )
vQueueAddToRegistry( xLCDQueue, "LCDQueue" );
/* Create the standard demo tasks. */
vAltStartComTestTasks( mainCOM_TEST_PRIORITY, 9600, mainCOM_TEST_LED );
vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );
vStartDynamicPriorityTasks();
vStartGenericQueueTasks( mainGENERIC_QUEUE_TEST_PRIORITY );
/* Create the terminal IO and button poll tasks, as described at the top
of this file. */
xTaskCreate( prvTerminalIOTask, ( signed char * ) "IO", configMINIMAL_STACK_SIZE * 2, NULL, mainLCD_TASK_PRIORITY, NULL );
xTaskCreate( prvButtonPollTask, ( signed char * ) "BPoll", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
/* Create the register test tasks as described at the top of this file. */
xTaskCreate( vRegTest1Task, "Reg1", configMINIMAL_STACK_SIZE, NULL, 0, NULL );
xTaskCreate( vRegTest2Task, "Reg2", configMINIMAL_STACK_SIZE, NULL, 0, NULL );
vTaskStartScheduler();
@ -161,6 +168,8 @@ LCD. Note this is a static variable to prevent it being allocated on the task
stack, which is too small to hold such a variable. The stack size is configured
when the task is created. */
static char cBuffer[ 512 ];
unsigned char ucLine = 1;
/* This function is the only function that uses printf(). If printf() is
used from any other function then some sort of mutual exclusion on stdout
@ -181,6 +190,13 @@ static char cBuffer[ 512 ];
has been received. */
xQueueReceive( xLCDQueue, &xReceivedMessage, portMAX_DELAY );
/* Clear the LCD if no room remains for any more text output. */
if( ucLine > 8 )
{
halLcdClearScreen();
ucLine = 0;
}
/* What is this message? What does it contain? */
switch( xReceivedMessage.cMessageID )
{
@ -201,7 +217,18 @@ static char cBuffer[ 512 ];
printf( "\nTask\t Abs Time\t %%Time\n*****************************************" );
fflush( stdout );
vTaskGetRunTimeStats( ( signed char * ) cBuffer );
// printf( cBuffer );
printf( cBuffer );
fflush( stdout );
/* Also print out a message to
the LCD - in this case the
pointer to the string to print
is sent directly in the
lMessageValue member of the
message. This just demonstrates
a different communication
technique. */
sprintf( cBuffer, "%s", ( char * ) xReceivedMessage.ulMessageValue );
break;
case mainMESSAGE_STATUS : /* The tick interrupt hook
@ -216,10 +243,8 @@ static char cBuffer[ 512 ];
break;
}
/* Output the message that was placed into the cBuffer array within the
switch statement above. */
printf( "%s : %u\n", cBuffer, ( unsigned int ) xTaskGetTickCount() );
fflush( stdout );
halLcdPrintLine( cBuffer, ucLine, OVERWRITE_TEXT );
ucLine++;
}
}
/*-----------------------------------------------------------*/
@ -230,9 +255,9 @@ static void prvGenerateStatusMessage( char *pcBuffer, long lStatusValue )
string for output onto the LCD. */
switch( lStatusValue )
{
case pdPASS : sprintf( pcBuffer, "Task status = PASS" );
case pdPASS : sprintf( pcBuffer, "Status = PASS" );
break;
case mainERROR_DYNAMIC_TASKS : sprintf( pcBuffer, "Error: Dynamic tasks" );
case mainERROR_DYNAMIC_TASKS : sprintf( pcBuffer, "Err: Dynamic tsks" );
break;
case mainERROR_COM_TEST : sprintf( pcBuffer, "Err: COM test" ); /* Error in COM test - is the Loopback connector connected? */
break;
@ -284,10 +309,19 @@ static void prvSetupHardware( void )
unsigned long ulCPU_Clock_KHz = ( configCPU_CLOCK_HZ / 1000UL );
halBoardInit();
halButtonsInit( BUTTON_ALL );
halButtonsInterruptEnable( BUTTON_SELECT );
LFXT_Start( XT1DRIVE_0 );
Init_FLL_Settle( ( unsigned short ) ulCPU_Clock_KHz, 488 );
halButtonsInit( BUTTON_ALL );
halButtonsInterruptEnable( BUTTON_SELECT );
halLcdInit();
halLcdBackLightInit();
halLcdSetBackLight( 0 );
halLcdSetContrast( 100 );
halLcdClearScreen();
halLcdPrintLine( " www.FreeRTOS.org", 0, OVERWRITE_TEXT );
}
/*-----------------------------------------------------------*/
@ -358,44 +392,38 @@ static xQueueMessage xStatusMessage = { mainMESSAGE_STATUS, pdPASS };
ulCounter++;
if( ulCounter >= ulCheckFrequency )
{
#ifdef LEFT_OVER_FROM_CUT_AND_PASTE
/* See if the standard demo tasks are executing as expected, changing
the message that is sent to the LCD task from PASS to an error code if
any tasks set reports an error. */
if( xAreDynamicPriorityTasksStillRunning() != pdPASS )
{
xStatusMessage.lMessageValue = mainERROR_DYNAMIC_TASKS;
}
if( xAreGenericQueueTasksStillRunning() != pdPASS )
{
xStatusMessage.lMessageValue = mainERROR_GEN_QUEUE_TEST;
}
#else
/* See if the standard demo tasks are executing as expected, changing
the message that is sent to the LCD task from PASS to an error code if
any tasks set reports an error. */
if( xAreComTestTasksStillRunning() != pdPASS )
{
xStatusMessage.ulMessageValue = mainERROR_COM_TEST;
}
/* Check the reg test tasks are still cycling. They will stop incrementing
their loop counters if they encounter an error. */
if( usRegTest1Counter == usLastRegTest1Counter )
{
xStatusMessage.ulMessageValue = mainERROR_REG_TEST;
}
if( usRegTest2Counter == usLastRegTest2Counter )
{
xStatusMessage.ulMessageValue = mainERROR_REG_TEST;
}
usLastRegTest1Counter = usRegTest1Counter;
usLastRegTest2Counter = usRegTest2Counter;
#endif
/* See if the standard demo tasks are executing as expected, changing
the message that is sent to the LCD task from PASS to an error code if
any tasks set reports an error. */
if( xAreComTestTasksStillRunning() != pdPASS )
{
xStatusMessage.ulMessageValue = mainERROR_COM_TEST;
}
if( xAreDynamicPriorityTasksStillRunning() != pdPASS )
{
xStatusMessage.ulMessageValue = mainERROR_DYNAMIC_TASKS;
}
if( xAreGenericQueueTasksStillRunning() != pdPASS )
{
xStatusMessage.ulMessageValue = mainERROR_GEN_QUEUE_TEST;
}
/* Check the reg test tasks are still cycling. They will stop incrementing
their loop counters if they encounter an error. */
if( usRegTest1Counter == usLastRegTest1Counter )
{
xStatusMessage.ulMessageValue = mainERROR_REG_TEST;
}
if( usRegTest2Counter == usLastRegTest2Counter )
{
xStatusMessage.ulMessageValue = mainERROR_REG_TEST;
}
usLastRegTest1Counter = usRegTest1Counter;
usLastRegTest2Counter = usRegTest2Counter;
/* As this is the tick hook the lHigherPriorityTaskWoken parameter is not
needed (a context switch is going to be performed anyway), but it must
@ -424,7 +452,7 @@ static xQueueMessage xStatusMessage = { mainMESSAGE_STATUS, pdPASS };
__interrupt static void prvSelectButtonInterrupt(void)
{
/* Define the message sent to the LCD task from this interrupt. */
static const xQueueMessage xMessage = { mainMESSAGE_BUTTON_SEL, ( unsigned long ) "Select Interrupt!" };
static const xQueueMessage xMessage = { mainMESSAGE_BUTTON_SEL, ( unsigned long ) "Select Interrupt" };
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
/* This is the interrupt handler for the joystick select button input.

Loading…
Cancel
Save