📄 main.c
字号:
//******************************************************************************
//
// MSP430F2132
// +---------------+
// |
// +--<P3.7
// |
// R
// |
// +---+-->P2.3/CA0
// | |
// R R
// | |
// GND |
// |
//c-+-------------------+-R--+--<P1.0/CAOUT
// | |
// | c-+---------------+-R--+
// | | |
// | | c-+-----------+-R--+
// | | | |
// | | | c-+-------+-R--+
// | | | | |
// | | | | c-+-----R--+
// | | | | | |
// | | | | | c-+-R--+
// | | | | | | |
// | | | | | | R
// | | | | | | |
// | | | | | | c--+-->P2.7/CA7 (slider:2)
// | | | | | +------->P2.6/CA6 (slider:1)
// | | | | +----------->P2.5/CA5 (slider:3)
// | | | +--------------->P2.2/CA4 (menu:left)
// | | +------------------->P2.1/CA3 (menu: right)
// | +----------------------->P2.0/CA2 (slider:0)
// +--------------------------->P2.4/CA1 (Power button)
//
//******************************************************************************
#include "CTS_Layer.h"
uint16_t position;
struct Element * direction;
//unsigned int Cnt[3];
// Main Function
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
// establish baseline
TI_CAPT_Init_Baseline(&slider);
TI_CAPT_Update_Baseline(&slider,5);
TI_CAPT_Init_Baseline(&menu);
TI_CAPT_Update_Baseline(&menu,5);
TI_CAPT_Init_Baseline(&power);
TI_CAPT_Update_Baseline(&power,5);
// Main loop starts here
while (1)
{
// TI_CAPT_Raw(&slider,Cnt);
// TI_CAPT_Custom(&slider,Cnt);
position = TI_CAPT_Slider(&slider);
direction = (struct Element*)TI_CAPT_Buttons(&menu);
if(TI_CAPT_Button(&power))
{
__no_operation();
}
if(direction == (struct Element*)&right)
{
__no_operation();
}
if(direction == (struct Element*)&left);
{
__no_operation();
}
if(position != ILLEGAL_SLIDER_WHEEL_POSITION)
{
__no_operation();
}
__delay_cycles(100);
}
} // End Main
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -