#ifndef HAL_PMM_H

#define HAL_PMM_H
#include <stdint.h>
#include "HAL_MACROS.h"
/*******************************************************************************
* Macros
******************************************************************************/
#define ENABLE_SVSL()
st(PMMCTL0_H = 0xA5; SVSMLCTL |= SVSLE; PMMCTL0_H =
0x00;)
#define DISABLE_SVSL()
st(PMMCTL0_H = 0xA5; SVSMLCTL &= ~SVSLE; PMMCTL0_H
= 0x00;)
#define ENABLE_SVML()
st(PMMCTL0_H = 0xA5; SVSMLCTL |= SVMLE; PMMCTL0_H =
0x00;)
#define DISABLE_SVML()
st(PMMCTL0_H = 0xA5; SVSMLCTL &= ~SVMLE; PMMCTL0_H
= 0x00;)
#define ENABLE_SVSH()
st(PMMCTL0_H = 0xA5; SVSMHCTL |= SVSHE; PMMCTL0_H =
0x00;)
#define DISABLE_SVSH()
st(PMMCTL0_H = 0xA5; SVSMHCTL &= ~SVSHE; PMMCTL0_H
= 0x00;)
#define ENABLE_SVMH()
st(PMMCTL0_H = 0xA5; SVSMHCTL |= SVMHE; PMMCTL0_H =
0x00;)
#define DISABLE_SVMH()
st(PMMCTL0_H = 0xA5; SVSMHCTL &= ~SVMHE; PMMCTL0_H
= 0x00;)
#define ENABLE_SVSL_SVML() st(PMMCTL0_H = 0xA5; SVSMLCTL |= (SVSLE + SVMLE); P
MMCTL0_H = 0x00;)
#define DISABLE_SVSL_SVML() st(PMMCTL0_H = 0xA5; SVSMLCTL &= ~(SVSLE + SVMLE);
PMMCTL0_H = 0x00;)
#define ENABLE_SVSH_SVMH() st(PMMCTL0_H = 0xA5; SVSMHCTL |= (SVSHE + SVMHE); P
MMCTL0_H = 0x00;)
#define DISABLE_SVSH_SVMH() st(PMMCTL0_H = 0xA5; SVSMHCTL &= ~(SVSHE + SVMHE);
PMMCTL0_H = 0x00;)
#define ENABLE_SVSL_RESET()
_H = 0x00;)
#define DISABLE_SVSL_RESET()
0_H = 0x00;)
#define ENABLE_SVML_INTERRUPT()
_H = 0x00;)
#define DISABLE_SVML_INTERRUPT()
0_H = 0x00;)
#define ENABLE_SVSH_RESET()
_H = 0x00;)
#define DISABLE_SVSH_RESET()
0_H = 0x00;)
#define ENABLE_SVMH_INTERRUPT()
_H = 0x00;)
#define DISABLE_SVMH_INTERRUPT()
0_H = 0x00;)
#define CLEAR_PMM_IFGS()
x00;)

st(PMMCTL0_H = 0xA5; PMMRIE |= SVSLPE; PMMCTL0
st(PMMCTL0_H = 0xA5; PMMRIE &= ~SVSLPE; PMMCTL
st(PMMCTL0_H = 0xA5; PMMRIE |= SVMLIE; PMMCTL0
st(PMMCTL0_H = 0xA5; PMMRIE &= ~SVMLIE; PMMCTL
st(PMMCTL0_H = 0xA5; PMMRIE |= SVSHPE; PMMCTL0
st(PMMCTL0_H = 0xA5; PMMRIE &= ~SVSHPE; PMMCTL
st(PMMCTL0_H = 0xA5; PMMRIE |= SVMHIE; PMMCTL0
st(PMMCTL0_H = 0xA5; PMMRIE &= ~SVMHIE; PMMCTL
st(PMMCTL0_H = 0xA5; PMMIFG = 0; PMMCTL0_H = 0

// These settings use SVSH/LACE = 0
#define SVSL_ENABLED_IN_LPM_FAST_WAKE() st(PMMCTL0_H = 0xA5; SVSMLCTL |= (SVSLF
P+SVSLMD); SVSMLCTL &= ~SVSMLACE; PMMCTL0_H = 0x00;)
#define SVSL_ENABLED_IN_LPM_SLOW_WAKE() st(PMMCTL0_H = 0xA5; SVSMLCTL |= SVSLMD
; SVSMLCTL &= ~(SVSLFP+SVSMLACE); PMMCTL0_H = 0x00;)
#define SVSL_DISABLED_IN_LPM_FAST_WAKE() st(PMMCTL0_H = 0xA5; SVSMLCTL |= SVSLFP

SVSMLCTL |= (SVSL FP+SVSLMD+SVSMLACE).g. SVSMLCTL &= ~(SVSL FP+SVSMLACE+SVSLMD).g. SVSMHCTL |= (SVSH MD+SVSHFP+SVSMHACE). SVSMHCTL &= ~SVSMHACE. SELECT_MCLK(SELM__XT2CLK) */ #define SELECT_MCLK(source) st(UCSCTL4 = (UCSCTL4 & ~(SELM_7)) | (source). SELECT_ACLK(SELA__XT1CLK) */ #define SELECT_ACLK(source) st(UCSCTL4 = (UCSCTL4 & ~(SELA_7)) | (source).. PMMCTL0_H = 0x00.) /* Select source for MCLK and SMCLK e.) #define SVSH_DISABLED_IN_LPM_FULL_PERF() st(PMMCTL0_H = 0xA5. SVSMHCTL &= ~(SVSMHACE+SVSHMD).) /* set ACLK/x */ .g.) #define SVSH_OPTIMIZED_IN_LPM_FULL_PERF() st(PMMCTL0_H = 0xA5.) /******************************************************************************* * Defines ******************************************************************************/ #define PMM_STATUS_OK 0 #define PMM_STATUS_ERROR 1 /******************************************************************************* * \brief Set Vcore to expected level * * \param level Level to which Vcore needs to be increased/decreased * \return status Success/failure ******************************************************************************/ extern uint16_t SetVCore(uint8_t level).) /* Select source for MCLK e.) // These setting use SVSH/LACE = 1 #define SVSL_OPTIMIZED_IN_LPM_FAST_WAKE() st(PMMCTL0_H = 0xA5. SVSMHCTL |= (SVSHM D+SVSHFP).) /* Select source for ACLK e.) #define SVSH_ENABLED_IN_LPM_FULL_PERF() st(PMMCTL0_H = 0xA5. SELECT_SMCLK(SELS__XT2CLK) */ #define SELECT_SMCLK(source) st(UCSCTL4 = (UCSCTL4 & ~(SELS_7)) | (source).h> #include "hal_macros. PMMCTL0_H = 0x00. SVSMHCTL &= ~(SVSMHACE+SVSHFP).) /* Select source for SMCLK e.PMMCTL0_H = 0x00.h" /******************************************************************************* * Macros ******************************************************************************/ /* Select source for FLLREF e.g. SVSMHCTL |= SVSHFP . SELECT_FLLREF(SELREF__XT1CLK) */ #define SELECT_FLLREF(source) st(UCSCTL3 = (UCSCTL3 & ~(SELREF_7)) | (source).) #define SVSH_ENABLED_IN_LPM_NORM_PERF() st(PMMCTL0_H = 0xA5. SVSMLCTL &= ~(SVSLMD+SVSMLACE).) #define SVSH_DISABLED_IN_LPM_NORM_PERF() st(PMMCTL0_H = 0xA5. SELECT_MCLK_SMCLK(SELM__DCOCLK + SELS__ DCOCLK) */ #define SELECT_MCLK_SMCLK(sources) st(UCSCTL4 = (UCSCTL4 & ~(SELM_7 + SELS_7)) | (sources). SVSMHCTL |= SVSHMD . PMMCTL0_H = 0x00.g. PMMCTL0_H = 0x00. SVSMHCTL &= ~(SVSM HACE+SVSHFP+SVSHMD). PMMCTL0_H = 0x00. PMMCTL0_H = 0x00. PMMCTL0_H = 0x00. #endif /* HAL_PMM_H */ #ifndef HAL_UCS_H #define HAL_UCS_H #include <stdint.) #define SVSL_DISABLED_IN_LPM_SLOW_WAKE() st(PMMCTL0_H = 0xA5.

SELECT_FLLREFDIV(2) */ #define SELECT_FLLREFDIV(x) st(UCSCTL3 = (UCSCTL3 & ~(FLLREFDIV_7))|(FLLREFDIV__ ##x). /******************************************************************************* * \brief Stop XT1 oscillator ******************************************************************************/ extern void XT1_Stop(void).) /* set SMCLK/x */ #define SMCLK_DIV(x) st(UCSCTL5 = (UCSCTL5 & ~(DIVS_7)) | (DIVS__##x). /******************************************************************************* * \brief Startup routine for 32kHz Crystal 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.g. /******************************************************************************* * \brief Use XT1 in Bypasss mode ******************************************************************************/ extern void XT1_Bypass(void). uint16_t timeout).) /* set MCLK/x */ #define MCLK_DIV(x) st(UCSCTL5 = (UCSCTL5 & ~(DIVM_7)) | (DIVM__##x).) /******************************************************************************* * Defines ******************************************************************************/ #define UCS_STATUS_OK 0 #define UCS_STATUS_ERROR 1 /******************************************************************************* * \brief Startup routine for 32kHz Crystal on LFXT1 * * \param xtdrive Bits defining the LFXT drive mode after startup ******************************************************************************/ extern void LFXT_Start(uint16_t xtdrive). /******************************************************************************* * \brief Startup routine for XT2 . uint16_t timeout).) /* Select divider for FLLREF e. /******************************************************************************* * \brief 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. /******************************************************************************* * \brief Startup routine for XT1 * * \param xtdrive Bits defining the XT drive mode ******************************************************************************/ extern void XT1_Start(uint16_t xtdrive).#define ACLK_DIV(x) st(UCSCTL5 = (UCSCTL5 & ~(DIVA_7)) | (DIVA__##x).

h> #define #define #define #define #define #define #define #define #define LED1 LED2 LED3 LED4 LED5 LED6 LED7 LED8 LED_ALL 0x01 0x02 0x04 0x08 0x10 0x20 0x40 0x80 0xFF extern void Board_init(void). /******************************************************************************* * \brief Initializes FLL of the UCS and wait till settled before allowing * code execution to resume. #endif /* HAL_UCS_H */ #ifndef HAL_BOARD_H #define HAL_BOARD_H #include <stdint. uint16_t ratio). /******************************************************************************* * \brief Stop XT2 oscillator ******************************************************************************/ extern void XT2_Stop(void).* * \param xtdrive Bits defining the XT drive mode ******************************************************************************/ extern void XT2_Start(uint16_t xtdrive). /******************************************************************************* * \brief Initializes FLL of the UCS * * \param fsystem Required system frequency (MCLK) in kHz * \param ratio Ratio between fsystem and FLLREFCLK ******************************************************************************/ extern void Init_FLL(uint16_t fsystem. . extern void Board_ledOn(uint8_t ledMask). uint16_t ratio). The use of this function is preferred * over the use of Init_FLL(). * * \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 timeout). /******************************************************************************* * \brief Use XT2 in Bypasss mode for MCLK ******************************************************************************/ extern void XT2_Bypass(void). /******************************************************************************* * \brief 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.

extern void Buttons_interruptDisable(uint16_t buttonsMask). volatile extern uint8_t buttonDebounce. int8_t Cma3000_readRegister(uint8_t Address). int8_t Cma3000_writeRegister(uint8_t Address. extern int8_t Cma3000_yAccel. int8_t yAccel_offset. extern void Buttons_interruptEnable(uint16_t buttonsMask). extern void Buttons_init(uint16_t buttonsMask). void Cma3000_readAccel(void). extern extern extern extern int8_t extern extern extern void Cma3000_init(void). #endif /* HAL_BOARD_H */ #ifndef HAL_BUTTONS_H #define HAL_BUTTONS_H #include <stdint. void Cma3000_setAccel_offset(int8_t xAccel_offset. extern int8_t Cma3000_zAccel. void Cma3000_disable(void). int8_t Data).extern void Board_ledOff(uint8_t ledMask).h> // Screen size #define DOGS102x6_X_SIZE #define DOGS102x6_Y_SIZE 102 64 // Screen printing styles #define DOGS102x6_DRAW_NORMAL und #define DOGS102x6_DRAW_INVERT // Display Size in dots: X-Axis // Display Size in dots: Y-Axis 0x00 // Display dark pixels on a light backgro 0x01 // Display light pixels on a dark backgro . extern void Board_ledToggle(uint8_t ledMask). void Cma3000_readAccel_offset(void).h> #define DOUTX #define DOUTY #define DOUTZ 0x06 0x07 0x08 extern int8_t Cma3000_xAccel. zAccel_offset).h> #define BUTTON_S2 #define BUTTON_S1 #define BUTTON_ALL 0x0400 0x0080 0x0480 volatile extern uint16_t buttonsPressed. #endif /* HAL_BUTTONS_H */ #ifndef HAL_CMA3000_H #define HAL_CMA3000_H #include <stdint. #endif /* HAL_MENU_H */ #ifndef HAL_DOGS102X6_H #define HAL_DOGS102X6_H #include <stdint.

extern void Dogs102x6_scrollLine(uint8_t lines). extern void Dogs102x6_setAddress(uint8_t pa. extern void Dogs102x6_horizontalLineDraw(uint8_t x1. #endif /* HAL_MENU_H */ . uin t8_t col). uint 8_t style). extern void Dogs102x6_backlightInit(void). char *word. uint8_t s tyle). uint16_t f. uint8_t y. char *word. uint8_t y. extern void Dogs102x6_verticalLineDraw(uint8_t y1. extern void Dogs102x6_setAllPixelsOn(void). uint8_t y. uint8_t numItems). uint8_t style ). uint8_t x. uint8_t row. uint8_t ca). uint8_t y. extern void Dogs102x6_refresh(uint8_t mode). extern void Dogs102x6_stringDraw(uint8_t row. extern void Dogs102x6_disable(void). extern void Dogs102x6_imageDraw(const uint8_t IMAGE[]. extern void Dogs102x6_setInverseDisplay(void). uint8_t y2. extern void Dogs102x6_writeCommand(uint8_t* sCmd. extern void Dogs102x6_lineDraw(uint8_t x1. uint8_t col. uint8_t col. uint16_t f. extern void Dogs102x6_clearScreen(void). uint8_t x2. extern void Dogs102x6_writeData(uint8_t* sData. u int8_t style). uint8_t style). uint8_t s tyle).h> extern uint8_t Menu_active(char **menuText. uint8_t width. extern void Dogs102x6_circleDraw(uint8_t x. uint8_t y. uint8_t sty le). uint8_t col) . extern void Dogs102x6_clearImage(uint8_t height. uint8_ t style). extern void Dogs102x6_pixelDraw(uint8_t x. uint8_t row. extern void Dogs102x6_stringDrawXY(uint8_t x. uint8_t sty le). extern void Dogs102x6_setContrast(uint8_t newContrast). #endif /* HAL_DOGS102x6_H */ #ifndef HAL_MENU_H #define HAL_MENU_H #include <stdint. extern void Dogs102x6_setBacklight(uint8_t brightness). uint8_t y1.und // Screen printing mode #define DOGS102x6_DRAW_IMMEDIATE 0x01 // Display update done immediately #define DOGS102x6_DRAW_ON_REFRESH 0x00 // Display update done only with refresh extern uint8_t dogs102x6Memory[]. extern uint8_t Dogs102x6_getBacklight(void). uint8_t i). extern void Dogs102x6_clearInverseDisplay(void). extern void Dogs102x6_clearRow(uint8_t row). extern void Dogs102x6_clearAllPixelsOn(void). uint8_t y2. fer // Provide direct access to the frame buf extern void Dogs102x6_init(void). extern void Dogs102x6_charDraw(uint8_t row. uint8_t radius. extern void Dogs102x6_charDrawXY(uint8_t x. uint8_t i). uint8_t x2. extern uint8_t Dogs102x6_getContrast(void).

#ifndef HAL_WHEEL_H #define HAL_WHEEL_H #include <stdint. #endif /* GAME_H */ . void Wheel_enable(void). uint16_t Wheel_getValue(void). uint8_t Wheel_getPosition(void). #endif /* HAL_WHEEL_H */ #ifndef LAUNCHPADDEF_H #define LAUNCHPADDEF_H extern void LaunchpadDef(void). void Wheel_disable(void).h> extern extern extern extern extern void Wheel_init(void).

Sign up to vote on this title
UsefulNot useful