Sie sind auf Seite 1von 7

#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 &= ~(SVSLMD+SVSMLACE); PMMCTL0_H = 0x00;)


#define SVSL_DISABLED_IN_LPM_SLOW_WAKE() st(PMMCTL0_H = 0xA5; SVSMLCTL &= ~(SVSL
FP+SVSMLACE+SVSLMD); PMMCTL0_H = 0x00;)
#define SVSH_ENABLED_IN_LPM_NORM_PERF() st(PMMCTL0_H = 0xA5; SVSMHCTL |= SVSHMD
; SVSMHCTL &= ~(SVSMHACE+SVSHFP); PMMCTL0_H = 0x00;)
#define SVSH_ENABLED_IN_LPM_FULL_PERF() st(PMMCTL0_H = 0xA5; SVSMHCTL |= (SVSHM
D+SVSHFP); SVSMHCTL &= ~SVSMHACE; PMMCTL0_H = 0x00;)
#define SVSH_DISABLED_IN_LPM_NORM_PERF() st(PMMCTL0_H = 0xA5; SVSMHCTL &= ~(SVSM
HACE+SVSHFP+SVSHMD);PMMCTL0_H = 0x00;)
#define SVSH_DISABLED_IN_LPM_FULL_PERF() st(PMMCTL0_H = 0xA5; SVSMHCTL |= SVSHFP
; SVSMHCTL &= ~(SVSMHACE+SVSHMD); PMMCTL0_H = 0x00;)
// These setting use SVSH/LACE = 1
#define SVSL_OPTIMIZED_IN_LPM_FAST_WAKE() st(PMMCTL0_H = 0xA5; SVSMLCTL |= (SVSL
FP+SVSLMD+SVSMLACE); PMMCTL0_H = 0x00;)
#define SVSH_OPTIMIZED_IN_LPM_FULL_PERF() st(PMMCTL0_H = 0xA5; SVSMHCTL |= (SVSH
MD+SVSHFP+SVSMHACE); PMMCTL0_H = 0x00;)
/*******************************************************************************
* 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);
#endif /* HAL_PMM_H */
#ifndef HAL_UCS_H
#define HAL_UCS_H
#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
/*******************************************************************************
* \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 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, uint16_t timeout);
/*******************************************************************************
* \brief Startup routine for XT1
*
* \param xtdrive Bits defining the XT drive mode
******************************************************************************/
extern void XT1_Start(uint16_t xtdrive);
/*******************************************************************************
* \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, uint16_t timeout);
/*******************************************************************************
* \brief Use XT1 in Bypasss mode
******************************************************************************/
extern void XT1_Bypass(void);
/*******************************************************************************
* \brief Stop XT1 oscillator
******************************************************************************/
extern void XT1_Stop(void);
/*******************************************************************************
* \brief Startup routine for XT2

*
* \param xtdrive Bits defining the XT drive mode
******************************************************************************/
extern void XT2_Start(uint16_t xtdrive);
/*******************************************************************************
* \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, uint16_t timeout);
/*******************************************************************************
* \brief Use XT2 in Bypasss mode for MCLK
******************************************************************************/
extern void XT2_Bypass(void);
/*******************************************************************************
* \brief Stop XT2 oscillator
******************************************************************************/
extern void XT2_Stop(void);
/*******************************************************************************
* \brief Initializes FLL of the UCS and wait till settled before allowing
*
code execution to resume. 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 ratio);
/*******************************************************************************
* \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, uint16_t ratio);
#endif /* HAL_UCS_H */
#ifndef HAL_BOARD_H
#define HAL_BOARD_H
#include <stdint.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);


extern void Board_ledOn(uint8_t ledMask);

extern void Board_ledOff(uint8_t ledMask);


extern void Board_ledToggle(uint8_t ledMask);
#endif /* HAL_BOARD_H */
#ifndef HAL_BUTTONS_H
#define HAL_BUTTONS_H
#include <stdint.h>
#define BUTTON_S2
#define BUTTON_S1
#define BUTTON_ALL

0x0400
0x0080
0x0480

volatile extern uint16_t buttonsPressed;


volatile extern uint8_t buttonDebounce;
extern void Buttons_init(uint16_t buttonsMask);
extern void Buttons_interruptEnable(uint16_t buttonsMask);
extern void Buttons_interruptDisable(uint16_t buttonsMask);
#endif /* HAL_BUTTONS_H */
#ifndef HAL_CMA3000_H
#define HAL_CMA3000_H
#include <stdint.h>
#define DOUTX
#define DOUTY
#define DOUTZ

0x06
0x07
0x08

extern int8_t Cma3000_xAccel;


extern int8_t Cma3000_yAccel;
extern int8_t Cma3000_zAccel;
extern
extern
extern
extern
int8_t
extern
extern
extern

void Cma3000_init(void);
void Cma3000_disable(void);
void Cma3000_readAccel(void);
void Cma3000_setAccel_offset(int8_t xAccel_offset, int8_t yAccel_offset,
zAccel_offset);
void Cma3000_readAccel_offset(void);
int8_t Cma3000_readRegister(uint8_t Address);
int8_t Cma3000_writeRegister(uint8_t Address, int8_t Data);

#endif /* HAL_MENU_H */
#ifndef HAL_DOGS102X6_H
#define HAL_DOGS102X6_H
#include <stdint.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

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[];
fer

// Provide direct access to the frame buf

extern void Dogs102x6_init(void);


extern void Dogs102x6_backlightInit(void);
extern void Dogs102x6_disable(void);
extern void Dogs102x6_refresh(uint8_t mode);
extern void Dogs102x6_writeCommand(uint8_t* sCmd, uint8_t i);
extern void Dogs102x6_writeData(uint8_t* sData, uint8_t i);
extern void Dogs102x6_setAddress(uint8_t pa, uint8_t ca);
extern uint8_t Dogs102x6_getContrast(void);
extern uint8_t Dogs102x6_getBacklight(void);
extern void Dogs102x6_setContrast(uint8_t newContrast);
extern void Dogs102x6_setBacklight(uint8_t brightness);
extern void Dogs102x6_setInverseDisplay(void);
extern void Dogs102x6_clearInverseDisplay(void);
extern void Dogs102x6_scrollLine(uint8_t lines);
extern void Dogs102x6_setAllPixelsOn(void);
extern void Dogs102x6_clearAllPixelsOn(void);
extern void Dogs102x6_clearScreen(void);
extern void Dogs102x6_charDraw(uint8_t row, uint8_t col, uint16_t f, uint8_t sty
le);
extern void Dogs102x6_charDrawXY(uint8_t x, uint8_t y, uint16_t f, uint8_t style
);
extern void Dogs102x6_stringDraw(uint8_t row, uint8_t col, char *word, uint8_t s
tyle);
extern void Dogs102x6_stringDrawXY(uint8_t x, uint8_t y, char *word, uint8_t sty
le);
extern void Dogs102x6_clearRow(uint8_t row);
extern void Dogs102x6_pixelDraw(uint8_t x, uint8_t y, uint8_t style);
extern void Dogs102x6_horizontalLineDraw(uint8_t x1, uint8_t x2, uint8_t y, uint
8_t style);
extern void Dogs102x6_verticalLineDraw(uint8_t y1, uint8_t y2, uint8_t x, uint8_
t style);
extern void Dogs102x6_lineDraw(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, u
int8_t style);
extern void Dogs102x6_circleDraw(uint8_t x, uint8_t y, uint8_t radius, uint8_t s
tyle);
extern void Dogs102x6_imageDraw(const uint8_t IMAGE[], uint8_t row, uint8_t col)
;
extern void Dogs102x6_clearImage(uint8_t height, uint8_t width, uint8_t row, uin
t8_t col);
#endif /* HAL_DOGS102x6_H */
#ifndef HAL_MENU_H
#define HAL_MENU_H
#include <stdint.h>
extern uint8_t Menu_active(char **menuText, uint8_t numItems);
#endif /* HAL_MENU_H */

#ifndef HAL_WHEEL_H
#define HAL_WHEEL_H
#include <stdint.h>
extern
extern
extern
extern
extern

void Wheel_init(void);
uint8_t Wheel_getPosition(void);
uint16_t Wheel_getValue(void);
void Wheel_disable(void);
void Wheel_enable(void);

#endif /* HAL_WHEEL_H */
#ifndef LAUNCHPADDEF_H
#define LAUNCHPADDEF_H
extern void LaunchpadDef(void);
#endif /* GAME_H */

Das könnte Ihnen auch gefallen