📄 davinci_evm.h
字号:
#ifndef DaVinci_EVM_H
#define DaVinci_EVM_H
#include <msp430x12x2.h>
#include "configOptions.h"
#include "RTC_Calendar.h"
#include "sw_i2c_slave.h"
//
// UART
//
#define UART_BAUD_RATE 9600 // Baud Rate
#define UART_TX_RETRY 50000 // UART TX max retry count
//
// Clock MACROs
//
#define DCO_FREQ 7358000 // Max DCO frequency at 3.3V
//#define DCO_FREQ 8000000 // Max DCO frequency at 3.6V
#define DCO_CLKS DCO_FREQ/4096 // Num of SMCLKS per ALK/8 period
#define DCO_TOL 1 // +/- DCO clk tolerance
#define DCO_ROSC 1 // Set to 1 if using Rosc, else 0
#define DCO_RSEL_MASK 0x07 // RSEL bit mask
//
// DCO Status LED Port Pin
//
#define DCO_LED_PIN 0x01 // DCO status LED pin
#define DCO_LED_PORT P1OUT // DCO status LED port
#define DCO_LED_DIR P1DIR // DCO status LED port direction
#define DCO_STATUS_LED (DCO_LED_DIR |= DCO_LED_PIN)
// Set status LED pin as output
#define DCO_LOCKED (DCO_LED_PORT |= DCO_LED_PIN)
// Illuminate DCO status LED
//
// IR Port Pin
//
#define IR_PIN 0x04 // IR pin is P1.2
#define IR_IN P1IN
#define IR_OUT P1OUT
#define IR_DIR P1DIR
#define IR_SEL P1SEL
//
// IR Bit Times
//
#define BIT_50 29 // 885us @ 32768 ACLK
#define BIT_75 42 // 1282us @ 32768 ACLK
//
// IR Buffer
//
#define IRBUFFLEN 32 // IR receive buffer length
//
// Events
//
#define EVENT_TIMEOUT 0x01 // Timeout event
#define EVENT_IR 0x02 // IR event
#define EVENT_CHK_PINS 0x04 // Check input pins event
#define EVENT_RTC 0x08 // RTC event
//
// I2C Message Identifiers
//
#define SET_RTC_PARAMS 0
#define GET_RTC_PARAMS 1
#define SEND_IR_DATA 2
#define GET_LAST_IR_VALUE 3
#define GET_INPUT_STATE 4
#define GET_EVENT 5
#define SET_OUTPUT_STATE 6
//
// Event Flags for I2C getEvent message
//
#define EVENT_STATE_CHG 0x01 // Input signal state change
#define EVENT_IR_DATA 0x02 // IR data ready
//
// Input Pin Masks
//
#define P2_MASK 0x1E // Input pins P2.4,3,2,1
#define P3_MASK 0xC6 // Input pins P3.7,6,2,1
//
// Timeout for Master I2C device to respond to interrupt
//
#define INTR_TIMEOUT 3300 // 3300 ACLKs (~100 msec)
//
// Errors
//
#define ERROR_DCO_MIN 0x01
#define ERROR_DCO_MAX 0x02
#define ERROR_DCO_OV 0x04
#define ERROR_TIMEOUT 0x10
#endif /* DaVinci_EVM_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -