@ -0,0 +1,42 @@ | |||
/* | |||
Blink | |||
The basic Energia example. | |||
Turns on an LED on for one second, then off for one second, repeatedly. | |||
Change the LED define to blink other LEDs. | |||
Hardware Required: | |||
* LaunchPad with an LED | |||
This example code is in the public domain. | |||
*/ | |||
// most launchpads have a red LED | |||
//#define LED RED_LED | |||
//see pins_energia.h for more LED definitions | |||
#define LED GREEN_LED | |||
#define DUSTSENSORPIN 1 | |||
// the setup routine runs once when you press reset: | |||
void setup() { | |||
// initialize the digital pin as an output. | |||
pinMode(LED, OUTPUT); | |||
pinMode(DUSTSENSORPIN, INPUT); | |||
Serial.begin(4800); | |||
} | |||
// the loop routine runs over and over again forever: | |||
void loop() { | |||
Serial.println("test"); | |||
digitalWrite(LED, HIGH); // turn the LED on (HIGH is the voltage level) | |||
delay(1000); // wait for a second | |||
digitalWrite(LED, LOW); // turn the LED off by making the voltage LOW | |||
delay(1000); // wait for a second | |||
int DustSensorState = digitalRead(DUSTSENSORPIN); | |||
Serial.print("Sensor reads:"); | |||
Serial.println(DustSensorState); | |||
} | |||
@ -0,0 +1,35 @@ | |||
#include <math.h> | |||
int DustSensePin = 14; | |||
unsigned long duration; | |||
unsigned long starttime; | |||
unsigned long sampletime_ms = 30000;//sample 30s ; | |||
unsigned long lowpulseoccupancy = 0; | |||
float ratio = 0; | |||
float concentration = 0; | |||
void setup() | |||
{ | |||
Serial.begin(9600); | |||
pinMode(DustSensePin,INPUT); | |||
starttime = millis();//get the current time; | |||
} | |||
void loop() | |||
{ | |||
duration = pulseIn(DustSensePin, LOW); | |||
lowpulseoccupancy = lowpulseoccupancy+duration; | |||
if ((millis()-starttime) > sampletime_ms)//if the sample time == 30s | |||
{ | |||
ratio = lowpulseoccupancy/(sampletime_ms*10.0); // Integer percentage 0=>100 | |||
concentration = 1.1*powf(ratio,3)-3.8*powf(ratio,2)+520*ratio+0.62; // using spec sheet curve | |||
Serial.print(lowpulseoccupancy); | |||
Serial.print(","); | |||
Serial.print(ratio); | |||
Serial.print(","); | |||
Serial.println(concentration); | |||
lowpulseoccupancy = 0; | |||
starttime = millis(); | |||
} | |||
} |
@ -0,0 +1,493 @@ | |||
****************************************************************************** | |||
MSP430 Linker PC v3.3.1 | |||
****************************************************************************** | |||
>> Linked Mon Mar 07 17:01:00 2011 | |||
OUTPUT FILE NAME: <LaunchPadCapTouchBoosterPack.out> | |||
ENTRY POINT SYMBOL: "_c_int00" address: 0000f04e | |||
MEMORY CONFIGURATION | |||
name origin length used unused attr fill | |||
---------------------- -------- --------- -------- -------- ---- -------- | |||
SFR 00000000 00000010 00000000 00000010 RWIX | |||
PERIPHERALS_8BIT 00000010 000000f0 00000000 000000f0 RWIX | |||
PERIPHERALS_16BIT 00000100 00000100 00000000 00000100 RWIX | |||
RAM 00000200 00000100 0000007c 00000084 RWIX | |||
INFOD 00001000 00000040 00000000 00000040 RWIX | |||
INFOC 00001040 00000040 00000000 00000040 RWIX | |||
INFOB 00001080 00000040 00000000 00000040 RWIX | |||
INFOA 000010c0 00000040 00000000 00000040 RWIX | |||
FLASH 0000e000 00001fe0 000011e0 00000e00 RWIX | |||
INT00 0000ffe0 00000002 00000000 00000002 RWIX | |||
INT01 0000ffe2 00000002 00000000 00000002 RWIX | |||
INT02 0000ffe4 00000002 00000000 00000002 RWIX | |||
INT03 0000ffe6 00000002 00000000 00000002 RWIX | |||
INT04 0000ffe8 00000002 00000000 00000002 RWIX | |||
INT05 0000ffea 00000002 00000000 00000002 RWIX | |||
INT06 0000ffec 00000002 00000000 00000002 RWIX | |||
INT07 0000ffee 00000002 00000000 00000002 RWIX | |||
INT08 0000fff0 00000002 00000000 00000002 RWIX | |||
INT09 0000fff2 00000002 00000002 00000000 RWIX | |||
INT10 0000fff4 00000002 00000002 00000000 RWIX | |||
INT11 0000fff6 00000002 00000000 00000002 RWIX | |||
INT12 0000fff8 00000002 00000000 00000002 RWIX | |||
INT13 0000fffa 00000002 00000000 00000002 RWIX | |||
INT14 0000fffc 00000002 00000000 00000002 RWIX | |||
RESET 0000fffe 00000002 00000002 00000000 RWIX | |||
SECTION ALLOCATION MAP | |||
output attributes/ | |||
section page origin length input sections | |||
-------- ---- ---------- ---------- ---------------- | |||
.pinit 0 0000e000 00000000 UNINITIALIZED | |||
.bss 0 00000200 0000002c UNINITIALIZED | |||
00000200 00000016 CTS_Layer.obj (.bss) | |||
00000216 00000008 CapTouchBoosterPack_UserExperience.obj (.bss) | |||
0000021e 00000005 uart.obj (.bss) | |||
00000223 00000001 --HOLE-- | |||
00000224 00000004 rts430.lib : _lock.obj (.bss) | |||
00000228 00000004 : boot.obj (.bss) | |||
.stack 0 000002b0 00000050 UNINITIALIZED | |||
000002b0 00000002 rts430.lib : boot.obj (.stack) | |||
000002b2 0000004e --HOLE-- | |||
.text 0 0000e000 0000113c | |||
0000e000 00000502 CTS_Layer.obj (.text:TI_CAPT_Custom) | |||
0000e502 0000022e CTS_Layer.obj (.text:TI_CAPT_Wheel) | |||
0000e730 00000202 CapTouchBoosterPack_UserExperience.obj (.text:CapTouchActiveMode) | |||
0000e932 00000166 CTS_HAL.obj (.text:TI_CTS_RO_PINOSC_TA0_WDTp_HAL) | |||
0000ea98 00000112 CTS_Layer.obj (.text:Dominant_Element) | |||
0000ebaa 000000ba CapTouchBoosterPack_UserExperience.obj (.text:GetGesture) | |||
0000ec64 000000a0 CapTouchBoosterPack_UserExperience.obj (.text:LedStartUpSequence) | |||
0000ed04 00000076 CTS_Layer.obj (.text:TI_CAPT_Update_Baseline) | |||
0000ed7a 00000060 CapTouchBoosterPack_UserExperience.obj (.text:CapTouchIdleMode) | |||
0000edda 0000004c rts430.lib : lsr16.obj (.text) | |||
0000ee26 0000004a uart.obj (.text:Timer_A0_ISR) | |||
0000ee70 00000046 rts430.lib : autoinit.obj (.text:_auto_init) | |||
0000eeb6 00000042 CapTouchBoosterPack_UserExperience.obj (.text:main) | |||
0000eef8 0000003c CapTouchBoosterPack_UserExperience.obj (.text:MeasureCapBaseLine) | |||
0000ef34 0000003a uart.obj (.text:TimerA_UART_tx) | |||
0000ef6e 00000038 uart.obj (.text:TimerA_UART_init) | |||
0000efa6 0000002c rts430.lib : div16s.obj (.text) | |||
0000efd2 0000002c : lsl16.obj (.text) | |||
0000effe 0000002a CapTouchBoosterPack_UserExperience.obj (.text:InitLaunchPadCore) | |||
0000f028 00000026 CTS_Layer.obj (.text:TI_CAPT_Button) | |||
0000f04e 00000026 rts430.lib : boot.obj (.text:_c_int00_noexit) | |||
0000f074 0000001e CTS_Layer.obj (.text:TI_CAPT_Raw) | |||
0000f092 0000001c uart.obj (.text:TimerA_UART_shutdown) | |||
0000f0ae 00000018 CapTouchBoosterPack_UserExperience.obj (.text:SendByte) | |||
0000f0c6 00000018 CTS_Layer.obj (.text:TI_CAPT_Init_Baseline) | |||
0000f0de 00000016 rts430.lib : div16u.obj (.text) | |||
0000f0f4 00000014 : mult16.obj (.text) | |||
0000f108 00000012 : memcpy.obj (.text:memcpy) | |||
0000f11a 00000010 : epilog.obj (.text) | |||
0000f12a 00000008 CTS_HAL.obj (.text:watchdog_timer) | |||
0000f132 00000004 rts430.lib : pre_init.obj (.text:_system_pre_init) | |||
0000f136 00000004 : exit.obj (.text:abort) | |||
0000f13a 00000002 : _lock.obj (.text:_nop) | |||
.const 0 0000f13c 00000090 | |||
0000f13c 00000078 structure.obj (.const) | |||
0000f1b4 00000010 CapTouchBoosterPack_UserExperience.obj (.const:LedWheelPosition) | |||
0000f1c4 00000008 CapTouchBoosterPack_UserExperience.obj (.const:startSequence) | |||
.cinit 0 0000f1cc 00000014 | |||
0000f1cc 0000000b uart.obj (.cinit) | |||
0000f1d7 00000001 --HOLE-- [fill = 0] | |||
0000f1d8 00000006 CTS_Layer.obj (.cinit) | |||
0000f1de 00000002 --HOLE-- [fill = 0] | |||
.int09 0 0000fff2 00000002 | |||
0000fff2 00000002 uart.obj (.int09) | |||
.int10 0 0000fff4 00000002 | |||
0000fff4 00000002 CTS_HAL.obj (.int10) | |||
.reset 0 0000fffe 00000002 | |||
0000fffe 00000002 rts430.lib : boot.obj (.reset) | |||
GLOBAL SYMBOLS: SORTED ALPHABETICALLY BY Name | |||
address name | |||
-------- ---- | |||
00000200 .bss | |||
0000e000 .text | |||
0000004a ADC10AE0 | |||
000001b0 ADC10CTL0 | |||
000001b2 ADC10CTL1 | |||
00000048 ADC10DTC0 | |||
00000049 ADC10DTC1 | |||
000001b4 ADC10MEM | |||
000001bc ADC10SA | |||
00000057 BCSCTL1 | |||
00000058 BCSCTL2 | |||
00000053 BCSCTL3 | |||
0000f136 C$$EXIT | |||
00000059 CACTL1 | |||
0000005a CACTL2 | |||
000010fb CALBC1_12MHZ | |||
000010f9 CALBC1_16MHZ | |||
000010ff CALBC1_1MHZ | |||
000010fd CALBC1_8MHZ | |||
000010fa CALDCO_12MHZ | |||
000010f8 CALDCO_16MHZ | |||
000010fe CALDCO_1MHZ | |||
000010fc CALDCO_8MHZ | |||
0000005b CAPD | |||
0000e730 CapTouchActiveMode | |||
0000ed7a CapTouchIdleMode | |||
00000056 DCOCTL | |||
0000ea98 Dominant_Element | |||
00000128 FCTL1 | |||
0000012a FCTL2 | |||
0000012c FCTL3 | |||
0000ebaa GetGesture | |||
00000000 IE1 | |||
00000002 IFG1 | |||
0000efd2 I_LSL | |||
0000effa I_LSL_1 | |||
0000efe8 I_LSL_10 | |||
0000efe6 I_LSL_11 | |||
0000efe4 I_LSL_12 | |||
0000efe2 I_LSL_13 | |||
0000efe0 I_LSL_14 | |||
0000efde I_LSL_15 | |||
0000eff8 I_LSL_2 | |||
0000eff6 I_LSL_3 | |||
0000eff4 I_LSL_4 | |||
0000eff2 I_LSL_5 | |||
0000eff0 I_LSL_6 | |||
0000efee I_LSL_7 | |||
0000efec I_LSL_8 | |||
0000efea I_LSL_9 | |||
0000edda I_LSR | |||
0000ee20 I_LSR_1 | |||
0000edfc I_LSR_10 | |||
0000edf8 I_LSR_11 | |||
0000edf4 I_LSR_12 | |||
0000edf0 I_LSR_13 | |||
0000edec I_LSR_14 | |||
0000ede8 I_LSR_15 | |||
0000ee1c I_LSR_2 | |||
0000ee18 I_LSR_3 | |||
0000ee14 I_LSR_4 | |||
0000ee10 I_LSR_5 | |||
0000ee0c I_LSR_6 | |||
0000ee08 I_LSR_7 | |||
0000ee04 I_LSR_8 | |||
0000ee00 I_LSR_9 | |||
0000effe InitLaunchPadCore | |||
0000ec64 LedStartUpSequence | |||
0000f1b4 LedWheelPosition | |||
0000eef8 MeasureCapBaseLine | |||
00000022 P1DIR | |||
00000025 P1IE | |||
00000024 P1IES | |||
00000023 P1IFG | |||
00000020 P1IN | |||
00000021 P1OUT | |||
00000027 P1REN | |||
00000026 P1SEL | |||
00000041 P1SEL2 | |||
0000002a P2DIR | |||
0000002d P2IE | |||
0000002c P2IES | |||
0000002b P2IFG | |||
00000028 P2IN | |||
00000029 P2OUT | |||
0000002f P2REN | |||
0000002e P2SEL | |||
00000042 P2SEL2 | |||
0000f0ae SendByte | |||
00000172 TA0CCR0 | |||
00000174 TA0CCR1 | |||
00000176 TA0CCR2 | |||
00000162 TA0CCTL0 | |||
00000164 TA0CCTL1 | |||
00000166 TA0CCTL2 | |||
00000160 TA0CTL | |||
0000012e TA0IV | |||
00000170 TA0R | |||
0000f028 TI_CAPT_Button | |||
0000e000 TI_CAPT_Custom | |||
0000f0c6 TI_CAPT_Init_Baseline | |||
0000f074 TI_CAPT_Raw | |||
0000ed04 TI_CAPT_Update_Baseline | |||
0000e502 TI_CAPT_Wheel | |||
0000e932 TI_CTS_RO_PINOSC_TA0_WDTp_HAL | |||
0000ef6e TimerA_UART_init | |||
0000f092 TimerA_UART_shutdown | |||
0000ef34 TimerA_UART_tx | |||
0000ee26 Timer_A0_ISR | |||
0000007a USICCTL | |||
0000007a USICKCTL | |||
0000007b USICNT | |||
00000078 USICTL | |||
00000078 USICTL0 | |||
00000079 USICTL1 | |||
0000007c USISR | |||
0000007d USISRH | |||
0000007c USISRL | |||
00000120 WDTCTL | |||
00000300 __STACK_END | |||
00000050 __STACK_SIZE | |||
00000001 __TI_args_main | |||
00000001 __TI_auto_init | |||
00000001 __TI_exit | |||
ffffffff __binit__ | |||
00000200 __bss__ | |||
ffffffff __c_args__ | |||
0000f1cc __cinit__ | |||
0000efa6 __divi | |||
0000f0de __divu | |||
0000022c __end__ | |||
0000f13c __etext__ | |||
0000f0f4 __mpyi | |||
ffffffff __pinit__ | |||
0000efa6 __remi | |||
0000f0de __remu | |||
0000e000 __text__ | |||
0000ee70 _auto_init | |||
0000f04e _c_int00 | |||
0000f04e _c_int00_noexit | |||
00000228 _cleanup_ptr | |||
0000022a _dtors_ptr | |||
00000224 _lock | |||
0000f13a _nop | |||
0000fffe _reset_vector | |||
000002b0 _stack | |||
0000f132 _system_pre_init | |||
00000226 _unlock | |||
0000f136 abort | |||
00000200 baseCnt | |||
ffffffff binit | |||
0000f1cc cinit | |||
00000214 ctsStatusReg | |||
0000021a deltaCnts | |||
0000022c end | |||
0000f13c etext | |||
0000f126 func_epilog_1 | |||
0000f124 func_epilog_2 | |||
0000f122 func_epilog_3 | |||
0000f120 func_epilog_4 | |||
0000f11e func_epilog_5 | |||
0000f11c func_epilog_6 | |||
0000f11a func_epilog_7 | |||
00000218 last_wheel_position | |||
0000f15a left | |||
0000eeb6 main | |||
0000020c measCnt | |||
0000f108 memcpy | |||
0000f18c middle_button | |||
0000f164 middle_element | |||
ffffffff pinit | |||
0000021c prox_raw_Cnts | |||
0000f16e proximity_element | |||
0000f1a0 proximity_sensor | |||
0000f146 right | |||
0000f1c4 startSequence | |||
0000021e timerA_UART_mode | |||
00000220 txData | |||
0000f13c volume_down | |||
0000f150 volume_up | |||
0000f12a watchdog_timer | |||
0000f178 wheel | |||
00000216 wheel_position | |||
GLOBAL SYMBOLS: SORTED BY Symbol Address | |||
address name | |||
-------- ---- | |||
00000000 IE1 | |||
00000001 __TI_args_main | |||
00000001 __TI_auto_init | |||
00000001 __TI_exit | |||
00000002 IFG1 | |||
00000020 P1IN | |||
00000021 P1OUT | |||
00000022 P1DIR | |||
00000023 P1IFG | |||
00000024 P1IES | |||
00000025 P1IE | |||
00000026 P1SEL | |||
00000027 P1REN | |||
00000028 P2IN | |||
00000029 P2OUT | |||
0000002a P2DIR | |||
0000002b P2IFG | |||
0000002c P2IES | |||
0000002d P2IE | |||
0000002e P2SEL | |||
0000002f P2REN | |||
00000041 P1SEL2 | |||
00000042 P2SEL2 | |||
00000048 ADC10DTC0 | |||
00000049 ADC10DTC1 | |||
0000004a ADC10AE0 | |||
00000050 __STACK_SIZE | |||
00000053 BCSCTL3 | |||
00000056 DCOCTL | |||
00000057 BCSCTL1 | |||
00000058 BCSCTL2 | |||
00000059 CACTL1 | |||
0000005a CACTL2 | |||
0000005b CAPD | |||
00000078 USICTL | |||
00000078 USICTL0 | |||
00000079 USICTL1 | |||
0000007a USICCTL | |||
0000007a USICKCTL | |||
0000007b USICNT | |||
0000007c USISR | |||
0000007c USISRL | |||
0000007d USISRH | |||
00000120 WDTCTL | |||
00000128 FCTL1 | |||
0000012a FCTL2 | |||
0000012c FCTL3 | |||
0000012e TA0IV | |||
00000160 TA0CTL | |||
00000162 TA0CCTL0 | |||
00000164 TA0CCTL1 | |||
00000166 TA0CCTL2 | |||
00000170 TA0R | |||
00000172 TA0CCR0 | |||
00000174 TA0CCR1 | |||
00000176 TA0CCR2 | |||
000001b0 ADC10CTL0 | |||
000001b2 ADC10CTL1 | |||
000001b4 ADC10MEM | |||
000001bc ADC10SA | |||
00000200 .bss | |||
00000200 __bss__ | |||
00000200 baseCnt | |||
0000020c measCnt | |||
00000214 ctsStatusReg | |||
00000216 wheel_position | |||
00000218 last_wheel_position | |||
0000021a deltaCnts | |||
0000021c prox_raw_Cnts | |||
0000021e timerA_UART_mode | |||
00000220 txData | |||
00000224 _lock | |||
00000226 _unlock | |||
00000228 _cleanup_ptr | |||
0000022a _dtors_ptr | |||
0000022c __end__ | |||
0000022c end | |||
000002b0 _stack | |||
00000300 __STACK_END | |||
000010f8 CALDCO_16MHZ | |||
000010f9 CALBC1_16MHZ | |||
000010fa CALDCO_12MHZ | |||
000010fb CALBC1_12MHZ | |||
000010fc CALDCO_8MHZ | |||
000010fd CALBC1_8MHZ | |||
000010fe CALDCO_1MHZ | |||
000010ff CALBC1_1MHZ | |||
0000e000 .text | |||
0000e000 TI_CAPT_Custom | |||
0000e000 __text__ | |||
0000e502 TI_CAPT_Wheel | |||
0000e730 CapTouchActiveMode | |||
0000e932 TI_CTS_RO_PINOSC_TA0_WDTp_HAL | |||
0000ea98 Dominant_Element | |||
0000ebaa GetGesture | |||
0000ec64 LedStartUpSequence | |||
0000ed04 TI_CAPT_Update_Baseline | |||
0000ed7a CapTouchIdleMode | |||
0000edda I_LSR | |||
0000ede8 I_LSR_15 | |||
0000edec I_LSR_14 | |||
0000edf0 I_LSR_13 | |||
0000edf4 I_LSR_12 | |||
0000edf8 I_LSR_11 | |||
0000edfc I_LSR_10 | |||
0000ee00 I_LSR_9 | |||
0000ee04 I_LSR_8 | |||
0000ee08 I_LSR_7 | |||
0000ee0c I_LSR_6 | |||
0000ee10 I_LSR_5 | |||
0000ee14 I_LSR_4 | |||
0000ee18 I_LSR_3 | |||
0000ee1c I_LSR_2 | |||
0000ee20 I_LSR_1 | |||
0000ee26 Timer_A0_ISR | |||
0000ee70 _auto_init | |||
0000eeb6 main | |||
0000eef8 MeasureCapBaseLine | |||
0000ef34 TimerA_UART_tx | |||
0000ef6e TimerA_UART_init | |||
0000efa6 __divi | |||
0000efa6 __remi | |||
0000efd2 I_LSL | |||
0000efde I_LSL_15 | |||
0000efe0 I_LSL_14 | |||
0000efe2 I_LSL_13 | |||
0000efe4 I_LSL_12 | |||
0000efe6 I_LSL_11 | |||
0000efe8 I_LSL_10 | |||
0000efea I_LSL_9 | |||
0000efec I_LSL_8 | |||
0000efee I_LSL_7 | |||
0000eff0 I_LSL_6 | |||
0000eff2 I_LSL_5 | |||
0000eff4 I_LSL_4 | |||
0000eff6 I_LSL_3 | |||
0000eff8 I_LSL_2 | |||
0000effa I_LSL_1 | |||
0000effe InitLaunchPadCore | |||
0000f028 TI_CAPT_Button | |||
0000f04e _c_int00 | |||
0000f04e _c_int00_noexit | |||
0000f074 TI_CAPT_Raw | |||
0000f092 TimerA_UART_shutdown | |||
0000f0ae SendByte | |||
0000f0c6 TI_CAPT_Init_Baseline | |||
0000f0de __divu | |||
0000f0de __remu | |||
0000f0f4 __mpyi | |||
0000f108 memcpy | |||
0000f11a func_epilog_7 | |||
0000f11c func_epilog_6 | |||
0000f11e func_epilog_5 | |||
0000f120 func_epilog_4 | |||
0000f122 func_epilog_3 | |||
0000f124 func_epilog_2 | |||
0000f126 func_epilog_1 | |||
0000f12a watchdog_timer | |||
0000f132 _system_pre_init | |||
0000f136 C$$EXIT | |||
0000f136 abort | |||
0000f13a _nop | |||
0000f13c __etext__ | |||
0000f13c etext | |||
0000f13c volume_down | |||
0000f146 right | |||
0000f150 volume_up | |||
0000f15a left | |||
0000f164 middle_element | |||
0000f16e proximity_element | |||
0000f178 wheel | |||
0000f18c middle_button | |||
0000f1a0 proximity_sensor | |||
0000f1b4 LedWheelPosition | |||
0000f1c4 startSequence | |||
0000f1cc __cinit__ | |||
0000f1cc cinit | |||
0000fffe _reset_vector | |||
ffffffff __binit__ | |||
ffffffff __c_args__ | |||
ffffffff __pinit__ | |||
ffffffff binit | |||
ffffffff pinit | |||
[183 symbols] |
@ -0,0 +1,292 @@ | |||
@e000 | |||
31 82 81 4D 02 00 81 4C 00 00 92 C3 14 02 1D 41 | |||
02 00 B0 12 74 F0 C1 43 04 00 30 40 E6 E4 5F 41 | |||
04 00 0F 5F 1F 51 02 00 A1 4F 06 00 A2 B3 14 02 | |||
05 24 2F 41 3E 40 C0 00 6E BF 08 20 A2 B3 14 02 | |||
5F 20 2F 41 3E 40 C0 00 6E BF 5A 20 5E 41 04 00 | |||
5D 4F 02 00 0D 5E 0D 5D 5E 41 04 00 0E 5E 1E 51 | |||
02 00 AD 9E 00 02 37 2C 5F 41 04 00 0F 5F 1F 51 | |||
02 00 8F 43 00 00 5F 41 04 00 0F 5F 2F 51 1F 4F | |||
04 00 8F 93 06 00 3C 24 5E 41 04 00 2F 41 5D 4F | |||
02 00 0D 5E 0D 5D 5E 41 04 00 0E 5E 2E 51 1E 4E | |||
04 00 1E 4E 06 00 1E 5D 00 02 1E 91 06 00 28 2C | |||
5E 41 04 00 5F 4F 02 00 0F 5E 0F 5F 5E 41 04 00 | |||
0E 5E 2E 51 1E 4E 04 00 1E 4E 06 00 1E 5F 00 02 | |||
81 4E 06 00 15 3C 5E 41 04 00 5F 4F 02 00 0F 5E | |||
0F 5F 1E 4F 00 02 5F 41 04 00 0F 5F 1F 51 02 00 | |||
2E 8F 5F 41 04 00 0F 5F 1F 51 02 00 8F 4E 00 00 | |||
A2 B3 14 02 05 20 2F 41 3E 40 C0 00 6E BF 08 20 | |||
A2 B3 14 02 60 24 2F 41 3E 40 C0 00 6E BF 5B 20 | |||
5E 41 04 00 5D 4F 02 00 0D 5E 0D 5D 5E 41 04 00 | |||
0E 5E 1E 51 02 00 9E 9D 00 02 00 00 37 2C 5F 41 | |||
04 00 0F 5F 1F 51 02 00 8F 43 00 00 5F 41 04 00 | |||
0F 5F 2F 51 1F 4F 04 00 8F 93 06 00 3C 24 5E 41 | |||
04 00 2F 41 5D 4F 02 00 0D 5E 0D 5D 5E 41 04 00 | |||
0E 5E 2E 51 1E 4E 04 00 1E 4E 06 00 1E 51 06 00 | |||
1E 9D 00 02 28 2C 5E 41 04 00 5F 4F 02 00 0F 5E | |||
0F 5F 1E 4F 00 02 5F 41 04 00 0F 5F 2F 51 1F 4F | |||
04 00 1E 8F 06 00 81 4E 06 00 15 3C 5E 41 04 00 | |||
5F 4F 02 00 0F 5E 0F 5F 5E 41 04 00 0E 5E 1E 51 | |||
02 00 2E 4E 1E 8F 00 02 5F 41 04 00 0F 5F 1F 51 | |||
02 00 8F 4E 00 00 5F 41 04 00 0F 5F 1F 51 02 00 | |||
8F 93 00 00 96 20 72 3C 12 C3 11 10 06 00 5E 41 | |||
04 00 2F 41 5D 4F 02 00 0D 5E 0D 5D 1D 4D 00 02 | |||
12 C3 0D 10 5E 41 04 00 5F 4F 02 00 0F 5E 0F 5F | |||
8F 4D 00 02 6A 3C 12 C3 11 10 06 00 11 11 06 00 | |||
5F 41 04 00 2E 41 5D 4E 02 00 0D 5F 0D 5D 1D 4D | |||
00 02 12 C3 0D 10 0D 11 0F 4D 0F 5F 0D 5F 5F 41 | |||
04 00 5E 4E 02 00 0E 5F 0E 5E 8E 4D 00 02 4D 3C | |||
1C 41 06 00 B0 12 0C EE 81 4C 06 00 5F 41 04 00 | |||
2E 41 5E 4E 02 00 0E 5F 0E 5E 1C 4E 00 02 B0 12 | |||
0C EE 0F 4C B0 12 F0 EF 0C 8F 5F 41 04 00 2E 41 | |||
5E 4E 02 00 0E 5F 0E 5E 8E 4C 00 02 2E 3C 1C 41 | |||
06 00 B0 12 08 EE 81 4C 06 00 5F 41 04 00 2E 41 | |||
5E 4E 02 00 0E 5F 0E 5E 1C 4E 00 02 B0 12 08 EE | |||
0F 4C B0 12 EE EF 0C 8F 5F 41 04 00 2E 41 5E 4E | |||
02 00 0E 5F 0E 5E 8E 4C 00 02 0F 3C 3F 40 C0 00 | |||
1F F2 14 02 0F 93 88 27 3F 80 40 00 9C 27 3F 80 | |||
40 00 B6 27 3F 80 40 00 D2 27 5E 41 04 00 2F 41 | |||
5D 4F 02 00 0D 5E 0D 5D 1D 4D 00 02 1D 51 06 00 | |||
5E 41 04 00 5F 4F 02 00 0F 5E 0F 5F 8F 4D 00 02 | |||
E8 3C 5F 41 04 00 0F 5F 2F 51 1E 4F 04 00 5F 41 | |||
04 00 0F 5F 1F 51 02 00 9F 9E 06 00 00 00 C6 2C | |||
A2 B2 14 02 C3 20 9F 3C 5F 41 04 00 0F 5F 1F 51 | |||
02 00 BF 90 10 00 00 00 2E 28 5E 41 04 00 2F 41 | |||
5D 4F 02 00 0D 5E 0D 5D 91 9D 00 02 06 00 12 2C | |||
5E 41 04 00 5D 4F 02 00 0D 5E 0D 5D 1D 4D 00 02 | |||
1D 83 5E 41 04 00 5F 4F 02 00 0F 5E 0F 5F 8F 4D | |||
00 02 11 3C 5E 41 04 00 5D 4F 02 00 0D 5E 0D 5D | |||
1C 43 1C 5D 00 02 5E 41 04 00 5F 4F 02 00 0F 5E | |||
0F 5F 8F 4C 00 02 81 43 06 00 74 3C 5E 41 04 00 | |||
2F 41 5D 4F 02 00 0D 5E 0D 5D 91 9D 00 02 06 00 | |||
12 2C 5E 41 04 00 5D 4F 02 00 0D 5E 0D 5D 1D 4D | |||
00 02 1D 83 5E 41 04 00 5F 4F 02 00 0F 5E 0F 5F | |||
8F 4D 00 02 11 3C 5E 41 04 00 5D 4F 02 00 0D 5E | |||
0D 5D 1C 43 1C 5D 00 02 5E 41 04 00 5F 4F 02 00 | |||
0F 5E 0F 5F 8F 4C 00 02 81 43 06 00 43 3C 12 C3 | |||
11 10 06 00 11 11 06 00 5F 41 04 00 2E 41 5D 4E | |||
02 00 0D 5F 0D 5D 1D 4D 00 02 12 C3 0D 10 0D 11 | |||
0F 4D 0F 5F 0D 5F 5F 41 04 00 5E 4E 02 00 0E 5F | |||
0E 5E 8E 4D 00 02 26 3C 12 C3 11 10 06 00 5E 41 | |||
04 00 2F 41 5D 4F 02 00 0D 5E 0D 5D 1D 4D 00 02 | |||
12 C3 0D 10 5E 41 04 00 5F 4F 02 00 0F 5E 0F 5F | |||
8F 4D 00 02 0F 3C 3F 40 30 00 1F F2 14 02 0F 93 | |||
5B 27 3F 80 10 00 92 27 3F 80 10 00 C0 27 3F 80 | |||
10 00 DA 27 5E 41 04 00 2F 41 5D 4F 02 00 0D 5E | |||
0D 5D 1D 4D 00 02 1D 51 06 00 5E 41 04 00 5F 4F | |||
02 00 0F 5E 0F 5F 8F 4D 00 02 13 3C 5F 41 04 00 | |||
0F 5F 2F 51 1E 4F 04 00 5F 41 04 00 0F 5F 1F 51 | |||
02 00 9F 9E 06 00 00 00 04 28 92 D3 14 02 A2 D2 | |||
14 02 D1 53 04 00 2F 41 D1 9F 01 00 04 00 02 2C | |||
30 40 1E E0 92 B3 14 02 02 20 A2 C2 14 02 31 52 | |||
30 41 31 80 06 00 81 4C 00 00 B1 43 04 00 2C 41 | |||
3D 40 0C 02 B0 12 00 E0 92 B3 14 02 04 25 3D 40 | |||
0C 02 2C 41 B0 12 98 EA C1 4C 02 00 C1 93 02 00 | |||
0E 20 2F 41 5F 4F 01 00 0F 5F 2F 83 1F 4F 0C 02 | |||
1F 52 0C 02 1F 52 0E 02 81 4F 04 00 2B 3C 2F 41 | |||
5F 4F 01 00 1F 83 5E 41 02 00 0E 9F 10 20 5F 41 | |||
02 00 0F 5F 1E 42 0C 02 1E 5F 0C 02 5F 41 02 00 | |||
0F 5F 2F 83 1E 5F 0C 02 81 4E 04 00 13 3C 5F 41 | |||
02 00 0F 5F 5E 41 02 00 0E 5E 2E 53 1E 4E 0C 02 | |||
1E 5F 0C 02 5F 41 02 00 0F 5F 2F 83 1E 5F 0C 02 | |||
81 4E 04 00 2F 41 5E 4F 13 00 1E 91 04 00 B9 34 | |||
5C 4F 12 00 5D 4F 01 00 B0 12 DE F0 5D 41 02 00 | |||
B0 12 F4 F0 81 4C 04 00 2F 41 5C 4F 12 00 5D 4F | |||
01 00 B0 12 DE F0 2D 43 B0 12 A6 EF 81 5C 04 00 | |||
C1 93 02 00 30 20 2F 41 5C 4F 12 00 5D 4F 01 00 | |||
B0 12 DE F0 1D 42 0E 02 B0 12 F4 F0 3D 40 64 00 | |||
B0 12 DE F0 81 5C 04 00 2F 41 5C 4F 12 00 5D 4F | |||
01 00 B0 12 DE F0 2F 41 5F 4F 01 00 0F 5F 2F 83 | |||
1D 4F 0C 02 B0 12 F4 F0 3D 40 64 00 B0 12 DE F0 | |||
81 8C 04 00 81 93 04 00 68 34 2F 41 5F 4F 12 00 | |||
81 5F 04 00 62 3C 2F 41 5E 4F 01 00 1E 83 5D 41 | |||
02 00 0D 9E 31 20 5C 4F 12 00 5D 4F 01 00 B0 12 | |||
DE F0 1D 42 0C 02 B0 12 F4 F0 3D 40 64 00 B0 12 | |||
DE F0 81 5C 04 00 2F 41 5C 4F 12 00 5D 4F 01 00 | |||
B0 12 DE F0 5F 41 02 00 0F 5F 2F 83 1D 4F 0C 02 | |||
B0 12 F4 F0 3D 40 64 00 B0 12 DE F0 81 8C 04 00 | |||
2F 41 5E 4F 12 00 1E 83 1E 91 04 00 2E 34 5F 4F | |||
12 00 81 8F 04 00 29 3C 5C 4F 12 00 5D 4F 01 00 | |||
B0 12 DE F0 5F 41 02 00 0F 5F 2F 53 1D 4F 0C 02 | |||
B0 12 F4 F0 3D 40 64 00 B0 12 DE F0 81 5C 04 00 | |||
2F 41 5C 4F 12 00 5D 4F 01 00 B0 12 DE F0 5F 41 | |||
02 00 0F 5F 2F 83 1D 4F 0C 02 B0 12 F4 F0 3D 40 | |||
64 00 B0 12 DE F0 81 8C 04 00 2F 41 5F 4F 12 00 | |||
1F 91 04 00 03 38 81 93 04 00 05 34 B1 43 04 00 | |||
02 3C B1 43 04 00 1C 41 04 00 31 50 06 00 30 41 | |||
31 82 C1 43 04 00 B1 40 0B 00 06 00 F1 40 FD 00 | |||
02 00 7C 40 BE 00 B0 12 AE F0 7C 40 EF 00 B0 12 | |||
AE F0 C1 43 00 00 C1 43 01 00 C1 43 03 00 DF 3C | |||
D2 42 FD 10 57 00 D2 42 FC 10 56 00 F2 D0 06 00 | |||
58 00 B2 F0 EF FF 62 01 B2 43 16 02 3C 40 78 F1 | |||
B0 12 02 E5 82 4C 16 02 B2 93 16 02 7D 24 C1 43 | |||
04 00 B2 92 16 02 04 2C B2 50 38 00 16 02 02 3C | |||
B2 82 16 02 12 C3 12 10 16 02 12 11 16 02 5C 42 | |||
16 02 B0 12 AA EB C1 4C 02 00 C1 93 03 00 13 20 | |||
E1 93 02 00 08 28 F1 90 11 00 02 00 04 24 F1 90 | |||
10 00 02 00 08 20 B2 93 18 02 03 24 92 42 18 02 | |||
16 02 C1 43 02 00 1E 42 16 02 1F 43 5F F2 21 00 | |||
5F DE B4 F1 C2 4F 21 00 C1 93 02 00 22 24 F1 90 | |||
10 00 02 00 1E 24 F1 90 FD 00 02 00 1A 24 C1 93 | |||
03 00 0C 20 D1 43 03 00 7C 40 FC 00 B0 12 AE F0 | |||
3C 40 20 00 5C 52 18 02 B0 12 AE F0 5C 41 02 00 | |||
B0 12 AE F0 3C 40 20 00 5C 52 16 02 B0 12 AE F0 | |||
1B 3C C1 93 03 00 15 20 91 53 06 00 B1 90 0C 00 | |||
06 00 12 28 81 43 06 00 3C 40 30 00 5C 52 16 02 | |||
B0 12 AE F0 3C 40 30 00 5C 52 16 02 B0 12 AE F0 | |||
03 3C B1 40 0B 00 06 00 C1 43 00 00 D1 53 01 00 | |||
92 42 16 02 18 02 4B 3C 3C 40 8C F1 B0 12 28 F0 | |||
4C 93 16 24 C1 93 04 00 10 20 7C 40 80 00 B0 12 | |||
AE F0 7C 40 80 00 B0 12 AE F0 D1 43 04 00 1F 43 | |||
5F F2 21 00 5F E3 C2 4F 21 00 C1 43 00 00 28 3C | |||
C1 43 04 00 D2 F3 21 00 F1 90 FD 00 02 00 03 24 | |||
C1 93 03 00 12 20 B2 93 18 02 0F 24 3C 40 30 00 | |||
5C 52 18 02 B0 12 AE F0 3C 40 30 00 5C 52 18 02 | |||
B0 12 AE F0 B1 40 0B 00 06 00 D1 93 03 00 08 20 | |||
7C 40 FB 00 B0 12 AE F0 7C 40 FB 00 B0 12 AE F0 | |||
B2 43 18 02 F1 40 FD 00 02 00 C1 43 03 00 6E 41 | |||
0F 4E 5F 53 C1 4F 00 00 7E 90 C8 00 19 2B 31 52 | |||
30 41 31 80 12 00 81 4D 02 00 81 4C 00 00 0F 42 | |||
C1 4F 05 00 D1 42 00 00 06 00 91 42 20 01 08 00 | |||
B1 F0 FF 00 08 00 B1 D0 00 5A 08 00 91 42 60 01 | |||
0A 00 91 42 64 01 0C 00 91 42 74 01 0E 00 B2 40 | |||
20 03 60 01 B2 40 00 E1 64 01 D2 D3 00 00 C1 43 | |||
04 00 6C 3C 5F 41 04 00 0F 5F 2F 51 1F 4F 04 00 | |||
2F 4F E1 4F 10 00 5F 41 04 00 0F 5F 2F 51 1F 4F | |||
04 00 1F 4F 02 00 E1 4F 11 00 5F 41 04 00 0F 5F | |||
2F 51 1F 4F 04 00 2E 4F 5F 41 04 00 0F 5F 2F 51 | |||
1F 4F 04 00 DE CF 04 00 00 00 5F 41 04 00 0F 5F | |||
2F 51 1F 4F 04 00 1E 4F 02 00 5F 41 04 00 0F 5F | |||
2F 51 1F 4F 04 00 DE DF 04 00 00 00 2F 41 1E 4F | |||
10 00 1E 5F 0C 00 3E 50 10 5A 82 4E 20 01 A2 D2 | |||
60 01 AF 92 0C 00 03 20 32 D0 D8 00 02 3C 32 D0 | |||
18 00 B2 E0 00 10 64 01 5F 41 04 00 0F 5F 1F 51 | |||
02 00 9F 42 74 01 00 00 B2 40 80 5A 20 01 5F 41 | |||
04 00 0F 5F 2F 51 1F 4F 04 00 2F 4F DF 41 10 00 | |||
00 00 5F 41 04 00 0F 5F 2F 51 1F 4F 04 00 1F 4F | |||
02 00 DF 41 11 00 00 00 D1 53 04 00 2F 41 D1 9F | |||
01 00 04 00 8F 2B 5F 41 05 00 02 DF F1 B2 05 00 | |||
01 20 32 C2 D2 41 06 00 00 00 92 41 08 00 20 01 | |||
92 41 0A 00 60 01 92 41 0C 00 64 01 92 41 0E 00 | |||
74 01 31 50 12 00 30 41 31 80 0A 00 81 4D 02 00 | |||
81 4C 00 00 81 43 06 00 C1 43 08 00 C1 43 04 00 | |||
72 3C 5F 41 04 00 0F 5F 2F 51 1E 4F 04 00 5F 41 | |||
04 00 0F 5F 1F 51 02 00 9F 9E 06 00 00 00 5A 28 | |||
5F 41 04 00 0F 5F 2F 51 1E 4F 04 00 5F 41 04 00 | |||
0F 5F 1F 51 02 00 AE 9F 08 00 0E 2C 5F 41 04 00 | |||
0F 5F 2F 51 1E 4F 04 00 5F 41 04 00 0F 5F 1F 51 | |||
02 00 9F 4E 08 00 00 00 5F 41 04 00 0F 5F 2F 51 | |||
1E 4F 04 00 5F 41 04 00 0F 5F 1F 51 02 00 2C 4F | |||
1C 8E 06 00 3D 40 64 00 B0 12 F4 F0 5F 41 04 00 | |||
0F 5F 2F 51 1E 4F 04 00 5F 41 04 00 0F 5F 2F 51 | |||
1F 4F 04 00 1D 4F 08 00 1D 8E 06 00 B0 12 DE F0 | |||
5F 41 04 00 0F 5F 1F 51 02 00 8F 4C 00 00 5F 41 | |||
04 00 0F 5F 1F 51 02 00 A1 9F 06 00 12 2C 5F 41 | |||
04 00 0F 5F 1F 51 02 00 A1 4F 06 00 D1 41 04 00 | |||
08 00 07 3C 5F 41 04 00 0F 5F 1F 51 02 00 8F 43 | |||
00 00 D1 53 04 00 2F 41 D1 9F 01 00 04 00 89 2B | |||
5C 41 08 00 31 50 0A 00 30 41 31 80 06 00 C1 4C | |||
00 00 F1 40 FD 00 01 00 B2 93 18 02 3F 24 6F 41 | |||
1F 92 18 02 1E 2C 5F 42 18 02 6F 81 C1 4F 03 00 | |||
F1 92 03 00 06 2C D1 41 03 00 01 00 D1 43 02 00 | |||
2D 3C 6F 41 5F 82 18 02 7F 50 10 00 C1 4F 04 00 | |||
F1 92 04 00 23 2C D1 41 04 00 01 00 E1 43 02 00 | |||
1D 3C 6F 41 5F 82 18 02 C1 4F 04 00 F1 92 04 00 | |||
06 2C D1 41 04 00 01 00 E1 43 02 00 0F 3C 5F 42 | |||
18 02 6F 81 7F 50 10 00 C1 4F 03 00 F1 92 03 00 | |||
05 2C D1 41 03 00 01 00 D1 43 02 00 F1 90 FD 00 | |||
01 00 03 20 5C 41 01 00 0A 3C D1 93 02 00 05 20 | |||
3C 40 10 00 5C 51 01 00 02 3C 5C 41 01 00 31 50 | |||
06 00 30 41 21 83 B2 40 10 00 62 01 A2 D2 60 01 | |||
3F 40 F4 01 1F 52 70 01 82 4F 72 01 B2 40 10 01 | |||
60 01 C1 43 00 00 F1 92 00 00 1F 2C 6F 41 D2 4F | |||
C4 F1 21 00 32 D0 D8 00 0D 12 0E 12 3D 40 8C 10 | |||
3E 40 03 00 1D 83 0E 73 FD 23 0D 93 FB 23 3E 41 | |||
3D 41 00 3C 3F 40 F4 01 1F 52 70 01 82 4F 72 01 | |||
D1 53 00 00 F1 92 00 00 E1 2B D2 43 21 00 C1 93 | |||
00 00 11 24 D1 83 00 00 6F 41 D2 4F C4 F1 21 00 | |||
32 D0 D8 00 3F 40 F4 01 1F 52 70 01 82 4F 72 01 | |||
C1 93 00 00 EF 23 B2 F0 EF FF 62 01 C2 43 21 00 | |||
21 53 30 41 31 80 06 00 C1 4D 02 00 81 4C 00 00 | |||
C1 43 04 00 2B 3C C1 43 03 00 21 3C 3D 40 0C 02 | |||
B0 12 74 F0 5F 41 03 00 2D 41 5E 4D 02 00 0E 5F | |||
0E 5E 1E 4E 00 02 12 C3 0E 10 5F 41 03 00 0F 5F | |||
1F 4F 0C 02 12 C3 0F 10 0E 5F 5F 41 03 00 5D 4D | |||
02 00 0D 5F 0D 5D 8D 4E 00 02 D1 53 03 00 2C 41 | |||
D1 9C 01 00 03 00 DA 2B D1 53 04 00 D1 91 02 00 | |||
04 00 D1 2B 31 50 06 00 30 41 7C 40 DE 00 B0 12 | |||
AE F0 7C 40 AD 00 B0 12 AE F0 D2 42 FF 10 57 00 | |||
D2 42 FE 10 56 00 F2 D0 06 00 58 00 D2 D3 21 00 | |||
82 43 1A 02 B2 40 64 00 72 01 B2 40 10 01 60 01 | |||
B2 D0 10 00 62 01 32 D0 D8 00 B2 F0 EF FF 62 01 | |||
3C 40 A0 F1 3D 40 1A 02 B0 12 00 E0 B2 90 3D 00 | |||
1A 02 E8 2B D2 C3 21 00 30 41 3D F0 0F 00 3D E0 | |||
0F 00 0D 5D 0D 5D 00 5D 12 C3 0C 10 12 C3 0C 10 | |||
12 C3 0C 10 12 C3 0C 10 12 C3 0C 10 12 C3 0C 10 | |||
12 C3 0C 10 12 C3 0C 10 12 C3 0C 10 12 C3 0C 10 | |||
12 C3 0C 10 12 C3 0C 10 12 C3 0C 10 12 C3 0C 10 | |||
12 C3 0C 10 30 41 C2 93 1E 02 04 20 B1 C0 D8 00 | |||
00 00 00 13 B2 50 68 00 72 01 D2 83 22 02 0A 20 | |||
B2 F0 EF FF 62 01 F2 40 0A 00 22 02 B1 C0 18 00 | |||
00 00 00 13 92 B3 20 02 04 24 B2 F0 7F FF 62 01 | |||
03 3C B2 D0 80 00 62 01 12 C3 12 10 20 02 00 13 | |||
0A 12 09 12 3F 40 CC F1 3F 93 12 24 3D 40 CC F1 | |||
0C 3C 8F 12 2A 53 12 3C 3C 4D 0A 4D 0E 49 B0 12 | |||
08 F1 0A 59 0D 4A 1D 53 1D C3 39 4D 09 93 F4 23 | |||
3F 40 FF FF 3F 93 05 24 3A 40 FF FF 2F 4A 0F 93 | |||
E8 23 30 40 24 F1 B2 40 80 5A 20 01 B0 12 FE EF | |||
D2 42 FF 10 57 00 D2 42 FE 10 56 00 F2 D0 06 00 | |||
58 00 3C 40 A0 F1 B0 12 C6 F0 3C 40 A0 F1 7D 40 | |||
05 00 B0 12 04 ED B0 12 7A ED B0 12 F8 EE B0 12 | |||
64 EC B0 12 30 E7 F7 3F D2 43 21 00 D2 42 FD 10 | |||
57 00 D2 42 FC 10 56 00 F2 D0 06 00 58 00 3C 40 | |||
78 F1 B0 12 C6 F0 3C 40 78 F1 6D 43 B0 12 04 ED | |||
3C 40 8C F1 B0 12 C6 F0 3C 40 8C F1 6D 43 B0 12 | |||
04 ED 30 41 21 83 C1 4C 00 00 B2 B0 10 00 62 01 | |||
FC 23 92 42 70 01 72 01 B2 50 68 00 72 01 6F 41 | |||
82 4F 20 02 B2 D0 00 01 20 02 92 52 20 02 20 02 | |||
B2 40 30 00 62 01 32 D0 18 00 21 53 30 41 C2 43 | |||
56 00 D2 42 FF 10 57 00 D2 42 FE 10 56 00 F2 F0 | |||
F9 00 58 00 F2 D0 06 00 26 00 E2 D3 22 00 E2 C2 | |||
22 00 A2 42 62 01 A2 D2 60 01 B2 40 20 02 60 01 | |||
D2 43 1E 02 30 41 0B 43 0D 93 03 34 3D E3 1D 53 | |||
1B D3 0C 93 03 34 3C E3 1C 53 3B E3 B0 12 DE F0 | |||
1B B3 02 24 3C E3 1C 53 2B B3 02 24 3E E3 1E 53 | |||
30 41 3D F0 0F 00 3D E0 0F 00 0D 5D 00 5D 0C 5C | |||
0C 5C 0C 5C 0C 5C 0C 5C 0C 5C 0C 5C 0C 5C 0C 5C | |||
0C 5C 0C 5C 0C 5C 0C 5C 0C 5C 0C 5C 30 41 D2 42 | |||
57 00 57 00 F2 D0 20 00 53 00 F2 F0 06 00 21 00 | |||
F2 D0 F9 00 22 00 C2 43 2E 00 F2 D0 3F 00 2A 00 | |||
F2 F0 C0 00 29 00 30 41 21 82 81 4C 00 00 C1 43 | |||
02 00 2C 41 3D 40 0C 02 B0 12 00 E0 92 B3 14 02 | |||
02 24 D1 43 02 00 5C 41 02 00 21 52 30 41 31 40 | |||
00 03 B2 40 3A F1 24 02 B2 40 3A F1 26 02 B0 12 | |||
32 F1 0C 93 02 24 B0 12 70 EE 0C 43 B0 12 B6 EE | |||
B0 12 36 F1 21 82 81 4D 02 00 81 4C 00 00 3F 40 | |||
41 00 6F 9C 04 20 1D 41 02 00 B0 12 32 E9 21 52 | |||
30 41 C2 43 1E 02 F2 F0 F9 00 26 00 B2 F0 EF FF | |||
64 01 B2 F0 CF FF 60 01 E2 C3 21 00 30 41 21 83 | |||
C1 4C 00 00 B0 12 6E EF 6C 41 B0 12 34 EF B0 12 | |||
92 F0 21 53 30 41 21 83 81 4C 00 00 5D 4C 02 00 | |||
0D 5D 3D 50 00 02 B0 12 74 F0 21 53 30 41 0E 43 | |||
0F 4C 1C 43 0F 5F 0E 6E 0E 9D 01 28 0E 8D 0C 6C | |||
F9 2B 30 41 0E 43 12 C3 0C 10 01 28 0E 5D 0D 5D | |||
0C 93 F9 23 0C 4E 30 41 0F 4C 0E 93 05 24 1F 53 | |||
FF 4D FF FF 1E 83 FB 23 30 41 34 41 35 41 36 41 | |||
37 41 38 41 39 41 3A 41 30 41 B1 C0 D0 00 00 00 | |||
00 13 1C 43 30 41 03 43 FF 3F 30 41 2E 00 42 00 | |||
04 00 79 00 08 03 2E 00 42 00 08 00 71 00 00 03 | |||
2E 00 42 00 10 00 76 00 05 03 2E 00 42 00 02 00 | |||
6F 00 FE 02 2E 00 42 00 20 00 5E 01 ED 03 2E 00 | |||
42 00 01 00 82 00 C8 00 41 04 00 00 50 F1 46 F1 | |||
3C F1 5A F1 00 00 00 00 01 00 40 4B 41 01 04 00 | |||
64 F1 00 00 00 00 00 00 00 00 00 00 01 00 00 00 | |||
41 01 05 00 6E F1 00 00 00 00 00 00 00 00 00 00 | |||
01 00 00 00 E8 E8 C8 D8 98 B8 38 78 80 80 C0 40 | |||
60 20 30 10 E8 D8 B8 78 80 40 20 10 01 00 1E 02 | |||
00 00 01 00 22 02 0A 00 02 00 14 02 12 00 00 00 | |||
@fff2 | |||
26 EE 2A F1 | |||
@fffe | |||
4E F0 | |||
q |
@ -0,0 +1,16 @@ | |||
CLS | |||
@echo off | |||
rem This is a small helper script that runs through the test collection for one device (folder) | |||
rem | |||
rem Dung Dang, MSP430 Applications, Texas Instruments, Inc. | |||
rem Last modified: 02/25/2011 | |||
:input | |||
@echo MSP-EXP430G2-LaunchPad Firmware Programmer | |||
set device=MSP430G2231 | |||
set firmware=LaunchPadCapTouchBoosterPack.txt | |||
@echo Programing %firmware% into %device% ...... | |||
..\..\MSP430Flasher\MSP430Flasher.exe -n %device% -w %firmware% -v -g -z [VCC] | |||
pause |
@ -0,0 +1,216 @@ | |||
------------MSP430G2-LaunchPad CapTouch BoosterPack User Experience------------- | |||
Ver.: 1.00 Initial Release | |||
February 2011 | |||
Dung Dang | |||
MSP430 Applications | |||
Texas Instruments, Inc. | |||
-------------------------------------------------------------------------------- | |||
CONTENTS | |||
I. DESCRIPTION | |||
II. PROJECT & FILE CONFIGURATION | |||
III. PROJECT IMPORT IN CCS & IAR | |||
IV. CAP TOUCH LIBRARY | |||
V. TOUCH & GESTURE DEFINITIONS | |||
VI. UART COMMUNICATION PROTOCOL | |||
VII. HISTORY | |||
I. DESCRIPTION | |||
----------------------------------- | |||
This application operates on the LaunchPad platform using the MSP430G2452 | |||
device and the CapTouch BoosterPack plugin board. The capacitive touch and | |||
proximity sensing are enabled by the pin oscillator feature new to the | |||
MSP430G2xx2 family devices. The User Experience application also utilizes | |||
the cap touch library to realize & measure the capacitive touch and proximity | |||
sensors. The cap touch library also provides layers of abstractions to | |||
generate higher logical outputs such as logical touches, geometry (in this | |||
hardware, a four-button wheel), and even gestures. | |||
The User Experience application starts up and remains in 'sleep' mode, | |||
sampling the proximity sensor every ~8.3ms [VLO/100=12kHz/100=120Hz]. Upon | |||
registering a valid proximity event [hand/finger/object hovering ~3-5cm from | |||
the BoosterPack], the application wakes up to operate in the 'active' mode. | |||
During the wake up period, the LEDs surrounding the wheel light in a wake-up | |||
sequence, starting with a slow clockwise and ending with a fast | |||
counter-clockwise motion. As this sequence ends, the device enters active mode. | |||
In active mode, the application samples and registers individual finger touches | |||
on the 16-position wheel or the center button as well as simple gestures | |||
[Clockwise & Counter-clockwise] while the finger moves along and remains on | |||
the wheel. Upon wheel position detection, the corresponding LEDs surrounding | |||
the wheel light up accordingly. Each individual tap on the center capactive | |||
touch button toggles the center LED. | |||
After a predetermined amount of time without any touch activity (on the wheel | |||
or on the center button) the application returns to sleep mode, enabling only | |||
the proximity sensor. | |||
A 9600 baud UART link is also implemented using SW TimerA to provide | |||
application and cap touch data to the PC via the UART-USB back channel. | |||
The application sends UART data upon events such as wake up, sleep, touch, | |||
or gesture. | |||
II. PROJECT & FILE CONFIGURATION | |||
----------------------------------- | |||
PROJECT ROOT - CapTouchBoosterPack_UserExperience | |||
| CapTouchBoosterPack_UserExperience.c | |||
| <Main application code> | |||
| README <This file> | |||
| uart.c <C file: UART implementation using TimerA & SW> | |||
| uart.h <H file: UART implementation using TimerA & SW> | |||
| | |||
+---[CapTouchLibrary] <Capacitive Touch Library Code> | |||
| Cap_Touch_HAL.c | |||
| Cap_Touch_HAL.h | |||
| Cap_Touch_Layer.c | |||
| Cap_Touch_Layer.h | |||
| requirements.doc | |||
| structure.c <Created using template_structure.*> | |||
| structure.h <Configured/calibrated specifically for this HW> | |||
| | |||
+---[CCS] <CCS Project Configuration Files> | |||
| | <All listed files are required> | |||
| | <The non-listed can be safely removed> | |||
| | .ccsproject | |||
| | .cdtbuild | |||
| | .cdtproject | |||
| | .project <Contains links to portable project folders/files> | |||
| | lnk_msp430g2452.cmd | |||
| | macros.ini <Enables portable project> | |||
| | MSP430G2452.ccxml | |||
| | | |||
| \---All other folders & files: IDE/build generated files | |||
remove/ignore when exporting projects | |||
| | |||
\---[IAR] <CCS Project Configuration Files> | |||
| <All listed files are required> | |||
| <The non-listed can be safely removed> | |||
| CapTouch_BoosterPack_UserExperience.ewd | |||
| CapTouch_BoosterPack_UserExperience.ewp | |||
| CapTouch_BoosterPack_UserExperience.eww | |||
\---All other folders & files: IDE/build generated files | |||
remove/ignore when exporting projects | |||
Legend: [Directory] | |||
|---filename | |||
III. PROJECT IMPORT IN CCS & IAR | |||
----------------------------------- | |||
1. Project Import in CCS | |||
a. Open CCS. | |||
b. Select a new project workspace outside of the project folder* | |||
c. Select Project-->Import Existing Project | |||
d. Browse to the [PROJECT_ROOT]\CCS folder | |||
e. Select Finish | |||
*Ideally, workspace should be in completely independent folder, not | |||
containing or contained by the project/package folder. | |||
!Note: For CCS, while project root is in the outer directory, the CCS | |||
project files are located inside CCS. To enable the portability of | |||
the project, the file macros.ini is created to define the root. | |||
Additionally, all project code files (*.c, *.h) are added as linked | |||
resources with their relative path to the project root. | |||
2. Open project & workspace in IAR | |||
a. Browse to the [PROJECT_ROOT]\IAR folder | |||
b. Open the CapTouch_BoosterPack_UserExperience.eww workspace. | |||
IV. CAP TOUCH LIBRARY | |||
The MSP430G2-LaunchPad CapTouch BoosterPack User Experience uses the Cap Touch | |||
Library to configure, calibrate, and control the capacitive sensors. | |||
The sensor pads are configured in the structure.h & structure.c files. | |||
Specifically 6 elements are divided into three sensors: 1 proximity sensor, 1 | |||
cap touch button (center button), and a 4-element wheel. | |||
After each element is calibrated to determine the touch threshold as well as | |||
their maximum values in number of counts (which correlate to the measured | |||
capacitances), these calibration values are also registered inside structure.c. | |||
The cap_touch_hal.* files provide the hardware abstract layer for the cap touch | |||
library, which essentially provides different hardware/peripheral options to | |||
drive the cap touch functionality. Specifically for the CapTouch BoosterPack | |||
using an MSP430G2xx2/MSP430G2xx3 device, the Pin Oscillator peripheral is used. | |||
The cap_touch_layer.* files provides the cap touch layer, which offers functions | |||
that process the raw data into structured format. The main application utilizes | |||
this layer for their API calls to setup, measure baseline, detect touches, and | |||
detect wheel positions. | |||
For more information on the Cap Touch Library, refer to the Cap Touch Library | |||
documentation. | |||
V. TOUCH & GESTURE DEFINITIONS | |||
----------------------------------- | |||
Proximity Sensor | |||
The proximity sensor is made of the entire top PCB layer surface that covers the | |||
capacitive touch wheel. The proximity sensor detection occurs when the measured | |||
capacitance increases due to the presence of some conductive object within 1-2 | |||
inch from the surface. Generally, a hand wave motion in parallel and 1-2 inch | |||
from the CapTouch BoosterPack can trigger the detection. | |||
Individual Cap Touch Presses | |||
The center button (small round button in the middle of the board) can register | |||
an individual touch/press. | |||
The capactive touch wheel consists of four physical "ninja-star" elements | |||
arranged in a wheel formation that is calibrated & programed to provide | |||
16-position detection. These positions can be detected individually as a | |||
button press. A press by the application's definition is consituted by a | |||
separate and single position detection registered continously [i.e. press | |||
begins when the position is touched and after no other position was detected, | |||
and ends when another position is detected or no further position is dectected. | |||
Wheel Gesture | |||
A gesture on the capacitive touch wheel is formed when a continuous series of | |||
touches is detected (no no-detection is reported, i.e. finger never leaves the | |||
wheel). A complete continuous finger motion on the wheel might consist of | |||
several intermediate gestures, each with one separate direction (clockwise or | |||
counter-clockwise). | |||
VI. UART COMMUNICATION PROTOCOL | |||
----------------------------------- | |||
Per each event (wake up, go to sleep, touch/press, or gesture), a UART packet | |||
of two bytes is sent. They are specified as follows. | |||
WAKE UP [due to proximity sensor detection]: 0xBE 0xEF | |||
SLEEP [after period of inactivity]: 0xDE 0xAD | |||
CENTER BUTTON PRESS: 0x80 0x80 | |||
WHEEL POSITION TOUCH/PRESS [z = touch position]: 0x3z 0x3z [z=1 nibble 0x0-F] | |||
GESTURE START [z = touch position]: 0xFC 0x2z [z=1 nibble 0x0-F] | |||
GESTURE STOP: 0xFB 0xFB | |||
GESTURE & GESTURE END POSITION : 0xGG 0x2z | |||
GG = [binary] b???????? | |||
First bit is direction: 0 = clockwise, 1 = counter-clockwise | |||
Last 7 bits = count of gesture movement | |||
z = ending position of the immediate gesture [[z=1 nibble 0x0-F] | |||
The UART receiver can decipher the packets by comparing them against the fixed | |||
values (WAKE UP, SLEEP, CENTER BUTTON PRESS, GESTURE START & STOP) or against | |||
ranges (WHEEL TOUCH = 0x30-0x3F, GESTURE = 0x00-0x1F, GESTURE POSITION = | |||
0x20-0x2F) | |||
VII. HISTORY | |||
----------------------------------- | |||
Ver. 1.0 | |||
- Implemented 64-position detection in the cap touch layer (defined in | |||
structure.h/c fies). These 64 position are still translated into 16-position | |||
representational wheel. | |||
- Instead of sending continuous wheel touch packets, only send initial, last | |||
and every other WHEEL_TOUCH_DELAY wheel touch detections. This modification does | |||
not affect the MSP430G2-LaunchPad CapTouch BoosterPack User Experience GUI, but | |||
enables full and expected behavior of the MediaPad program in Windows. | |||
Ver. 0.9: | |||
-Initial firmware release for small lot production. Supports MSP430G2-LaunchPad | |||
CapTouch BoosterPack User Experience GUI. Partial support for MediaPad, | |||
application behavior might not be optimized. |
@ -0,0 +1,5 @@ | |||
# only export the jar file for applets.. | |||
# everything else is installed as a separate browser plugin | |||
applet=sonia_v2_9.jar | |||
# application needs everything | |||
application=sonia_v2_9.jar,JSynClasses.jar,JSynV142.dll,libJSynV142.jnilib |
@ -0,0 +1,3 @@ | |||
CapTouch_BoosterPack_UserExperience_GUI | |||
CapTouch_BoosterPack_UserExperience_GUI.jar,core.jar,JSynClasses.jar,sonia_v2_9.jar,serial.jar,RXTXcomm.jar |
@ -0,0 +1,755 @@ | |||
import processing.core.*; | |||
import processing.xml.*; | |||
import pitaru.sonia_v2_9.*; | |||
import processing.serial.*; | |||
import java.io.BufferedReader; | |||
import java.io.IOException; | |||
import java.io.InputStreamReader; | |||
import java.applet.*; | |||
import java.awt.Dimension; | |||
import java.awt.Frame; | |||
import java.awt.event.MouseEvent; | |||
import java.awt.event.KeyEvent; | |||
import java.awt.event.FocusEvent; | |||
import java.awt.Image; | |||
import java.io.*; | |||
import java.net.*; | |||
import java.text.*; | |||
import java.util.*; | |||
import java.util.zip.*; | |||
import java.util.regex.*; | |||
public class CapTouch_BoosterPack_UserExperience_GUI extends PApplet { | |||
/******************************************************************************* | |||
* | |||
* CapTouch_BoosterPack_UserExperience_GUI.pde | |||
* - PC demo application for establishing a serial connection | |||
* with the LaunchPad CapTouch BoosterPack. | |||
* | |||
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ | |||
* | |||
* Redistribution and use in source and binary forms, with or without | |||
* modification, are permitted provided that the following conditions | |||
* are met: | |||
* | |||
* Redistributions of source code must retain the above copyright | |||
* notice, this list of conditions and the following disclaimer. | |||
* | |||
* Redistributions in binary form must reproduce the above copyright | |||
* notice, this list of conditions and the following disclaimer in the | |||
* documentation and/or other materials provided with the | |||
* distribution. | |||
* | |||
* Neither the name of Texas Instruments Incorporated nor the names of | |||
* its contributors may be used to endorse or promote products derived | |||
* from this software without specific prior written permission. | |||
* | |||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* | |||
* | |||
******************************************************************************/ | |||
/****************************************************************************** | |||
* MSP430G2-LaunchPad CapTouch BoosterPack User Experience GUI | |||
* Desc: | |||
* This PC GUI application communicates with the LaunchPad specifically to | |||
* receive capacitive touch data from the LaunchPad CapTouch BoosterPack and | |||
* provides the visualization of said information in the GUI. | |||
* | |||
* The GUI uses a small .NET utility (FindAppUART.exe) to automatically detect | |||
* a proper LaunchPad/430Emulator device connected to the PC USB port. Upon | |||
* correct USB COM port discovery, the application initiates a 9600baud UART | |||
* connection and starts receiving data. | |||
* | |||
* Upon each LaunchPad event, data is transmitted [always] via a simple '2-byte' | |||
* protocol as described below. | |||
* [LaunchPad] Wake up : 0xBE 0xEF | |||
* [LaunchPad] Sleep : 0xDE 0xAD | |||
* [CapTouch] Center Button : 0x80 0x80 | |||
* [CapTouch] Wheel Tap : WT WT = pos. on wheel [0-0x0F] + 0x30 | |||
* [CapTouch] Gesture Start : 0xFC POS = pos. on wheel [0-0x0F] + 0x20 | |||
* [CapTouch] Gesture Stop : 0xFB POS = pos. on wheel [0-0x0F] + 0x20 | |||
* [CapTouch] Gesture Update: GES POS | |||
* Gesture = [0-0x0F] --> Clockwise gesture | |||
* = 0x10+ [0-0x0F] --> Counter-clockwise gesture | |||
* | |||
* The GUI grays out during sleep mode and returns to active mode upon wake up. | |||
* The 'Center Button' press data toggles the center circle color, mimicking the | |||
* behavior of the center LED on the BoosterPack. | |||
* The 'Wheel Tap' is represented by lighting up a single slice on the wheel. | |||
* The gesture tracking [Start, Stop, Update] is visualized on the wheel with | |||
* the coloration of the wheel slices. Gesture can be tracked for several | |||
* revolutions of the wheel, in both clockwise and counter-clockwise directions. | |||
* | |||
* A hidden code/lock is embedded in the wheel. Correct sequence [similar to a | |||
* rotational combination lock] reveals a secret address. | |||
* | |||
* D. Dang | |||
* Texas Instruments, Inc. | |||
* Ver 0.90 Feb 2011 | |||
******************************************************************************/ | |||
final int TIME_OUT = 140; | |||
/*--------Dimensions & coordinates------------*/ | |||
final int CANVAS_SIZE_X = 900; | |||
final int CANVAS_SIZE_Y = 580; | |||
final int OUT_CIRCLE_RADIUS = 248; | |||
final int IN_CIRCLE_RADIUS = 101; | |||
final int CENTER_CIRCLE_RADIUS = 37; | |||
final int CIRCLE_CENTER_X = 450; | |||
final int CIRCLE_CENTER_Y = 285; | |||
final int SOUND_ICON_X = 820; | |||
final int SOUND_ICON_Y = 20; | |||
/*--------Drawing definitions------------*/ | |||
final int NUMBER_OF_SLICES = 16; | |||
final int BACKGROUND_COLOR = 170; | |||
final int TAP_SLICE_COLOR = -100; | |||
final int SLICE_TRANSPARENCY = 30; | |||
final int SLICE_TRANSPARENCY_OFFSET = 80; | |||
/*--------UART protocol definitions------------*/ | |||
final int WAKE_UP_UART_CODE = 0xBE; | |||
final int WAKE_UP_UART_CODE2 = 0xEF; | |||
final int SLEEP_MODE_UART_CODE = 0xDE; | |||
final int SLEEP_MODE_UART_CODE2 = 0xAD; | |||
final int CENTER_BUTTON_CODE = 0x80; | |||
final int INVALID_WHEEL_POSITION = 0xFE; | |||
final int INVALID_GESTURE = 0xFD; | |||
final int GESTURE_START = 0xFC; | |||
final int GESTURE_STOP = 0xFB; | |||
final int GESTURE_POSITION_OFFSET = 0x20; | |||
final int WHEEL_POSITION_OFFSET = 0x30; | |||
final int NUMBER_OF_WHEEL_POSITIONS = 16; | |||
//final int INVALID_WHEEL_POSITION = -100; | |||
final int INVALID_GESTURE_DIRECTION = -100; | |||
final int GESTURE_CLOCKWISE = 1; | |||
final int GESTURE_COUNTERCLOCKWISE = -1; | |||
/*----------CapTouch-related variables----------------*/ | |||
int gestureStartingPosition = INVALID_WHEEL_POSITION, gestureStoppingPosition = INVALID_WHEEL_POSITION; | |||
int[] gestureCoverPositions = new int[16]; | |||
int gestureDirection = INVALID_GESTURE_DIRECTION; | |||
int gestureImmediateDirection = INVALID_GESTURE_DIRECTION; | |||
int allLit = 0; | |||
int inactivityCounter=0, sleeping=0, tapping=0, centerButton=0; | |||
int CenterButtonToggle=0; | |||
/*------Serial communication----------------*/ | |||
int LaunchPadComPortFound = 0, numberOfLookingDots=0; | |||
Serial LaunchPad; | |||
/*--------- Visual & audio elements-----------*/ | |||
PImage backgroundImage, innerCircleImage,innerCircleSelectedImage, innerCircleUnlockedImage ; | |||
int drawNumberEnabled = 0; | |||
Sample click,clickFound, clickOpen; | |||
int soundEnabled = 0; | |||
public void drawSlice(int sliceIndex, int sliceLevel) | |||
{ | |||
int sliceAfter, sliceLabel; | |||
sliceLabel = sliceIndex; | |||
if (sliceIndex < 3) | |||
sliceIndex = sliceIndex + 16 - 4; | |||
else | |||
sliceIndex = sliceIndex - 4; | |||
sliceAfter = sliceIndex + 1; | |||
if (sliceAfter == NUMBER_OF_SLICES) | |||
sliceAfter = 0; | |||
noStroke(); | |||
stroke(255); | |||
strokeWeight(4); | |||
if (sliceLevel == TAP_SLICE_COLOR) | |||
fill(160,160,160, 225); | |||
else | |||
fill(252,236,54, sliceLevel * SLICE_TRANSPARENCY + SLICE_TRANSPARENCY_OFFSET); | |||
arc(CIRCLE_CENTER_X, CIRCLE_CENTER_Y, OUT_CIRCLE_RADIUS*2, OUT_CIRCLE_RADIUS*2, (((float)sliceIndex)-0.5f) * 2 * PI /16, (((float)sliceIndex)+0.5f) * 2 * PI /16); | |||
line( CIRCLE_CENTER_X + cos( (((float)sliceIndex)-0.5f) * 2 * PI /16 ) * OUT_CIRCLE_RADIUS, CIRCLE_CENTER_Y + sin((((float)sliceIndex)-0.5f) * 2 * PI /16 ) * OUT_CIRCLE_RADIUS, | |||
CIRCLE_CENTER_X + cos( (((float)sliceIndex)-0.5f) * 2 * PI /16 ) * IN_CIRCLE_RADIUS, CIRCLE_CENTER_Y + sin((((float)sliceIndex)-0.5f) * 2 * PI /16 ) * IN_CIRCLE_RADIUS); | |||
line( CIRCLE_CENTER_X + cos( (((float)sliceIndex)+0.5f) * 2 * PI /16 ) * OUT_CIRCLE_RADIUS, CIRCLE_CENTER_Y + sin((((float)sliceIndex)+0.5f) * 2 * PI /16 ) * OUT_CIRCLE_RADIUS, | |||
CIRCLE_CENTER_X + cos( (((float)sliceIndex)+0.5f) * 2 * PI /16 ) * IN_CIRCLE_RADIUS, CIRCLE_CENTER_Y + sin((((float)sliceIndex)+0.5f) * 2 * PI /16 ) * IN_CIRCLE_RADIUS); | |||
if (drawNumberEnabled == 1) | |||
{ | |||
fill(0); | |||
text( sliceLabel, | |||
CIRCLE_CENTER_X + cos( (((float)sliceIndex)) * 2 * PI /16 ) * (OUT_CIRCLE_RADIUS-40)-7, | |||
CIRCLE_CENTER_Y + sin( (((float)sliceIndex)) * 2 * PI /16 ) * (OUT_CIRCLE_RADIUS-40)); | |||
} | |||
} | |||
public void drawCanvas() | |||
{ | |||
int i; | |||
background(BACKGROUND_COLOR); | |||
image(backgroundImage, 0 ,0); | |||
fill(0,0,0,255); | |||
if (unlocked == 1) | |||
{ | |||
fill(0); | |||
text("BoosterPack Unlocked",300,30); | |||
for (i=0;i<4;i++) | |||
drawSlice(code[i],4); | |||
fill(255); | |||
ellipse(CIRCLE_CENTER_X, CIRCLE_CENTER_Y, IN_CIRCLE_RADIUS*2 , IN_CIRCLE_RADIUS*2); | |||
image(innerCircleUnlockedImage, 0, 0); | |||
} | |||
} | |||
public void goToSleep() | |||
{ | |||
tint(120,120,120,180); | |||
drawCanvas(); | |||
tint(120,120,120,180); | |||
fill(255); | |||
textSize(20); | |||
text(".",20,30); | |||
text(".",28,30); | |||
text(".",35,30); | |||
textSize(25); | |||
text("z",47,30); | |||
textSize(30); | |||
text("z",65,30); | |||
textSize(35); | |||
text("z",85,30); | |||
textSize(40); | |||
text("z",108,30); | |||
textSize(30); | |||
noTint(); | |||
sleeping = 1; | |||
inactivityCounter = TIME_OUT; | |||
} | |||
public void findLaunchPad() | |||
{ | |||
String ComPortName =""; | |||
try | |||
{ | |||
Process proc = Runtime.getRuntime().exec("FindAppUART.exe"); | |||
proc.waitFor(); | |||
int exitVal = proc.exitValue(); | |||
// Get the first line from the process' STDOUT | |||
BufferedReader buf = new BufferedReader(new InputStreamReader(proc.getInputStream())); | |||
ComPortName = buf.readLine(); | |||
if (ComPortName.substring(0,3).equals("COM") != true) | |||
ComPortName = ""; | |||
else | |||
{ | |||
LaunchPadComPortFound = 1; | |||
LaunchPad = new Serial(this, ComPortName, 9600); | |||
} | |||
} | |||
catch(Exception e) | |||
{ | |||
println(e); | |||
} | |||
} | |||
public void promptLookingForLaunchPad() | |||
{ | |||
fill(255,0,0); | |||
noStroke(); | |||
rect(100,CANVAS_SIZE_Y/2-100,CANVAS_SIZE_X-120,200); | |||
fill(255); | |||
textSize(50); | |||
numberOfLookingDots++; | |||
if (numberOfLookingDots==5) | |||
numberOfLookingDots = 1; | |||
switch(numberOfLookingDots) | |||
{ | |||
case 1: text("Looking for LaunchPad ", 175,CANVAS_SIZE_Y/2 ); break; | |||
case 2: text("Looking for LaunchPad . ", 175,CANVAS_SIZE_Y/2 ); break; | |||
case 3: text("Looking for LaunchPad .. ", 175,CANVAS_SIZE_Y/2 ); break; | |||
case 4: text("Looking for LaunchPad ...", 175,CANVAS_SIZE_Y/2 ); break; | |||
} | |||
} | |||
public void setup() | |||
{ | |||
size(CANVAS_SIZE_X, CANVAS_SIZE_Y); | |||
background(255,0,0); | |||
Sonia.start(this); | |||
click = new Sample("click1.aiff"); | |||
clickOpen = new Sample("open.aiff"); | |||
clickFound = new Sample("unlock.aiff"); | |||
click.setVolume(3); | |||
clickFound.setVolume(3); | |||
frameRate(3); | |||
backgroundImage = loadImage("background.png"); | |||
innerCircleImage = loadImage("innerCircle.png"); | |||
innerCircleSelectedImage = loadImage("innerCircleSelected.png"); | |||
innerCircleUnlockedImage = loadImage("innerCircleUnlocked.png"); | |||
findLaunchPad(); | |||
if (LaunchPadComPortFound == 0) | |||
{ | |||
fill(255); | |||
textSize(40); | |||
text("LaunchPad Capacitive Touch BoosterPack", 70,50); | |||
textSize(55); | |||
fill(0); | |||
text("User Experience Demo", 150,100); | |||
fill(0); | |||
textSize(25); | |||
text("1. Plug your Capacitive Touch BoosterPack into the LaunchPad", 150,CANVAS_SIZE_Y - 70); | |||
text("2. Connect your LaunchPad to the PC via USB", 150,CANVAS_SIZE_Y - 45); | |||
promptLookingForLaunchPad(); | |||
} | |||
else | |||
{ | |||
frameRate(30); | |||
goToSleep(); | |||
} | |||
} | |||
public void draw() | |||
{ | |||
int i; | |||
if (LaunchPadComPortFound==0) | |||
{ | |||
findLaunchPad(); | |||
if (LaunchPadComPortFound==1) | |||
{ | |||
goToSleep(); | |||
frameRate(30); | |||
} | |||
else | |||
promptLookingForLaunchPad(); | |||
} | |||
else | |||
if(LaunchPad.available() >= 0) | |||
{ | |||
int buf, buf1; | |||
buf = LaunchPad.read(); | |||
buf1 = -1; | |||
if (buf>=0) | |||
{ | |||
drawCanvas(); | |||
textSize(30); | |||
sleeping = 0; | |||
inactivityCounter=0; | |||
tapping = 0 ; | |||
centerButton = 0; | |||
switch(buf) | |||
{ | |||
case WAKE_UP_UART_CODE: | |||
while (buf1 <0) | |||
buf1 = LaunchPad.read(); | |||
if (buf1==WAKE_UP_UART_CODE2) | |||
text("Proximity Sensor Wake Up",20,30); | |||
else | |||
{ | |||
print("Error: invalid UART Wake up == "); | |||
println(buf1); | |||
} | |||
break; | |||
case SLEEP_MODE_UART_CODE: | |||
while (buf1 <0) | |||
buf1 = LaunchPad.read(); | |||
if (buf1==SLEEP_MODE_UART_CODE2) | |||
{ | |||
//tint(120,0,0,180); | |||
CenterButtonToggle = 0; | |||
backgroundImage = loadImage("background.png"); | |||
innerCircleImage = loadImage("innerCircle.png"); | |||
tint(120,120,120,180); | |||
drawCanvas(); | |||
text("Good night!",20,30); | |||
sleeping = 1; | |||
noTint(); | |||
} | |||
else | |||
{ | |||
print("Error: invalid UART Sleep == "); | |||
println(buf1); | |||
} | |||
break; | |||
case CENTER_BUTTON_CODE: | |||
while (buf1 <0) | |||
buf1 = LaunchPad.read(); | |||
if (buf==buf1) | |||
{ | |||
if (unlocked==1) | |||
{ | |||
unlocked = 0; | |||
link(secretURL); | |||
} | |||
CenterButtonToggle = 1 - CenterButtonToggle; | |||
if (CenterButtonToggle == 1) | |||
{ | |||
innerCircleImage= loadImage("innerCircleSelected.png"); | |||
backgroundImage = loadImage("backgroundSelected.png"); | |||
} | |||
else | |||
{ | |||
innerCircleImage= loadImage("innerCircle.png"); | |||
backgroundImage = loadImage("background.png"); | |||
} | |||
drawCanvas(); | |||
centerButton = 1; | |||
} | |||
else | |||
{ | |||
print("Error: invalid CENTER BUTTON code == "); | |||
println(buf1); | |||
} | |||
break; | |||
case GESTURE_STOP: | |||
while (buf1 <0) | |||
buf1 = LaunchPad.read(); | |||
if (buf==buf1) | |||
{ | |||
text("Gesture Released",20,30); | |||
gestureStartingPosition = INVALID_WHEEL_POSITION; | |||
gestureStoppingPosition = INVALID_WHEEL_POSITION; | |||
gestureDirection = INVALID_GESTURE_DIRECTION; | |||
allLit = 0; | |||
codeCheck = 0; | |||
codeLevel = 0; | |||
//unlocked = 0; | |||
} | |||
else | |||
{ | |||
print("Error: invalid GESTURE_STOP code == "); | |||
println(buf1); | |||
} | |||
break; | |||
case GESTURE_START: | |||
while (buf1 <0) | |||
buf1 = LaunchPad.read(); | |||
if ( (buf1 < GESTURE_POSITION_OFFSET ) || (buf1 > GESTURE_POSITION_OFFSET + NUMBER_OF_WHEEL_POSITIONS)) | |||
{ | |||
print("Error: invalid gesture start position == "); | |||
println(buf1); | |||
} | |||
else | |||
{ | |||
text("Gesture Detected",20,30); | |||
buf1 = buf1 - GESTURE_POSITION_OFFSET; | |||
if (buf1<0) | |||
println(buf); | |||
gestureStartingPosition = buf1; | |||
gestureStoppingPosition = buf1; | |||
if (buf1 == code[0]) | |||
codeCheck = 1; | |||
else | |||
codeCheck = -1; | |||
codeLevel = 0; | |||
changeDirection = 0; | |||
drawSlice(buf1, 1); | |||
fill(255); | |||
ellipse(CIRCLE_CENTER_X, CIRCLE_CENTER_Y, IN_CIRCLE_RADIUS*2 , IN_CIRCLE_RADIUS*2); | |||
image(innerCircleImage,0,0); | |||
} | |||
break; | |||
default: // data from LaunchPad is not code, but value | |||
if (buf > WHEEL_POSITION_OFFSET + NUMBER_OF_WHEEL_POSITIONS ) // Invalid Code | |||
{ | |||
print("Error: invalid UART code == "); | |||
println(buf); | |||
} | |||
else | |||
/*---------------------WHEEL POSITION-----------------------*/ | |||
if ((buf <= WHEEL_POSITION_OFFSET + NUMBER_OF_WHEEL_POSITIONS) && (buf >= WHEEL_POSITION_OFFSET )) // Tapping | |||
{ | |||
while (buf1 <0) | |||
buf1 = LaunchPad.read(); | |||
if (buf==buf1) | |||
{ | |||
buf = buf - WHEEL_POSITION_OFFSET; | |||
text("Press @ ",10,30); | |||
text(buf,125,30); | |||
tapping = 1; | |||
drawSlice(buf, TAP_SLICE_COLOR); | |||
fill(255); | |||
ellipse(CIRCLE_CENTER_X, CIRCLE_CENTER_Y, IN_CIRCLE_RADIUS*2 , IN_CIRCLE_RADIUS*2); | |||
image(innerCircleImage, 0,0); | |||
} | |||
else | |||
{ | |||
print("Error: invalid WHEEL POSITION code == "); | |||
println(buf); | |||
} | |||
} | |||
else | |||
/*---------------------GESTURE DATA-----------------------*/ | |||
if (buf < GESTURE_POSITION_OFFSET ) // Gesturing | |||
if (gestureStartingPosition != INVALID_WHEEL_POSITION) | |||
{ | |||
if (buf>=NUMBER_OF_WHEEL_POSITIONS) // Determine orientation: binary value 00000xxx = CW, 00001xxx = CC | |||
{ | |||
buf -= NUMBER_OF_WHEEL_POSITIONS; | |||
text(buf, 20,30); | |||
text("Counter-Clockwise",55,30); | |||
gestureImmediateDirection = GESTURE_COUNTERCLOCKWISE; | |||
} | |||
else | |||
{ | |||
text(buf, 20,30); | |||
text("Clockwise",55,30); | |||
gestureImmediateDirection = GESTURE_CLOCKWISE; | |||
} | |||
while (buf1 <0) | |||
buf1 = LaunchPad.read(); | |||
if ( (buf1 >= GESTURE_POSITION_OFFSET ) && (buf1 < GESTURE_POSITION_OFFSET + NUMBER_OF_WHEEL_POSITIONS)) | |||
{ | |||
buf1 = buf1 - GESTURE_POSITION_OFFSET; | |||
if (gestureDirection == INVALID_GESTURE_DIRECTION) | |||
gestureDirection = gestureImmediateDirection; | |||
// if (gestureImmediateDirection != gestureDirection) | |||
// gestureCoverPositions[gestureStoppingPosition] = 0; | |||
// | |||
while (buf-->0) | |||
{ | |||
if (gestureStoppingPosition == gestureStartingPosition) //If moving from the starting position | |||
if (gestureDirection != gestureImmediateDirection) //If moving against the current direction | |||
{ | |||
if (allLit == 0) //Starting at zero? Change direction | |||
gestureDirection = gestureImmediateDirection; | |||
else //Back to a previous revolution? | |||
allLit--; | |||
} | |||
gestureStoppingPosition += gestureImmediateDirection; | |||
if (gestureStoppingPosition == NUMBER_OF_WHEEL_POSITIONS) | |||
gestureStoppingPosition = 0; | |||
if (gestureStoppingPosition < 0) | |||
gestureStoppingPosition = NUMBER_OF_WHEEL_POSITIONS-1; | |||
if (gestureStoppingPosition == gestureStartingPosition) //If moving to the starting position | |||
{ | |||
if (gestureImmediateDirection == gestureDirection) //complete a revolution? | |||
allLit += 1; | |||
else | |||
if (allLit == 0) //Back to zero | |||
gestureDirection = INVALID_GESTURE_DIRECTION; | |||
//Undo | |||
} | |||
} | |||
for ( i = 0; i < NUMBER_OF_WHEEL_POSITIONS; i++) | |||
gestureCoverPositions[i] = allLit; | |||
i = gestureStartingPosition; | |||
while (i != gestureStoppingPosition) | |||
{ | |||
gestureCoverPositions[i]= allLit + 1; | |||
i += gestureDirection; | |||
if (i<0) | |||
i = NUMBER_OF_WHEEL_POSITIONS-1; | |||
if (i == NUMBER_OF_WHEEL_POSITIONS) | |||
i = 0; | |||
} | |||
gestureCoverPositions[i]= allLit + 1; | |||
for ( i = 0; i < NUMBER_OF_WHEEL_POSITIONS; i++) | |||
if (gestureCoverPositions[i] > 0) | |||
drawSlice(i, gestureCoverPositions[i]); | |||
fill(255); | |||
ellipse(CIRCLE_CENTER_X, CIRCLE_CENTER_Y, IN_CIRCLE_RADIUS*2 , IN_CIRCLE_RADIUS*2); | |||
image(innerCircleImage,0,0); | |||
if (changeDirection !=0) | |||
{ | |||
if (gestureImmediateDirection != changeDirection) | |||
codeCheck = -1; | |||
changeDirection = 0; | |||
} | |||
if (soundEnabled == 1) | |||
click.play(); | |||
if (codeModeEnabled == 1) | |||
{ | |||
if (codeCheck==1) | |||
{ | |||
codeValid = 1; | |||
for ( i = 0; i < NUMBER_OF_WHEEL_POSITIONS; i++) | |||
if (gestureCoverPositions[i] != codeValues[codeLevel][i]) | |||
codeValid = 0; | |||
if (codeRotate[codeLevel] != gestureImmediateDirection) | |||
codeValid = 0; | |||
if (codeValid == 1) | |||
{ | |||
if (codeLevel++ < 2) | |||
{ | |||
changeDirection = -gestureImmediateDirection; | |||
if (soundEnabled == 1) | |||
clickFound.play(); | |||
} | |||
else | |||
{ | |||
fill(0); | |||
text("Unlocked!!",400,30); | |||
text("Press Center",500,90); | |||
unlocked = 1; | |||
codeLevel = 0; | |||
codeCheck = -1; | |||
if (soundEnabled == 1) | |||
clickOpen.play(); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
// invalid gesture data | |||
else | |||
{ | |||
print("Error: invalid gesture position data == "); | |||
println(buf1); | |||
} | |||
} | |||
else | |||
{ // Should not happen | |||
buf = buf - GESTURE_POSITION_OFFSET; | |||
println("Invalid UART Data, not expecting such data"); | |||
} | |||
break; | |||
} | |||
} | |||
else | |||
{ | |||
if (++inactivityCounter==TIME_OUT) | |||
{ | |||
if (sleeping==1) | |||
{ | |||
goToSleep(); | |||
} | |||
else | |||
drawCanvas(); | |||
} | |||
} | |||
} | |||
} | |||
public void mouseReleased() | |||
{ | |||
if ( (mouseX-CANVAS_SIZE_X/2)*(mouseX-CANVAS_SIZE_X/2) + (mouseY-CANVAS_SIZE_Y/2)*(mouseY-CANVAS_SIZE_Y/2) < IN_CIRCLE_RADIUS * IN_CIRCLE_RADIUS ) | |||
if (LaunchPadComPortFound ==1) | |||
{ | |||
soundEnabled = 1 - soundEnabled; | |||
codeModeEnabled = 1 - codeModeEnabled; | |||
drawNumberEnabled = 1 - drawNumberEnabled; | |||
} | |||
} | |||
/*---------Embedded code validation------------------*/ | |||
// Ideally nobody should ever bother scrolling down here | |||
// But good job, you've found it the easy way! | |||
// Anyways, don't spoil the fun for others would ya? | |||
int[] code = { 0, 4, 3, 0}; | |||
int[] codeRotate = {1, -1, 1}; | |||
int[][] codeValues = { {1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |||
{1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, | |||
{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; | |||
String secretURL = "http://ti.com/msp430rr"; | |||
int codeCheck, codeLevel, codeValid, changeDirection, unlocked=0, codeModeEnabled = 0; | |||
static public void main(String args[]) { | |||
PApplet.main(new String[] { "--bgcolor=#E2E2E2", "CapTouch_BoosterPack_UserExperience_GUI" }); | |||
} | |||
} |
@ -0,0 +1,725 @@ | |||
/******************************************************************************* | |||
* | |||
* CapTouch_BoosterPack_UserExperience_GUI.pde | |||
* - PC demo application for establishing a serial connection | |||
* with the LaunchPad CapTouch BoosterPack. | |||
* | |||
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ | |||
* | |||
* Redistribution and use in source and binary forms, with or without | |||
* modification, are permitted provided that the following conditions | |||
* are met: | |||
* | |||
* Redistributions of source code must retain the above copyright | |||
* notice, this list of conditions and the following disclaimer. | |||
* | |||
* Redistributions in binary form must reproduce the above copyright | |||
* notice, this list of conditions and the following disclaimer in the | |||
* documentation and/or other materials provided with the | |||
* distribution. | |||
* | |||
* Neither the name of Texas Instruments Incorporated nor the names of | |||
* its contributors may be used to endorse or promote products derived | |||
* from this software without specific prior written permission. | |||
* | |||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* | |||
* | |||
******************************************************************************/ | |||
/****************************************************************************** | |||
* MSP430G2-LaunchPad CapTouch BoosterPack User Experience GUI | |||
* Desc: | |||
* This PC GUI application communicates with the LaunchPad specifically to | |||
* receive capacitive touch data from the LaunchPad CapTouch BoosterPack and | |||
* provides the visualization of said information in the GUI. | |||
* | |||
* The GUI uses a small .NET utility (FindAppUART.exe) to automatically detect | |||
* a proper LaunchPad/430Emulator device connected to the PC USB port. Upon | |||
* correct USB COM port discovery, the application initiates a 9600baud UART | |||
* connection and starts receiving data. | |||
* | |||
* Upon each LaunchPad event, data is transmitted [always] via a simple '2-byte' | |||
* protocol as described below. | |||
* [LaunchPad] Wake up : 0xBE 0xEF | |||
* [LaunchPad] Sleep : 0xDE 0xAD | |||
* [CapTouch] Center Button : 0x80 0x80 | |||
* [CapTouch] Wheel Tap : WT WT = pos. on wheel [0-0x0F] + 0x30 | |||
* [CapTouch] Gesture Start : 0xFC POS = pos. on wheel [0-0x0F] + 0x20 | |||
* [CapTouch] Gesture Stop : 0xFB POS = pos. on wheel [0-0x0F] + 0x20 | |||
* [CapTouch] Gesture Update: GES POS | |||
* Gesture = [0-0x0F] --> Clockwise gesture | |||
* = 0x10+ [0-0x0F] --> Counter-clockwise gesture | |||
* | |||
* The GUI grays out during sleep mode and returns to active mode upon wake up. | |||
* The 'Center Button' press data toggles the center circle color, mimicking the | |||
* behavior of the center LED on the BoosterPack. | |||
* The 'Wheel Tap' is represented by lighting up a single slice on the wheel. | |||
* The gesture tracking [Start, Stop, Update] is visualized on the wheel with | |||
* the coloration of the wheel slices. Gesture can be tracked for several | |||
* revolutions of the wheel, in both clockwise and counter-clockwise directions. | |||
* | |||
* A hidden code/lock is embedded in the wheel. Correct sequence [similar to a | |||
* rotational combination lock] reveals a secret address. | |||
* | |||
* D. Dang | |||
* Texas Instruments, Inc. | |||
* Ver 0.90 Feb 2011 | |||
******************************************************************************/ | |||
import pitaru.sonia_v2_9.*; | |||
import processing.serial.*; | |||
import java.io.BufferedReader; | |||
import java.io.IOException; | |||
import java.io.InputStreamReader; | |||
final int TIME_OUT = 140; | |||
/*--------Dimensions & coordinates------------*/ | |||
final int CANVAS_SIZE_X = 900; | |||
final int CANVAS_SIZE_Y = 580; | |||
final int OUT_CIRCLE_RADIUS = 248; | |||
final int IN_CIRCLE_RADIUS = 101; | |||
final int CENTER_CIRCLE_RADIUS = 37; | |||
final int CIRCLE_CENTER_X = 450; | |||
final int CIRCLE_CENTER_Y = 285; | |||
final int SOUND_ICON_X = 820; | |||
final int SOUND_ICON_Y = 20; | |||
/*--------Drawing definitions------------*/ | |||
final int NUMBER_OF_SLICES = 16; | |||
final int BACKGROUND_COLOR = 170; | |||
final int TAP_SLICE_COLOR = -100; | |||
final int SLICE_TRANSPARENCY = 30; | |||
final int SLICE_TRANSPARENCY_OFFSET = 80; | |||
/*--------UART protocol definitions------------*/ | |||
final int WAKE_UP_UART_CODE = 0xBE; | |||
final int WAKE_UP_UART_CODE2 = 0xEF; | |||
final int SLEEP_MODE_UART_CODE = 0xDE; | |||
final int SLEEP_MODE_UART_CODE2 = 0xAD; | |||
final int CENTER_BUTTON_CODE = 0x80; | |||
final int INVALID_WHEEL_POSITION = 0xFE; | |||
final int INVALID_GESTURE = 0xFD; | |||
final int GESTURE_START = 0xFC; | |||
final int GESTURE_STOP = 0xFB; | |||
final int GESTURE_POSITION_OFFSET = 0x20; | |||
final int WHEEL_POSITION_OFFSET = 0x30; | |||
final int NUMBER_OF_WHEEL_POSITIONS = 16; | |||
//final int INVALID_WHEEL_POSITION = -100; | |||
final int INVALID_GESTURE_DIRECTION = -100; | |||
final int GESTURE_CLOCKWISE = 1; | |||
final int GESTURE_COUNTERCLOCKWISE = -1; | |||
/*----------CapTouch-related variables----------------*/ | |||
int gestureStartingPosition = INVALID_WHEEL_POSITION, gestureStoppingPosition = INVALID_WHEEL_POSITION; | |||
int[] gestureCoverPositions = new int[16]; | |||
int gestureDirection = INVALID_GESTURE_DIRECTION; | |||
int gestureImmediateDirection = INVALID_GESTURE_DIRECTION; | |||
int allLit = 0; | |||
int inactivityCounter=0, sleeping=0, tapping=0, centerButton=0; | |||
int CenterButtonToggle=0; | |||
/*------Serial communication----------------*/ | |||
int LaunchPadComPortFound = 0, numberOfLookingDots=0; | |||
Serial LaunchPad; | |||
/*--------- Visual & audio elements-----------*/ | |||
PImage backgroundImage, innerCircleImage,innerCircleSelectedImage, innerCircleUnlockedImage ; | |||
int drawNumberEnabled = 0; | |||
Sample click,clickFound, clickOpen; | |||
int soundEnabled = 0; | |||
void drawSlice(int sliceIndex, int sliceLevel) | |||
{ | |||
int sliceAfter, sliceLabel; | |||
sliceLabel = sliceIndex; | |||
if (sliceIndex < 3) | |||
sliceIndex = sliceIndex + 16 - 4; | |||
else | |||
sliceIndex = sliceIndex - 4; | |||
sliceAfter = sliceIndex + 1; | |||
if (sliceAfter == NUMBER_OF_SLICES) | |||
sliceAfter = 0; | |||
noStroke(); | |||
stroke(255); | |||
strokeWeight(4); | |||
if (sliceLevel == TAP_SLICE_COLOR) | |||
fill(160,160,160, 225); | |||
else | |||
fill(252,236,54, sliceLevel * SLICE_TRANSPARENCY + SLICE_TRANSPARENCY_OFFSET); | |||
arc(CIRCLE_CENTER_X, CIRCLE_CENTER_Y, OUT_CIRCLE_RADIUS*2, OUT_CIRCLE_RADIUS*2, (((float)sliceIndex)-0.5) * 2 * PI /16, (((float)sliceIndex)+0.5) * 2 * PI /16); | |||
line( CIRCLE_CENTER_X + cos( (((float)sliceIndex)-0.5) * 2 * PI /16 ) * OUT_CIRCLE_RADIUS, CIRCLE_CENTER_Y + sin((((float)sliceIndex)-0.5) * 2 * PI /16 ) * OUT_CIRCLE_RADIUS, | |||
CIRCLE_CENTER_X + cos( (((float)sliceIndex)-0.5) * 2 * PI /16 ) * IN_CIRCLE_RADIUS, CIRCLE_CENTER_Y + sin((((float)sliceIndex)-0.5) * 2 * PI /16 ) * IN_CIRCLE_RADIUS); | |||
line( CIRCLE_CENTER_X + cos( (((float)sliceIndex)+0.5) * 2 * PI /16 ) * OUT_CIRCLE_RADIUS, CIRCLE_CENTER_Y + sin((((float)sliceIndex)+0.5) * 2 * PI /16 ) * OUT_CIRCLE_RADIUS, | |||
CIRCLE_CENTER_X + cos( (((float)sliceIndex)+0.5) * 2 * PI /16 ) * IN_CIRCLE_RADIUS, CIRCLE_CENTER_Y + sin((((float)sliceIndex)+0.5) * 2 * PI /16 ) * IN_CIRCLE_RADIUS); | |||
if (drawNumberEnabled == 1) | |||
{ | |||
fill(0); | |||
text( sliceLabel, | |||
CIRCLE_CENTER_X + cos( (((float)sliceIndex)) * 2 * PI /16 ) * (OUT_CIRCLE_RADIUS-40)-7, | |||
CIRCLE_CENTER_Y + sin( (((float)sliceIndex)) * 2 * PI /16 ) * (OUT_CIRCLE_RADIUS-40)); | |||
} | |||
} | |||
void drawCanvas() | |||
{ | |||
int i; | |||
background(BACKGROUND_COLOR); | |||
image(backgroundImage, 0 ,0); | |||
fill(0,0,0,255); | |||
if (unlocked == 1) | |||
{ | |||
fill(0); | |||
text("BoosterPack Unlocked",300,30); | |||
for (i=0;i<4;i++) | |||
drawSlice(code[i],4); | |||
fill(255); | |||
ellipse(CIRCLE_CENTER_X, CIRCLE_CENTER_Y, IN_CIRCLE_RADIUS*2 , IN_CIRCLE_RADIUS*2); | |||
image(innerCircleUnlockedImage, 0, 0); | |||
} | |||
} | |||
void goToSleep() | |||
{ | |||
tint(120,120,120,180); | |||
drawCanvas(); | |||
tint(120,120,120,180); | |||
fill(255); | |||
textSize(20); | |||
text(".",20,30); | |||
text(".",28,30); | |||
text(".",35,30); | |||
textSize(25); | |||
text("z",47,30); | |||
textSize(30); | |||
text("z",65,30); | |||
textSize(35); | |||
text("z",85,30); | |||
textSize(40); | |||
text("z",108,30); | |||
textSize(30); | |||
noTint(); | |||
sleeping = 1; | |||
inactivityCounter = TIME_OUT; | |||
} | |||
void findLaunchPad() | |||
{ | |||
String ComPortName =""; | |||
try | |||
{ | |||
Process proc = Runtime.getRuntime().exec("FindAppUART.exe"); | |||
proc.waitFor(); | |||
int exitVal = proc.exitValue(); | |||
// Get the first line from the process' STDOUT | |||
BufferedReader buf = new BufferedReader(new InputStreamReader(proc.getInputStream())); | |||
ComPortName = buf.readLine(); | |||
if (ComPortName.substring(0,3).equals("COM") != true) | |||
ComPortName = ""; | |||
else | |||
{ | |||
LaunchPadComPortFound = 1; | |||
LaunchPad = new Serial(this, ComPortName, 9600); | |||
} | |||
} | |||
catch(Exception e) | |||
{ | |||
println(e); | |||
} | |||
} | |||
void promptLookingForLaunchPad() | |||
{ | |||
fill(255,0,0); | |||
noStroke(); | |||
rect(100,CANVAS_SIZE_Y/2-100,CANVAS_SIZE_X-120,200); | |||
fill(255); | |||
textSize(50); | |||
numberOfLookingDots++; | |||
if (numberOfLookingDots==5) | |||
numberOfLookingDots = 1; | |||
switch(numberOfLookingDots) | |||
{ | |||
case 1: text("Looking for LaunchPad ", 175,CANVAS_SIZE_Y/2 ); break; | |||
case 2: text("Looking for LaunchPad . ", 175,CANVAS_SIZE_Y/2 ); break; | |||
case 3: text("Looking for LaunchPad .. ", 175,CANVAS_SIZE_Y/2 ); break; | |||
case 4: text("Looking for LaunchPad ...", 175,CANVAS_SIZE_Y/2 ); break; | |||
} | |||
} | |||
void setup() | |||
{ | |||
size(CANVAS_SIZE_X, CANVAS_SIZE_Y); | |||
background(255,0,0); | |||
Sonia.start(this); | |||
click = new Sample("click1.aiff"); | |||
clickOpen = new Sample("open.aiff"); | |||
clickFound = new Sample("unlock.aiff"); | |||
click.setVolume(3); | |||
clickFound.setVolume(3); | |||
frameRate(3); | |||
backgroundImage = loadImage("background.png"); | |||
innerCircleImage = loadImage("innerCircle.png"); | |||
innerCircleSelectedImage = loadImage("innerCircleSelected.png"); | |||
innerCircleUnlockedImage = loadImage("innerCircleUnlocked.png"); | |||
findLaunchPad(); | |||
if (LaunchPadComPortFound == 0) | |||
{ | |||
fill(255); | |||
textSize(40); | |||
text("LaunchPad Capacitive Touch BoosterPack", 70,50); | |||
textSize(55); | |||
fill(0); | |||
text("User Experience Demo", 150,100); | |||
fill(0); | |||
textSize(25); | |||
text("1. Plug your Capacitive Touch BoosterPack into the LaunchPad", 150,CANVAS_SIZE_Y - 70); | |||
text("2. Connect your LaunchPad to the PC via USB", 150,CANVAS_SIZE_Y - 45); | |||
promptLookingForLaunchPad(); | |||
} | |||
else | |||
{ | |||
frameRate(30); | |||
goToSleep(); | |||
} | |||
} | |||
void draw() | |||
{ | |||
int i; | |||
if (LaunchPadComPortFound==0) | |||
{ | |||
findLaunchPad(); | |||
if (LaunchPadComPortFound==1) | |||
{ | |||
goToSleep(); | |||
frameRate(30); | |||
} | |||
else | |||
promptLookingForLaunchPad(); | |||
} | |||
else | |||
if(LaunchPad.available() >= 0) | |||
{ | |||
int buf, buf1; | |||
buf = LaunchPad.read(); | |||
buf1 = -1; | |||
if (buf>=0) | |||
{ | |||
drawCanvas(); | |||
textSize(30); | |||
sleeping = 0; | |||
inactivityCounter=0; | |||
tapping = 0 ; | |||
centerButton = 0; | |||
switch(buf) | |||
{ | |||
case WAKE_UP_UART_CODE: | |||
while (buf1 <0) | |||
buf1 = LaunchPad.read(); | |||
if (buf1==WAKE_UP_UART_CODE2) | |||
text("Proximity Sensor Wake Up",20,30); | |||
else | |||
{ | |||
print("Error: invalid UART Wake up == "); | |||
println(buf1); | |||
} | |||
break; | |||
case SLEEP_MODE_UART_CODE: | |||
while (buf1 <0) | |||
buf1 = LaunchPad.read(); | |||
if (buf1==SLEEP_MODE_UART_CODE2) | |||
{ | |||
//tint(120,0,0,180); | |||
CenterButtonToggle = 0; | |||
backgroundImage = loadImage("background.png"); | |||
innerCircleImage = loadImage("innerCircle.png"); | |||
tint(120,120,120,180); | |||
drawCanvas(); | |||
text("Good night!",20,30); | |||
sleeping = 1; | |||
noTint(); | |||
} | |||
else | |||
{ | |||
print("Error: invalid UART Sleep == "); | |||
println(buf1); | |||
} | |||
break; | |||
case CENTER_BUTTON_CODE: | |||
while (buf1 <0) | |||
buf1 = LaunchPad.read(); | |||
if (buf==buf1) | |||
{ | |||
if (unlocked==1) | |||
{ | |||
unlocked = 0; | |||
link(secretURL); | |||
} | |||
CenterButtonToggle = 1 - CenterButtonToggle; | |||
if (CenterButtonToggle == 1) | |||
{ | |||
innerCircleImage= loadImage("innerCircleSelected.png"); | |||
backgroundImage = loadImage("backgroundSelected.png"); | |||
} | |||
else | |||
{ | |||
innerCircleImage= loadImage("innerCircle.png"); | |||
backgroundImage = loadImage("background.png"); | |||
} | |||
drawCanvas(); | |||
centerButton = 1; | |||
} | |||
else | |||
{ | |||
print("Error: invalid CENTER BUTTON code == "); | |||
println(buf1); | |||
} | |||
break; | |||
case GESTURE_STOP: | |||
while (buf1 <0) | |||
buf1 = LaunchPad.read(); | |||
if (buf==buf1) | |||
{ | |||
text("Gesture Released",20,30); | |||
gestureStartingPosition = INVALID_WHEEL_POSITION; | |||
gestureStoppingPosition = INVALID_WHEEL_POSITION; | |||
gestureDirection = INVALID_GESTURE_DIRECTION; | |||
allLit = 0; | |||
codeCheck = 0; | |||
codeLevel = 0; | |||
//unlocked = 0; | |||
} | |||
else | |||
{ | |||
print("Error: invalid GESTURE_STOP code == "); | |||
println(buf1); | |||
} | |||
break; | |||
case GESTURE_START: | |||
while (buf1 <0) | |||
buf1 = LaunchPad.read(); | |||
if ( (buf1 < GESTURE_POSITION_OFFSET ) || (buf1 > GESTURE_POSITION_OFFSET + NUMBER_OF_WHEEL_POSITIONS)) | |||
{ | |||
print("Error: invalid gesture start position == "); | |||
println(buf1); | |||
} | |||
else | |||
{ | |||
text("Gesture Detected",20,30); | |||
buf1 = buf1 - GESTURE_POSITION_OFFSET; | |||
if (buf1<0) | |||
println(buf); | |||
gestureStartingPosition = buf1; | |||
gestureStoppingPosition = buf1; | |||
if (buf1 == code[0]) | |||
codeCheck = 1; | |||
else | |||
codeCheck = -1; | |||
codeLevel = 0; | |||
changeDirection = 0; | |||
drawSlice(buf1, 1); | |||
fill(255); | |||
ellipse(CIRCLE_CENTER_X, CIRCLE_CENTER_Y, IN_CIRCLE_RADIUS*2 , IN_CIRCLE_RADIUS*2); | |||
image(innerCircleImage,0,0); | |||
} | |||
break; | |||
default: // data from LaunchPad is not code, but value | |||
if (buf > WHEEL_POSITION_OFFSET + NUMBER_OF_WHEEL_POSITIONS ) // Invalid Code | |||
{ | |||
print("Error: invalid UART code == "); | |||
println(buf); | |||
} | |||
else | |||
/*---------------------WHEEL POSITION-----------------------*/ | |||
if ((buf <= WHEEL_POSITION_OFFSET + NUMBER_OF_WHEEL_POSITIONS) && (buf >= WHEEL_POSITION_OFFSET )) // Tapping | |||
{ | |||
while (buf1 <0) | |||
buf1 = LaunchPad.read(); | |||
if (buf==buf1) | |||
{ | |||
buf = buf - WHEEL_POSITION_OFFSET; | |||
text("Press @ ",10,30); | |||
text(buf,125,30); | |||
tapping = 1; | |||
drawSlice(buf, TAP_SLICE_COLOR); | |||
fill(255); | |||
ellipse(CIRCLE_CENTER_X, CIRCLE_CENTER_Y, IN_CIRCLE_RADIUS*2 , IN_CIRCLE_RADIUS*2); | |||
image(innerCircleImage, 0,0); | |||
} | |||
else | |||
{ | |||
print("Error: invalid WHEEL POSITION code == "); | |||
println(buf); | |||
} | |||
} | |||
else | |||
/*---------------------GESTURE DATA-----------------------*/ | |||
if (buf < GESTURE_POSITION_OFFSET ) // Gesturing | |||
if (gestureStartingPosition != INVALID_WHEEL_POSITION) | |||
{ | |||
if (buf>=NUMBER_OF_WHEEL_POSITIONS) // Determine orientation: binary value 00000xxx = CW, 00001xxx = CC | |||
{ | |||
buf -= NUMBER_OF_WHEEL_POSITIONS; | |||
text(buf, 20,30); | |||
text("Counter-Clockwise",55,30); | |||
gestureImmediateDirection = GESTURE_COUNTERCLOCKWISE; | |||
} | |||
else | |||
{ | |||
text(buf, 20,30); | |||
text("Clockwise",55,30); | |||
gestureImmediateDirection = GESTURE_CLOCKWISE; | |||
} | |||
while (buf1 <0) | |||
buf1 = LaunchPad.read(); | |||
if ( (buf1 >= GESTURE_POSITION_OFFSET ) && (buf1 < GESTURE_POSITION_OFFSET + NUMBER_OF_WHEEL_POSITIONS)) | |||
{ | |||
buf1 = buf1 - GESTURE_POSITION_OFFSET; | |||
if (gestureDirection == INVALID_GESTURE_DIRECTION) | |||
gestureDirection = gestureImmediateDirection; | |||
// if (gestureImmediateDirection != gestureDirection) | |||
// gestureCoverPositions[gestureStoppingPosition] = 0; | |||
// | |||
while (buf-->0) | |||
{ | |||
if (gestureStoppingPosition == gestureStartingPosition) //If moving from the starting position | |||
if (gestureDirection != gestureImmediateDirection) //If moving against the current direction | |||
{ | |||
if (allLit == 0) //Starting at zero? Change direction | |||
gestureDirection = gestureImmediateDirection; | |||
else //Back to a previous revolution? | |||
allLit--; | |||
} | |||
gestureStoppingPosition += gestureImmediateDirection; | |||
if (gestureStoppingPosition == NUMBER_OF_WHEEL_POSITIONS) | |||
gestureStoppingPosition = 0; | |||
if (gestureStoppingPosition < 0) | |||
gestureStoppingPosition = NUMBER_OF_WHEEL_POSITIONS-1; | |||
if (gestureStoppingPosition == gestureStartingPosition) //If moving to the starting position | |||
{ | |||
if (gestureImmediateDirection == gestureDirection) //complete a revolution? | |||
allLit += 1; | |||
else | |||
if (allLit == 0) //Back to zero | |||
gestureDirection = INVALID_GESTURE_DIRECTION; | |||
//Undo | |||
} | |||
} | |||
for ( i = 0; i < NUMBER_OF_WHEEL_POSITIONS; i++) | |||
gestureCoverPositions[i] = allLit; | |||
i = gestureStartingPosition; | |||
while (i != gestureStoppingPosition) | |||
{ | |||
gestureCoverPositions[i]= allLit + 1; | |||
i += gestureDirection; | |||
if (i<0) | |||
i = NUMBER_OF_WHEEL_POSITIONS-1; | |||
if (i == NUMBER_OF_WHEEL_POSITIONS) | |||
i = 0; | |||
} | |||
gestureCoverPositions[i]= allLit + 1; | |||
for ( i = 0; i < NUMBER_OF_WHEEL_POSITIONS; i++) | |||
if (gestureCoverPositions[i] > 0) | |||
drawSlice(i, gestureCoverPositions[i]); | |||
fill(255); | |||
ellipse(CIRCLE_CENTER_X, CIRCLE_CENTER_Y, IN_CIRCLE_RADIUS*2 , IN_CIRCLE_RADIUS*2); | |||
image(innerCircleImage,0,0); | |||
if (changeDirection !=0) | |||
{ | |||
if (gestureImmediateDirection != changeDirection) | |||
codeCheck = -1; | |||
changeDirection = 0; | |||
} | |||
if (soundEnabled == 1) | |||
click.play(); | |||
if (codeModeEnabled == 1) | |||
{ | |||
if (codeCheck==1) | |||
{ | |||
codeValid = 1; | |||
for ( i = 0; i < NUMBER_OF_WHEEL_POSITIONS; i++) | |||
if (gestureCoverPositions[i] != codeValues[codeLevel][i]) | |||
codeValid = 0; | |||
if (codeRotate[codeLevel] != gestureImmediateDirection) | |||
codeValid = 0; | |||
if (codeValid == 1) | |||
{ | |||
if (codeLevel++ < 2) | |||
{ | |||
changeDirection = -gestureImmediateDirection; | |||
if (soundEnabled == 1) | |||
clickFound.play(); | |||
} | |||
else | |||
{ | |||
fill(0); | |||
text("Unlocked!!",400,30); | |||
text("Press Center",500,90); | |||
unlocked = 1; | |||
codeLevel = 0; | |||
codeCheck = -1; | |||
if (soundEnabled == 1) | |||
clickOpen.play(); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
// invalid gesture data | |||
else | |||
{ | |||
print("Error: invalid gesture position data == "); | |||
println(buf1); | |||
} | |||
} | |||
else | |||
{ // Should not happen | |||
buf = buf - GESTURE_POSITION_OFFSET; | |||
println("Invalid UART Data, not expecting such data"); | |||
} | |||
break; | |||
} | |||
} | |||
else | |||
{ | |||
if (++inactivityCounter==TIME_OUT) | |||
{ | |||
if (sleeping==1) | |||
{ | |||
goToSleep(); | |||
} | |||
else | |||
drawCanvas(); | |||
} | |||
} | |||
} | |||
} | |||
void mouseReleased() | |||
{ | |||
if ( (mouseX-CANVAS_SIZE_X/2)*(mouseX-CANVAS_SIZE_X/2) + (mouseY-CANVAS_SIZE_Y/2)*(mouseY-CANVAS_SIZE_Y/2) < IN_CIRCLE_RADIUS * IN_CIRCLE_RADIUS ) | |||
if (LaunchPadComPortFound ==1) | |||
{ | |||
soundEnabled = 1 - soundEnabled; | |||
codeModeEnabled = 1 - codeModeEnabled; | |||
drawNumberEnabled = 1 - drawNumberEnabled; | |||
} | |||
} | |||
/*---------Embedded code validation------------------*/ | |||
// Ideally nobody should ever bother scrolling down here | |||
// But good job, you've found it the easy way! | |||
// Anyways, don't spoil the fun for others would ya? | |||
int[] code = { 0, 4, 3, 0}; | |||
int[] codeRotate = {1, -1, 1}; | |||
int[][] codeValues = { {1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |||
{1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, | |||
{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; | |||
String secretURL = "http://ti.com/msp430rr"; | |||
int codeCheck, codeLevel, codeValid, changeDirection, unlocked=0, codeModeEnabled = 0; | |||
@ -0,0 +1,121 @@ | |||
-------------------------------MEDIAPAD README---------------------------------- | |||
Ver.: 1.00 (February 2011) | |||
- Initial Release | |||
Author: Dung Dang | |||
MSP430 Applications | |||
Texas Instruments Inc. | |||
-------------------------------------------------------------------------------- | |||
CONTENTS | |||
I. DESCRIPTION | |||
II. APPLICATION USAGE | |||
III. PROJECT SOLUTION & FILE CONFIGURATION | |||
IV. USB SERIAL COM PORT PROTOCOL | |||
I. DESCRIPTION | |||
----------------------------------- | |||
PC demo application for establishing a serial connection with the LaunchPad | |||
CapTouch BoosterPack. It receives capacitive touch button presses and capacitive | |||
wheel gestures that are captured and transmitted by the MSP430, and uses this | |||
data to simulate virtual keystrokes to control windows media. The program will | |||
not open a window; instead it will place a small icon into the taskbar | |||
notification area. | |||
To exit the program, right-click on the icon, and then select "Exit". | |||
The code was developed with the Express Edition of Visual C++ 2008 | |||
http://www.microsoft.com/express/ | |||
Big thanks to Andreas Dannenberg for creating the .NET COM Serial port | |||
auto-detection code. | |||
II. APPLICATION USAGE | |||
----------------------------------- | |||
Upon execution, the application starts looking for a LaunchPad or an eZ430 | |||
emulator compatible USB serial COM port. If no compatible COM port is found, | |||
the application displays an error message which then exits the application. | |||
If a LaunchPad COM port is found, the application prompts a greeting start-up | |||
message. Once the message is closed, the application minimizes itself to the | |||
taskbar. The application then executes in background, receiving UART data from | |||
the serial port and translating them into Windows virtual key strokes. | |||
These keystrokes are determined based on the user capacitive input on the | |||
LaunchPad CapTouch BoosterPack when the device is in active mode*. | |||
1. Center button press: Start Media Player [Windows Media Player by default]** | |||
2. Bottom arrow button press: Play/Pause | |||
3. Left arrow button press: Previous Track | |||
4. Right arrow button press: Next Track | |||
5. Scroll wheel clockwise: Volume Up | |||
6. Scroll wheel counter-clockwise: Volume Down | |||
*Make sure to wake up device before providing touch inputs. | |||
Device frequently goes to sleep after inactivity. To wake up, slowly wave hand | |||
1-2 inch away from the BoosterPack, an LED sequence (slow clockwise, then fast | |||
counter-clockwise) indicates a device wakeup. Only after device fully wakes up, | |||
the capacitive touch inputs can be captured and transmitted to the program. | |||
**Depending on the computer system, opening the Media Player might take some | |||
time. | |||
The prorgam's system tray icon provides an About dialog box and an option to | |||
exit the application. | |||
III. PROJECT SOLUTION & FILE CONFIGURATION | |||
----------------------------------- | |||
PROJECT SOLUTION ROOT - MediaPad | |||
| 430Boost_CapTouchMediaPad.ncb | |||
| 430Boost_CapTouchMediaPad.sln | |||
| ReadMe.txt | |||
| | |||
+---[MediaPad] | |||
| | MediaPad.cpp | |||
| | MediaPad.h | |||
| | MediaPad.ico | |||
| | MediaPad.rc | |||
| | MediaPad.vcproj | |||
| | MediaPad.vcproj.ENT.a0271518.user | |||
| | ReadMe.txt | |||
| | Resource.h | |||
| | small.ico | |||
| | stdafx.cpp | |||
| | stdafx.h | |||
| | targetver.h | |||
| | | |||
| \---[Release] | |||
| | |||
\---[Release] | |||
430Boost_CapTouchMediaPad.exe <Executable Program> | |||
430Boost_CapTouchMediaPad.pdb | |||
Legend: [Directory] | |||
|---filename | |||
IV. USB SERIAL COM PORT PROTOCOL | |||
----------------------------------- | |||
Per each event (wake up, go to sleep, touch/press, or gesture), the LaunchPad | |||
transmits a 2-byte UART packet, which appears from the USB serial COM port on | |||
the PC. They are specified as follows. | |||
WAKE UP [due to proximity sensor detection]: 0xBE 0xEF | |||
SLEEP [after period of inactivity]: 0xDE 0xAD | |||
CENTER BUTTON PRESS: 0x80 0x80 | |||
WHEEL POSITION TOUCH/PRESS [z = touch position]: 0x3z 0x3z [z=1 nibble 0x0-F] | |||
GESTURE START [z = touch position]: 0xFC 0x2z [z=1 nibble 0x0-F] | |||
GESTURE STOP: 0xFB 0xFB | |||
GESTURE & GESTURE END POSITION : 0xGG 0x2z | |||
GG = [binary] b???????? | |||
First bit is direction: 0 = clockwise, 1 = counter-clockwise | |||
Last 7 bits = count of gesture movement | |||
z = ending position of the immediate gesture [[z=1 nibble 0x0-F] | |||
The UART receiver can decipher the packets by comparing them against the fixed | |||
values (WAKE UP, SLEEP, CENTER BUTTON PRESS, GESTURE START & STOP) or against | |||
ranges (WHEEL TOUCH = 0x30-0x3F, GESTURE = 0x00-0x1F, GESTURE POSITION = | |||
0x20-0x2F) | |||
MediaPad processes all UART packets and checks for their integrity. However, the | |||
application only uses the inputs from CENTER BUTTON PRESS, WHEEL POSITIONS, and | |||
GESTURES to generate virtual keystrokes. |
@ -0,0 +1,227 @@ | |||
@c000 | |||
0A 12 09 12 08 12 09 4D 0A 4C 92 C3 36 02 B0 12 | |||
F2 CC 4B 43 F1 3D 4F 4B 0F 5F 0F 59 2F 4F 4E 4B | |||
0E 5E 0E 59 8E 93 00 00 E6 25 A2 B3 36 02 04 24 | |||
FA B0 C0 FF 00 00 0B 20 1E 43 A2 B3 36 02 05 20 | |||
FA B0 C0 FF 00 00 01 20 0E 43 0E 93 4F 20 4C 4B | |||
0C 5C 0C 59 5E 4A 02 00 0E 5E 4D 4B 0D 5D 0D 5E | |||
AD 9C 3A 02 32 2C 4E 4B 0E 5E 0E 59 8E 43 00 00 | |||
4E 4B 0E 5E 0E 5A 1E 4E 04 00 8E 93 06 00 36 24 | |||
5E 4A 02 00 0E 5E 4D 4B 0D 5D 0D 5E 4C 4B 0C 5C | |||
0C 5A 1E 4C 04 00 1E 4E 06 00 12 C3 0E 10 1E 5D | |||
3A 02 0E 9F 23 2C 5F 4A 02 00 0F 5F 4E 4B 0E 5E | |||
0E 5F 4F 4B 0F 5F 0F 5A 1F 4F 04 00 1F 4F 06 00 | |||
12 C3 0F 10 1F 5E 3A 02 11 3C 4C 4B 0C 5C 0C 59 | |||
5E 4A 02 00 0E 5E 4D 4B 0D 5D 0D 5E 1D 4D 3A 02 | |||
2D 8C 4E 4B 0E 5E 0E 59 8E 4D 00 00 A2 B3 36 02 | |||
04 20 FA B0 C0 FF 00 00 07 20 A2 B3 36 02 51 24 | |||
FA B0 C0 FF 00 00 4D 20 4C 4B 0C 5C 0C 59 5E 4A | |||
02 00 0E 5E 4D 4B 0D 5D 0D 5E 9C 9D 3A 02 00 00 | |||
34 2C 4E 4B 0E 5E 0E 59 8E 43 00 00 4E 4B 0E 5E | |||
0E 5A 1E 4E 04 00 8E 93 06 00 33 24 4E 4B 0E 5E | |||
0E 5A 1E 4E 04 00 1C 4E 06 00 12 C3 0C 10 5E 4A | |||
02 00 0E 5E 4D 4B 0D 5D 0D 5E 1E 4D 3A 02 0E 8C | |||
0F 9E 1F 2C 4F 4B 0F 5F 0F 5A 1F 4F 04 00 1D 4F | |||
06 00 12 C3 0D 10 5F 4A 02 00 0F 5F 4E 4B 0E 5E | |||
0E 5F 1F 4E 3A 02 0F 8D 0C 3C 4C 4B 0C 5C 0C 59 | |||
5E 4A 02 00 0E 5E 4D 4B 0D 5D 0D 5E 9C 8D 3A 02 | |||
00 00 4E 4B 0E 5E 0E 59 8E 93 00 00 AE 20 08 43 | |||
3E 40 C0 00 1E F2 36 02 0E 93 83 24 3E 80 40 00 | |||
66 24 3E 80 40 00 33 24 3E 80 40 00 85 20 5E 4A | |||
02 00 0E 5E 4D 4B 0D 5D 0D 5E 3E 40 7F 00 1E FD | |||
3A 02 0C 4E B0 12 F6 CB 0C 8E 0E 4F 3E F0 7F 00 | |||
0C 5E B0 12 84 CB 08 4C 0C 4F B0 12 84 CB 0F 4C | |||
5E 4A 02 00 0E 5E 4D 4B 0D 5D 0D 5E 1C 4D 3A 02 | |||
B0 12 84 CB 0E 4C B0 12 F6 CB 0C 8E 5E 4A 02 00 | |||
0E 5E 4D 4B 0D 5D 0D 5E 8D 4C 3A 02 55 3C 5E 4A | |||
02 00 0E 5E 4D 4B 0D 5D 0D 5E 3E 40 3F 00 1E FD | |||
3A 02 0C 4E B0 12 F8 CB 0C 8E 0E 4F 3E F0 3F 00 | |||
0C 5E B0 12 88 CB 08 4C 0C 4F B0 12 88 CB 0F 4C | |||
5E 4A 02 00 0E 5E 4D 4B 0D 5D 0D 5E 1C 4D 3A 02 | |||
B0 12 88 CB 0E 4C B0 12 F8 CB 0C 8E 5E 4A 02 00 | |||
0E 5E 4D 4B 0D 5D 0D 5E 8D 4C 3A 02 25 3C 12 C3 | |||
0F 10 0F 11 5E 4A 02 00 0E 5E 4D 4B 0D 5D 0D 5E | |||
1E 4D 3A 02 12 C3 0E 10 0E 11 0C 4E 0C 5C 0C 5E | |||
5E 4A 02 00 0E 5E 4D 4B 0D 5D 0D 5E 8D 4C 3A 02 | |||
0B 3C 12 C3 0F 10 5E 4A 02 00 0E 5E 4D 4B 0D 5D | |||
0D 5E 12 C3 1D 10 3A 02 0F 58 5E 4A 02 00 0E 5E | |||
4D 4B 0D 5D 0D 5E 8D 5F 3A 02 5F 4A 02 00 0F 5F | |||
4E 4B 0E 5E 0E 5F FA B0 C0 FF 00 00 02 24 1F 43 | |||
01 3C 3F 43 8E 5F 3A 02 76 3C 4E 4B 0E 5E 0E 5A | |||
1D 4E 04 00 4E 4B 0E 5E 0E 59 9E 9D 06 00 00 00 | |||
5B 2C A2 B2 36 02 58 20 18 43 3E 40 30 00 1E F2 | |||
36 02 0E 93 32 24 3E 80 10 00 2C 24 3E 80 10 00 | |||
0F 24 3E 80 10 00 2A 20 12 C3 0F 10 5E 4A 02 00 | |||
0E 5E 4D 4B 0D 5D 0D 5E 12 C3 1D 10 3A 02 1E 3C | |||
12 C3 0F 10 0F 11 5E 4A 02 00 0E 5E 4D 4B 0D 5D | |||
0D 5E 1E 4D 3A 02 12 C3 0E 10 0E 11 0C 4E 0C 5C | |||
0C 5E 5E 4A 02 00 0E 5E 4D 4B 0D 5D 0D 5E 8D 4C | |||
3A 02 04 3C 28 43 0F 43 01 3C 0F 43 5E 4A 02 00 | |||
0E 5E 4D 4B 0D 5D 0D 5E 8D 5F 3A 02 FA B0 C0 FF | |||
00 00 09 20 5F 4A 02 00 0F 5F 4E 4B 0E 5E 0E 5F | |||
8E 58 3A 02 18 3C 5F 4A 02 00 0F 5F 4E 4B 0E 5E | |||
0E 5F 8E 88 3A 02 0F 3C 4F 4B 0F 5F 0F 5A 1E 4F | |||
04 00 4F 4B 0F 5F 0F 59 9F 9E 06 00 00 00 03 28 | |||
B2 D0 05 00 36 02 5B 53 5B 9A 01 00 0C 2A 92 B3 | |||
36 02 02 20 A2 C2 36 02 30 40 EA CC 0A 12 09 12 | |||
09 4C 3A 43 3D 40 46 02 B0 12 00 C0 92 B3 36 02 | |||
C9 24 0C 49 3D 40 46 02 B0 12 36 C8 0B 4C 4B 93 | |||
0A 20 5F 49 01 00 0F 5F 1A 4F 44 02 1A 52 46 02 | |||
1A 52 48 02 1D 3C 5F 49 01 00 1F 83 4E 4B 0E 9F | |||
0B 20 4F 4B 0F 5F 1A 42 46 02 1A 5F 46 02 4F 4B | |||
0F 5F 1A 5F 44 02 0C 3C 4F 4B 0F 5F 4E 4B 0E 5E | |||
1A 4E 48 02 1A 5F 46 02 4F 4B 0F 5F 1A 5F 44 02 | |||
5F 49 0F 00 0F 9A 95 34 5C 49 0E 00 5D 49 01 00 | |||
B0 12 5C CC 4D 4B B0 12 9A CC 0A 4C 5C 49 0E 00 | |||
5D 49 01 00 B0 12 5C CC 0C 11 0A 5C 4B 93 28 20 | |||
5C 49 0E 00 5D 49 01 00 B0 12 5C CC 1D 42 48 02 | |||
B0 12 9A CC 3D 40 64 00 B0 12 5C CC 0A 5C 5C 49 | |||
0E 00 5D 49 01 00 B0 12 5C CC 5F 49 01 00 0F 5F | |||
1D 4F 44 02 B0 12 9A CC 3D 40 64 00 B0 12 5C CC | |||
0A 8C 0A 93 56 34 5F 49 0E 00 0A 5F 1A 53 51 3C | |||
5F 49 01 00 1F 83 4E 4B 0E 9F 29 20 5C 49 0E 00 | |||
5D 49 01 00 B0 12 5C CC 1D 42 46 02 B0 12 9A CC | |||
3D 40 64 00 B0 12 5C CC 0A 5C 5C 49 0E 00 5D 49 | |||
01 00 B0 12 5C CC 4B 4B 0B 5B 1D 4B 44 02 B0 12 | |||
9A CC 3D 40 64 00 B0 12 5C CC 0A 8C 5F 49 0E 00 | |||
0F 9A 27 34 5F 49 0E 00 0A 8F 1A 83 22 3C 5C 49 | |||
0E 00 5D 49 01 00 B0 12 5C CC 4F 4B 0F 5F 1D 4F | |||
48 02 B0 12 9A CC 3D 40 64 00 B0 12 5C CC 0A 5C | |||
5C 49 0E 00 5D 49 01 00 B0 12 5C CC 4B 4B 0B 5B | |||
1D 4B 44 02 B0 12 9A CC 3D 40 64 00 B0 12 5C CC | |||
0A 8C 5F 49 0E 00 0F 9A 02 38 0A 93 03 34 3A 43 | |||
01 3C 3A 43 0C 4A 30 40 EC CC 0A 12 21 82 3D 40 | |||
26 02 3C 40 68 CD B0 12 00 C0 3D 40 2C 02 3C 40 | |||
78 CD B0 12 00 C0 4A 43 6A 93 14 2C 4F 4A 0F 5F | |||
1C 4F 32 02 B0 12 0C C4 4F 4A 0F 5F 0F 51 8F 4C | |||
00 00 4F 4A 0F 5F 0F 51 3E 43 2E 9F 05 20 5A 53 | |||
6A 93 EC 2B 4C 43 7F 3C 4F 4A 0F 5F 1F 4F 32 02 | |||
5C 4F 0E 00 4F 4A 0F 5F 1F 4F 32 02 5D 4F 01 00 | |||
B0 12 5C CC 0C 11 4F 4A 0F 5F 0F 51 8F 9C 00 00 | |||
06 28 4F 4A 0F 5F 0F 51 8F 8C 00 00 0D 3C 4F 4A | |||
0F 5F 0F 51 4E 4A 0E 5E 1E 4E 32 02 5E 4E 0E 00 | |||
2E 5F 0E 8C 8F 4E 00 00 4F 4A 0F 5F 0F 51 4E 4A | |||
0E 5E AE 9F 88 CD 06 28 4F 4A 0F 5F 0F 51 8F 43 | |||
00 00 08 3C 4F 4A 0F 5F 0F 51 4E 4A 0E 5E 9F 8E | |||
88 CD 00 00 4F 4A 0F 5F 0F 51 2C 4F 4E 4A 0E 5E | |||
1E 4E 32 02 5D 4E 0E 00 B0 12 9A CC 8F 4C 00 00 | |||
4B 4A 0B 5B 0B 51 2C 4B 4F 4A 0F 5F 4E 4A 0E 5E | |||
1D 4E 8C CD 1D 8F 88 CD B0 12 5C CC 8B 4C 00 00 | |||
4F 4A 0F 5F 0F 51 4E 4A 0E 5E 1E 4E 32 02 5E 4E | |||
0E 00 2E 9F 0B 2C 4F 4A 0F 5F 0F 51 4E 4A 0E 5E | |||
1E 4E 32 02 5E 4E 0E 00 8F 4E 00 00 4E 4A 0E 5E | |||
4F 4A 0F 5F 0F 51 AE 5F 22 02 4A 4A 0A 5A 12 C3 | |||
1A 10 22 02 5C 43 21 52 3A 41 30 41 0A 12 09 12 | |||
08 12 07 12 06 12 05 12 04 12 21 83 0B 42 4B 4B | |||
5F 42 00 00 81 4F 00 00 1E 42 20 01 4E C3 3E D0 | |||
00 5A 14 42 60 01 15 42 64 01 16 42 74 01 B2 40 | |||
20 03 60 01 B2 40 00 E1 64 01 D2 D3 00 00 4A 43 | |||
5C 3C 4F 4A 0F 5F 0F 5C 1F 4F 04 00 2F 4F 67 4F | |||
4F 4A 0F 5F 0F 5C 1F 4F 04 00 1F 4F 02 00 68 4F | |||
4F 4A 0F 5F 0F 5C 1F 4F 04 00 29 4F 4F 4A 0F 5F | |||
0F 5C 1F 4F 04 00 D9 CF 04 00 00 00 4F 4A 0F 5F | |||
0F 5C 1F 4F 04 00 19 4F 02 00 4F 4A 0F 5F 0F 5C | |||
1F 4F 04 00 D9 DF 04 00 00 00 1F 4C 0C 00 1F 5C | |||
0A 00 3F 50 10 5A 82 4F 20 01 A2 D2 60 01 AC 92 | |||
0A 00 03 24 32 D0 18 00 02 3C 32 D0 D8 00 B2 E0 | |||
00 10 64 01 4F 4A 0F 5F 0F 5D 9F 42 74 01 00 00 | |||
B2 40 80 5A 20 01 4F 4A 0F 5F 0F 5C 1F 4F 04 00 | |||
2F 4F CF 47 00 00 4F 4A 0F 5F 0F 5C 1F 4F 04 00 | |||
1F 4F 02 00 CF 48 00 00 5A 53 5A 9C 01 00 A1 2B | |||
4F 4B 02 DF 7B B2 01 20 32 C2 2F 41 C2 4F 00 00 | |||
82 4E 20 01 82 44 60 01 82 45 64 01 82 46 74 01 | |||
21 53 30 40 E2 CC 0A 12 09 12 08 12 07 12 0A 4D | |||
09 4C 08 43 47 43 4B 43 58 3C 4F 4B 0F 5F 0F 59 | |||
1E 4F 04 00 4F 4B 0F 5F 0F 5A 9F 9E 06 00 00 00 | |||
46 28 4F 4B 0F 5F 0F 59 1E 4F 04 00 4F 4B 0F 5F | |||
0F 5A AE 9F 08 00 0B 2C 4F 4B 0F 5F 0F 59 1E 4F | |||
04 00 4F 4B 0F 5F 0F 5A 9F 4E 08 00 00 00 4F 4B | |||
0F 5F 0F 59 1E 4F 04 00 4F 4B 0F 5F 0F 5A 2C 4F | |||
1C 8E 06 00 3D 40 64 00 B0 12 9A CC 4F 4B 0F 5F | |||
0F 59 1E 4F 04 00 4F 4B 0F 5F 0F 59 1F 4F 04 00 | |||
1D 4F 08 00 1D 8E 06 00 B0 12 5C CC 4F 4B 0F 5F | |||
0F 5A 8F 4C 00 00 4F 4B 0F 5F 0F 5A 8F 98 00 00 | |||
0B 28 4F 4B 0F 5F 0F 5A 28 4F 07 4B 05 3C 4F 4B | |||
0F 5F 0F 5A 8F 43 00 00 5B 53 5B 99 01 00 A5 2B | |||
0C 47 30 40 E8 CC 0A 12 B2 40 80 5A 20 01 C2 43 | |||
21 00 F2 40 41 00 22 00 F2 93 FF 10 03 24 F2 93 | |||
FD 10 02 20 B0 12 0C CD C2 43 56 00 D2 42 FB 10 | |||
57 00 D2 42 FA 10 56 00 E2 43 58 00 F2 D0 20 00 | |||
53 00 B0 12 06 CC 7C 40 A0 00 B0 12 72 CC 3C 40 | |||
68 CD B0 12 D2 CC 3C 40 78 CD B0 12 D2 CC 3C 40 | |||
68 CD 7D 40 05 00 B0 12 38 CA 3C 40 78 CD 7D 40 | |||
05 00 B0 12 38 CA B2 40 10 00 82 01 B2 40 58 02 | |||
92 01 B2 40 10 01 80 01 32 D2 C2 93 21 02 15 24 | |||
C2 43 21 02 D2 E3 21 00 B0 12 BA C5 0A 4C 3C 40 | |||
22 02 7D 42 B0 12 C0 C9 5A 93 04 24 F2 F0 BF 00 | |||
21 00 03 3C F2 D0 40 00 21 00 32 D0 10 00 E5 3F | |||
0A 12 7D 90 0B 00 02 28 7D 40 0A 00 3B 40 02 02 | |||
4E 4D 0F 4E 0F 5F 0E 5F 5E 53 C2 4E 38 02 1B 53 | |||
DB 42 38 02 FF FF 3F 40 FF 00 5F 52 38 02 4A 43 | |||
11 3C CB 4A 00 00 7F 5B 4E 4A 0E 5E 0E 5C DB 4E | |||
01 00 00 00 7F 5B 4E 4A 0E 5E 0E 5C EB 4E 00 00 | |||
7F 5B 5A 53 4A 9D ED 2B CB 4F 00 00 F2 50 03 00 | |||
38 02 E2 D3 01 00 32 D0 10 00 C2 93 38 02 02 24 | |||
32 D0 10 00 3A 41 30 41 0A 12 09 12 08 12 07 12 | |||
07 4D 09 4C 48 43 25 3C 4A 43 1F 3C 0C 49 3D 40 | |||
46 02 B0 12 F2 CC 5F 49 02 00 0F 5F 4E 4A 0E 5E | |||
0E 5F 1F 4E 3A 02 12 C3 0F 10 4E 4A 0E 5E 1D 4E | |||
46 02 12 C3 0D 10 0D 5F 5F 49 02 00 0F 5F 4E 4A | |||
0E 5E 0E 5F 8E 4D 3A 02 5A 53 5A 99 01 00 DE 2B | |||
58 53 48 97 D9 2B 30 40 E8 CC 0A 12 09 12 7A 4C | |||
1E 3C 1C 53 0E 93 0D 24 3F 90 00 01 0A 2C 29 43 | |||
4F 4F 8F 10 7B 4C 0F DB 19 83 FA 23 02 3C 2F 92 | |||
02 28 7B 4C 05 3C 0B 4A 03 3C 1D 53 CD 4B FF FF | |||
1F 83 3F 93 FA 23 03 3C 1D 53 CD 4F FF FF 7F 4C | |||
4F 9A FA 23 7F 4C 0F 93 EA 23 7F 4C 8F 10 6B 4C | |||
0F 5B D7 23 30 40 EC CC 0A 12 09 12 3F 40 AA CD | |||
3F 90 A5 CD 19 28 3F 40 B6 CD 3F 90 AF CD 14 28 | |||
3A 40 B6 CD 3A 80 AE CD 3A 50 03 00 0A 11 0A 11 | |||
39 40 AE CD 3C 49 7F 4C 4F 4F 0F 5F 1F 4F A4 CD | |||
3D 49 8F 12 1A 83 F6 23 3F 40 00 00 3F 90 00 00 | |||
08 24 3A 40 00 00 02 3C 3F 4A 8F 12 3A 90 00 00 | |||
FB 23 30 40 EC CC 3D F0 0F 00 3D E0 0F 00 0D 5D | |||
0D 5D 00 5D 12 C3 0C 10 12 C3 0C 10 12 C3 0C 10 | |||
12 C3 0C 10 12 C3 0C 10 12 C3 0C 10 12 C3 0C 10 | |||
12 C3 0C 10 12 C3 0C 10 12 C3 0C 10 12 C3 0C 10 | |||
12 C3 0C 10 12 C3 0C 10 12 C3 0C 10 12 C3 0C 10 | |||
30 41 0F 12 0E 12 5F 42 39 02 0E 4F 5E 53 C2 4E | |||
39 02 4F 4F D2 4F 00 02 67 00 D2 92 38 02 39 02 | |||
09 20 C2 43 39 02 C2 43 38 02 E2 C3 01 00 B1 C0 | |||
D0 00 04 00 3E 41 3F 41 00 13 3D F0 0F 00 3D E0 | |||
0F 00 0D 5D 00 5D 0C 5C 0C 5C 0C 5C 0C 5C 0C 5C | |||
0C 5C 0C 5C 0C 5C 0C 5C 0C 5C 0C 5C 0C 5C 0C 5C | |||
0C 5C 0C 5C 30 41 E2 D2 26 00 E2 D2 41 00 F2 D0 | |||
80 00 61 00 F2 40 71 00 62 00 E2 43 63 00 C2 43 | |||
64 00 D2 C3 61 00 30 41 0F 12 0E 12 0D 12 0C 12 | |||
0B 12 B0 12 0C CD 3B 41 3C 41 3D 41 3E 41 3F 41 | |||
00 13 31 40 00 04 B0 12 24 CD 0C 93 02 24 B0 12 | |||
F8 CA 0C 43 B0 12 06 C9 B0 12 28 CD 0E 43 0F 4C | |||
1C 43 0F 5F 0E 6E 0E 9D 01 28 0E 8D 0C 6C F9 2B | |||
30 41 3F 40 0F 00 5F F2 36 02 7C F0 F0 00 4C DF | |||
C2 4C 36 02 30 41 1F 4C 01 00 0F 93 05 24 1D 53 | |||
CD 43 FF FF 1F 83 FB 23 30 41 0E 43 12 C3 0C 10 | |||
01 28 0E 5D 0D 5D 0C 93 F9 23 0C 4E 30 41 0F 4C | |||
0C 4D 3D 40 03 00 0D 5F 1E 4F 01 00 30 40 C0 CC | |||
0F 4C 0E 93 05 24 1F 53 FF 4D FF FF 1E 83 FB 23 | |||
30 41 5D 4C 02 00 0D 5D 3D 50 3A 02 B0 12 F2 CC | |||
30 41 34 41 35 41 36 41 37 41 38 41 39 41 3A 41 | |||
30 41 3F 40 41 00 6F 9C 02 20 B0 12 0C C7 30 41 | |||
D2 43 21 02 B1 C0 D0 00 00 00 00 13 F2 D0 41 00 | |||
21 00 03 43 FE 3F B1 C0 D0 00 00 00 00 13 1E 43 | |||
30 40 9A CA 1C 43 30 41 03 43 FF 3F 2E 00 42 00 | |||
04 00 05 00 46 00 2E 00 42 00 02 00 05 00 64 00 | |||
2E 00 42 00 01 00 05 00 5F 00 2E 00 42 00 08 00 | |||
05 00 47 00 2E 00 42 00 10 00 05 00 67 00 2E 00 | |||
42 00 20 00 05 00 69 00 41 03 00 00 2C CD 36 CD | |||
40 CD 00 00 02 00 40 48 41 03 03 00 4A CD 54 CD | |||
5E CD 00 00 02 00 40 4C 02 00 02 00 3E 00 3E 00 | |||
01 01 55 AA 01 30 00 68 CD 78 CD 12 00 00 00 01 | |||
00 00 00 00 86 CC 1E CD AE CC 00 00 12 00 90 CD | |||
00 02 AA CD 3A 02 | |||
@ffe4 | |||
28 CC 28 CC | |||
@ffea | |||
28 CC A2 CB 28 CC 28 CC 28 CC 16 CD 28 CC 28 CC | |||
00 CD 28 CC 42 CC | |||
q |
@ -0,0 +1,16 @@ | |||
CLS | |||
@echo off | |||
rem This is a small helper script that runs through the test collection for one device (folder) | |||
rem | |||
rem Dung Dang, MSP430 Applications, Texas Instruments, Inc. | |||
rem Last modified: 02/25/2011 | |||
:input | |||
@echo MSP-EXP430G2-LaunchPad Firmware Programmer | |||
set device=MSP430G2231 | |||
set firmware=430BOOST-SHARP96_CapacitiveTouch.txt | |||
@echo Programing %firmware% into %device% ...... | |||
..\..\MSP430Flasher\MSP430Flasher.exe -n %device% -w %firmware% -v -g -z [VCC] | |||
pause |
@ -0,0 +1,763 @@ | |||
@c000 | |||
0A 12 31 80 0C 00 B2 40 80 5A 20 01 C2 43 21 00 | |||
C2 43 29 00 F2 43 22 00 F2 43 2A 00 B0 12 0C E9 | |||
B2 40 D6 02 60 01 B2 D0 10 00 62 01 B2 40 FF 7C | |||
72 01 B2 40 51 A5 2A 01 32 D2 B0 12 26 E7 3C 40 | |||
00 02 3D 40 E2 EE B0 12 B8 E7 B0 12 00 C8 0D 43 | |||
0E 43 9F 12 14 00 82 4C 0E 02 82 43 10 02 B0 12 | |||
00 C8 3D 43 3E 40 FF 00 9F 12 14 00 0D 4C 82 4D | |||
12 02 82 43 14 02 B2 40 DC ED 16 02 B0 12 00 C8 | |||
9F 12 18 00 B0 12 00 C8 9F 12 16 00 3C 40 00 02 | |||
3D 40 DC EC B0 12 FE C6 3D 40 DC EC 3E 43 3F 43 | |||
B0 12 B0 CE 3C 40 00 02 3D 40 E8 EC 3E 43 3F 43 | |||
B0 12 82 E2 2E 43 0F 43 B0 12 F8 E7 B0 12 0C C7 | |||
3D 40 E8 EC 3E 43 3F 43 B0 12 B0 CE 91 43 00 00 | |||
81 43 02 00 B1 40 33 00 04 00 B0 12 C6 C7 3D 40 | |||
F4 EC 3E 43 3F 43 B0 12 B0 CE 3C 40 00 02 3D 40 | |||
06 ED B0 12 F0 C6 3D 40 06 ED 3E 43 3F 43 B0 12 | |||
B0 CE B0 12 00 C8 9F 12 16 00 0D 12 0E 12 3D 40 | |||
FC 51 3E 40 79 00 1D 83 0E 73 FD 23 0D 93 FB 23 | |||
3E 41 3D 41 00 3C B0 12 F6 C7 9F 12 18 00 3C 40 | |||
00 02 3D 40 12 ED B0 12 E2 C6 3D 40 12 ED 3E 43 | |||
3F 43 B0 12 B0 CE 3C 40 00 02 3D 40 1E ED B0 12 | |||
FE C6 3D 40 1E ED 3E 43 3F 43 B0 12 B0 CE 3A 40 | |||
06 02 2F 4A 3F 90 1F 00 19 34 B2 90 1E 00 0A 02 | |||
15 38 B2 90 1F 00 08 02 11 34 B2 90 1E 00 0C 02 | |||
0D 38 1B 42 04 02 1C 4B 04 00 3D 40 1E 00 3E 40 | |||
1E 00 1F 42 0E 02 9B 12 0A 00 2F 4A 3F 90 1F 00 | |||
1A 34 B2 90 1E 00 0A 02 16 38 B2 90 21 00 08 02 | |||
12 34 B2 90 20 00 0C 02 0E 38 1B 42 04 02 1C 4B | |||
04 00 3D 40 1E 00 3E 40 20 00 1F 42 0E 02 9B 12 | |||
0A 00 1F 42 06 02 3F 90 21 00 1A 34 B2 90 20 00 | |||
0A 02 16 38 B2 90 21 00 08 02 12 34 B2 90 20 00 | |||
0C 02 0E 38 1B 42 04 02 1C 4B 04 00 3D 40 20 00 | |||
3E 40 20 00 1F 42 0E 02 9B 12 0A 00 1F 42 06 02 | |||
3F 90 21 00 18 34 B2 90 20 00 0A 02 14 38 B2 90 | |||
1F 00 08 02 10 34 B2 90 1E 00 0C 02 0C 38 1B 42 | |||
04 02 1C 4B 04 00 3D 40 20 00 3E 40 1E 00 1F 42 | |||
0E 02 9B 12 0A 00 3F 40 23 00 81 43 00 00 B1 40 | |||
5A 00 02 00 81 43 04 00 B1 40 5A 00 06 00 81 43 | |||
08 00 3C 40 00 02 3D 40 23 00 0E 43 B0 12 9E D8 | |||
3F 40 50 00 81 43 00 00 B1 40 50 00 02 00 81 43 | |||
04 00 B1 40 14 00 06 00 81 43 08 00 3C 40 00 02 | |||
3D 40 05 00 0E 43 B0 12 9E D8 1E 42 04 02 1F 4E | |||
08 00 1F 83 81 43 00 00 1E 4E 06 00 1E 83 81 4E | |||
02 00 81 43 04 00 81 4F 06 00 81 43 08 00 3C 40 | |||
00 02 0D 43 0E 43 B0 12 9E D8 B0 12 00 C8 9F 12 | |||
16 00 0D 12 0E 12 3D 40 FC 51 3E 40 79 00 1D 83 | |||
0E 73 FD 23 0D 93 FB 23 3E 41 3D 41 00 3C B0 12 | |||
F6 C7 9F 12 18 00 B1 40 0A 00 00 00 81 43 02 00 | |||
B1 40 05 00 04 00 B0 12 C6 C7 3D 40 26 ED 3E 43 | |||
3F 43 B0 12 B0 CE 3F 40 46 00 81 43 00 00 B1 40 | |||
14 00 02 00 81 43 04 00 3C 40 00 02 3D 40 1E 00 | |||
0E 43 B0 12 0A C8 3F 40 32 00 81 43 00 00 B1 40 | |||
1E 00 02 00 81 43 04 00 3C 40 00 02 3D 40 3C 00 | |||
0E 43 B0 12 26 D5 B0 12 00 C8 9F 12 16 00 0D 12 | |||
0E 12 3D 40 FC 51 3E 40 79 00 1D 83 0E 73 FD 23 | |||
0D 93 FB 23 3E 41 3D 41 00 3C B0 12 F6 C7 9F 12 | |||
18 00 3C 40 00 02 3D 40 34 ED 3E 43 3F 43 B0 12 | |||
82 E2 2E 43 0F 43 B0 12 F8 E7 B0 12 1A C7 3D 40 | |||
34 ED 3E 43 3F 43 B0 12 B0 CE 3C 40 00 02 3D 40 | |||
A2 EE B0 12 42 DF 3C 40 00 02 3D 40 AA EE B0 12 | |||
D0 E1 B0 12 00 C8 9F 12 16 00 0D 12 0E 12 3D 40 | |||
FC 51 3E 40 79 00 1D 83 0E 73 FD 23 0D 93 FB 23 | |||
3E 41 3D 41 00 3C B0 12 F6 C7 9F 12 18 00 3C 40 | |||
00 02 3D 40 44 ED B0 12 FE C6 3D 40 44 ED 3E 43 | |||
3F 43 B0 12 B0 CE 3C 40 00 02 3D 40 4E ED B0 12 | |||
B4 C7 B0 12 0C C7 3D 40 4E ED 3E 43 3F 43 B0 12 | |||
B0 CE 3C 40 00 02 3D 40 5C ED B0 12 36 C7 3F 40 | |||
33 00 B0 12 60 C7 3D 40 5C ED 3E 43 3F 43 B0 12 | |||
B0 CE 3C 40 00 02 3D 40 6A ED B0 12 F0 C6 3D 40 | |||
6A ED 3E 43 3F 43 B0 12 B0 CE B0 12 00 C8 9F 12 | |||
16 00 0D 12 0E 12 3D 40 FC 51 3E 40 79 00 1D 83 | |||
0E 73 FD 23 0D 93 FB 23 3E 41 3D 41 00 3C B0 12 | |||
F6 C7 9F 12 18 00 3C 40 00 02 3D 40 7A ED B0 12 | |||
B4 C7 B0 12 1A C7 3D 40 7A ED 3E 43 3F 43 B0 12 | |||
B0 CE 3C 40 00 02 3D 40 B2 EE B0 12 D8 C7 B1 40 | |||
0F 00 04 00 B0 12 C6 C7 3D 40 88 ED 3E 40 0A 00 | |||
0F 43 B0 12 B0 CE 3C 40 00 02 3D 40 BA EE B0 12 | |||
D0 E1 B1 40 0F 00 00 00 81 43 02 00 B1 40 19 00 | |||
04 00 B0 12 C6 C7 3D 40 92 ED 3E 40 0A 00 0F 43 | |||
B0 12 B0 CE 3C 40 00 02 3D 40 C2 EE B0 12 D8 C7 | |||
B1 40 23 00 04 00 B0 12 C6 C7 3D 40 9C ED 3E 40 | |||
0A 00 0F 43 B0 12 B0 CE 3C 40 00 02 3D 40 CA EE | |||
B0 12 D8 C7 B1 40 2D 00 04 00 B0 12 C6 C7 3D 40 | |||
A6 ED 3E 40 0A 00 0F 43 B0 12 B0 CE 3C 40 00 02 | |||
3D 40 D2 EE B0 12 D8 C7 B1 40 37 00 04 00 B0 12 | |||
C6 C7 3D 40 B0 ED 3E 40 0A 00 0F 43 B0 12 B0 CE | |||
B0 12 00 C8 9F 12 16 00 0D 12 0E 12 3D 40 FC 51 | |||
3E 40 79 00 1D 83 0E 73 FD 23 0D 93 FB 23 3E 41 | |||
3D 41 00 3C B0 12 F6 C7 9F 12 18 00 3C 40 00 02 | |||
3D 40 BA ED B0 12 E2 C6 3D 40 BA ED 3E 43 3F 43 | |||
B0 12 B0 CE 3C 40 00 02 3D 40 DA EE B0 12 42 DF | |||
3C 40 00 02 3D 40 C8 ED B0 12 F0 C6 3D 40 C8 ED | |||
3E 43 3F 43 B0 12 B0 CE B0 12 00 C8 9F 12 16 00 | |||
0D 12 0E 12 3D 40 1C E1 3E 40 06 00 1D 83 0E 73 | |||
FD 23 0D 93 FB 23 3E 41 3D 41 00 3C B0 12 E8 C7 | |||
B0 12 00 C8 9F 12 16 00 0D 12 0E 12 3D 40 1C E1 | |||
3E 40 06 00 1D 83 0E 73 FD 23 0D 93 FB 23 3E 41 | |||
3D 41 00 3C B2 40 1E 00 18 02 B2 40 28 00 1A 02 | |||
B2 40 32 00 1C 02 B0 12 8A C7 9F 12 16 00 0D 12 | |||
0E 12 3D 40 1C E1 3E 40 06 00 1D 83 0E 73 FD 23 | |||
0D 93 FB 23 3E 41 3D 41 00 3C B2 40 32 00 18 02 | |||
B2 40 28 00 1A 02 B2 40 46 00 1C 02 B0 12 8A C7 | |||
9F 12 16 00 0D 12 0E 12 3D 40 1C E1 3E 40 06 00 | |||
1D 83 0E 73 FD 23 0D 93 FB 23 3E 41 3D 41 00 3C | |||
B2 40 46 00 18 02 B2 40 28 00 1A 02 B2 40 5A 00 | |||
1C 02 B2 40 3C 00 1E 02 B0 12 E8 C7 3C 40 00 02 | |||
3D 40 D6 ED B0 12 36 C7 3F 40 55 00 B0 12 60 C7 | |||
3D 40 D6 ED 3E 43 3F 43 B0 12 B0 CE B0 12 00 C8 | |||
9F 12 16 00 0D 12 0E 12 3D 40 FC 51 3E 40 79 00 | |||
1D 83 0E 73 FD 23 0D 93 FB 23 3E 41 3D 41 00 3C | |||
FF 3F B0 12 28 C7 3F 40 05 00 B0 12 40 C7 30 41 | |||
B0 12 28 C7 3F 40 4B 00 B0 12 40 C7 30 41 B0 12 | |||
28 C7 3F 40 0F 00 B0 12 40 C7 30 41 B0 12 80 C7 | |||
3F 40 23 00 B0 12 40 C7 30 41 B0 12 80 C7 3F 40 | |||
05 00 B0 12 40 C7 30 41 B0 12 B4 C7 3E 40 30 00 | |||
B0 12 9A C7 30 41 B0 12 B4 C7 B0 12 80 C7 30 41 | |||
0F 8E 3F B0 00 80 0E 7E 3E E3 81 4F 08 00 81 4E | |||
0A 00 81 43 0C 00 81 43 0E 00 3C 40 00 02 30 41 | |||
0F 8E 3F B0 00 80 0E 7E 3E E3 81 4F 06 00 81 4E | |||
08 00 81 43 0A 00 81 43 0C 00 3C 40 00 02 30 41 | |||
3E 40 30 00 B0 12 9A C7 30 41 B2 40 3C 00 1E 02 | |||
B0 12 E8 C7 B0 12 00 C8 30 41 0F 43 0E 8C 0F 7D | |||
81 4E 06 00 81 4F 08 00 1F 42 16 02 5E 4F 03 00 | |||
0E 11 30 41 3E 43 3F 43 B0 12 82 E2 2E 43 0F 43 | |||
B0 12 F8 E7 30 41 81 43 08 00 81 43 0A 00 81 43 | |||
0C 00 3C 40 00 02 30 41 B0 12 42 DF B1 40 0F 00 | |||
02 00 81 43 04 00 30 41 3C 40 00 02 3D 40 18 02 | |||
B0 12 D0 E1 30 41 B0 12 00 C8 1D 42 12 02 30 41 | |||
1F 42 04 02 1C 4F 04 00 30 41 0A 12 09 12 08 12 | |||
07 12 06 12 05 12 04 12 31 80 24 00 81 4F 0E 00 | |||
81 4D 0A 00 81 4E 0C 00 81 4C 08 00 1F 41 36 00 | |||
1E 41 38 00 91 41 34 00 10 00 81 4F 16 00 81 4E | |||
18 00 0D 4F 0D 5D 0E 6E 3C 40 03 00 0F 43 0C 8D | |||
0F 7E 81 4C 1A 00 81 4F 1C 00 81 93 18 00 02 34 | |||
30 40 3A CE 91 41 08 00 04 00 1E 41 04 00 3E 52 | |||
81 4E 02 00 81 43 12 00 81 43 14 00 1A 41 0E 00 | |||
19 41 10 00 1A 81 12 00 19 71 14 00 1F 41 02 00 | |||
2F 4F 3F B0 00 80 06 76 36 E3 09 96 9D 38 02 20 | |||
0A 9F 9A 28 1D 41 04 00 3D 50 0C 00 81 4D 20 00 | |||
0E 4D 2E 4E 81 4E 00 00 3E B0 00 80 05 75 35 E3 | |||
05 99 8A 38 02 20 0E 9A 87 28 3E 40 06 00 1E 51 | |||
04 00 A1 4E 22 00 1B 41 16 00 1C 41 18 00 18 41 | |||
0A 00 08 5B 1C 61 0C 00 81 4C 1E 00 3C 40 06 00 | |||
1C 51 04 00 81 4C 06 00 24 4E 34 B0 00 80 07 77 | |||
37 E3 1D 41 0A 00 1E 41 0C 00 0D 8B 1E 71 18 00 | |||
0E 97 29 38 02 20 0D 94 26 28 B0 12 5A CE 23 38 | |||
02 20 0B 9D 20 28 0E 97 1E 38 02 20 0D 94 1B 28 | |||
0C 9E 19 38 02 20 0B 9D 16 28 09 96 14 38 02 20 | |||
0A 9F 11 28 05 99 0F 38 03 20 81 9A 00 00 0B 28 | |||
B0 12 86 CE 9B 12 0A 00 1F 41 02 00 2F 4F 1E 41 | |||
06 00 A1 4E 22 00 1E 41 22 00 3E B0 00 80 0D 7D | |||
3D E3 1C 41 1E 00 0C 9D 2F 38 02 20 08 9E 2C 28 | |||
1D 41 04 00 3D 50 0A 00 2D 4D 3D B0 00 80 0E 7E | |||
3E E3 0E 9C 21 38 02 20 0D 98 1E 28 0E 9C 1C 38 | |||
02 20 0D 98 19 28 B0 12 9A CE 16 38 02 20 0A 9F | |||
13 28 1E 41 20 00 2D 4E 3D B0 00 80 0E 7E 3E E3 | |||
0E 99 0A 38 02 20 0D 9A 07 28 B0 12 70 CE 9B 12 | |||
0A 00 1F 41 02 00 2F 4F 1D 41 12 00 1A 41 0E 00 | |||
19 41 10 00 0A 5D 19 61 14 00 B0 12 9A CE 97 38 | |||
02 20 0A 9F 94 28 1E 41 04 00 3E 50 0C 00 81 4E | |||
06 00 0F 4E 24 4F 34 B0 00 80 06 76 36 E3 06 99 | |||
86 38 02 20 04 9A 83 28 81 93 14 00 02 20 0D 93 | |||
7E 24 3F 40 06 00 1F 51 04 00 A1 4F 1E 00 18 41 | |||
0A 00 18 51 16 00 17 41 0C 00 17 61 18 00 1D 41 | |||
04 00 3D 50 06 00 81 4D 00 00 25 4F 35 B0 00 80 | |||
0B 7B 3B E3 1D 41 0A 00 1F 41 0C 00 1D 81 16 00 | |||
1F 71 18 00 0F 9B 27 38 02 20 0D 95 24 28 3C 40 | |||
0A 00 1C 51 04 00 2C 4C 3C B0 00 80 0E 7E 3E E3 | |||
0E 9F 19 38 02 20 0C 9D 16 28 0F 9B 14 38 02 20 | |||
0D 95 11 28 0E 9F 0F 38 02 20 0C 9D 0C 28 06 99 | |||
0A 38 02 20 04 9A 07 28 B0 12 86 CE 9B 12 0A 00 | |||
2F 41 A1 4F 1E 00 1F 41 1E 00 3F B0 00 80 0E 7E | |||
3E E3 07 9E 2C 38 02 20 08 9F 29 28 1E 41 04 00 | |||
3E 50 0A 00 2E 4E B0 12 A6 CE 0F 97 20 38 02 20 | |||
0E 98 1D 28 0F 97 1B 38 02 20 0E 98 18 28 1F 41 | |||
02 00 2E 4F B0 12 A6 CE 09 9F 11 38 02 20 0A 9E | |||
0E 28 1F 41 06 00 2E 4F B0 12 A6 CE 0F 99 07 38 | |||
02 20 0E 9A 04 28 B0 12 70 CE 9B 12 0A 00 1E 41 | |||
18 00 81 9E 14 00 05 20 1E 41 16 00 81 9E 12 00 | |||
4E 25 1A 41 0E 00 19 41 10 00 1A 81 16 00 19 71 | |||
18 00 1F 41 02 00 2F 4F 1C 41 18 00 1E 41 0E 00 | |||
1E 51 16 00 1C 61 10 00 81 4C 06 00 81 4E 00 00 | |||
3F B0 00 80 07 77 37 E3 09 97 9B 38 02 20 0A 9F | |||
98 28 1D 41 04 00 3D 50 0C 00 81 4D 20 00 0E 4D | |||
24 4E 34 B0 00 80 06 76 36 E3 06 99 8A 38 02 20 | |||
04 9A 87 28 1D 41 04 00 3D 50 06 00 81 4D 1E 00 | |||
1E 41 04 00 15 4E 06 00 35 B0 00 80 08 78 38 E3 | |||
1D 41 0A 00 1E 41 0C 00 1D 81 12 00 1E 71 14 00 | |||
0E 98 24 38 02 20 0D 95 21 28 B0 12 5A CE 1E 38 | |||
02 20 0B 9D 1B 28 0E 98 19 38 02 20 0D 95 16 28 | |||
0C 9E 14 38 02 20 0B 9D 11 28 09 97 0F 38 02 20 | |||
0A 9F 0C 28 06 99 0A 38 02 20 04 9A 07 28 B0 12 | |||
86 CE 9B 12 0A 00 1F 41 02 00 2F 4F 81 93 14 00 | |||
03 20 81 93 12 00 45 24 1E 41 1E 00 27 4E 37 B0 | |||
00 80 08 78 38 E3 1C 41 14 00 1D 41 0A 00 1D 51 | |||
12 00 1C 61 0C 00 0C 98 34 38 02 20 0D 97 31 28 | |||
1B 41 04 00 3B 50 0A 00 2B 4B 3B B0 00 80 0E 7E | |||
3E E3 0E 9C 26 38 02 20 0B 9D 23 28 0C 98 21 38 | |||
02 20 0D 97 1E 28 0E 9C 1C 38 02 20 0B 9D 19 28 | |||
B0 12 9A CE 16 38 02 20 0A 9F 13 28 1E 41 20 00 | |||
2C 4E 3C B0 00 80 0E 7E 3E E3 0E 99 0A 38 02 20 | |||
0C 9A 07 28 B0 12 86 CE 9B 12 0A 00 1F 41 02 00 | |||
2F 4F 2A 41 19 41 06 00 B0 12 9A CE 90 38 02 20 | |||
0A 9F 8D 28 38 40 0C 00 1F 41 04 00 08 5F 24 48 | |||
34 B0 00 80 0B 7B 3B E3 0B 99 81 38 02 20 04 9A | |||
7E 28 37 40 06 00 07 5F 16 4F 06 00 36 B0 00 80 | |||
0E 7E 3E E3 1D 41 0A 00 1F 41 0C 00 1D 81 12 00 | |||
1F 71 14 00 0F 9E 24 38 02 20 0D 96 21 28 15 41 | |||
04 00 35 50 0A 00 25 45 35 B0 00 80 0C 7C 3C E3 | |||
0C 9F 16 38 02 20 05 9D 13 28 0F 9E 11 38 02 20 | |||
0D 96 0E 28 0C 9F 0C 38 02 20 05 9D 09 28 0B 99 | |||
07 38 02 20 04 9A 04 28 B0 12 86 CE 9B 12 0A 00 | |||
81 93 14 00 03 20 81 93 12 00 41 24 2B 47 3B B0 | |||
00 80 0E 7E 3E E3 17 41 12 00 1D 41 0A 00 1F 41 | |||
0C 00 0D 57 1F 61 14 00 0F 9E 31 38 02 20 0D 9B | |||
2E 28 17 41 04 00 37 50 0A 00 27 47 37 B0 00 80 | |||
0C 7C 3C E3 0C 9F 23 38 02 20 07 9D 20 28 0F 9E | |||
1E 38 02 20 0D 9B 1B 28 0C 9F 19 38 02 20 07 9D | |||
16 28 1F 41 02 00 2E 4F B0 12 A6 CE 09 9F 0F 38 | |||
02 20 0A 9E 0C 28 2E 48 B0 12 A6 CE 0F 99 07 38 | |||
02 20 0E 9A 04 28 B0 12 86 CE 9B 12 0A 00 81 93 | |||
1C 00 13 38 1E 41 12 00 1F 41 14 00 1E 81 16 00 | |||
1F 71 18 00 B0 12 42 CE 3F 50 0A 00 81 63 1C 00 | |||
91 83 16 00 81 73 18 00 0A 3C 1E 41 12 00 1F 41 | |||
14 00 B0 12 42 CE 3F 50 06 00 81 63 1C 00 81 4F | |||
1A 00 91 53 12 00 81 63 14 00 1F 41 14 00 0E 4F | |||
81 9E 18 00 0A 38 02 24 30 40 7C C8 1E 41 12 00 | |||
81 9E 16 00 02 28 30 40 7C C8 31 50 24 00 30 40 | |||
B2 E9 0E 5E 0F 6F 0E 5E 0F 6F 1E 51 1C 00 1F 61 | |||
1E 00 81 4F 1E 00 0F 4E 30 41 3B 40 0A 00 1B 51 | |||
06 00 2B 4B 3B B0 00 80 0C 7C 3C E3 0C 9E 30 41 | |||
1F 41 0A 00 1B 4F 04 00 1C 4B 04 00 1F 4F 0E 00 | |||
0D 48 0E 4A 30 41 1F 41 0A 00 1B 4F 04 00 1C 4B | |||
04 00 1F 4F 0E 00 0E 4A 30 41 3F B0 00 80 0E 7E | |||
3E E3 09 9E 30 41 3E B0 00 80 0F 7F 3F E3 30 41 | |||
0A 12 09 12 08 12 07 12 06 12 05 12 04 12 31 80 | |||
52 00 81 4E 26 00 81 4F 28 00 81 4D 24 00 81 4C | |||
22 00 91 41 6A 00 32 00 91 41 6C 00 34 00 91 41 | |||
66 00 2E 00 91 41 68 00 30 00 91 41 62 00 2A 00 | |||
91 41 64 00 2C 00 0C 41 3C 50 06 00 1D 41 22 00 | |||
3E 40 18 00 B0 12 A0 E9 1F 41 22 00 1F 4F 16 00 | |||
FF B0 80 FF 00 00 11 20 91 4F C4 00 46 00 2F 52 | |||
81 4F 48 00 7F 40 20 00 81 4F 4A 00 7F 40 7E 00 | |||
81 4F 4C 00 7F 40 2E 00 1A 3C 91 4F 08 00 46 00 | |||
91 4F 06 00 48 00 5E 4F 04 00 81 4E 4A 00 5E 4F | |||
05 00 81 4E 4C 00 1E 41 4A 00 7E 90 2F 00 05 2C | |||
1E 41 4C 00 7E 90 2E 00 E5 2F 5F 4F 04 00 81 4F | |||
4E 00 30 40 64 D4 1B 41 4A 00 4B 4B 0B 5B 1C 41 | |||
0C 00 3C B0 00 80 0D 7D 3D E3 1E 41 4A 00 4F 9E | |||
04 28 1E 41 4C 00 4E 9F 03 2C 1F 41 4E 00 04 3C | |||
1B 41 4A 00 4B 4B 0B 5B 4F 4F 0F 5F 0F 8B 1F 51 | |||
48 00 2E 4F 1E 51 46 00 81 4E 44 00 91 53 24 00 | |||
1E 53 81 4E 20 00 1E 41 2A 00 1F 41 2C 00 1B 41 | |||
20 00 6B 4B 0E 5B 0F 63 0F 9D 02 34 30 40 56 D4 | |||
04 20 0E 9C 02 2C 30 40 56 D4 A1 43 36 00 81 43 | |||
38 00 09 43 0A 43 81 49 40 00 81 4A 42 00 0F 49 | |||
81 4F 3A 00 0F 4A 81 4F 3C 00 1F 41 44 00 6F 4F | |||
81 93 38 00 08 38 02 24 30 40 56 D4 81 9F 36 00 | |||
02 28 30 40 56 D4 B0 12 14 D5 02 34 30 40 56 D4 | |||
05 20 1E 91 3A 00 02 2C 30 40 56 D4 1F 41 1C 00 | |||
3E 40 7F 00 6E BF 42 24 1E 41 44 00 1F 41 36 00 | |||
0F 5E CF 93 00 00 26 20 1F 41 36 00 1F 53 0F 5E | |||
67 4F 77 B0 80 FF 0D 20 47 47 07 57 07 57 07 57 | |||
37 B0 00 80 04 74 34 E3 A1 53 36 00 81 43 3E 00 | |||
21 3C 6F 4F 3F F0 7F 00 0F 5F 0F 5F 0F 5F 81 4F | |||
3E 00 3F B0 00 80 08 78 38 E3 A1 53 36 00 81 63 | |||
38 00 2D 3D 6F 4F 4C 4F B0 12 8C E8 07 4C 37 B0 | |||
00 80 04 74 34 E3 4F 4F 3F F0 0F 00 81 4F 3E 00 | |||
91 53 36 00 08 43 81 63 38 00 0E 3D 07 43 04 43 | |||
08 3C 91 53 36 00 81 63 38 00 81 43 40 00 81 43 | |||
42 00 1F 41 44 00 6F 4F 81 93 38 00 04 38 1D 20 | |||
81 9F 36 00 1A 2C B0 12 FE D4 B0 12 E6 D4 0A 38 | |||
03 20 3C 90 09 00 06 28 3C 42 0F 43 1C 81 40 00 | |||
1F 71 42 00 07 5C 04 6F 81 5C 40 00 81 6F 42 00 | |||
04 20 1F 41 40 00 3F 92 D4 27 81 43 3E 00 08 43 | |||
08 3C 91 53 36 00 81 63 38 00 81 43 40 00 81 43 | |||
42 00 1F 41 44 00 6F 4F 81 93 38 00 04 38 CC 20 | |||
81 9F 36 00 C9 2C B0 12 FE D4 3C E3 B0 12 E6 D4 | |||
0A 38 03 20 3C 90 09 00 06 28 3C 42 0F 43 1C 81 | |||
40 00 1F 71 42 00 81 5C 3E 00 08 6F 81 5C 40 00 | |||
81 6F 42 00 B1 20 1F 41 40 00 3F 92 D2 27 AC 3C | |||
04 93 6B 38 02 20 27 93 68 28 0D 49 0E 4A 1D 53 | |||
0E 63 1F 41 20 00 6F 4F 0E 93 03 38 5E 20 0D 9F | |||
5C 2C 1F 41 0E 00 0C 49 0C 57 0D 4A 0D 64 1E 41 | |||
20 00 6E 4E 0B 43 0B 9D 03 38 09 20 0E 9C 07 2C | |||
1E 41 20 00 65 4E 06 43 05 89 06 7A 02 3C 05 47 | |||
06 44 3F B0 00 80 0E 7E 3E E3 81 9E 3C 00 38 38 | |||
03 20 81 9F 3A 00 34 28 81 93 34 00 03 20 81 93 | |||
32 00 2E 24 1F 41 22 00 91 4F 12 00 14 00 91 4F | |||
14 00 16 00 1D 41 2A 00 1E 41 2C 00 0D 59 0E 6A | |||
81 4D 1E 00 0D 55 0C 4E 0C 66 1D 83 0C 73 81 4D | |||
50 00 81 4C 00 00 1D 41 3A 00 1F 41 3C 00 1D 51 | |||
2E 00 1F 61 30 00 81 4D 02 00 81 4F 04 00 0C 41 | |||
3C 50 06 00 1D 41 1E 00 1F 41 50 00 B0 12 34 E0 | |||
07 85 04 76 09 55 0A 66 32 3C 05 49 06 4A 15 53 | |||
06 63 B0 12 B0 D4 27 38 02 20 0D 9C 24 28 1C 41 | |||
10 00 3C B0 00 80 0E 7E 3E E3 0E 9F 1C 38 02 20 | |||
0C 9D 19 28 1E 41 0E 00 3E B0 00 80 0F 7F 3F E3 | |||
81 9F 3C 00 10 38 03 20 81 9E 3A 00 0C 28 81 93 | |||
34 00 03 20 81 93 32 00 06 24 B0 12 CC D4 1F 4F | |||
12 00 9B 12 0A 00 17 83 04 73 09 45 0A 46 1F 41 | |||
20 00 6F 4F 0A 93 08 20 09 9F 06 20 91 53 3A 00 | |||
81 63 3C 00 09 43 0A 43 04 93 02 20 07 93 07 24 | |||
B0 12 14 D5 04 38 4C 23 1E 91 3A 00 49 2F 08 93 | |||
03 20 81 93 3E 00 81 26 B0 12 14 D5 7E 3A 03 20 | |||
1E 91 3A 00 7A 2A 08 93 63 38 04 20 1F 41 3E 00 | |||
2F 93 5E 28 0E 49 0F 4A 1E 53 0F 63 1D 41 20 00 | |||
6D 4D 0F 93 03 38 54 20 0E 9D 52 2C 1F 41 0E 00 | |||
1D 41 3E 00 0D 59 0C 4A 0C 68 1E 41 20 00 6E 4E | |||
0B 43 0B 9C 03 38 09 20 0E 9D 07 2C 1E 41 20 00 | |||
67 4E 06 43 07 89 06 7A 03 3C 17 41 3E 00 06 48 | |||
3F B0 00 80 0E 7E 3E E3 81 9E 3C 00 2B 38 03 20 | |||
81 9F 3A 00 27 28 1F 41 22 00 91 4F 0E 00 14 00 | |||
91 4F 10 00 16 00 1D 41 2A 00 1E 41 2C 00 0D 59 | |||
0E 6A 0F 4D 0F 57 0C 4E 0C 66 1F 83 0C 73 81 4C | |||
00 00 14 41 3A 00 15 41 3C 00 14 51 2E 00 15 61 | |||
30 00 81 44 02 00 81 45 04 00 0C 41 3C 50 06 00 | |||
B0 12 34 E0 81 87 3E 00 08 76 09 57 0A 66 2D 3C | |||
06 49 07 4A 16 53 07 63 B0 12 B0 D4 21 38 02 20 | |||
0D 9C 1E 28 1C 41 10 00 3C B0 00 80 0E 7E 3E E3 | |||
0E 9F 16 38 02 20 0C 9D 13 28 1E 41 0E 00 3E B0 | |||
00 80 0F 7F 3F E3 81 9F 3C 00 0A 38 03 20 81 9E | |||
3A 00 06 28 B0 12 CC D4 1F 4F 0E 00 9B 12 0A 00 | |||
91 83 3E 00 08 73 09 46 0A 47 1F 41 20 00 6F 4F | |||
0A 93 5D 23 09 9F 5B 23 91 53 3A 00 81 63 3C 00 | |||
09 43 0A 43 54 3F 1F 41 20 00 6F 4F 81 5F 2A 00 | |||
81 63 2C 00 1F 41 24 00 6F 4F 4F 93 1D 24 91 83 | |||
26 00 81 73 28 00 1E 41 28 00 3E 93 04 20 1E 41 | |||
26 00 3E 93 11 24 1D 41 10 00 3D B0 00 80 0E 7E | |||
3E E3 1E 91 2C 00 08 38 02 24 30 40 76 CF 1D 91 | |||
2A 00 02 28 30 40 76 CF 31 50 52 00 30 40 B2 E9 | |||
1D 41 2C 00 1F 41 2E 00 0D 59 0F 6A 1C 41 0E 00 | |||
3C B0 00 80 0E 7E 3E E3 0F 9E 30 41 1F 41 24 00 | |||
1B 4F 04 00 1C 4B 04 00 1E 41 30 00 1E 51 3C 00 | |||
1F 41 24 00 30 41 3C B0 00 80 0D 7D 3D E3 B0 12 | |||
38 E8 3C B0 00 80 0F 7F 3F E3 0F 93 30 41 1F 41 | |||
46 00 1E 41 38 00 0E 5F 6C 4E 1D 41 42 00 B0 12 | |||
96 E8 30 41 1E 41 14 00 3E B0 00 80 0F 7F 3F E3 | |||
1F 91 3E 00 30 41 0A 12 09 12 08 12 07 12 06 12 | |||
05 12 04 12 31 80 1C 00 81 4F 10 00 81 4D 0C 00 | |||
81 4E 0E 00 0A 4C 1F 41 2E 00 19 41 30 00 91 41 | |||
2C 00 12 00 81 4F 16 00 0E 4F 0C 49 0E 5E 0C 6C | |||
3D 40 03 00 0F 43 0D 8E 0F 7C 81 4D 18 00 81 4F | |||
1A 00 09 93 56 39 3F 42 0F 5A 81 4F 06 00 81 43 | |||
14 00 08 43 17 41 10 00 1B 41 12 00 17 81 14 00 | |||
0B 78 1F 41 06 00 2C 4F B0 12 92 D8 3C 38 02 20 | |||
07 9C 39 28 B0 12 6E D8 36 38 02 20 0E 97 33 28 | |||
B0 12 58 D8 25 4F 16 41 16 00 16 51 0C 00 1F 41 | |||
0E 00 04 4F 04 69 81 46 08 00 16 4A 06 00 36 B0 | |||
00 80 0F 7F 3F E3 0E 9F 03 38 04 20 0D 96 02 2C | |||
0D 46 0E 4F 1F 41 08 00 35 B0 00 80 06 76 36 E3 | |||
06 94 03 38 04 20 05 9F 02 2C 0F 45 04 46 04 9E | |||
0A 38 02 20 0F 9D 07 28 B0 12 82 D8 B0 12 34 E0 | |||
1F 41 06 00 2C 4F 17 41 10 00 17 51 14 00 1B 41 | |||
12 00 0B 68 B0 12 92 D8 39 38 02 20 07 9C 36 28 | |||
B0 12 6E D8 33 38 02 20 0E 97 30 28 08 93 03 20 | |||
81 93 14 00 2B 24 B0 12 58 D8 2C 4F 1F 41 0C 00 | |||
1F 51 16 00 14 41 0E 00 04 69 15 4A 06 00 35 B0 | |||
00 80 06 76 36 E3 0E 96 03 38 04 20 0D 95 02 2C | |||
0D 45 0E 46 3C B0 00 80 06 76 36 E3 06 94 03 38 | |||
04 20 0C 9F 02 2C 0F 4C 04 46 04 9E 07 38 02 20 | |||
0F 9D 04 28 B0 12 82 D8 B0 12 34 E0 81 93 1A 00 | |||
96 38 08 99 05 20 1E 41 16 00 81 9E 14 00 8F 24 | |||
17 41 10 00 1B 41 12 00 17 81 16 00 0B 79 1F 41 | |||
06 00 2C 4F 1F 41 10 00 1F 51 16 00 1E 41 12 00 | |||
0E 69 81 4E 0A 00 81 4F 08 00 B0 12 92 D8 3C 38 | |||
02 20 07 9C 39 28 B0 12 6E D8 36 38 02 20 0E 97 | |||
33 28 B0 12 42 D8 24 4F 16 4A 06 00 36 B0 00 80 | |||
0F 7F 3F E3 0E 9F 03 38 04 20 0D 96 02 2C 0D 46 | |||
0E 4F 1F 41 0C 00 1F 51 14 00 16 41 0E 00 06 68 | |||
34 B0 00 80 05 75 35 E3 05 96 03 38 04 20 04 9F | |||
02 2C 0F 44 06 45 06 9E 0F 38 02 20 0F 9D 0C 28 | |||
81 46 00 00 81 47 02 00 81 4B 04 00 0C 4A B0 12 | |||
34 E0 1F 41 06 00 2C 4F 17 41 08 00 1B 41 0A 00 | |||
B0 12 92 D8 34 38 02 20 07 9C 31 28 B0 12 6E D8 | |||
2E 38 02 20 0E 97 2B 28 B0 12 42 D8 2C 4F 1F 41 | |||
0C 00 1F 51 14 00 14 41 0E 00 04 68 15 4A 06 00 | |||
35 B0 00 80 06 76 36 E3 0E 96 03 38 04 20 0D 95 | |||
02 2C 0D 45 0E 46 3C B0 00 80 06 76 36 E3 06 94 | |||
03 38 04 20 0C 9F 02 2C 0F 4C 04 46 04 9E 07 38 | |||
02 20 0F 9D 04 28 B0 12 82 D8 B0 12 34 E0 81 93 | |||
1A 00 10 38 1E 41 14 00 0F 48 1E 81 16 00 0F 79 | |||
B0 12 2A D8 3F 50 0A 00 81 63 1A 00 91 83 16 00 | |||
09 73 09 3C 1E 41 14 00 0F 48 B0 12 2A D8 3F 50 | |||
06 00 81 63 1A 00 81 4F 18 00 91 53 14 00 1F 41 | |||
14 00 08 63 09 98 05 38 B5 22 0E 4F 81 9E 16 00 | |||
B1 2E 31 50 1C 00 30 40 B2 E9 0E 5E 0F 6F 0E 5E | |||
0F 6F 1E 51 1A 00 1F 61 1C 00 81 4F 1C 00 0F 4E | |||
30 41 1D 41 0E 00 1E 41 10 00 1D 81 16 00 0E 78 | |||
3F 40 0A 00 0F 5A 30 41 1D 41 0E 00 1E 41 10 00 | |||
1D 81 18 00 0E 79 3F 40 0A 00 0F 5A 30 41 3F 40 | |||
0C 00 0F 5A 2E 4F 3E B0 00 80 0F 7F 3F E3 0F 9B | |||
30 41 81 44 02 00 81 47 04 00 81 4B 06 00 0C 4A | |||
30 41 3C B0 00 80 0F 7F 3F E3 0B 9F 30 41 0A 12 | |||
09 12 08 12 07 12 06 12 05 12 04 12 31 80 14 00 | |||
81 4F 0A 00 81 4D 06 00 81 4E 08 00 07 4C 91 41 | |||
24 00 0C 00 91 91 28 00 08 00 04 20 91 91 26 00 | |||
06 00 28 25 91 91 2C 00 0C 00 04 20 91 91 2A 00 | |||
0A 00 0E 25 0F 41 3F 50 2A 00 81 4F 00 00 0D 41 | |||
3D 50 06 00 0E 41 3E 50 0A 00 0F 41 3F 50 26 00 | |||
B0 12 4E DB 0D 93 02 20 0C 93 1D 25 91 91 2C 00 | |||
0C 00 05 38 0D 20 91 91 2A 00 0A 00 09 2C 1C 41 | |||
2A 00 1D 41 2C 00 1C 81 0A 00 1D 71 0C 00 08 3C | |||
1C 41 0A 00 1D 41 0C 00 1C 81 2A 00 1D 71 2C 00 | |||
91 91 28 00 08 00 05 38 0D 20 91 91 26 00 06 00 | |||
09 2C 1E 41 26 00 1F 41 28 00 1E 81 06 00 1F 71 | |||
08 00 08 3C 1E 41 06 00 1F 41 08 00 1E 81 26 00 | |||
1F 71 28 00 0F 9D 05 38 02 20 0E 9C 02 28 06 43 | |||
1D 3C 1E 41 06 00 1F 41 08 00 91 41 0A 00 06 00 | |||
91 41 0C 00 08 00 81 4E 0A 00 81 4F 0C 00 1E 41 | |||
26 00 1F 41 28 00 91 41 2A 00 26 00 91 41 2C 00 | |||
28 00 81 4E 2A 00 81 4F 2C 00 16 43 91 91 08 00 | |||
28 00 05 38 20 20 91 91 06 00 26 00 1C 2C 1E 41 | |||
06 00 1F 41 08 00 91 41 26 00 06 00 91 41 28 00 | |||
08 00 81 4E 26 00 81 4F 28 00 1E 41 0A 00 1F 41 | |||
0C 00 91 41 2A 00 0A 00 91 41 2C 00 0C 00 81 4E | |||
2A 00 81 4F 2C 00 1F 41 26 00 1A 41 28 00 1F 81 | |||
06 00 1A 71 08 00 81 4F 0E 00 91 91 2C 00 0C 00 | |||
05 38 0D 20 91 91 2A 00 0A 00 09 2C 1E 41 2A 00 | |||
1F 41 2C 00 1E 81 0A 00 1F 71 0C 00 08 3C 1E 41 | |||
0A 00 1F 41 0C 00 1E 81 2A 00 1F 71 2C 00 81 4E | |||
10 00 81 4F 12 00 1C 41 0E 00 0D 4A 2E 43 0F 43 | |||
B0 12 F8 E7 3C E3 3D E3 1C 53 0D 63 08 4C 09 4D | |||
91 91 2C 00 0C 00 05 38 07 20 91 91 2A 00 0A 00 | |||
03 2C 14 43 05 43 02 3C 34 43 35 43 91 91 08 00 | |||
28 00 59 38 04 20 91 91 06 00 26 00 54 28 0F 43 | |||
0F 93 07 20 06 93 05 20 1D 41 06 00 1E 41 0A 00 | |||
04 3C 1D 41 0A 00 1E 41 06 00 1B 47 04 00 1C 4B | |||
04 00 1F 47 0E 00 9B 12 0A 00 18 51 10 00 19 61 | |||
12 00 09 93 0A 38 02 20 18 93 07 28 81 54 0A 00 | |||
81 65 0C 00 18 81 0E 00 09 7A 1E 43 0F 43 1E 51 | |||
06 00 1F 61 08 00 81 4E 06 00 81 4F 08 00 C6 3F | |||
1F 41 26 00 91 41 28 00 00 00 91 41 0A 00 02 00 | |||
91 41 0C 00 04 00 1D 41 06 00 1E 41 08 00 B0 12 | |||
34 E0 11 3C 1F 41 0A 00 91 41 0C 00 00 00 91 41 | |||
2A 00 02 00 91 41 2C 00 04 00 1D 41 06 00 1E 41 | |||
08 00 B0 12 02 E1 31 50 14 00 30 40 B2 E9 0A 12 | |||
09 12 08 12 07 12 06 12 05 12 04 12 31 80 0E 00 | |||
06 4F 07 4E 08 4D 81 4C 0C 00 15 41 1E 00 2F 47 | |||
91 47 02 00 00 00 2D 48 1E 48 02 00 B0 12 B0 E3 | |||
04 4C 81 4D 0A 00 2F 45 91 45 02 00 00 00 2D 46 | |||
1E 46 02 00 1C 41 0C 00 B0 12 B0 E3 81 4C 06 00 | |||
81 4D 08 00 89 3C 1E 41 0C 00 3C 40 0A 00 3B 40 | |||
0C 00 3D 42 81 93 0A 00 02 20 04 93 02 24 0F 44 | |||
02 3C 1F 41 06 00 1F B3 28 20 2F B3 25 20 2F B2 | |||
03 24 19 4E 06 00 02 3C 0C 5E 29 4C 39 B0 00 80 | |||
0A 7A 3A E3 2C 45 1D 45 02 00 2C 87 1D 77 02 00 | |||
0E 49 0F 4A 2E 88 1F 78 02 00 B0 12 C2 E8 2E 46 | |||
1F 46 02 00 2E 88 1F 78 02 00 B0 12 F8 E7 0F 4C | |||
2F 57 1D 67 02 00 29 3C 0D 4B 0D 5E 2F 4D 81 4F | |||
02 00 3F B0 00 80 0F 7F 3F E3 81 4F 04 00 2C 46 | |||
1D 46 02 00 2C 88 1D 78 02 00 1E 41 02 00 2E 87 | |||
1F 77 02 00 B0 12 C2 E8 2E 45 1F 45 02 00 2E 87 | |||
1F 77 02 00 B0 12 F8 E7 09 4C 0A 4D 29 58 1A 68 | |||
02 00 1F 41 02 00 1D 41 04 00 81 93 0A 00 11 20 | |||
04 93 0F 20 86 49 00 00 86 4A 02 00 85 4F 00 00 | |||
85 4D 02 00 81 4D 00 00 1C 41 0C 00 0D 49 0E 4A | |||
83 3F 88 49 00 00 88 4A 02 00 87 4F 00 00 87 4D | |||
02 00 81 4D 00 00 1C 41 0C 00 0D 49 0E 4A B0 12 | |||
B0 E3 04 4C 81 4D 0A 00 81 93 0A 00 0A 20 04 93 | |||
08 20 81 93 08 00 05 20 81 93 06 00 02 20 1C 43 | |||
0C 3C 1F 41 06 00 1D 41 08 00 0F F4 1D F1 0A 00 | |||
0D 93 02 20 0F 93 5F 27 0C 43 0D 43 31 50 0E 00 | |||
30 40 B2 E9 0A 12 31 80 0A 00 0A 4E 0B 4D 81 43 | |||
00 00 81 43 02 00 2E 4B 0F 4E 0F 11 0F 11 0F 11 | |||
81 4F 04 00 1F 4B 04 00 0D 4F 0D 11 0D 11 0D 11 | |||
81 4D 06 00 B2 40 00 A5 2C 01 B2 40 40 A5 28 01 | |||
3D 40 07 00 0D FE 3C 40 FF 00 B0 12 6A E8 C1 4C | |||
08 00 3F F0 07 00 3D 40 07 00 0D 8F 3C 40 FF 00 | |||
B0 12 96 E8 C1 4C 09 00 91 91 06 00 04 00 17 20 | |||
D1 F1 09 00 08 00 1C 4B 02 00 3D 40 0C 00 B0 12 | |||
7A E9 1C 51 04 00 3C 50 00 F4 0A 93 04 20 DC C1 | |||
08 00 00 00 15 3C DC D1 08 00 00 00 11 3C 91 4B | |||
02 00 02 00 09 3C DC D1 09 00 00 00 03 3C DC C1 | |||
09 00 00 00 91 53 02 00 9B 91 02 00 06 00 07 2C | |||
B2 40 00 A5 28 01 B2 40 10 A5 2C 01 38 3C 1C 41 | |||
02 00 3D 40 0C 00 B0 12 7A E9 1C 51 04 00 3C 50 | |||
00 F4 0A 93 15 20 1C 53 0F 4C 1F 83 DF C1 08 00 | |||
00 00 91 41 04 00 00 00 1F 41 06 00 1F 83 81 9F | |||
00 00 D5 2F 1C 53 CC 43 FF FF 91 53 00 00 F4 3F | |||
1C 53 0F 4C 1F 83 DF D1 08 00 00 00 91 41 04 00 | |||
00 00 3E 40 FF 00 1F 41 06 00 1F 83 81 9F 00 00 | |||
BA 2F 1C 53 CC 4E FF FF 91 53 00 00 F4 3F 31 50 | |||
0A 00 3A 41 30 41 31 82 0C 4D 1B 41 0A 00 81 43 | |||
00 00 0D 11 0D 11 0D 11 81 4D 02 00 0D 4E 0D 11 | |||
0D 11 0D 11 81 4D 04 00 B2 40 00 A5 2C 01 B2 40 | |||
40 A5 28 01 3D 40 07 00 0D FC 3C 40 FF 00 B0 12 | |||
6A E8 C1 4C 06 00 3E F0 07 00 3D 40 07 00 0D 8E | |||
3C 40 FF 00 B0 12 96 E8 C1 4C 07 00 91 91 04 00 | |||
02 00 0E 20 D1 F1 07 00 06 00 B0 12 2C DF 04 20 | |||
DC C1 06 00 00 00 3A 3C DC D1 06 00 00 00 36 3C | |||
B0 12 2C DF 19 20 1C 53 0F 4C 1F 83 DF C1 06 00 | |||
00 00 91 41 02 00 00 00 05 3C 1C 53 CC 43 FF FF | |||
91 53 00 00 1F 41 04 00 1F 83 81 9F 00 00 F5 2B | |||
DC C1 07 00 00 00 1A 3C 1C 53 0F 4C 1F 83 DF D1 | |||
06 00 00 00 91 41 02 00 00 00 3E 40 FF 00 05 3C | |||
1C 53 CC 4E FF FF 91 53 00 00 1F 41 04 00 1F 83 | |||
81 9F 00 00 F5 2B DC D1 07 00 00 00 B2 40 00 A5 | |||
28 01 B2 40 10 A5 2C 01 31 52 30 41 0C 4F 3D 40 | |||
0C 00 B0 12 7A E9 1C 51 04 00 3C 50 00 F4 0B 93 | |||
30 41 0A 12 09 12 31 80 06 00 0A 4D 09 4C 1F 4A | |||
04 00 3F B0 00 80 0E 7E 3E E3 81 4E 00 00 1D 4A | |||
02 00 B0 12 2A E0 81 4D 02 00 81 4E 04 00 2D 4A | |||
B0 12 2A E0 B0 12 34 E0 1E 4A 06 00 1F 4A 02 00 | |||
0F 9E 4F 24 1F 53 3F B0 00 80 0D 7D 3D E3 81 4D | |||
00 00 3E B0 00 80 0D 7D 3D E3 81 4E 02 00 81 4D | |||
04 00 1D 4A 04 00 B0 12 2A E0 0C 49 B0 12 02 E1 | |||
1D 4A 04 00 2F 4A 0F 9D 34 24 3F B0 00 80 0E 7E | |||
3E E3 81 4E 00 00 1C 4A 06 00 3C B0 00 80 0E 7E | |||
3E E3 81 4C 02 00 81 4E 04 00 1D 83 B0 12 2A E0 | |||
0C 49 B0 12 34 E0 1F 4A 06 00 1E 4A 02 00 0D 4E | |||
0D 8F 3D 93 16 24 1F 83 3F B0 00 80 0D 7D 3D E3 | |||
81 4D 00 00 1E 53 3E B0 00 80 0D 7D 3D E3 81 4E | |||
02 00 81 4D 04 00 2D 4A B0 12 2A E0 0C 49 B0 12 | |||
02 E1 31 50 06 00 30 40 BC E9 3D B0 00 80 0E 7E | |||
3E E3 30 41 0A 12 09 12 08 12 07 12 06 12 05 12 | |||
21 83 1B 41 12 00 16 41 14 00 17 41 10 00 3A 42 | |||
39 40 0C 00 38 40 0A 00 0A 5C 25 4A 35 B0 00 80 | |||
0A 7A 3A E3 06 9A 4A 38 02 20 0B 95 47 28 09 5C | |||
29 49 39 B0 00 80 0A 7A 3A E3 0A 96 3F 38 02 20 | |||
09 9B 3C 28 07 9E 03 38 08 20 0F 9D 06 2C 09 4D | |||
0A 4E 0D 4F 0E 47 0F 49 07 4A 08 5C 2A 48 3A B0 | |||
00 80 09 79 39 E3 09 9E 29 38 02 20 0A 9D 26 28 | |||
18 4C 06 00 38 B0 00 80 09 79 39 E3 07 99 1E 38 | |||
02 20 0F 98 1B 28 0E 99 03 38 03 20 0D 98 01 2C | |||
0D 48 3A B0 00 80 0E 7E 3E E3 0E 97 03 38 03 20 | |||
0A 9F 01 2C 0F 4A 1A 4C 04 00 91 4C 0E 00 00 00 | |||
1C 4A 04 00 0E 4F 0F 4B 9A 12 0E 00 21 53 30 40 | |||
B4 E9 0A 12 09 12 08 12 07 12 06 12 05 12 21 83 | |||
1B 41 12 00 17 41 14 00 18 41 10 00 3A 40 0A 00 | |||
39 40 0C 00 15 4C 06 00 35 B0 00 80 06 76 36 E3 | |||
0E 96 4B 38 02 20 0D 95 48 28 0A 5C 26 4A 36 B0 | |||
00 80 0A 7A 3A E3 0A 9E 40 38 02 20 06 9D 3D 28 | |||
07 98 03 38 08 20 0B 9F 06 2C 0A 4F 0E 48 0F 4B | |||
08 47 0B 4A 07 4E 09 5C 2E 49 3E B0 00 80 0A 7A | |||
3A E3 0A 98 2A 38 02 20 0E 9F 27 28 3A 42 0A 5C | |||
29 4A 39 B0 00 80 0A 7A 3A E3 07 9A 1E 38 02 20 | |||
0B 99 1B 28 08 9A 03 38 03 20 0F 99 01 2C 0F 49 | |||
3E B0 00 80 0A 7A 3A E3 0A 97 03 38 03 20 0E 9B | |||
01 2C 0B 4E 1A 4C 04 00 91 4C 0E 00 00 00 1C 4A | |||
04 00 0E 4F 0F 4B 9A 12 10 00 21 53 30 40 B4 E9 | |||
0A 12 09 12 08 12 07 12 06 12 05 12 31 82 1F 4D | |||
04 00 2E 4D 0F 9E 03 38 08 4E 0E 4F 01 3C 08 4F | |||
81 48 00 00 81 4E 04 00 1F 4D 06 00 1D 4D 02 00 | |||
0F 9D 03 38 07 4D 0D 4F 01 3C 07 4F 81 47 02 00 | |||
81 4D 06 00 16 4C 0A 00 0F 4C 3A 40 0C 00 39 42 | |||
3B 40 0A 00 0B 5F 8B 98 00 00 28 38 3B 40 06 00 | |||
0B 5F 25 4B 0E 95 22 38 0A 5F 2A 4A 0A 97 1E 38 | |||
09 5F 2F 49 0D 9F 1A 38 08 95 02 34 A1 4B 00 00 | |||
06 9E 02 34 81 46 04 00 07 9F 02 34 81 4F 02 00 | |||
0A 9D 02 34 81 4A 06 00 1B 4C 04 00 1F 4B 04 00 | |||
1E 4C 0E 00 0C 4F 0D 41 9B 12 12 00 31 52 30 40 | |||
B4 E9 0A 12 09 12 08 12 07 12 06 12 05 12 04 12 | |||
21 83 1C 4C 16 00 FC B0 80 FF 00 00 09 20 14 4C | |||
C4 00 28 42 08 5C 76 40 20 00 75 40 7E 00 11 3C | |||
14 4C 08 00 18 4C 06 00 56 4C 04 00 55 4C 05 00 | |||
76 90 2F 00 03 2C 75 90 2E 00 03 2C 5C 4C 04 00 | |||
02 3C 7C 40 2E 00 81 4C 00 00 0C 43 09 43 19 3C | |||
17 43 07 54 4A 46 0A 5A 6B 4D 4B 96 02 28 45 9B | |||
02 2C 2B 41 02 3C 4A 46 0A 5A 4B 4B 0B 5B 0B 8A | |||
0B 58 27 5B 6B 47 4B 4B 0C 5B 09 63 1D 53 1E 83 | |||
0F 73 CD 93 00 00 04 24 0F 93 E2 23 0E 93 E0 23 | |||
0D 49 21 53 30 40 B2 E9 31 80 06 00 0C 4D 1B 41 | |||
08 00 81 43 00 00 0D 11 0D 11 0D 11 81 4D 02 00 | |||
B2 40 00 A5 2C 01 B2 40 40 A5 28 01 3D 40 07 00 | |||
0D FC 3C 40 80 00 B0 12 6A E8 C1 4C 04 00 81 4E | |||
00 00 2F 91 11 28 0B 93 06 20 B0 12 9A E3 DC C1 | |||
04 00 00 00 05 3C B0 12 9A E3 DC D1 04 00 00 00 | |||
91 53 00 00 2F 91 EF 2F B2 40 00 A5 28 01 B2 40 | |||
10 A5 2C 01 31 50 06 00 30 41 1C 41 02 00 3D 40 | |||
0C 00 B0 12 7A E9 1C 51 04 00 3C 50 00 F4 30 41 | |||
0A 12 09 12 08 12 07 12 06 12 17 41 0C 00 38 40 | |||
0A 00 0B 43 09 43 3A 42 0A 5C 26 4A 36 B0 00 80 | |||
0A 7A 3A E3 07 9A 03 38 03 20 0F 96 01 2C 1B 43 | |||
3A 40 0C 00 0A 5C 26 4A 36 B0 00 80 0A 7A 3A E3 | |||
0A 97 03 38 03 20 06 9F 01 2C 2B D3 1A 4C 06 00 | |||
3A B0 00 80 0F 7F 3F E3 0E 9F 03 38 03 20 0D 9A | |||
01 2C 2B D2 0C 58 2C 4C 3C B0 00 80 0F 7F 3F E3 | |||
0F 9E 03 38 03 20 0C 9D 01 2C 3B D2 0D 49 0C 4B | |||
30 40 B6 E9 3F 40 80 00 5F E2 20 02 F2 D0 10 00 | |||
21 00 F2 B2 03 00 FD 27 C2 4F 6F 00 C2 43 21 02 | |||
3B 40 00 F4 0D 43 F2 B2 03 00 FD 27 1C 43 4C 5D | |||
B0 12 2C E9 C2 4C 6F 00 3F 40 0C 00 F2 B2 03 00 | |||
FD 27 F2 4B 6F 00 1F 83 F9 23 F2 B2 03 00 FD 27 | |||
C2 43 6F 00 1D 53 3D 90 60 00 E5 3B F2 B2 03 00 | |||
FD 27 C2 43 6F 00 D2 B3 6D 00 FD 23 0D 12 3D 40 | |||
03 00 1D 83 FE 23 3D 41 F2 F0 EF 00 21 00 30 41 | |||
0A 12 0C 4E 0F 4D 1B 41 08 00 1A 41 04 00 3D 40 | |||
0C 00 B0 12 7A E9 0F 11 0F 11 0F 11 0C 5F 3C 50 | |||
00 F4 0F 4C B2 40 00 A5 2C 01 B2 40 40 A5 28 01 | |||
0E 4A 0E 11 0E 11 0E 11 0E 93 05 24 1F 53 FF 4B | |||
FF FF 1E 83 FB 23 3D 40 07 00 0D FA 3C 40 FF 00 | |||
B0 12 6A E8 6C FF 6C DB CF 4C 00 00 B2 40 00 A5 | |||
28 01 B2 40 10 A5 2C 01 3A 41 30 41 0A 12 09 12 | |||
7A 4C 1E 3C 1C 53 0E 93 0D 24 3F 90 00 01 0A 2C | |||
29 43 4F 4F 8F 10 7B 4C 0F DB 19 83 FA 23 02 3C | |||
2F 92 02 28 7B 4C 05 3C 0B 4A 03 3C 1D 53 CD 4B | |||
FF FF 1F 83 3F 93 FA 23 03 3C 1D 53 CD 4F FF FF | |||
7F 4C 4F 9A FA 23 7F 4C 0F 93 EA 23 7F 4C 8F 10 | |||
6B 4C 0F 5B D7 23 30 40 BC E9 0A 12 09 12 3F 40 | |||
20 EF 3F 90 1B EF 19 28 3F 40 34 EF 3F 90 29 EF | |||
14 28 3A 40 34 EF 3A 80 28 EF 3A 50 03 00 0A 11 | |||
0A 11 39 40 28 EF 3C 49 7F 4C 4F 4F 0F 5F 1F 4F | |||
1A EF 3D 49 8F 12 1A 83 F6 23 3F 40 00 00 3F 90 | |||
00 00 08 24 3A 40 00 00 02 3C 3F 4A 8F 12 3A 90 | |||
00 00 FB 23 30 40 BC E9 0A 12 09 12 09 43 0A 43 | |||
1B 43 0F 93 04 24 09 4D 0D 4C 0C 43 0D 3C 0C 5C | |||
0D 6D 09 69 09 8E 04 28 1C D3 0B 5B F8 2B 03 3C | |||
09 5E 0B 5B F4 2B 1B 43 0C 5C 0D 6D 09 69 0A 6A | |||
09 8E 0A 7F 04 28 1C D3 0B 5B F6 2B 04 3C 09 5E | |||
0A 6F 0B 5B F1 2B 0E 49 0F 4A 39 41 3A 41 30 41 | |||
0F 93 0C 4E 0B 4D B2 40 00 A5 2C 01 B2 40 40 A5 | |||
28 01 05 20 B0 12 64 E6 CF CC 00 F4 04 3C B0 12 | |||
64 E6 CF DC 00 F4 B2 40 00 A5 28 01 B2 40 10 A5 | |||
2C 01 30 41 3D 40 0C 00 B0 12 7A E9 0F 4B 0F 11 | |||
0F 11 0F 11 0F 5C 3D 40 07 00 0D FB 3C 40 80 00 | |||
B0 12 6A E8 30 41 B2 40 00 A5 2C 01 3B 40 60 00 | |||
0F 43 3E 40 0C 00 0F 93 0A 20 4D 93 08 24 B2 40 | |||
02 A5 28 01 CC 43 00 00 B2 40 40 A5 28 01 92 B3 | |||
2C 01 FD 23 1C 53 CC 4D FF FF 1F 53 3F 90 00 02 | |||
01 20 0F 43 1E 83 E7 23 1B 83 E3 23 B2 40 00 A5 | |||
28 01 B2 40 10 A5 2C 01 30 41 3F 40 20 00 5F E2 | |||
20 02 F2 D0 10 00 21 00 F2 B2 03 00 FD 27 C2 4F | |||
6F 00 C2 43 21 02 F2 B2 03 00 FD 27 C2 43 6F 00 | |||
D2 B3 6D 00 FD 23 0D 12 3D 40 03 00 1D 83 FE 23 | |||
3D 41 F2 F0 EF 00 21 00 0D 93 02 20 4D 43 01 3C | |||
7D 43 30 40 86 E6 F2 D0 80 00 26 00 F2 D0 80 00 | |||
41 00 F2 D0 20 00 26 00 F2 D0 20 00 41 00 F2 D0 | |||
09 00 22 00 F2 D0 09 00 21 00 F2 D0 20 00 22 00 | |||
F2 F0 EF 00 21 00 F2 D0 A9 00 68 00 F2 D0 C0 00 | |||
69 00 F2 D2 6A 00 C2 43 6B 00 D2 C3 69 00 30 41 | |||
F2 E0 40 00 20 02 D2 93 21 02 1B 20 5F 42 20 02 | |||
F2 D0 10 00 21 00 F2 B2 03 00 FD 27 C2 4F 6F 00 | |||
F2 B2 03 00 FD 27 C2 43 6F 00 D2 B3 6D 00 FD 23 | |||
0D 12 3D 40 03 00 1D 83 FE 23 3D 41 F2 F0 EF 00 | |||
21 00 D2 43 21 02 30 41 BC 40 18 00 00 00 8C 43 | |||
02 00 8C 4D 04 00 8C 43 06 00 8C 43 08 00 1F 4D | |||
06 00 1F 83 8C 4F 0A 00 1F 4D 08 00 1F 83 8C 4F | |||
0C 00 8C 43 0E 00 8C 43 10 00 8C 43 12 00 8C 43 | |||
14 00 8C 43 16 00 30 41 0A 12 0A 43 0F 93 05 34 | |||
3E E3 3F E3 1E 53 0F 63 1A D3 0D 93 05 34 3C E3 | |||
3D E3 1C 53 0D 63 3A E3 B0 12 D8 E5 1A B3 04 24 | |||
3C E3 3D E3 1C 53 0D 63 2A B3 04 24 3E E3 3F E3 | |||
1E 53 0F 63 3A 41 30 41 0A 12 09 12 08 12 3A 40 | |||
20 00 3B 40 80 00 0E 43 0F 43 08 4C 08 FB 09 4D | |||
09 FE 09 93 07 20 08 93 05 20 1F 53 0E 11 0B 10 | |||
1A 83 F3 23 0C 4F 30 40 BA E9 3D F0 0F 00 3D E0 | |||
0F 00 0D 5D 00 5D 0C 11 0C 11 0C 11 0C 11 0C 11 | |||
0C 11 0C 11 0C 11 0C 11 0C 11 0C 11 0C 11 0C 11 | |||
0C 11 0C 11 30 41 3D F0 0F 00 3D E0 0F 00 0D 5D | |||
00 5D 0C 5C 0C 5C 0C 5C 0C 5C 0C 5C 0C 5C 0C 5C | |||
0C 5C 0C 5C 0C 5C 0C 5C 0C 5C 0C 5C 0C 5C 0C 5C | |||
30 41 0A 12 0A 43 0B 43 12 C3 0D 10 0C 10 02 28 | |||
0A 5E 0B 6F 0E 5E 0F 6F 0D 93 F6 23 0C 93 F4 23 | |||
0C 4A 0D 4B 3A 41 30 41 0F 12 0E 12 0D 12 0C 12 | |||
0B 12 B0 12 70 E7 B2 50 FF 7C 72 01 92 C3 60 01 | |||
3B 41 3C 41 3D 41 3E 41 3F 41 00 13 F2 93 FD 10 | |||
0C 24 C2 43 56 00 D2 42 FD 10 57 00 D2 42 FC 10 | |||
56 00 F2 D0 20 00 53 00 30 41 FF 3F 0F 4C 4E 4F | |||
3E F0 0F 00 5C 4E FC EE B0 12 B8 E8 0E 4C 4C 4F | |||
B0 12 8C E8 5C 4C FC EE 4C DE 30 41 31 40 00 04 | |||
B0 12 DC E9 0C 93 02 24 B0 12 7A E5 0C 43 B0 12 | |||
00 C0 B0 12 E0 E9 1F 4C 01 00 0F 93 05 24 1D 53 | |||
CD 43 FF FF 1F 83 FB 23 30 41 0E 43 12 C3 0C 10 | |||
01 28 0E 5D 0D 5D 0C 93 F9 23 0C 4E 30 41 0F 4C | |||
0C 4D 3D 40 03 00 0D 5F 1E 4F 01 00 30 40 A0 E9 | |||
0F 4C 0E 93 05 24 1F 53 FF 4D FF FF 1E 83 FB 23 | |||
30 41 34 41 35 41 36 41 37 41 38 41 39 41 3A 41 | |||
30 41 0C 43 0E 93 02 20 0D 93 01 24 1C 43 30 41 | |||
32 D0 10 00 FD 3F 1E 43 30 40 1C E5 1C 43 30 41 | |||
03 43 FF 3F 08 06 00 00 00 00 00 00 08 06 20 82 | |||
08 00 02 00 08 06 51 45 00 00 00 00 08 06 51 4F | |||
94 F9 45 00 08 06 21 EA 1C 2B C2 00 08 06 C3 21 | |||
08 42 61 80 08 06 62 4A 10 AA 46 80 08 06 60 84 | |||
00 00 00 00 08 06 10 84 10 40 81 00 08 06 40 81 | |||
04 10 84 00 08 06 00 8A 9C A8 80 00 08 06 00 82 | |||
3E 20 80 00 08 06 00 00 00 60 84 00 08 06 00 00 | |||
3E 00 00 00 08 06 00 00 00 01 86 00 08 06 00 21 | |||
08 42 00 00 08 06 72 29 AA CA 27 00 08 06 21 82 | |||
08 20 87 00 08 06 72 20 84 21 0F 80 08 06 F8 42 | |||
04 0A 27 00 08 06 10 C5 24 F8 41 00 08 06 FA 0F | |||
02 0A 27 00 08 06 31 08 3C 8A 27 00 08 06 F8 21 | |||
08 41 04 00 08 06 72 28 9C 8A 27 00 08 06 72 28 | |||
9E 08 46 00 08 06 01 86 00 61 80 00 08 06 01 86 | |||
00 60 84 00 08 06 10 84 20 40 81 00 08 06 00 0F | |||
80 F8 00 00 08 06 40 81 02 10 84 00 08 06 72 20 | |||
84 20 02 00 08 06 72 20 9A AA A7 00 08 06 72 28 | |||
A2 FA 28 80 08 06 F2 28 BC 8A 2F 00 08 06 72 28 | |||
20 82 27 00 08 06 E2 48 A2 8A 4E 00 08 06 FA 08 | |||
3C 82 0F 80 08 06 FA 08 3C 82 08 00 08 06 72 28 | |||
2E 8A 27 80 08 06 8A 28 BE 8A 28 80 08 06 70 82 | |||
08 20 87 00 08 06 38 41 04 12 46 00 08 06 8A 4A | |||
30 A2 48 80 08 06 82 08 20 82 0F 80 08 06 8B 6A | |||
AA 8A 28 80 08 06 8A 2C AA 9A 28 80 08 06 72 28 | |||
A2 8A 27 00 08 06 F2 28 BC 82 08 00 08 06 72 28 | |||
A2 AA 46 80 08 06 F2 28 BC A2 48 80 08 06 7A 08 | |||
1C 08 2F 00 08 06 F8 82 08 20 82 00 08 06 8A 28 | |||
A2 8A 27 00 08 06 8A 28 A2 89 42 00 08 06 8A 28 | |||
AA AA A5 00 08 06 8A 25 08 52 28 80 08 06 8A 28 | |||
94 20 82 00 08 06 F8 21 08 42 0F 80 08 06 71 04 | |||
10 41 07 00 08 06 02 04 08 10 20 00 08 06 70 41 | |||
04 10 47 00 08 06 21 48 80 00 00 00 08 06 00 00 | |||
00 00 0F 80 08 06 40 81 00 00 00 00 08 06 00 07 | |||
02 7A 27 80 08 06 82 0B 32 8A 2F 00 08 06 00 07 | |||
20 82 27 00 08 06 08 26 A6 8A 27 80 08 06 00 07 | |||
22 FA 07 00 08 06 31 24 38 41 04 00 08 06 01 E8 | |||
A2 78 27 00 08 06 82 0B 32 8A 28 80 08 06 20 06 | |||
08 20 87 00 08 06 10 03 04 12 46 00 08 06 82 09 | |||
28 C2 89 00 08 06 60 82 08 20 87 00 08 06 00 0D | |||
2A AA 28 80 08 06 00 0B 32 8A 28 80 08 06 00 07 | |||
22 8A 27 00 08 06 00 0F 22 F2 08 00 08 06 00 06 | |||
A6 78 20 80 08 06 00 0B 32 82 08 00 08 06 00 07 | |||
20 70 2F 00 08 06 41 0E 10 41 23 00 08 06 00 08 | |||
A2 8A 66 80 08 06 00 08 A2 89 42 00 08 06 00 08 | |||
A2 AA A5 00 08 06 00 08 94 21 48 80 08 06 00 08 | |||
A2 78 27 00 08 06 00 0F 84 21 0F 80 08 06 10 82 | |||
10 20 81 00 08 06 20 82 08 20 82 00 08 06 40 82 | |||
04 20 84 00 08 06 42 A1 00 00 00 00 48 6F 77 20 | |||
74 6F 20 75 73 65 00 00 74 68 65 20 4D 53 50 34 | |||
33 30 00 00 47 72 61 70 68 69 63 73 20 4C 69 62 | |||
72 61 72 79 00 00 50 72 69 6D 69 74 69 76 65 73 | |||
00 00 44 72 61 77 20 50 69 78 65 6C 73 00 26 20 | |||
4C 69 6E 65 73 00 44 72 61 77 20 43 69 72 63 6C | |||
65 73 00 00 44 72 61 77 20 52 65 63 74 61 6E 67 | |||
6C 65 73 00 43 6F 6D 62 69 6E 69 6E 67 00 50 72 | |||
69 6D 69 74 69 76 65 73 20 74 6F 00 63 72 65 61 | |||
74 65 20 6D 65 6E 75 73 00 00 61 6E 64 20 61 6E | |||
69 6D 61 74 69 6F 6E 73 00 00 43 72 65 61 74 65 | |||
20 61 20 4D 65 6E 75 00 4F 70 74 69 6F 6E 20 23 | |||
31 00 4F 70 74 69 6F 6E 20 23 32 00 4F 70 74 69 | |||
6F 6E 20 23 33 00 4F 70 74 69 6F 6E 20 23 34 00 | |||
4F 70 74 69 6F 6E 20 23 35 00 53 68 6F 77 20 70 | |||
72 6F 67 72 65 73 73 00 50 72 6F 63 65 73 73 69 | |||
6E 67 2E 2E 2E 00 44 4F 4E 45 21 00 00 06 08 07 | |||
00 00 08 00 10 00 18 00 20 00 28 00 30 00 38 00 | |||
40 00 48 00 50 00 58 00 60 00 68 00 70 00 78 00 | |||
80 00 88 00 90 00 98 00 A0 00 A8 00 B0 00 B8 00 | |||
C0 00 C8 00 D0 00 D8 00 E0 00 E8 00 F0 00 F8 00 | |||
00 01 08 01 10 01 18 01 20 01 28 01 30 01 38 01 | |||
40 01 48 01 50 01 58 01 60 01 68 01 70 01 78 01 | |||
80 01 88 01 90 01 98 01 A0 01 A8 01 B0 01 B8 01 | |||
C0 01 C8 01 D0 01 D8 01 E0 01 E8 01 F0 01 F8 01 | |||
00 02 08 02 10 02 18 02 20 02 28 02 30 02 38 02 | |||
40 02 48 02 50 02 58 02 60 02 68 02 70 02 78 02 | |||
80 02 88 02 90 02 98 02 A0 02 A8 02 B0 02 B8 02 | |||
C0 02 C8 02 D0 02 D8 02 E0 02 E8 02 F0 02 00 00 | |||
E4 E9 05 00 0F 00 41 00 2D 00 0A 00 28 00 5A 00 | |||
5A 00 05 00 0F 00 0B 00 15 00 05 00 19 00 0B 00 | |||
1F 00 05 00 23 00 0B 00 29 00 05 00 2D 00 0B 00 | |||
33 00 05 00 37 00 0B 00 3D 00 0A 00 28 00 5A 00 | |||
3C 00 1A 00 00 00 00 F4 60 00 60 00 30 E6 B0 E4 | |||
36 DE 28 E3 F4 DC C2 E9 34 E4 DA E6 00 08 04 0C | |||
02 0A 06 0E 01 09 05 0D 03 0B 07 0F 02 00 0A 00 | |||
0A 00 28 00 1E 00 3C 00 40 00 66 E9 D6 E9 8E E9 | |||
00 00 00 06 00 00 18 00 0C EF 18 02 20 EF 00 F4 | |||
24 EF 00 02 | |||
@ffe4 | |||
D0 E9 D0 E9 | |||
@ffea | |||
D0 E9 D0 E9 D0 E9 D0 E9 E8 E8 D0 E9 D0 E9 D0 E9 | |||
D0 E9 D0 E9 4C E9 | |||
q |
@ -0,0 +1,16 @@ | |||
CLS | |||
@echo off | |||
rem This is a small helper script that runs through the test collection for one device (folder) | |||
rem | |||
rem Dung Dang, MSP430 Applications, Texas Instruments, Inc. | |||
rem Last modified: 02/25/2011 | |||
:input | |||
@echo MSP-EXP430G2-LaunchPad Firmware Programmer | |||
set device=MSP430G2231 | |||
set firmware=430BOOST-SHARP96_GrlibExample_G2.txt | |||
@echo Programing %firmware% into %device% ...... | |||
..\..\MSP430Flasher\MSP430Flasher.exe -n %device% -w %firmware% -v -g -z [VCC] | |||
pause |
@ -0,0 +1,40 @@ | |||
MSP430 Flasher - Command Line programmer | |||
For usage instructions please see http://processors.wiki.ti.com/index.php/MSP430_Flasher_-_Command_Line_Programmer | |||
Note: When using the MSP430 Flasher with the MSP430DLLv3 Make sure to update the firmware of your FET430 USB Emulator first. | |||
For instructions visit http://processors.wiki.ti.com/index.php/MSP_Debug_Stack#Upgrade_process_to_MSP430.DLLv3 | |||
Change Log: | |||
v1.1.4 November 07, 2011 | |||
- Added MSP430.dll v3 (3.2.1.9) to the MSP430 Flasher package | |||
v1.1.3 August 22, 2011 | |||
- Updated MSP430 Flasher package with MSP430.dll v2.4.9.1 | |||
v1.1.2 May 10, 2011 | |||
- Added FET FW update suppression switch (-s) | |||
v1.1.1 May 3, 2011 | |||
- Added breakpoint timeout switch (-t) | |||
- MSP430Flasher.exe now returns DLL error codes | |||
- Fixed logfile bug in quiet mode | |||
v1.1.0 Mar. 8, 2011 | |||
- Updated MSP430 Flasher package with MSP430.dll v2.4.8.2 | |||
v1.0.1 Jan. 18, 2011 | |||
- Added Locked Flash Access Switch (-u) | |||
- Added new MSP430.dll (v2.4.7.1) | |||
- Added BSL Unlock Mode | |||
- Added documentation to binary package | |||
- Fixed Manual COM Port Selection | |||
- Returned to the original versioning scheme. Version number is no longer connected to the one of the msp430.dll included with the package. | |||
v2.4.6.1 Nov. 11, 2010 | |||
- Added support to blow the JTAG fuse | |||
- Fixed bug where MSP430F413 would not be identified correctly | |||
- Updated version number from v1.0.0 to v2.4.6.1. The new versioning scheme is aligned with the current msp430.dll version that included with the package. Future releases that use the same MSP430.dll version will update the fifth digit in the version number (i.e. v2.4.6.1). | |||
v1.0.0 Released Oct 28, 2010 | |||
- Initial released | |||
@ -0,0 +1,3 @@ | |||
LaunchPad_Temp_GUI | |||
LaunchPad_Temp_GUI.jar,core.jar,serial.jar,RXTXcomm.jar |
@ -0,0 +1,124 @@ | |||
import processing.core.*; | |||
import processing.xml.*; | |||
import processing.serial.*; | |||
import java.applet.*; | |||
import java.awt.Dimension; | |||
import java.awt.Frame; | |||
import java.awt.event.MouseEvent; | |||
import java.awt.event.KeyEvent; | |||
import java.awt.event.FocusEvent; | |||
import java.awt.Image; | |||
import java.io.*; | |||
import java.net.*; | |||
import java.text.*; | |||
import java.util.*; | |||
import java.util.zip.*; | |||
import java.util.regex.*; | |||
public class LaunchPad_Temp_GUI extends PApplet { | |||
/** | |||
* LaunchPad GUI | |||
* | |||
* Select COM port that LaunchPad is connected to | |||
* receive serial communication from LaunchPad for | |||
* instantaneous temperature readings. | |||
* | |||
**/ | |||
PFont fontA; | |||
char instruct; | |||
int backColor; | |||
int dataRead; | |||
boolean portChosen = false; | |||
int COMPort; | |||
int [] keyIn = new int[3]; | |||
int i, keyIndex=0; | |||
// The serial port: | |||
Serial myPort; | |||
public void setup() | |||
{ | |||
//setup window | |||
size(1000, 500); | |||
smooth(); | |||
//load font | |||
fontA = loadFont("CourierNew36.vlw"); | |||
// Set the font, its size (in units of pixels), and alignment | |||
textAlign(CENTER); | |||
//Set background color | |||
int baseColor = color(70); | |||
backColor = baseColor; | |||
//import serial library | |||
// List all the available serial ports, then give prompt | |||
println(Serial.list()); | |||
println("Please type in the serial COM port that your LaunchPad is connected to."); | |||
background(backColor); | |||
stroke(255); | |||
textFont(fontA, 13); | |||
text("Please, select the COM port that your LaunchPad is connected to.", 265, 20); | |||
textAlign(LEFT); | |||
for(i=0; i<Serial.list().length; i++){ | |||
text("[" + i + "] " + Serial.list()[i], 215, 38+13*i); | |||
} | |||
//wait for keypress --> Refer to void keyPressed() | |||
} | |||
public void draw() | |||
{ | |||
if(portChosen == true){ | |||
dataRead= myPort.read(); | |||
if(dataRead != -1){ | |||
//clear previous temperature reading from screen | |||
background(backColor); | |||
stroke(255); | |||
//Update console | |||
print("Temp: "); | |||
print(dataRead); | |||
println("\u00b0"); | |||
//Update on screen GUI | |||
text("Current Temperature: ", 420, 60); | |||
text(dataRead, 835, 60); | |||
text("\u00b0", 900, 60); | |||
} | |||
} | |||
} | |||
//wait for key press. Once key is entered, initialize serial com port | |||
public void keyPressed() { | |||
if(portChosen == false){ | |||
if (key != 10) //Enter | |||
keyIn[keyIndex++] = key-48; | |||
else | |||
{ | |||
COMPort = 0; | |||
for (i = 0; i < keyIndex; i++) | |||
COMPort = COMPort * 10 + keyIn[i]; | |||
println(COMPort); | |||
myPort = new Serial(this, Serial.list()[COMPort], 2400); | |||
portChosen = true; | |||
textFont(fontA, 60); // change font size & alignment for temp readings | |||
textAlign(CENTER); | |||
} | |||
} | |||
} | |||
static public void main(String args[]) { | |||
PApplet.main(new String[] { "--bgcolor=#E2E2E2", "LaunchPad_Temp_GUI" }); | |||
} | |||
} |
@ -0,0 +1,98 @@ | |||
/** | |||
* LaunchPad GUI | |||
* | |||
* Select COM port that LaunchPad is connected to | |||
* receive serial communication from LaunchPad for | |||
* instantaneous temperature readings. | |||
* | |||
**/ | |||
PFont fontA; | |||
char instruct; | |||
color backColor; | |||
int dataRead; | |||
boolean portChosen = false; | |||
int COMPort; | |||
int [] keyIn = new int[3]; | |||
int i, keyIndex=0; | |||
// The serial port: | |||
Serial myPort; | |||
void setup() | |||
{ | |||
//setup window | |||
size(1000, 500); | |||
smooth(); | |||
//load font | |||
fontA = loadFont("CourierNew36.vlw"); | |||
// Set the font, its size (in units of pixels), and alignment | |||
textAlign(CENTER); | |||
//Set background color | |||
color baseColor = color(70); | |||
backColor = baseColor; | |||
//import serial library | |||
import processing.serial.*; | |||
// List all the available serial ports, then give prompt | |||
println(Serial.list()); | |||
println("Please type in the serial COM port that your LaunchPad is connected to."); | |||
background(backColor); | |||
stroke(255); | |||
textFont(fontA, 13); | |||
text("Please, select the COM port that your LaunchPad is connected to.", 265, 20); | |||
textAlign(LEFT); | |||
for(i=0; i<Serial.list().length; i++){ | |||
text("[" + i + "] " + Serial.list()[i], 215, 38+13*i); | |||
} | |||
//wait for keypress --> Refer to void keyPressed() | |||
} | |||
void draw() | |||
{ | |||
if(portChosen == true){ | |||
dataRead= myPort.read(); | |||
if(dataRead != -1){ | |||
//clear previous temperature reading from screen | |||
background(backColor); | |||
stroke(255); | |||
//Update console | |||
print("Temp: "); | |||
print(dataRead); | |||
println("°"); | |||
//Update on screen GUI | |||
text("Current Temperature: ", 420, 60); | |||
text(dataRead, 835, 60); | |||
text("°", 900, 60); | |||
} | |||
} | |||
} | |||
//wait for key press. Once key is entered, initialize serial com port | |||
void keyPressed() { | |||
if(portChosen == false){ | |||
if (key != 10) //Enter | |||
keyIn[keyIndex++] = key-48; | |||
else | |||
{ | |||
COMPort = 0; | |||
for (i = 0; i < keyIndex; i++) | |||
COMPort = COMPort * 10 + keyIn[i]; | |||
println(COMPort); | |||
myPort = new Serial(this, Serial.list()[COMPort], 2400); | |||
portChosen = true; | |||
textFont(fontA, 60); // change font size & alignment for temp readings | |||
textAlign(CENTER); | |||
} | |||
} | |||
} | |||
@ -0,0 +1,98 @@ | |||
@f800 | |||
B2 40 80 5A 20 01 D2 42 FF 10 57 00 D2 42 FE 10 | |||
56 00 F2 F0 F9 00 58 00 F2 C2 22 00 F2 D2 21 00 | |||
F2 D2 27 00 F2 D2 24 00 F2 C2 23 00 F2 D2 25 00 | |||
F2 D0 41 00 22 00 F2 F0 BE 00 21 00 B0 12 6A FC | |||
D2 43 01 02 B0 12 A0 FA B0 12 C4 F9 32 D2 3B 40 | |||
E8 03 0B 3C C2 43 05 02 B2 F0 EF FF 62 01 B2 F0 | |||
EF FF 64 01 F2 F0 BE 00 21 00 B2 D0 03 00 B0 01 | |||
32 D0 18 00 5F 42 28 02 0F 5F 0F 5F 9F 42 B4 01 | |||
08 02 8F 43 0A 02 D2 53 28 02 F2 92 28 02 02 20 | |||
C2 43 28 02 82 43 2A 02 82 43 2C 02 3E 42 3F 40 | |||
08 02 B2 5F 2A 02 B2 6F 2C 02 1E 83 FA 23 1C 42 | |||
2A 02 1D 42 2C 02 B0 12 A8 FB 82 4C 2A 02 82 4D | |||
2C 02 1B 83 03 24 C2 93 04 02 31 24 D2 43 02 02 | |||
A2 42 62 01 B2 40 E0 02 60 01 F2 D0 06 00 26 00 | |||
E2 D3 22 00 C2 93 04 02 07 24 B2 40 F8 00 06 02 | |||
B0 12 F4 FB C2 43 04 02 1C 42 2A 02 1D 42 2C 02 | |||
3E 40 F9 02 0F 43 B0 12 CA FC 3C 80 C6 50 3D 70 | |||
07 00 3E 40 00 04 0F 43 B0 12 38 FB 4C 4C 82 4C | |||
06 02 B0 12 F4 FB B0 12 C4 F9 3B 40 E8 03 1E 42 | |||
2A 02 1F 42 2C 02 1E 82 2E 02 1F 72 30 02 82 4E | |||
32 02 82 4F 34 02 3F 93 10 38 03 20 3E 90 FB FF | |||
0C 28 0F 93 7F 3B 03 20 3E 90 06 00 7B 2B D2 43 | |||
05 02 F2 F0 BF 00 21 00 0C 3C B2 E3 32 02 B2 E3 | |||
34 02 92 53 32 02 82 63 34 02 E2 43 05 02 D2 C3 | |||
21 00 1C 42 32 02 1D 42 34 02 B0 12 E6 FB 3C 50 | |||
14 00 0D 63 82 4C 32 02 82 4D 34 02 0D 93 07 38 | |||
03 20 3C 90 CF 07 03 28 3F 40 CF 07 02 3C 1F 42 | |||
32 02 82 4F 74 01 B2 D0 10 00 62 01 B2 D0 10 00 | |||
64 01 53 3F C2 43 02 02 B2 40 D0 07 72 01 B2 40 | |||
10 02 60 01 B2 40 10 00 62 01 B2 40 70 00 64 01 | |||
92 43 74 01 30 41 D2 93 02 02 0E 24 D2 93 05 02 | |||
02 20 D2 D3 21 00 E2 93 05 02 03 20 F2 D0 40 00 | |||
21 00 92 C3 62 01 00 13 B2 50 34 00 72 01 B2 B0 | |||
00 10 62 01 18 24 C2 93 00 02 0F 24 B2 D0 80 00 | |||
62 01 92 B3 06 02 03 24 B2 F0 7F FF 62 01 12 C3 | |||
12 10 06 02 D2 83 00 02 00 13 F2 F0 F9 00 26 00 | |||
B2 F0 EF FF 62 01 00 13 0A 12 09 12 09 43 0A 43 | |||
1B 43 0F 93 04 24 09 4D 0D 4C 0C 43 0D 3C 0C 5C | |||
0D 6D 09 69 09 8E 04 28 1C D3 0B 5B F8 2B 03 3C | |||
09 5E 0B 5B F4 2B 1B 43 0C 5C 0D 6D 09 69 0A 6A | |||
09 8E 0A 7F 04 28 1C D3 0B 5B F6 2B 04 3C 09 5E | |||
0A 6F 0B 5B F1 2B 0E 49 0F 4A 39 41 3A 41 30 41 | |||
B2 40 60 A0 B2 01 B2 40 38 38 B0 01 0D 12 3D 40 | |||
4B 01 1D 83 FE 23 3D 41 B2 D0 03 00 B0 01 32 D0 | |||
18 00 92 42 B4 01 2E 02 82 43 30 02 3E 42 3F 40 | |||
08 02 2F 52 9F 42 2E 02 FC FF 9F 42 30 02 FE FF | |||
1E 83 F7 23 92 42 2E 02 2A 02 92 42 30 02 2C 02 | |||
30 41 0A 12 09 12 3F 40 52 FD 3F 93 12 24 3D 40 | |||
52 FD 0C 3C 8F 12 2A 53 12 3C 3C 4D 0A 4D 0E 49 | |||
B0 12 1E FD 0A 59 0D 4A 1D 53 1D C3 39 4D 09 93 | |||
F4 23 3F 40 FF FF 3F 93 05 24 3A 40 FF FF 2F 4A | |||
0F 93 E8 23 30 40 3A FD 0A 12 0A 43 0F 93 05 34 | |||
3E E3 3F E3 1E 53 0F 63 1A D3 0D 93 05 34 3C E3 | |||
3D E3 1C 53 0D 63 3A E3 B0 12 48 FA 1A B3 04 24 | |||
3C E3 3D E3 1C 53 0D 63 2A B3 04 24 3E E3 3F E3 | |||
1E 53 0F 63 3A 41 30 41 0D 11 0C 10 0D 11 0C 10 | |||
0D 11 0C 10 0D 11 0C 10 0D 11 0C 10 0D 11 0C 10 | |||
0D 11 0C 10 0D 11 0C 10 0D 11 0C 10 0D 11 0C 10 | |||
0D 11 0C 10 0D 11 0C 10 0D 11 0C 10 0D 11 0C 10 | |||
0D 11 0C 10 30 41 0C 5C 0D 6D 0C 5C 0D 6D 0C 5C | |||
0D 6D 0C 5C 0D 6D 0C 5C 0D 6D 0C 5C 0D 6D 0C 5C | |||
0D 6D 0C 5C 0D 6D 0C 5C 0D 6D 0C 5C 0D 6D 0C 5C | |||
0D 6D 0C 5C 0D 6D 0C 5C 0D 6D 0C 5C 0D 6D 0C 5C | |||
0D 6D 30 41 F2 40 0A 00 00 02 B2 40 20 69 62 01 | |||
B2 D0 00 30 62 01 92 B3 62 01 FD 27 B2 50 34 00 | |||
72 01 1F 42 06 02 0F 5F 3F D0 00 02 82 4F 06 02 | |||
B2 40 30 10 62 01 B2 B0 10 00 62 01 FC 23 30 41 | |||
C2 43 23 00 F2 C2 25 00 B2 40 1D 5A 20 01 D2 C3 | |||
02 00 D2 D3 00 00 D2 93 01 02 06 24 D2 43 01 02 | |||
B1 C0 D0 00 00 00 00 13 92 42 2A 02 2E 02 92 42 | |||
2C 02 30 02 D2 43 04 02 00 13 F2 D0 41 00 22 00 | |||
D2 D3 21 00 F2 F0 BF 00 21 00 F2 D0 10 00 57 00 | |||
F2 D0 20 00 53 00 B2 40 B0 04 72 01 B2 40 10 01 | |||
60 01 B2 40 70 00 64 01 B2 40 58 02 74 01 32 D0 | |||
D8 00 30 41 31 40 7E 02 B2 40 50 FD 36 02 B2 40 | |||
50 FD 38 02 B0 12 48 FD 0C 93 02 24 B0 12 F2 FA | |||
0C 43 B0 12 00 F8 B0 12 4C FD 0A 12 0A 43 0B 43 | |||
12 C3 0D 10 0C 10 02 28 0A 5E 0B 6F 0E 5E 0F 6F | |||
0D 93 F6 23 0C 93 F4 23 0C 4A 0D 4B 3A 41 30 41 | |||
92 C3 64 01 D2 93 01 02 04 24 F2 E0 41 00 21 00 | |||
00 13 F2 F0 BE 00 21 00 00 13 D2 C3 00 00 D2 C3 | |||
02 00 B2 40 80 5A 20 01 F2 D2 25 00 00 13 0F 4C | |||
0E 93 05 24 1F 53 FF 4D FF FF 1E 83 FB 23 30 41 | |||
34 41 35 41 36 41 37 41 38 41 39 41 3A 41 30 41 | |||
B1 C0 10 00 00 00 00 13 1C 43 30 41 03 43 FF 3F | |||
30 41 01 00 01 02 00 00 01 00 02 02 00 00 01 00 | |||
04 02 00 00 01 00 05 02 00 00 01 00 28 02 00 00 | |||
00 00 | |||
@ffe4 | |||
30 FC | |||
@ffea | |||
40 FD | |||
@fff0 | |||
F0 FC E6 F9 0A FD | |||
@fffe | |||
A4 FC | |||
q |
@ -0,0 +1,16 @@ | |||
CLS | |||
@echo off | |||
rem This is a small helper script that runs through the test collection for one device (folder) | |||
rem | |||
rem Dung Dang, MSP430 Applications, Texas Instruments, Inc. | |||
rem Last modified: 02/25/2011 | |||
:input | |||
@echo MSP-EXP430G2-LaunchPad Firmware Programmer | |||
set device=MSP430G2231 | |||
set firmware=MSP-EXP430G2-LaunchPad.txt | |||
@echo Programing %firmware% into %device% ...... | |||
..\..\MSP430Flasher\MSP430Flasher.exe -n %device% -w %firmware% -v -g -z [VCC] | |||
pause |
@ -0,0 +1,6 @@ | |||
[InternetShortcut] | |||
URL=http://www.ti.com/lit/pdf/slac432 | |||
IDList= | |||
HotKey=0 | |||
[{000214A0-0000-0000-C000-000000000046}] | |||
Prop3=19,2 |
@ -0,0 +1,6 @@ | |||
[InternetShortcut] | |||
URL=http://www.ti.com/tool/msp-exp430g2 | |||
IDList= | |||
HotKey=0 | |||
[{000214A0-0000-0000-C000-000000000046}] | |||
Prop3=19,2 |
@ -0,0 +1,9 @@ | |||
[InternetShortcut] | |||
URL=http://www.ti.com/lit/pdf/slau318 | |||
IDList= | |||
HotKey=0 | |||
[{000214A0-0000-0000-C000-000000000046}] | |||
Prop3=19,2 |
@ -0,0 +1,102 @@ | |||
; Copyright (c) 2007 Texas Instruments | |||
; MSP430 Application UART Installation file for Win2000/XP/Vista | |||
; | |||
; Port drivers setup | |||
; | |||
; Supported operating systems: | |||
; Windows 32-bit and 64-bit | |||
[Version] | |||
Signature="$Windows NT$" | |||
CatalogFile=430CDC.cat | |||
Class=Ports | |||
ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318} | |||
Provider=%TI% | |||
LayoutFile=layout.inf | |||
DriverVer=12/11/2007, 1.3 | |||
[Manufacturer] | |||
%TI%=DeviceList, NTamd64 | |||
[DestinationDirs] | |||
DefaultDestDir=12 | |||
[SourceDisksFiles] | |||
[SourceDisksNames] | |||
[DeviceList] | |||
%DESCRIPTION%=TIUSB, USB\Vid_0451&Pid_F432&MI_00 | |||
%DESCRIPTION%=TIUSB, USB\Vid_0451&Pid_F433 | |||
%DESCRIPTION%=TIUSB, USB\Vid_0451&Pid_F434&MI_00 | |||
%DESCRIPTION%=TIUSB, USB\Vid_0451&Pid_F435&MI_00 | |||
%DESCRIPTION%=TIUSB, USB\Vid_0451&Pid_F436&MI_00 | |||
%DESCRIPTION%=TIUSB, USB\Vid_0451&Pid_F437&MI_00 | |||
%DESCRIPTION%=TIUSB, USB\Vid_0451&Pid_F438&MI_00 | |||
[DeviceList.NTamd64] | |||
%DESCRIPTION%=TIUSB.NTamd64, USB\Vid_0451&Pid_F432&MI_00 | |||
%DESCRIPTION%=TIUSB.NTamd64, USB\Vid_0451&Pid_F433 | |||
%DESCRIPTION%=TIUSB.NTamd64, USB\Vid_0451&Pid_F434&MI_00 | |||
%DESCRIPTION%=TIUSB.NTamd64, USB\Vid_0451&Pid_F435&MI_00 | |||
%DESCRIPTION%=TIUSB.NTamd64, USB\Vid_0451&Pid_F436&MI_00 | |||
%DESCRIPTION%=TIUSB.NTamd64, USB\Vid_0451&Pid_F437&MI_00 | |||
%DESCRIPTION%=TIUSB.NTamd64, USB\Vid_0451&Pid_F438&MI_00 | |||
;------------------------------------------------------------------------------ | |||
; Windows 32-bit Sections | |||
;------------------------------------------------------------------------------ | |||
[TIUSB.nt] | |||
include=mdmcpq.inf | |||
CopyFiles=DriverCopyFiles | |||
AddReg=TIUSB.nt.AddReg | |||
[DriverCopyFiles] | |||
usbser.sys,,,0x20 | |||
[TIUSB.nt.AddReg] | |||
HKR,,DevLoader,,*ntkern | |||
HKR,,NTMPDriver,,usbser.sys | |||
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" | |||
[TIUSB.nt.Services] | |||
AddService=usbser, 0x00000002, DriverService | |||
[TIUSB.nt.HW] | |||
include=mdmcpq.inf | |||
[DriverService] | |||
DisplayName=%DESCRIPTION% | |||
ServiceType=1 | |||
StartType=3 | |||
ErrorControl=1 | |||
ServiceBinary=%12%\usbser.sys | |||
;------------------------------------------------------------------------------ | |||
; Windows 64-bit Sections | |||
;------------------------------------------------------------------------------ | |||
[TIUSB.NTamd64] | |||
include=mdmcpq.inf | |||
CopyFiles=DriverCopyFiles | |||
AddReg=TIUSB.NTamd64.AddReg | |||
[TIUSB.NTamd64.AddReg] | |||
HKR,,DevLoader,,*ntkern | |||
HKR,,NTMPDriver,,usbser.sys | |||
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" | |||
[TIUSB.NTamd64.Services] | |||
AddService=usbser, 0x00000002, DriverService | |||
[TIUSB.NTamd64.HW] | |||
include=mdmcpq.inf | |||
;------------------------------------------------------------------------------ | |||
; String Definitions | |||
;------------------------------------------------------------------------------ | |||
[Strings] | |||
TI="Texas Instruments" | |||
DESCRIPTION="MSP430 Application UART" |
@ -0,0 +1,55 @@ | |||
MSP-EXP430G2 Software Examples v2.03.00 | |||
Texas Instruments, Inc. | |||
******************************************************************************** | |||
Welcome to the MSP-EXP430G2 LaunchPad! | |||
******************************************************************************** | |||
In this package, you will find software examples and source codes that can help | |||
you quickly get started in developing your own project. | |||
The software example projects are located in the 'Source' folder: | |||
1. 430BOOST-SENSE1 | |||
| CapTouch_BoosterPack_UserExperience | 430BOOST-SENSE1 Captouch Booster Pack User Experience | |||
2. 430BOOST-SHARP96 | |||
| 430BOOST-SHARP96_CapacitiveTouch | 430BOOST-SHARP96 capacitive touch source code | |||
| 430BOOST-SHARP96_GrlibExample_G2 | 430BOOST-SHARP96 Grlib Example | |||
3. OutOfBox_MSP-EXP430G2 | |||
| MSP-EXP430G2-LaunchPad | Out of box demo source code | |||
| LaunchPad_Temp_GUI | Out of box demo Temperature GUI | |||
Note: the MSP-EXP430G2_CapacitiveTouch example requires MSP430 Touch Pro GUI to be installed on your pc to function correctly. Please find the link to download in the Documentation folder | |||
In addition, prebuilt TI-TXT images are located in the 'Binary' folder. These | |||
images are ready to be downloaded onto your LaunchPad using a free MSP430 | |||
programming interface, such as the included MSP430Flasher. Just run the | |||
"Program <Example>.bat" to download the corresponding project to your LaunchPad! | |||
You can also find various web links in the 'Documentation' folder pointing to | |||
the Tool Page, Quick Start Guide, User's Guide and MSP430 USB Developers Package. | |||
For more resources, be sure to visit http://www.ti.com/tool/MSP-EXP430F5529LP | |||
Also checkout the Wiki page at http://processors.wiki.ti.com/index.php/MSP430F5529_LaunchPad | |||
******************************************************************************** | |||
Revision History | |||
******************************************************************************** | |||
Ver 2.03.00 - September 26th, 2014 | |||
- Fixed CapTouch_BoosterPack_UserExperience build error in CCS | |||
Ver 2.02.00 - March 8th, 2014 | |||
- Updated to include BoosterPack software examples | |||
******************************************************************************** | |||
Project File Listing | |||
******************************************************************************** | |||
|--Documentation : Folder containing links to more resources | |||
|--Drivers : Folder containing driver for MSP430 emulation tools | |||
|--Source : Folder containing software examples | |||
|--430BOOST-SENSE1 : Capacitive Touch BoosterPack example source codes | |||
|--430BOOST-SHARP96 : Sharp LCD BoosterPack example source codes | |||
|--OutOfBox_MSP-EXP430G2 : G2 LaunchPad out-of-box source codes | |||
|--Readme.txt : This file |
@ -0,0 +1,11 @@ | |||
<projectSpec> | |||
<project compilerBuildOptions="-I${PROJECT_LOC}/CapacitiveTouchLibrary --advice:power="all" -g" | |||
device="MSP430G2452" | |||
name="CapTouch_BoosterPack_UserExperience" | |||
postBuildStep=""${CG_TOOL_HEX}" --ti_txt "${BuildArtifactFileName}" -o "${BuildArtifactFileBaseName}.txt" -order MS -romwidth 16" > | |||
<file action="copy" path="../CapacitiveTouchLibrary/" /> | |||
<file action="copy" path="../CapTouchBoosterPack_UserExperience.c" /> | |||
<file action="copy" path="../uart.c" /> | |||
<file action="copy" path="../uart.h" /> | |||
</project> | |||
</projectSpec> |
@ -0,0 +1,553 @@ | |||
/******************************************************************************* | |||
* | |||
* CapTouchBoosterPack_UserExperience.c | |||
* - MSP430 firmware application to demonstrate the capacitive touch | |||
* capability of the MSP430G2452 interfacing with the LaunchPad CapTouch | |||
* BoosterPack. | |||
* | |||
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ | |||
* | |||
* Redistribution and use in source and binary forms, with or without | |||
* modification, are permitted provided that the following conditions | |||
* are met: | |||
* | |||
* Redistributions of source code must retain the above copyright | |||
* notice, this list of conditions and the following disclaimer. | |||
* | |||
* Redistributions in binary form must reproduce the above copyright | |||
* notice, this list of conditions and the following disclaimer in the | |||
* documentation and/or other materials provided with the | |||
* distribution. | |||
* | |||
* Neither the name of Texas Instruments Incorporated nor the names of | |||
* its contributors may be used to endorse or promote products derived | |||
* from this software without specific prior written permission. | |||
* | |||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* | |||
* | |||
******************************************************************************/ | |||
/****************************************************************************** | |||
* MSP430G2-LaunchPad CapTouch BoosterPack User Experience | |||
* | |||
* This application operates on the LaunchPad platform using the MSP430G2452 | |||
* device and the CapTouch BoosterPack plugin board. The capacitive touch and | |||
* proximity sensing are enabled by the pin oscillator feature new to the | |||
* MSP430G2xx2 family devices. The User Experience application also utilizes | |||
* the cap touch library to realize & measure the capacitive touch and proximity | |||
* sensors. The cap touch library also provides layers of abstractions to | |||
* generate higher logical outputs such as logical touches, geometry (in this | |||
* hardware, a four-button wheel), and even gestures. | |||
* | |||
* The User Experience application starts up and remains in 'sleep' mode, | |||
* sampling the proximity sensor every ~8.3ms [VLO/100=12kHz/100=120Hz]. Upon | |||
* registering a valid proximity event [hand/finger/object hovering ~3-5cm from | |||
* the BoosterPack], the application wakes up to operate in the 'active' mode. | |||
* | |||
* In active mode, the application samples and registers individual finger touches | |||
* on the 16-position wheel or the center button as well as simple gestures | |||
* [Clockwise & Counter-clockwise] while the finger moves along and remains on | |||
* the wheel. | |||
* | |||
* a 9600 baud UART link is also implemented using SW TimerA to provide | |||
* application and cap touch data back to the PC via the UART-USB back channel. | |||
* The application sends UART data upon events such as wake up, sleep, touch, | |||
* or gesture. | |||
* | |||
* D. Dang | |||
* Texas Instruments, Inc. | |||
* Ver 0.90 Feb 2011 | |||
******************************************************************************/ | |||
#include "CTS_Layer.h" | |||
#include "uart.h" | |||
#define WAKE_UP_UART_CODE 0xBE | |||
#define WAKE_UP_UART_CODE2 0xEF | |||
#define SLEEP_MODE_UART_CODE 0xDE | |||
#define SLEEP_MODE_UART_CODE2 0xAD | |||
#define MIDDLE_BUTTON_CODE 0x80 | |||
#define INVALID_GESTURE 0xFD | |||
#define GESTURE_START 0xFC | |||
#define GESTURE_STOP 0xFB | |||
#define COUNTER_CLOCKWISE 1 | |||
#define CLOCKWISE 2 | |||
#define GESTURE_POSITION_OFFSET 0x20 | |||
#define WHEEL_POSITION_OFFSET 0x30 | |||
#define WHEEL_TOUCH_DELAY 12 //Delay between re-sendings of touches | |||
#define MAX_IDLE_TIME 200 | |||
#define PROXIMITY_THRESHOLD 60 | |||
unsigned int wheel_position=ILLEGAL_SLIDER_WHEEL_POSITION, last_wheel_position=ILLEGAL_SLIDER_WHEEL_POSITION; | |||
unsigned int deltaCnts[1]; | |||
unsigned int prox_raw_Cnts; | |||
/*----------------- LED definition--------------------------------------------- | |||
* There are 8 LEDs to represent different positions around the wheel. They are | |||
* controlled by 5 pins of Port 1 using a muxing scheme. The LEDs are divided | |||
* vertically into two groups of 4, in which each LED is paired up [muxed] with | |||
* the LED mirrored on the other side of the imaginary center vertical line via | |||
* the use of pin P1.3 and one specific port pin. | |||
* Specifically, the pairs are LEDs [0,7], [1,6], [2,5], [3,4], as shown in the | |||
* diagram below. | |||
* LED Position (degrees, clockwise) | |||
* --RIGHT SIDE-- | |||
* 0 BIT4,!BIT3 45 | |||
* 1 BIT5,!BIT3 80 | |||
* 2 BIT6,!BIT3 100 | |||
* 3 BIT7,!BIT3 135 * | |||
* | |||
* --LEFT SIDE-- | |||
* 4 BIT3,(BIT4,5,6) 225 | |||
* 5 BIT3,(BIT4,5,7) 260 | |||
* 6 BIT3,(BIT4,6,7) 280 | |||
* 7 BIT3,(BIT5,6,7) 315 | |||
*----------------------------------------------------------------------------*/ | |||
#define MASK7 BIT4 | |||
#define MASK6 BIT5 | |||
#define MASK5 BIT6 | |||
#define MASK4 BIT7 | |||
#define MASK3 (BIT3+BIT4+BIT5+BIT6) | |||
#define MASK2 (BIT3+BIT4+BIT5+BIT7) | |||
#define MASK1 (BIT3+BIT4+BIT6+BIT7) | |||
#define MASK0 (BIT3+BIT5+BIT6+BIT7) | |||
const unsigned char LedWheelPosition[16] = | |||
{ | |||
MASK0, MASK0, MASK0 & MASK1, MASK1, | |||
MASK1 & MASK2, MASK2, MASK2 & MASK3, MASK3, | |||
MASK4, MASK4, MASK4 | MASK5, MASK5, | |||
MASK5 | MASK6, MASK6, MASK6 | MASK7, MASK7 | |||
}; | |||
const unsigned char startSequence[8] = | |||
{ | |||
MASK0, | |||
MASK1, | |||
MASK2, | |||
MASK3, | |||
MASK4, | |||
MASK5, | |||
MASK6, | |||
MASK7 | |||
}; | |||
/*----------------- LED definition------------------------------*/ | |||
void InitLaunchPadCore(void) | |||
{ | |||
BCSCTL1 |= DIVA_0; // ACLK/(0:1,1:2,2:4,3:8) | |||
BCSCTL3 |= LFXT1S_2; // LFXT1 = VLO | |||
// Port init | |||
P1OUT &= ~(BIT3+BIT4+BIT5+BIT6+BIT7+BIT0); | |||
P1DIR |= BIT3+BIT4+BIT5+BIT6+BIT7+BIT0; | |||
P2SEL = 0x00; // No XTAL | |||
P2DIR |= (BIT0+BIT4+BIT2+BIT3+BIT1+BIT5); | |||
P2OUT &= ~(BIT0+BIT4+BIT2+BIT3+BIT1+BIT5); | |||
} | |||
void SendByte(unsigned char touch) | |||
{ | |||
TimerA_UART_init(); | |||
TimerA_UART_tx(touch); | |||
TimerA_UART_shutdown(); | |||
} | |||
/* ----------------CapTouchIdleMode----------------------------------------- | |||
* Device stays in LPM3 'sleep' mode, only Proximity Sensor is used to detect | |||
* any movement triggering device wake up | |||
* ------------------------------------------------------------------------*/ | |||
void CapTouchIdleMode(void) | |||
{ | |||
/* Send status via UART: 'sleep' = [0xDE, 0xAD] */ | |||
SendByte(SLEEP_MODE_UART_CODE); | |||
SendByte(SLEEP_MODE_UART_CODE2); | |||
/* Set DCO to 1MHz */ | |||
/* Set SMCLK to 1MHz / 8 = 125kHz */ | |||
BCSCTL1 = CALBC1_1MHZ; | |||
DCOCTL = CALDCO_1MHZ; | |||
BCSCTL2 |= DIVS_3; | |||
P1OUT |= BIT0; // Turn on center LED | |||
deltaCnts[0] = 0; | |||
/* Sleeping in LPM3 with ACLK/100 = 12Khz/100 = 120Hz wake up interval */ | |||
/* Measure proximity sensor count upon wake up */ | |||
/* Wake up if proximity deltaCnts > THRESHOLD */ | |||
do | |||
{ | |||
TACCR0 = 100; | |||
TACTL = TASSEL_1 + MC_1; | |||
TACCTL0 |= CCIE; | |||
__bis_SR_register(LPM3_bits+GIE); | |||
TACCTL0 &= ~CCIE; | |||
TI_CAPT_Custom(&proximity_sensor,deltaCnts); | |||
} | |||
while (deltaCnts[0] <= PROXIMITY_THRESHOLD); | |||
P1OUT &= ~BIT0; // Turn off center LED | |||
} | |||
/* ----------------MeasureCapBaseLine-------------------------------------- | |||
* Re-measure the baseline capacitance of the wheel elements & the center | |||
* button. To be called after each wake up event. | |||
* ------------------------------------------------------------------------*/ | |||
void MeasureCapBaseLine(void) | |||
{ | |||
P1OUT = BIT0; | |||
/* Set DCO to 8MHz */ | |||
/* SMCLK = 8MHz/8 = 1MHz */ | |||
BCSCTL1 = CALBC1_8MHZ; | |||
DCOCTL = CALDCO_8MHZ; | |||
BCSCTL2 |= DIVS_3; | |||
TI_CAPT_Init_Baseline(&wheel); | |||
TI_CAPT_Update_Baseline(&wheel,2); | |||
TI_CAPT_Init_Baseline(&middle_button); | |||
TI_CAPT_Update_Baseline(&middle_button,2); | |||
} | |||
/* ----------------LedStartUpSequence-------------------------------------- | |||
* Display an LED lighting sequence to indicate the wake up event | |||
* ------------------------------------------------------------------------*/ | |||
void LedStartUpSequence(void) | |||
{ | |||
unsigned char i; | |||
TACCTL0 = CCIE; // CCR0 interrupt enabled | |||
TACTL |= TACLR; | |||
TACCR0 = TAR + 500; // 50ms | |||
TACTL = TASSEL_1 + MC_1; // ACLK, upmode | |||
/* Slow clockwise sequence */ | |||
for(i=0; i<8; i++) | |||
{ | |||
P1OUT = startSequence[i]; | |||
__bis_SR_register(LPM3_bits+GIE); | |||
__delay_cycles(1000000); | |||
TACCR0 = TAR + 500; // 50ms | |||
} | |||
P1OUT = BIT0; | |||
/* Fast counter-clockwise sequence */ | |||
while(i) | |||
{ | |||
i--; | |||
P1OUT = startSequence[i]; | |||
__bis_SR_register(LPM3_bits+GIE); | |||
TACCR0 = TAR + 500; // 50ms | |||
} | |||
TACCTL0 &= ~CCIE; // CCR0 interrupt disabled | |||
P1OUT = 0; // Turn off all LEDs | |||
} | |||
/* ----------------GetGesture---------------------------------------------- | |||
* Determine immediate gesture based on current & previous wheel position | |||
* ------------------------------------------------------------------------*/ | |||
unsigned char GetGesture(unsigned char wheel_position) | |||
{ | |||
unsigned char gesture = INVALID_GESTURE, direction, ccw_check, cw_check; | |||
// ****************************************************************************** | |||
// gesturing | |||
// determine if a direction/swipe is occuring | |||
// the difference between the initial position and | |||
// the current wheel position should not exceed 8 | |||
// 0-1-2-3-4-5-6-7-8-9-A-B-C-D-E-F-0... | |||
// | |||
// E-F-0-1-2: cw, 4 | |||
// 2-1-0-F-E: ccw, 4 | |||
// A-B-C-D-E-F | |||
//if(initial_wheel_position == INVALID_WHEEL_POSITION) | |||
//{ | |||
//gesture = 0; | |||
//initial_wheel_position = wheel_position; | |||
//} | |||
//else | |||
if(last_wheel_position != ILLEGAL_SLIDER_WHEEL_POSITION) | |||
{ | |||
if(last_wheel_position > wheel_position) | |||
{ | |||
// E-D-C-B-A: ccw, 4 | |||
// counter clockwise: 0 < (init_wheel_position - wheel_position) < 8 | |||
// gesture = init_wheel_position - wheel_position | |||
// | |||
// E-F-0-1-2: cw, 4 | |||
// clockwise: 0 < (init_wheel_position+wheel_position)-16 <8 | |||
// | |||
ccw_check = last_wheel_position - wheel_position; | |||
if(ccw_check < 8) | |||
{ | |||
gesture = ccw_check; | |||
direction = COUNTER_CLOCKWISE; | |||
} | |||
else | |||
{ | |||
// E-F-0-1-2: cw, 4 | |||
// 16 - 14 + 2 = 4 | |||
cw_check = 16 - last_wheel_position + wheel_position ; | |||
if(cw_check < 8) | |||
{ | |||
gesture = cw_check; | |||
direction = CLOCKWISE; | |||
} | |||
} | |||
} | |||
else | |||
{ | |||
// initial_wheel_position <= wheel_position | |||
// | |||
// 2-1-0-F-E: ccw, 4 | |||
// counter clockwise: | |||
// 0 < (init_wheel_position+wheel_position)-16 <8 | |||
// gesture = init_wheel_position - wheel_position | |||
// | |||
// 0-1-2-3-4: cw, 4 | |||
// clockwise: 0 < (wheel_position - init_wheel_position) < 8 | |||
// | |||
cw_check = wheel_position - last_wheel_position ; | |||
if(cw_check < 8) | |||
{ | |||
gesture = cw_check; | |||
direction = CLOCKWISE; | |||
} | |||
else | |||
{ | |||
// 2-1-0-F-E: ccw, 4 | |||
// 16 + 2 - 14 = 4 | |||
ccw_check = 16 + last_wheel_position - wheel_position ; | |||
if(ccw_check < 8) | |||
{ | |||
gesture = ccw_check; | |||
direction = COUNTER_CLOCKWISE; | |||
} | |||
} | |||
} | |||
} | |||
if (gesture == INVALID_GESTURE) | |||
return gesture; | |||
if (direction == COUNTER_CLOCKWISE) | |||
return (gesture + 16); | |||
else | |||
return gesture; | |||
} | |||
/* ----------------CapTouchActiveMode---------------------------------------------- | |||
* Determine immediate gesture based on current & previous wheel position | |||
* | |||
* | |||
* | |||
* | |||
* | |||
* | |||
* | |||
* -------------------------------------------------------------------------------*/ | |||
void CapTouchActiveMode() | |||
{ | |||
unsigned char idleCounter, activeCounter; | |||
unsigned char gesture, gestureDetected; | |||
unsigned char centerButtonTouched = 0; | |||
unsigned int wheelTouchCounter = WHEEL_TOUCH_DELAY - 1; | |||
gesture = INVALID_GESTURE; // Wipes out gesture history | |||
/* Send status via UART: 'wake up' = [0xBE, 0xEF] */ | |||
SendByte(WAKE_UP_UART_CODE); | |||
SendByte(WAKE_UP_UART_CODE2); | |||
idleCounter = 0; | |||
activeCounter = 0; | |||
gestureDetected = 0; | |||
while (idleCounter++ < MAX_IDLE_TIME) | |||
{ | |||
/* Set DCO to 8MHz */ | |||
/* SMCLK = 8MHz/8 = 1MHz */ | |||
BCSCTL1 = CALBC1_8MHZ; | |||
DCOCTL = CALDCO_8MHZ; | |||
BCSCTL2 |= DIVS_3; | |||
TACCTL0 &= ~CCIE; | |||
wheel_position = ILLEGAL_SLIDER_WHEEL_POSITION; | |||
wheel_position = TI_CAPT_Wheel(&wheel); | |||
/* Process wheel touch/position/gesture if a wheel touch is registered*/ | |||
/* Wheel processing has higher priority than center button*/ | |||
if(wheel_position != ILLEGAL_SLIDER_WHEEL_POSITION) | |||
{ | |||
centerButtonTouched = 0; | |||
/* Adjust wheel position based: rotate CCW by 2 positions */ | |||
if (wheel_position < 0x08) | |||
{ | |||
wheel_position += 0x40 - 0x08; | |||
} | |||
else | |||
{ | |||
wheel_position -= 0x08; | |||
/* Adjust wheel position based: rotate CCW by 2 positions */ | |||
} | |||
wheel_position = wheel_position >>2; // divide by four | |||
gesture = GetGesture(wheel_position); | |||
/* Add hysteresis to reduce toggling between wheel positions if no gesture | |||
* has been TRULY detected. */ | |||
if ( (gestureDetected==0) && ((gesture<=1) || (gesture==0x11) || (gesture==0x10))) | |||
{ | |||
if (last_wheel_position != ILLEGAL_SLIDER_WHEEL_POSITION) | |||
wheel_position = last_wheel_position; | |||
gesture = 0; | |||
} | |||
/* Turn on corresponding LED(s) */ | |||
P1OUT = (P1OUT & BIT0) | LedWheelPosition[wheel_position]; | |||
if ((gesture != 0) && (gesture != 16) && (gesture != INVALID_GESTURE)) | |||
{ /* A gesture has been detected */ | |||
if (gestureDetected ==0) | |||
{ /* Starting of a new gesture sequence */ | |||
gestureDetected = 1; | |||
/* Transmit gesture start status update & position via UART to PC */ | |||
SendByte(GESTURE_START); | |||
SendByte(last_wheel_position + GESTURE_POSITION_OFFSET); | |||
} | |||
/* Transmit gesture & position via UART to PC */ | |||
SendByte(gesture); | |||
SendByte(wheel_position + GESTURE_POSITION_OFFSET); | |||
} | |||
else | |||
if (gestureDetected==0) | |||
{ /* If no gesture was detected, this is constituted as a touch/tap */ | |||
if (++wheelTouchCounter >= WHEEL_TOUCH_DELAY) | |||
{ | |||
/* Transmit wheel position [twice] via UART to PC */ | |||
wheelTouchCounter = 0; | |||
SendByte(wheel_position + WHEEL_POSITION_OFFSET ); | |||
SendByte(wheel_position + WHEEL_POSITION_OFFSET ); | |||
} | |||
} | |||
else | |||
wheelTouchCounter = WHEEL_TOUCH_DELAY - 1; | |||
idleCounter = 0; // Reset idle counter | |||
activeCounter++; | |||
last_wheel_position = wheel_position; | |||
} | |||
else | |||
{ /* no wheel position was detected */ | |||
if(TI_CAPT_Button(&middle_button)) | |||
{ /* Middle button was touched */ | |||
if (centerButtonTouched==0) | |||
{ | |||
/* Transmit center button code [twice] via UART to PC */ | |||
SendByte(MIDDLE_BUTTON_CODE); | |||
SendByte(MIDDLE_BUTTON_CODE); | |||
centerButtonTouched = 1; | |||
P1OUT = (P1OUT&BIT0) ^ BIT0; // Toggle Center LED | |||
} | |||
idleCounter = 0; | |||
} | |||
else | |||
{ /* No touch was registered at all [Not wheel or center button */ | |||
centerButtonTouched = 0; | |||
P1OUT &= BIT0; | |||
if ( (gesture == INVALID_GESTURE) || (gestureDetected ==0)) | |||
{ /* No gesture was registered previously */ | |||
if (last_wheel_position != ILLEGAL_SLIDER_WHEEL_POSITION) | |||
{ | |||
/* Transmit last wheel position [twice] via UART to PC */ | |||
SendByte(last_wheel_position + WHEEL_POSITION_OFFSET ); | |||
SendByte(last_wheel_position + WHEEL_POSITION_OFFSET ); | |||
wheelTouchCounter = WHEEL_TOUCH_DELAY - 1; | |||
} | |||
} | |||
if (gestureDetected == 1) | |||
{ /* A gesture was registered previously */ | |||
/* Transmit status update: stop gesture tracking [twice] via UART to PC */ | |||
SendByte(GESTURE_STOP); | |||
SendByte(GESTURE_STOP); | |||
} | |||
} | |||
// Reset all touch conditions, turn off LEDs, | |||
last_wheel_position= ILLEGAL_SLIDER_WHEEL_POSITION; | |||
gesture = INVALID_GESTURE; | |||
gestureDetected = 0; | |||
} | |||
/* ------------------------------------------------------------------------ | |||
* Option: | |||
* Add delay/sleep cycle here to reduce active duty cycle. This lowers power | |||
* consumption but sacrifices wheel responsiveness. Additional timing | |||
* refinement must be taken into consideration when interfacing with PC | |||
* applications GUI to retain proper communication protocol. | |||
* -----------------------------------------------------------------------*/ | |||
} | |||
} | |||
void main(void) | |||
{ | |||
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer | |||
InitLaunchPadCore(); | |||
/* Set DCO to 1MHz */ | |||
/* Set SMCLK to 1MHz / 8 = 125kHz */ | |||
BCSCTL1 = CALBC1_1MHZ; | |||
DCOCTL = CALDCO_1MHZ; | |||
BCSCTL2 |= DIVS_3; | |||
/* Establish baseline for the proximity sensor */ | |||
TI_CAPT_Init_Baseline(&proximity_sensor); | |||
TI_CAPT_Update_Baseline(&proximity_sensor,5); | |||
while (1) | |||
{ | |||
CapTouchIdleMode(); | |||
MeasureCapBaseLine(); | |||
LedStartUpSequence(); | |||
CapTouchActiveMode(); | |||
} | |||
} |
@ -0,0 +1,97 @@ | |||
/******************************************************************************* | |||
* | |||
* CTS_HAL.h | |||
* | |||
* Redistribution and use in source and binary forms, with or without | |||
* modification, are permitted provided that the following conditions | |||
* are met: | |||
* | |||
* Redistributions of source code must retain the above copyright | |||
* notice, this list of conditions and the following disclaimer. | |||
* | |||
* Redistributions in binary form must reproduce the above copyright | |||
* notice, this list of conditions and the following disclaimer in the | |||
* documentation and/or other materials provided with the | |||
* distribution. | |||
* | |||
* Neither the name of Texas Instruments Incorporated nor the names of | |||
* its contributors may be used to endorse or promote products derived | |||
* from this software without specific prior written permission. | |||
* | |||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* | |||
******************************************************************************/ | |||
/***************************************************************************//** | |||
* @file CTS_HAL.h | |||
* | |||
* @brief | |||
* | |||
* @par Project: | |||
* MSP430 Capacitive Touch Library | |||
* | |||
* @par Developed using: | |||
* IAR Version : 5.10.6 [Kickstart] (5.10.6.30180) | |||
* CCS Version : 4.2.1.00004, w/support for GCC extensions (--gcc) | |||
* | |||
* | |||
* @version 1.0.0 Initial Release | |||
* | |||
* @par Supported Hardware Configurations: | |||
* - TI_CTS_RO_COMPAp_TA0_WDTp_HAL() | |||
* - TI_CTS_fRO_COMPAp_TA0_SW_HAL() | |||
* - TI_CTS_fRO_COMPAp_SW_TA0_HAL() | |||
* - TI_CTS_RO_COMPAp_TA1_WDTp_HAL() | |||
* - TI_CTS_fRO_COMPAp_TA1_SW_HAL() | |||
* - TI_CTS_RC_PAIR_TA0_HAL() | |||
* - TI_CTS_RO_PINOSC_TA0_WDTp_HAL() | |||
* - TI_CTS_RO_PINOSC_TA0_HAL() | |||
* - TI_CTS_fRO_PINOSC_TA0_SW_HAL() | |||
* - TI_CTS_RO_COMPB_TA0_WDTA_HAL() | |||
* - TI_CTS_RO_COMPB_TA1_WDTA_HAL() | |||
* - TI_CTS_fRO_COMPB_TA0_SW_HAL() | |||
* - TI_CTS_fRO_COMPB_TA1_SW_HAL() | |||
******************************************************************************/ | |||
#ifndef CAP_TOUCH_HAL | |||
#define CAP_TOUCH_HAL | |||
#include "structure.h" | |||
void TI_CTS_RO_COMPAp_TA0_WDTp_HAL(const struct Sensor *, uint16_t *); | |||
void TI_CTS_fRO_COMPAp_TA0_SW_HAL(const struct Sensor *, uint16_t *); | |||
void TI_CTS_fRO_COMPAp_SW_TA0_HAL(const struct Sensor *, uint16_t *); | |||
void TI_CTS_RO_COMPAp_TA1_WDTp_HAL(const struct Sensor *, uint16_t *); | |||
void TI_CTS_fRO_COMPAp_TA1_SW_HAL(const struct Sensor *, uint16_t *); | |||
void TI_CTS_RC_PAIR_TA0_HAL(const struct Sensor *, uint16_t *); | |||
void TI_CTS_RO_PINOSC_TA0_WDTp_HAL(const struct Sensor *, uint16_t *); | |||
void TI_CTS_RO_PINOSC_TA0_HAL(const struct Sensor *, uint16_t *); | |||
void TI_CTS_fRO_PINOSC_TA0_SW_HAL(const struct Sensor *, uint16_t *); | |||
void TI_CTS_RO_COMPB_TA0_WDTA_HAL(const struct Sensor *, uint16_t *); | |||
void TI_CTS_fRO_COMPB_TA0_SW_HAL(const struct Sensor *, uint16_t *); | |||
void TI_CTS_RO_COMPB_TA1_WDTA_HAL(const struct Sensor *, uint16_t *); | |||
void TI_CTS_fRO_COMPB_TA1_SW_HAL(const struct Sensor *, uint16_t *); | |||
#endif |
@ -0,0 +1,747 @@ | |||
/******************************************************************************* | |||
* CTS_HAL.c - defines functions called by application as well as | |||
* functions for information processing | |||
* | |||
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ | |||
* | |||
* Redistribution and use in source and binary forms, with or without | |||
* modification, are permitted provided that the following conditions | |||
* are met: | |||
* | |||
* Redistributions of source code must retain the above copyright | |||
* notice, this list of conditions and the following disclaimer. | |||
* | |||
* Redistributions in binary form must reproduce the above copyright | |||
* notice, this list of conditions and the following disclaimer in the | |||
* documentation and/or other materials provided with the | |||
* distribution. | |||
* | |||
* Neither the name of Texas Instruments Incorporated nor the names of | |||
* its contributors may be used to endorse or promote products derived | |||
* from this software without specific prior written permission. | |||
* | |||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* | |||
******************************************************************************/ | |||
/***************************************************************************//** | |||
* @file CTS_HAL.c | |||
* | |||
* @brief | |||
* | |||
* @par Project: | |||
* MSP430 Capacitive Touch Library | |||
* | |||
* @par Developed using: | |||
* IAR Version : 5.10.6 [Kickstart] (5.10.6.30180) | |||
* CCS Version : 4.2.1.00004, w/support for GCC extensions (--gcc) | |||
* | |||
* @version 1.0.0 Initial Release | |||
* | |||
* @par Supported API Calls: | |||
* - TI_CAPT_Init_Baseline() | |||
* - TI_CAPT_Update_Baseline() | |||
* - TI_CAPT_Reset_Tracking() | |||
* - TI_CAPT_Update_Tracking_DOI() | |||
* - TI_CAPT_Update_Tracking_Rate() | |||
* - TI_CAPT_Update_Baseline() | |||
* - TI_CAPT_Raw() | |||
* - TI_CAPT_Custom() | |||
* - TI_CAPT_Button() | |||
* - TI_CAPT_Buttons() | |||
* - TI_CAPT_Slider() | |||
* - TI_CAPT_Wheel() | |||
******************************************************************************/ | |||
#include "CTS_Layer.h" | |||
#include <stdlib.h> | |||
// Global variables for sensing | |||
#ifdef TOTAL_NUMBER_OF_ELEMENTS | |||
uint16_t baseCnt[TOTAL_NUMBER_OF_ELEMENTS]; | |||
#ifdef RAM_FOR_FLASH | |||
uint16_t measCnt[MAXIMUM_NUMBER_OF_ELEMENTS_PER_SENSOR]; | |||
#endif | |||
uint16_t ctsStatusReg = (DOI_INC+TRADOI_FAST+TRIDOI_SLOW); | |||
#endif | |||
/***************************************************************************//** | |||
* @addtogroup CTS_API | |||
* @{ | |||
******************************************************************************/ | |||
/***************************************************************************//** | |||
* @brief Measure the capacitance of each element within the Sensor | |||
* | |||
* This function selects the appropriate HAL to perform the capacitance | |||
* measurement based upon the halDefinition found in the sensor | |||
* structure. | |||
* The order of the elements within the Sensor structure is arbitrary | |||
* but must be consistent between the application and configuration. | |||
* The first element in the array (counts) corresponds to the first | |||
* element within the Sensor structure. | |||
* @param groupOfElements Pointer to Sensor structure to be measured | |||
* @param counts Address to where the measurements are to be written | |||
* @return none | |||
******************************************************************************/ | |||
void TI_CAPT_Raw(const struct Sensor* groupOfElements, uint16_t * counts) | |||
{ | |||
#ifdef RO_COMPAp_TA0_WDTp | |||
if(groupOfElements->halDefinition == RO_COMPAp_TA0_WDTp) | |||
{ | |||
TI_CTS_RO_COMPAp_TA0_WDTp_HAL(groupOfElements, counts); | |||
} | |||
#endif | |||
#ifdef fRO_COMPAp_TA0_SW | |||
if(groupOfElements->halDefinition == fRO_COMPAp_TA0_SW) | |||
{ | |||
TI_CTS_fRO_COMPAp_TA0_SW_HAL(groupOfElements, counts); | |||
} | |||
#endif | |||
#ifdef fRO_COMPAp_SW_TA0 | |||
if(groupOfElements->halDefinition == fRO_COMPAp_SW_TA0) | |||
{ | |||
TI_CTS_fRO_COMPAp_SW_TA0_HAL(groupOfElements, counts); | |||
} | |||
#endif | |||
#ifdef RO_COMPAp_TA1_WDTp | |||
if(groupOfElements->halDefinition == RO_COMPAp_TA1_WDTp) | |||
{ | |||
TI_CTS_RO_COMPAp_TA1_WDTp_HAL(groupOfElements, counts); | |||
} | |||
#endif | |||
#ifdef fRO_COMPAp_TA1_SW | |||
if(groupOfElements->halDefinition == fRO_COMPAp_TA1_SW) | |||
{ | |||
TI_CTS_fRO_COMPAp_TA1_SW_HAL(groupOfElements, counts); | |||
} | |||
#endif | |||
#ifdef RC_PAIR_TA0 | |||
if(groupOfElements->halDefinition == RC_PAIR_TA0) | |||
{ | |||
TI_CTS_RC_PAIR_TA0_HAL(groupOfElements, counts); // Measure all sensors | |||
} | |||
#endif | |||
#ifdef RO_PINOSC_TA0_WDTp | |||
if(groupOfElements->halDefinition == RO_PINOSC_TA0_WDTp) | |||
{ | |||
TI_CTS_RO_PINOSC_TA0_WDTp_HAL(groupOfElements, counts); | |||
} | |||
#endif | |||
#ifdef RO_PINOSC_TA0 | |||
if(groupOfElements->halDefinition == RO_PINOSC_TA0) | |||
{ | |||
TI_CTS_RO_PINOSC_TA0_HAL(groupOfElements, counts); | |||
} | |||
#endif | |||
#ifdef fRO_PINOSC_TA0_SW | |||
if(groupOfElements->halDefinition == fRO_PINOSC_TA0_SW) | |||
{ | |||
TI_CTS_fRO_PINOSC_TA0_SW_HAL(groupOfElements, counts); // Measure all sensors | |||
} | |||
#endif | |||
#ifdef RO_COMPB_TA0_WDTA | |||
if(groupOfElements->halDefinition == RO_COMPB_TA0_WDTA) | |||
{ | |||
TI_CTS_RO_COMPB_TA0_WDTA_HAL(groupOfElements, counts); | |||
} | |||
#endif | |||
#ifdef fRO_COMPB_TA0_SW | |||
if(groupOfElements->halDefinition == fRO_COMPB_TA0_SW) | |||
{ | |||
TI_CTS_fRO_COMPB_TA0_SW_HAL(groupOfElements, counts); | |||
} | |||
#endif | |||
#ifdef RO_COMPB_TA1_WDTA | |||
if(groupOfElements->halDefinition == RO_COMPB_TA1_WDTA) | |||
{ | |||
TI_CTS_RO_COMPB_TA1_WDTA_HAL(groupOfElements, counts); | |||
} | |||
#endif | |||
#ifdef fRO_COMPB_TA1_SW | |||
if(groupOfElements->halDefinition == fRO_COMPB_TA1_SW) | |||
{ | |||
TI_CTS_fRO_COMPB_TA1_SW_HAL(groupOfElements, counts); | |||
} | |||
#endif | |||
} | |||
#ifdef TOTAL_NUMBER_OF_ELEMENTS | |||
/***************************************************************************//** | |||
* @brief Make a single capacitance meausrment to initialize baseline tracking | |||
* @param groupOfElements Pointer to Sensor structure to be measured | |||
* @return none | |||
******************************************************************************/ | |||
void TI_CAPT_Init_Baseline(const struct Sensor* groupOfElements) | |||
{ | |||
TI_CAPT_Raw(groupOfElements, &baseCnt[groupOfElements->baseOffset]); | |||
} | |||
/***************************************************************************//** | |||
* @brief Update baseline tracking by averaging several measurements | |||
* @param groupOfElements Pointer to Sensor structure to be measured | |||
* @param numberofAverages Number of measurements to be averaged | |||
* @return none | |||
******************************************************************************/ | |||
void TI_CAPT_Update_Baseline(const struct Sensor* groupOfElements, uint8_t numberOfAverages) | |||
{ | |||
uint8_t i,j; | |||
#ifndef RAM_FOR_FLASH | |||
uint16_t *measCnt; | |||
measCnt = (uint16_t *)malloc(groupOfElements->numElements * sizeof(uint16_t)); | |||
if(measCnt ==0) | |||
{ | |||
while(1); | |||
} | |||
#endif | |||
for(j=0; j < numberOfAverages; j++) | |||
{ | |||
for(i=0; i < groupOfElements->numElements; i++) | |||
{ | |||
TI_CAPT_Raw(groupOfElements, measCnt); | |||
baseCnt[i+groupOfElements->baseOffset] = measCnt[i]/2 + baseCnt[i+groupOfElements->baseOffset]/2; | |||
} | |||
} | |||
#ifndef RAM_FOR_FLASH | |||
free(measCnt); | |||
#endif | |||
} | |||
/***************************************************************************//** | |||
* @brief Reset the Baseline Tracking algorithm to the default state | |||
* @param none | |||
* @return none | |||
******************************************************************************/ | |||
void TI_CAPT_Reset_Tracking(void) | |||
{ | |||
ctsStatusReg = (DOI_INC+TRADOI_FAST+TRIDOI_SLOW); | |||
} | |||
/***************************************************************************//** | |||
* @brief Update the Baseline Tracking algorithm Direction of Interest | |||
* @param direction Direction of increasing or decreasing capacitance | |||
* @return none | |||
******************************************************************************/ | |||
void TI_CAPT_Update_Tracking_DOI(uint8_t direction) | |||
{ | |||
if(direction) | |||
{ | |||
ctsStatusReg |= DOI_INC; | |||
} | |||
else | |||
{ | |||
ctsStatusReg &= ~DOI_INC; | |||
} | |||
} | |||
/***************************************************************************//** | |||
* @brief Update the baseling tracking algorithm tracking rates | |||
* @param rate Rate of tracking changes in and against direction of intrest | |||
* @return none | |||
******************************************************************************/ | |||
void TI_CAPT_Update_Tracking_Rate(uint8_t rate) | |||
{ | |||
ctsStatusReg &= ~(TRIDOI_FAST+TRADOI_VSLOW); // clear fields | |||
ctsStatusReg |= (rate & 0xF0); // update fields | |||
} | |||
/***************************************************************************//** | |||
* @brief Measure the change in capacitance of the Sensor | |||
* | |||
* This function measures the change in capacitance of each element | |||
* within a sensor and updates the baseline tracking in the event that | |||
* no change exceeds the detection threshold. | |||
* The order of the elements within the Sensor structure is arbitrary | |||
* but must be consistent between the application and configuration. | |||
* The first element in the array (deltaCnt) corresponds to the first | |||
* element within the Sensor structure. | |||
* @param groupOfElements Pointer to Sensor structure to be measured | |||
* @param deltaCnt Address to where the measurements are to be written | |||
* @return none | |||
******************************************************************************/ | |||
void TI_CAPT_Custom(const struct Sensor* groupOfElements, uint16_t * deltaCnt) | |||
{ | |||
uint8_t j; | |||
uint16_t tempCnt; | |||
ctsStatusReg &= ~ EVNT; | |||
// This section calculates the delta counts************************************* | |||
//****************************************************************************** | |||
TI_CAPT_Raw(groupOfElements, &deltaCnt[0]); // measure group of sensors | |||
for (j = 0; j < (groupOfElements->numElements); j++) | |||
{ | |||
tempCnt = deltaCnt[j]; | |||
if(((ctsStatusReg & DOI_MASK) && (groupOfElements->halDefinition & RO_MASK)) | |||
|| | |||
((!(ctsStatusReg & DOI_MASK)) && (!(groupOfElements->halDefinition & RO_MASK)))) | |||
{ | |||
// RO method, interested in an increase in capacitance | |||
if(baseCnt[j+groupOfElements->baseOffset] < deltaCnt[j]) | |||
{ | |||
// If capacitance decreases, then measCnt is greater than base | |||
// , set delta to zero | |||
deltaCnt[j] = 0; | |||
// Limit the change in the opposite direction to the threshold | |||
if(((groupOfElements->arrayPtr[j])->threshold) | |||
&& | |||
(baseCnt[j+groupOfElements->baseOffset]+(groupOfElements->arrayPtr[j])->threshold < tempCnt)) | |||
{ | |||
tempCnt = baseCnt[j+groupOfElements->baseOffset]+(groupOfElements->arrayPtr[j])->threshold; | |||
} | |||
} | |||
else | |||
{ | |||
// change occuring in our DOI, save result | |||
deltaCnt[j] = baseCnt[j+groupOfElements->baseOffset]-deltaCnt[j]; | |||
} | |||
} | |||
if(((!(ctsStatusReg & DOI_MASK)) && (groupOfElements->halDefinition & RO_MASK)) | |||
|| | |||
((ctsStatusReg & DOI_MASK) && (!(groupOfElements->halDefinition & RO_MASK)))) | |||
{ | |||
// RO method: interested in a decrease in capactiance | |||
// measCnt is greater than baseCnt | |||
if(baseCnt[j+groupOfElements->baseOffset] > deltaCnt[j]) | |||
{ | |||
// If capacitance increases, set delta to zero | |||
deltaCnt[j] = 0; | |||
// Limit the change in the opposite direction to the threshold | |||
if(((groupOfElements->arrayPtr[j])->threshold) | |||
&& | |||
(baseCnt[j+groupOfElements->baseOffset] > tempCnt+(groupOfElements->arrayPtr[j])->threshold)) | |||
{ | |||
tempCnt = baseCnt[j+groupOfElements->baseOffset]-(groupOfElements->arrayPtr[j])->threshold; | |||
} | |||
} | |||
else | |||
{ | |||
// change occuring in our DOI | |||
deltaCnt[j] = deltaCnt[j] - baseCnt[j+groupOfElements->baseOffset]; | |||
} | |||
} | |||
// This section updates the baseline capacitance**************************** | |||
//************************************************************************** | |||
if (deltaCnt[j]==0) | |||
{ // if delta counts is 0, then the change in capacitance was opposite the | |||
// direction of interest. The baseCnt[i] is updated with the saved | |||
// measCnt value for the current index value 'i'. | |||
switch ((ctsStatusReg & TRADOI_VSLOW)) | |||
{ | |||
case TRADOI_FAST://Fast | |||
tempCnt = tempCnt/2; | |||
baseCnt[j+groupOfElements->baseOffset] = (baseCnt[j+groupOfElements->baseOffset]/2); | |||
break; | |||
case TRADOI_MED://Medium | |||
tempCnt = tempCnt/4; | |||
baseCnt[j+groupOfElements->baseOffset] = 3*(baseCnt[j+groupOfElements->baseOffset]/4); | |||
break; | |||
case TRADOI_SLOW://slow | |||
tempCnt = tempCnt/64; | |||
baseCnt[j+groupOfElements->baseOffset] = 63*(baseCnt[j+groupOfElements->baseOffset]/64); | |||
break; | |||
case TRADOI_VSLOW://very slow | |||
tempCnt = tempCnt/128; | |||
baseCnt[j+groupOfElements->baseOffset] = 127*(baseCnt[j+groupOfElements->baseOffset]/128); | |||
break; | |||
} | |||
// set X, Y & Z, then perform calculation for baseline tracking: | |||
// Base_Capacitance = X*(Measured_Capacitance/Z) + Y*(Base_Capacitance/Z) | |||
baseCnt[j+groupOfElements->baseOffset] = (tempCnt)+(baseCnt[j+groupOfElements->baseOffset]); | |||
} | |||
// delta counts are either 0, less than threshold, or greater than threshold | |||
// never negative | |||
else if(deltaCnt[j]<(groupOfElements->arrayPtr[j])->threshold && !(ctsStatusReg & PAST_EVNT)) | |||
{ //if delta counts is positive but less than threshold, | |||
switch ((ctsStatusReg & TRIDOI_FAST)) | |||
{ | |||
case TRIDOI_VSLOW://very slow | |||
if(deltaCnt[j] > 15) | |||
{ | |||
if(tempCnt < baseCnt[j+groupOfElements->baseOffset]) | |||
{ | |||
baseCnt[j+groupOfElements->baseOffset] = baseCnt[j+groupOfElements->baseOffset] - 1; | |||
} | |||
else | |||
{ | |||
baseCnt[j+groupOfElements->baseOffset] = baseCnt[j+groupOfElements->baseOffset] + 1; | |||
} | |||
} | |||
tempCnt = 0; | |||
break; | |||
case TRIDOI_SLOW://slow | |||
if(tempCnt < baseCnt[j+groupOfElements->baseOffset]) | |||
{ | |||
baseCnt[j+groupOfElements->baseOffset] = baseCnt[j+groupOfElements->baseOffset] - 1; | |||
} | |||
else | |||
{ | |||
baseCnt[j+groupOfElements->baseOffset] = baseCnt[j+groupOfElements->baseOffset] + 1; | |||
} | |||
tempCnt = 0; | |||
break; | |||
case TRIDOI_MED://medium | |||
tempCnt = tempCnt/4; | |||
baseCnt[j+groupOfElements->baseOffset] = 3*(baseCnt[j+groupOfElements->baseOffset]/4); | |||
break; | |||
case TRIDOI_FAST://fast | |||
tempCnt = tempCnt/2; | |||
baseCnt[j+groupOfElements->baseOffset] = (baseCnt[j+groupOfElements->baseOffset]/2); | |||
break; | |||
} | |||
// set X, Y & Z, then perform calculation for baseline tracking: | |||
// Base_Capacitance = X*(Measured_Capacitance/Z) + Y*(Base_Capacitance/Z) | |||
baseCnt[j+groupOfElements->baseOffset] = (tempCnt)+(baseCnt[j+groupOfElements->baseOffset]); | |||
} | |||
//if delta counts above the threshold, event has occurred | |||
else if(deltaCnt[j]>=(groupOfElements->arrayPtr[j])->threshold) | |||
{ | |||
ctsStatusReg |= EVNT; | |||
ctsStatusReg |= PAST_EVNT; | |||
} | |||
}// end of for-loop | |||
if(!(ctsStatusReg & EVNT)) | |||
{ | |||
ctsStatusReg &= ~PAST_EVNT; | |||
} | |||
} | |||
/***************************************************************************//** | |||
* @brief Determine if a button is being pressed | |||
* @param groupOfElements Pointer to button to be scanned | |||
* @return result Indication if button is (1) or is not (0) being pressed | |||
******************************************************************************/ | |||
uint8_t TI_CAPT_Button(const struct Sensor * groupOfElements) | |||
{ | |||
uint8_t result = 0; | |||
#ifndef RAM_FOR_FLASH | |||
uint16_t *measCnt; | |||
measCnt = (uint16_t *)malloc(groupOfElements->numElements * sizeof(uint16_t)); | |||
if(measCnt ==0) | |||
{ | |||
while(1); | |||
} | |||
#endif | |||
TI_CAPT_Custom(groupOfElements, measCnt); | |||
#ifndef RAM_FOR_FLASH | |||
free(measCnt); | |||
#endif | |||
if(ctsStatusReg & EVNT) | |||
{ | |||
result = 1; | |||
} | |||
return result; | |||
} | |||
/***************************************************************************//** | |||
* @brief Determine which button if any is being pressed | |||
* @param groupOfElements Pointer to buttons to be scanned | |||
* @return result pointer to element (button) being pressed or 0 none | |||
******************************************************************************/ | |||
const struct Element *TI_CAPT_Buttons(const struct Sensor *groupOfElements) | |||
{ | |||
uint8_t index; | |||
#ifndef RAM_FOR_FLASH | |||
uint16_t *measCnt; | |||
measCnt = (uint16_t *)malloc(groupOfElements->numElements * sizeof(uint16_t)); | |||
if(measCnt ==0) | |||
{ | |||
while(1); | |||
} | |||
#endif | |||
TI_CAPT_Custom(groupOfElements, measCnt); | |||
if(ctsStatusReg & EVNT) | |||
{ | |||
index = Dominant_Element(groupOfElements, measCnt); | |||
//ctsStatusReg &= ~EVNT; | |||
index++; | |||
} | |||
else | |||
{ | |||
index = 0; | |||
} | |||
#ifndef RAM_FOR_FLASH | |||
free(measCnt); | |||
#endif | |||
if(index) | |||
{ | |||
return groupOfElements->arrayPtr[index-1]; | |||
} | |||
return 0; | |||
} | |||
#ifdef SLIDER | |||
/***************************************************************************//** | |||
* @brief Determine the position on a slider | |||
* @param groupOfElements Pointer to slider | |||
* @return result position on slider or illegal value if no touch | |||
******************************************************************************/ | |||
uint16_t TI_CAPT_Slider(const struct Sensor* groupOfElements) | |||
{ | |||
uint8_t index; | |||
int16_t position; | |||
// allocate memory for measurement | |||
#ifndef RAM_FOR_FLASH | |||
uint16_t *measCnt; | |||
measCnt = (uint16_t *)malloc(groupOfElements->numElements * sizeof(uint16_t)); | |||
if(measCnt ==0) | |||
{ | |||
while(1); | |||
} | |||
#endif | |||
position = ILLEGAL_SLIDER_WHEEL_POSITION; | |||
//make measurement | |||
TI_CAPT_Custom(groupOfElements, measCnt); | |||
// Use EVNT flag to determine if slider was touched. | |||
// The EVNT flag is a global variable and managed within the TI_CAPT_Custom function. | |||
if(ctsStatusReg & EVNT) | |||
{ | |||
index = Dominant_Element(groupOfElements, &measCnt[0]); | |||
// The index represents the element within the array with the highest return. | |||
if(index == 0) | |||
{ | |||
// Special case of 1st element in slider, add 1st, last, and 2nd | |||
position = measCnt[0] + measCnt[1]; | |||
} | |||
else if(index == (groupOfElements->numElements -1)) | |||
{ | |||
// Special case of Last element in slider, add last, 1st, and 2nd to last | |||
position = measCnt[groupOfElements->numElements -1] + measCnt[groupOfElements->numElements -2]; | |||
} | |||
else | |||
{ | |||
position = measCnt[index] + measCnt[index+1] + measCnt[index-1]; | |||
} | |||
// Determine if sensor threshold criteria is met | |||
if(position > groupOfElements->sensorThreshold) | |||
{ | |||
// calculate position | |||
position = index*(groupOfElements->points/groupOfElements->numElements); | |||
position += (groupOfElements->points/groupOfElements->numElements)/2; | |||
if(index == 0) | |||
{ | |||
// Special case of 1st element in slider, which only has one | |||
// neighbor, measCnt[1]. measCnt is limited to maxResponse | |||
// within dominantElement function | |||
if(measCnt[1]) | |||
{ | |||
position += (measCnt[1]*(groupOfElements->points/groupOfElements->numElements))/100; | |||
} | |||
else | |||
{ | |||
position = (measCnt[0]*(groupOfElements->points/groupOfElements->numElements)/2)/100; | |||
} | |||
} | |||
else if(index == (groupOfElements->numElements -1)) | |||
{ | |||
// Special case of Last element in slider, which only has one | |||
// neighbor, measCnt[x-1] or measCnt[numElements-1] | |||
if(measCnt[index-1]) | |||
{ | |||
position -= (measCnt[index-1]*(groupOfElements->points/groupOfElements->numElements))/100; | |||
} | |||
else | |||
{ | |||
position = groupOfElements->points; | |||
position -= (measCnt[index]*(groupOfElements->points/groupOfElements->numElements)/2)/100; | |||
} | |||
} | |||
else | |||
{ | |||
position += (measCnt[index+1]*(groupOfElements->points/groupOfElements->numElements))/100; | |||
position -= (measCnt[index-1]*(groupOfElements->points/groupOfElements->numElements))/100; | |||
} | |||
if((position > groupOfElements->points) || (position < 0)) | |||
{ | |||
position = ILLEGAL_SLIDER_WHEEL_POSITION; | |||
} | |||
} | |||
else | |||
{ | |||
position = ILLEGAL_SLIDER_WHEEL_POSITION; | |||
} | |||
} | |||
#ifndef RAM_FOR_FLASH | |||
free(measCnt); | |||
#endif | |||
return position; | |||
} | |||
#endif | |||
#ifdef WHEEL | |||
/***************************************************************************//** | |||
* @brief Determine the position on a wheel | |||
* @param groupOfElements Pointer to wheel | |||
* @return result position on wheel or illegal value if no touch | |||
******************************************************************************/ | |||
uint16_t TI_CAPT_Wheel(const struct Sensor* groupOfElements) | |||
{ | |||
uint8_t index; | |||
int16_t position; | |||
// allocate memory for measurement | |||
#ifndef RAM_FOR_FLASH | |||
uint16_t *measCnt; | |||
measCnt = (uint16_t *)malloc(groupOfElements->numElements * sizeof(uint16_t)); | |||
if(measCnt ==0) | |||
{ | |||
while(1); | |||
} | |||
#endif | |||
position = ILLEGAL_SLIDER_WHEEL_POSITION; | |||
//make measurement | |||
TI_CAPT_Custom(groupOfElements, measCnt); | |||
// Translate the EVNT flag from an element level EVNT to a sensor level EVNT. | |||
// The sensor must read at least 75% cumulative response before indicating a | |||
// touch. | |||
if(ctsStatusReg & EVNT) | |||
{ | |||
index = Dominant_Element(groupOfElements, &measCnt[0]); | |||
// The index represents the element within the array with the highest return. | |||
// | |||
if(index == 0) | |||
{ | |||
// Special case of 1st element in slider, add 1st, last, and 2nd | |||
position = measCnt[0] + measCnt[groupOfElements->numElements -1] + measCnt[1]; | |||
} | |||
else if(index == (groupOfElements->numElements -1)) | |||
{ | |||
// Special case of Last element in slider, add last, 1st, and 2nd to last | |||
position = measCnt[index] + measCnt[0] + measCnt[index-1]; | |||
} | |||
else | |||
{ | |||
position = measCnt[index] + measCnt[index+1] + measCnt[index-1]; | |||
} | |||
if(position > groupOfElements->sensorThreshold) | |||
{ | |||
//index = Dominant_Element(groupOfElements, &measCnt[0]); | |||
// The index represents the element within the array with the highest return. | |||
// | |||
position = index*(groupOfElements->points/groupOfElements->numElements); | |||
position += (groupOfElements->points/groupOfElements->numElements)/2; | |||
if(index == 0) | |||
{ | |||
// Special case of 1st element in slider, which only has one neighbor, measCnt[1] | |||
// measCnt is limited to maxResponse within dominantElement function | |||
position += (measCnt[1]*(groupOfElements->points/groupOfElements->numElements))/100; | |||
position -= (measCnt[groupOfElements->numElements -1]*(groupOfElements->points/groupOfElements->numElements))/100; | |||
if(position < 0) | |||
{ | |||
position = position + (int16_t)groupOfElements->points; | |||
} | |||
} | |||
else if(index == (groupOfElements->numElements -1)) | |||
{ | |||
// Special case of Last element in slider, which only has one neighbor, measCnt[x-1] or measCnt[numElements-1] | |||
// measCnt is limited to maxResponse within dominantElement function | |||
position += (measCnt[0]*(groupOfElements->points/groupOfElements->numElements))/100; | |||
position -= (measCnt[index-1]*(groupOfElements->points/groupOfElements->numElements))/100; | |||
if(position > (groupOfElements->points -1)) | |||
{ | |||
position = position - (int16_t)groupOfElements->points; | |||
} | |||
} | |||
else | |||
{ | |||
position += (measCnt[index+1]*(groupOfElements->points/groupOfElements->numElements))/100; | |||
position -= (measCnt[index-1]*(groupOfElements->points/groupOfElements->numElements))/100; | |||
} | |||
if((position > groupOfElements->points) || position < 0) | |||
{ | |||
position = ILLEGAL_SLIDER_WHEEL_POSITION; | |||
} | |||
} | |||
else | |||
{ | |||
position = ILLEGAL_SLIDER_WHEEL_POSITION; | |||
} | |||
} | |||
#ifndef RAM_FOR_FLASH | |||
free(measCnt); | |||
#endif | |||
return position; | |||
} | |||
#endif | |||
/***************************************************************************//** | |||
* @} | |||
******************************************************************************/ | |||
/***************************************************************************//** | |||
* @defgroup CTS_support | |||
* @ingroup CTS_API | |||
******************************************************************************/ | |||
/***************************************************************************//** | |||
* @ingroup CTS_support | |||
* @brief Determine which element within a sensor has the largest response | |||
* | |||
* This function compares and normalizes the change in capacitance to | |||
* determine which element has the dominant response. The deltaCnt | |||
* values for each element that exceed the threshold are also | |||
* converted from a 'raw' measurement to a percentage of the maximum | |||
* response. | |||
* @param groupOfElements Pointer to buttons to be scanned | |||
* @param deltaCnt Address to where the measurements are to be written | |||
* @return result index to the element which is dominant | |||
******************************************************************************/ | |||
uint8_t Dominant_Element(const struct Sensor* groupOfElements, uint16_t* deltaCnt) | |||
{ | |||
uint8_t i; | |||
uint16_t percentDelta=0; | |||
uint8_t dominantElement=0; | |||
for(i=0;i<groupOfElements->numElements;i++) | |||
{ | |||
if(deltaCnt[i]>=(groupOfElements->arrayPtr[i])->threshold) | |||
{ | |||
if(deltaCnt[i] > ((groupOfElements->arrayPtr[i])->maxResponse)) | |||
{ | |||
deltaCnt[i] = (groupOfElements->arrayPtr[i])->maxResponse; | |||
// limit response to the maximum | |||
} | |||
// (maxResponse - threshold) cannot exceed 655 | |||
// 100*(delta - threshold) / (maxResponse - threshold) | |||
deltaCnt[i] = (100*(deltaCnt[i]-(groupOfElements->arrayPtr[i])->threshold))/((groupOfElements->arrayPtr[i])->maxResponse - (groupOfElements->arrayPtr[i])->threshold); | |||
if(deltaCnt[i] > percentDelta) | |||
{ | |||
//update percentDelta | |||
percentDelta = deltaCnt[i]; | |||
dominantElement = i; | |||
} | |||
} | |||
else | |||
{ | |||
deltaCnt[i] = 0; | |||
} | |||
} // end for loop | |||
return dominantElement; | |||
} | |||
#endif |
@ -0,0 +1,130 @@ | |||
/******************************************************************************* | |||
* | |||
* CTS_HAL.h | |||
* | |||
* Redistribution and use in source and binary forms, with or without | |||
* modification, are permitted provided that the following conditions | |||
* are met: | |||
* | |||
* Redistributions of source code must retain the above copyright | |||
* notice, this list of conditions and the following disclaimer. | |||
* | |||
* Redistributions in binary form must reproduce the above copyright | |||
* notice, this list of conditions and the following disclaimer in the | |||
* documentation and/or other materials provided with the | |||
* distribution. | |||
* | |||
* Neither the name of Texas Instruments Incorporated nor the names of | |||
* its contributors may be used to endorse or promote products derived | |||
* from this software without specific prior written permission. | |||
* | |||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* | |||
******************************************************************************/ | |||
/***************************************************************************//** | |||
* @file CTS_Layer.h | |||
* | |||
* @brief | |||
* | |||
* @par Project: | |||
* MSP430 Capacitive Touch Library | |||
* | |||
* @par Developed using: | |||
* IAR Version : 5.10.6 [Kickstart] (5.10.6.30180) | |||
* CCS Version : 4.2.1.00004, w/support for GCC extensions (--gcc) | |||
* | |||
* | |||
* @version 1.0.0 Initial Release | |||
* | |||
* @par Supported API Calls: | |||
* - TI_CAPT_Init_Baseline() | |||
* - TI_CAPT_Update_Baseline() | |||
* - TI_CAPT_Reset_Tracking() | |||
* - TI_CAPT_Update_Tracking_DOI() | |||
* - TI_CAPT_Update_Tracking_Rate() | |||
* - TI_CAPT_Update_Baseline() | |||
* - TI_CAPT_Raw() | |||
* - TI_CAPT_Custom() | |||
* - TI_CAPT_Button() | |||
* - TI_CAPT_Buttons() | |||
* - TI_CAPT_Slider() | |||
* - TI_CAPT_Wheel() | |||
******************************************************************************/ | |||
#ifndef CTS_LAYER | |||
#define CTS_LAYER | |||
#include "CTS_HAL.h" | |||
//! \name Status Register Definitions | |||
//! @{ | |||
// | |||
//! (bit 0): Event Flag: this indicates that a threshold crossing occured | |||
#define EVNT 0x01 | |||
//! (bit 1): Direction of Interest: This indicates if the measurement is looking | |||
//! for an increasing (set) or decreasing (clr) capacitance. | |||
#define DOI_MASK 0x02 | |||
#define DOI_INC 0x02 | |||
#define DOI_DEC 0x00 | |||
//! (bit 2): Past Event Flag: this indicates that a prior element within the | |||
//! sensor group has detected a threshold crossing | |||
#define PAST_EVNT 0x04 | |||
//! (bits 4-5): Tracking Rate in Direction of Interest: this indicates at what | |||
//! rate the baseline will adjust to the current measurement when the | |||
//! when the measurement is changing in the direction of interst but does not | |||
//! result in a threshold crossing: | |||
//! \n Very Slow | |||
//! \n Slow | |||
//! \n Medium | |||
//! \n Fast | |||
#define TRIDOI_VSLOW 0x00 | |||
#define TRIDOI_SLOW 0x10 | |||
#define TRIDOI_MED 0x20 | |||
#define TRIDOI_FAST 0x30 | |||
//! (bits 5-6): Tracking Rate Against Direction of Interest: this indicates at | |||
//! what rate the baseline will adjust to the current measurement when the | |||
//! when the measurement is changing against the direction of interst: | |||
//! \n Fast | |||
//! \n Medium | |||
//! \n Slow | |||
//! \n Very Slow | |||
#define TRADOI_FAST 0x00 | |||
#define TRADOI_MED 0x40 | |||
#define TRADOI_SLOW 0x80 | |||
#define TRADOI_VSLOW 0xC0 | |||
//! @} | |||
// API Calls | |||
void TI_CAPT_Init_Baseline(const struct Sensor*); | |||
void TI_CAPT_Update_Baseline(const struct Sensor*, uint8_t); | |||
void TI_CAPT_Reset_Tracking(void); | |||
void TI_CAPT_Update_Tracking_DOI(uint8_t); | |||
void TI_CAPT_Update_Tracking_Rate(uint8_t); | |||
void TI_CAPT_Raw(const struct Sensor*, uint16_t*); | |||
void TI_CAPT_Custom(const struct Sensor *, uint16_t*); | |||
uint8_t TI_CAPT_Button(const struct Sensor *); | |||
const struct Element * TI_CAPT_Buttons(const struct Sensor *); | |||
uint16_t TI_CAPT_Slider(const struct Sensor*); | |||
uint16_t TI_CAPT_Wheel(const struct Sensor*); | |||
// Internal Calls | |||
uint8_t Dominant_Element (const struct Sensor*, uint16_t*); | |||
#endif |
@ -0,0 +1,181 @@ | |||
/******************************************************************************* | |||
* | |||
* structure.c | |||
* | |||
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ | |||
* | |||
* Redistribution and use in source and binary forms, with or without | |||
* modification, are permitted provided that the following conditions | |||
* are met: | |||
* | |||
* Redistributions of source code must retain the above copyright | |||
* notice, this list of conditions and the following disclaimer. | |||
* | |||
* Redistributions in binary form must reproduce the above copyright | |||
* notice, this list of conditions and the following disclaimer in the | |||
* documentation and/or other materials provided with the | |||
* distribution. | |||
* | |||
* Neither the name of Texas Instruments Incorporated nor the names of | |||
* its contributors may be used to endorse or promote products derived | |||
* from this software without specific prior written permission. | |||
* | |||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* | |||
* | |||
******************************************************************************/ | |||
//****************************************************************************** | |||
// structure.c | |||
// | |||
// 4 elements configured as a wheel. | |||
// 1 element configured as a button. [Center Button] | |||
// 1 element configured as a proximity sensor. | |||
// This file contains the structure names and the variable assingments. | |||
// | |||
// Revision 1.00 Baseline | |||
// Developed with IAR 5.10.4 [Kickstart] (5.10.4.30168) | |||
// | |||
// 09/24/10 Rev1.00 Pre-Alpha Version. Added "max_cnts" slider variable in | |||
// CT_Handler object. | |||
// | |||
// 09/29/10 0.02 Update naming convention for elements and sensors. | |||
// | |||
// 10/11/10 0.03 Update | |||
// | |||
//****************************************************************************** | |||
#include "structure.h" | |||
//PinOsc Volume down P2.2 | |||
const struct Element volume_down = { | |||
.inputPxselRegister = (uint8_t *)&P2SEL, | |||
.inputPxsel2Register = (uint8_t *)&P2SEL2, | |||
.inputBits = BIT2, | |||
// measured for a 1Mhz SMCLK | |||
.maxResponse = 121+655, // actual measure was 980 | |||
.threshold = 121 | |||
}; | |||
//PinOsc forward right P2.3 | |||
const struct Element right = { | |||
.inputPxselRegister = (uint8_t *)&P2SEL, | |||
.inputPxsel2Register = (uint8_t *)&P2SEL2, | |||
.inputBits = BIT3, | |||
// 1Mhz SMCLK | |||
.maxResponse = 113+655, | |||
.threshold = 113 | |||
}; | |||
//PinOsc Volume up, P2.4 | |||
const struct Element volume_up = { | |||
.inputPxselRegister = (uint8_t *)&P2SEL, | |||
.inputPxsel2Register = (uint8_t *)&P2SEL2, | |||
.inputBits = BIT4, | |||
// 1Mhz SMCLK | |||
.maxResponse = 118+655, | |||
.threshold = 118 | |||
}; | |||
//PinOsc reverse left P2.1 | |||
const struct Element left = { | |||
.inputPxselRegister = (uint8_t *)&P2SEL, | |||
.inputPxsel2Register = (uint8_t *)&P2SEL2, | |||
.inputBits = BIT1, | |||
// 1Mhz SMCLK | |||
.maxResponse = 111+655, | |||
.threshold = 111 | |||
}; | |||
//PinOsc Wheel: middle button P2.5 | |||
const struct Element middle_element = { | |||
.inputPxselRegister = (uint8_t *)&P2SEL, | |||
.inputPxsel2Register = (uint8_t *)&P2SEL2, | |||
.inputBits = BIT5, | |||
// When using an abstracted function to measure the element | |||
// the 100*(maxResponse - threshold) < 0xFFFF | |||
// ie maxResponse - threshold < 655 | |||
.maxResponse = 350+655, | |||
.threshold = 350 | |||
}; | |||
//PinOsc proximity: P2.0 | |||
const struct Element proximity_element = { | |||
.inputPxselRegister = (uint8_t *)&P2SEL, | |||
.inputPxsel2Register = (uint8_t *)&P2SEL2, | |||
.inputBits = BIT0, | |||
.maxResponse = 200, | |||
.threshold = 130 | |||
}; | |||
//*** CAP TOUCH HANDLER *******************************************************/ | |||
// This defines the grouping of sensors, the method to measure change in | |||
// capacitance, and the function of the group | |||
const struct Sensor wheel = | |||
{ | |||
//.halDefinition = fRO_PINOSC_TA0_SW, | |||
.halDefinition = RO_PINOSC_TA0_WDTp, | |||
.numElements = 4, | |||
.points = 64, | |||
.sensorThreshold = 75, | |||
.baseOffset = 0, | |||
// Pointer to elements | |||
.arrayPtr[0] = &volume_up, // point to first element | |||
.arrayPtr[1] = &right, | |||
.arrayPtr[2] = &volume_down, | |||
.arrayPtr[3] = &left, | |||
// Timer Information | |||
//.measGateSource= GATE_WDT_SMCLK, // 0->SMCLK, 1-> ACLK | |||
//.accumulationCycles= WDTp_GATE_32768 //32768 | |||
.accumulationCycles= WDTp_GATE_8192 // 8192 | |||
//.accumulationCycles= WDTp_GATE_512 //512 | |||
//.accumulationCycles= WDTp_GATE_64 //64 | |||
//.accumulationCycles = 32 | |||
}; | |||
const struct Sensor middle_button = | |||
{ | |||
.halDefinition = RO_PINOSC_TA0_WDTp, | |||
.numElements = 1, | |||
.baseOffset = 4, | |||
// Pointer to elements | |||
.arrayPtr[0] = &middle_element, // point to first element | |||
// Timer Information | |||
.measGateSource= GATE_WDT_SMCLK, // 0->SMCLK, 1-> ACLK | |||
//.accumulationCycles= WDTp_GATE_32768 //32768 | |||
.accumulationCycles= WDTp_GATE_8192 // 8192 | |||
//.accumulationCycles= WDTp_GATE_512 //512 | |||
//.accumulationCycles= WDTp_GATE_64 //64 | |||
}; | |||
const struct Sensor proximity_sensor = | |||
{ | |||
.halDefinition = RO_PINOSC_TA0_WDTp, | |||
.numElements = 1, | |||
.baseOffset = 5, | |||
// Pointer to elements | |||
.arrayPtr[0] = &proximity_element, // point to first element | |||
// Timer Information | |||
.measGateSource= GATE_WDT_SMCLK, // 0->SMCLK, 1-> ACLK | |||
//.accumulationCycles= WDTp_GATE_32768 //32768 | |||
.accumulationCycles= WDTp_GATE_8192 // 8192 | |||
//.accumulationCycles= WDTp_GATE_512 //512 | |||
//.accumulationCycles= WDTp_GATE_64 //64 | |||
}; |
@ -0,0 +1,421 @@ | |||
#ifndef CAP_TOUCH_STRUCTURE | |||
#define CAP_TOUCH_STRUCTURE | |||
//****************************************************************************** | |||
// structure.h | |||
// | |||
// Launch Pad MSP430G2452 | |||
// 4 element wheel | |||
// middle button | |||
// proximity sensor | |||
// | |||
// | |||
// This file contains both application dependent and independent pieces. The | |||
// dependent piece must be updated along with structure.c, and carries the | |||
// naming conventions found in structure.c to the rest of the library. | |||
// | |||
// | |||
// | |||
// | |||
// Revision 0.06 Updated with case and format from Stye Guide | |||
// | |||
//****************************************************************************** | |||
//****************************************************************************** | |||
//****************************************************************************** | |||
// The following elements need to be configured by the user. | |||
//****************************************************************************** | |||
//#include "msp430.h" | |||
#include "msp430g2452.h" | |||
#include <stdint.h> | |||
/* Public Globals */ | |||
extern const struct Element volume_down; // structure containing elements for | |||
extern const struct Element volume_up; // | |||
extern const struct Element right; // | |||
extern const struct Element left; // | |||
extern const struct Element middle_element; // | |||
extern const struct Element proximity_element; // | |||
extern const struct Sensor wheel; | |||
extern const struct Sensor middle_button; // structure of info for a given | |||
extern const struct Sensor proximity_sensor; // structure of info for a given | |||
//****** RAM ALLOCATION ******************************************************** | |||
// TOTAL_NUMBER_OF_ELEMENTS defines the total number of elements used, even if | |||
// they are going to be segmented into seperate groups. | |||
// If the RAM_FOR_FLASH definition is removed, then the appropriate HEAP size | |||
// must be allocated. 2 bytes * MAXIMUM_NUMBER_OF_ELEMENTS_PER_SENSOR + 2 bytes | |||
// of overhead. | |||
#define TOTAL_NUMBER_OF_ELEMENTS 6 | |||
#define RAM_FOR_FLASH | |||
//****** Structure Array Definition ******************************************** | |||
// This defines the array size in the sensor strucure. In the event that | |||
// RAM_FOR_FLASH is defined, then this also defines the amount of RAM space | |||
// allocated (global variable) for computations. | |||
#define MAXIMUM_NUMBER_OF_ELEMENTS_PER_SENSOR 4 | |||
//****** Choosing a Measurement Method **************************************** | |||
// These variables are references to the definitions found in structure.c and | |||
// must be generated per the application. | |||
// possible values for the method field | |||
// OSCILLATOR DEFINITIONS | |||
//#define RO_COMPAp_TA0_WDTp 64 | |||
#define RO_PINOSC_TA0_WDTp 65 | |||
//#define RO_PINOSC_TA0 66 | |||
//#define RO_COMPAp_TA1_WDTp 67 | |||
//#define RO_COMPB_TA0_WDTA 68 | |||
//#define RO_COMPB_TA1_WDTA 69 | |||
//#define RO_COMPAp_TA0_SW 70 | |||
//#define RO_PINOSC_TA0_SW 71 | |||
// RC DEFINITIONS | |||
//#define RC_PAIR_TA0 01 | |||
//#define RC_PAIR_TA1 02 | |||
//#define RC_PAIR_TD0 03 | |||
// FAST RO DEFINITIONS | |||
//#define fRO_PINOSC_TA0_SW 25 | |||
//#define fRO_COMPB_TA0_TA1 26 | |||
//#define fRO_COMPB_TA0_TD0 27 | |||
//****** WHEEL and SLIDER ****************************************************** | |||
// Are wheel or slider representations used? | |||
//#define SLIDER | |||
#define ILLEGAL_SLIDER_WHEEL_POSITION 0xFFFF | |||
#define WHEEL | |||
//****************************************************************************** | |||
// End of user configuration section. | |||
//****************************************************************************** | |||
//****************************************************************************** | |||
//****************************************************************************** | |||
//possible timer source clock dividers, different from clock module dividers | |||
#define TIMER_TxCLK 0x0000 // ID_0, IDX_0 | |||
#define TIMER_ACLK 0x0100 | |||
#define TIMER_SMCLK 0x0200 | |||
#define TIMER_INCLK 0x0300 | |||
#define TIMER_SOURCE_DIV_0 0x0000 | |||
#define TIMER_SOURCE_DIV_1 0x0040 | |||
#define TIMER_SOURCE_DIV_2 0x0080 | |||
#define TIMER_SOURCE_DIV_3 0x00C0 | |||
#define GATE_WDT_ACLK 0x0004 | |||
#define GATE_WDT_SMCLK 0x0000 | |||
#define WDTp_GATE_32768 0x0000 // watchdog source/32768 | |||
#define WDTp_GATE_8192 0x0001 // watchdog source/8192 | |||
#define WDTp_GATE_512 0x0002 // watchdog source/512 | |||
#define WDTp_GATE_64 0x0003 // watchdog source/64 | |||
#define WDTA_GATE_2G 0x0000 // watchdog source/2G | |||
#define WDTA_GATE_128M 0x0001 // watchdog source/128M | |||
#define WDTA_GATE_8192K 0x0002 // watchdog source/8192K | |||
#define WDTA_GATE_512K 0x0003 // watchdog source/512K | |||
#define WDTA_GATE_32768 0x0004 // watchdog source/32768 | |||
#define WDTA_GATE_8192 0x0005 // watchdog source/8192 | |||
#define WDTA_GATE_512 0x0006 // watchdog source/512 | |||
#define WDTA_GATE_64 0x0007 // watchdog source/64 | |||
// The below variables are used to excluded portions of code not needed by | |||
// the method chosen by the user. Uncomment the type used prior to compilation. | |||
// Multiple types can be chosen as needed. | |||
// What Method(s) are used in this application? | |||
#ifdef RO_COMPAp_TA0_WDTp | |||
#define RO_TYPE | |||
#define RO_COMPAp_TYPE | |||
#define WDT_GATE | |||
//what devices have Pxsel2 ?? | |||
// msp430f2112, 2122, 2132 | |||
// msp430G2112, G2212, G2312, G2412, G2152, G2252, G2352, G2452 | |||
// SEL2REGISTER | |||
#ifdef __MSP430F2112 | |||
#define SEL2REGISTER | |||
#endif | |||
#ifdef __MSP430F2122 | |||
#define SEL2REGISTER | |||
#endif | |||
#ifdef __MSP430F2132 | |||
#define SEL2REGISTER | |||
#endif | |||
#ifdef __MSP430G2112 | |||
#define SEL2REGISTER | |||
#endif | |||
#ifdef __MSP430G2212 | |||
#define SEL2REGISTER | |||
#endif | |||
#ifdef __MSP430G2312 | |||
#define SEL2REGISTER | |||
#endif | |||
#ifdef __MSP430G2412 | |||
#define SEL2REGISTER | |||
#endif | |||
#ifdef __MSP430G2152 | |||
#define SEL2REGISTER | |||
#endif | |||
#ifdef __MSP430G2252 | |||
#define SEL2REGISTER | |||
#endif | |||
#ifdef __MSP430G2352 | |||
#define SEL2REGISTER | |||
#endif | |||
#ifdef __MSP430G2452 | |||
#define SEL2REGISTER | |||
#endif | |||
#endif | |||
#ifdef RO_PINOSC_TA0_WDTp | |||
#define RO_TYPE | |||
#define RO_PINOSC_TYPE | |||
#define WDT_GATE | |||
#endif | |||
#ifdef RO_PINOSC_TA0 | |||
#define RO_TYPE | |||
#define RO_PINOSC_TYPE | |||
#define ACCUMULATE_TYPE | |||
#endif | |||
#ifdef RO_COMPAp_TA1_WDTp | |||
#define RO_TYPE | |||
#define RO_COMPAp_TYPE | |||
#define WDT_GATE | |||
#endif | |||
#ifdef RO_COMPB_TA0_WDTA | |||
#define RO_TYPE | |||
#define RO_COMPB_TYPE | |||
#define WDT_GATE | |||
#endif | |||
#ifdef RO_COMPB_TA1_WDTA | |||
#define RO_TYPE | |||
#define RO_COMPB_TYPE | |||
#define WDT_GATE | |||
#endif | |||
#ifdef RO_COMPAp_TA0_SW | |||
#define RO_TYPE | |||
#define RO_COMPAp_TYPE | |||
#endif | |||
#ifdef RO_PINOSC_TA0_SW | |||
#define RO_TYPE | |||
#define RO_PINOSC_TYPE | |||
#endif | |||
#ifdef RC_PAIR_TA0 | |||
#define RC_TYPE | |||
#define RC_PAIR_TYPE | |||
#define ACCUMULATE_TYPE | |||
#endif | |||
#ifdef RC_PAIR_TA1 | |||
#define RC_TYPE | |||
#define RC_PAIR_TYPE | |||
#endif | |||
#ifdef RC_PAIR_TD0 | |||
#define RC_TYPE | |||
#define RC_PAIR_TYPE | |||
#endif | |||
#ifdef fRO_PINOSC_TA0_SW | |||
#define RO_TYPE | |||
#define RO_PINOSC_TYPE | |||
#define ACCUMULATE_TYPE | |||
#endif | |||
#ifdef fRO_COMPB_TA0_TA1 | |||
#define RO_TYPE | |||
#define FAST_SCAN_RO_COMP_TYPE | |||
#endif | |||
#ifdef fRO_COMPB_TA0_TD0 | |||
#define RO_TYPE | |||
#define FAST_SCAN_RO_COMP_TYPE | |||
#endif | |||
#ifdef SLIDER | |||
#define SLIDER_WHEEL | |||
#endif | |||
#ifdef WHEEL | |||
#define SLIDER_WHEEL | |||
#endif | |||
#define RO_MASK 0xC0 // 1100 0000 | |||
#define RC_FRO_MASK 0x3F // 0011 1111 | |||
//****************************************************************************** | |||
// The sensor structure identifies port or comparator input definitions for each | |||
// sensor. | |||
//****************************************************************************** | |||
struct Element{ | |||
#ifdef RO_PINOSC_TYPE | |||
// These register address definitions are needed for each sensor only | |||
// when using the PinOsc method | |||
volatile uint8_t *inputPxselRegister; // PinOsc: port selection address | |||
volatile uint8_t *inputPxsel2Register; // PinOsc: port selection 2 address | |||
#endif | |||
#ifdef RC_PAIR_TYPE | |||
// these fields are specific to the RC type. | |||
uint8_t *inputPxoutRegister; // RC: port output address: PxOUT | |||
volatile uint8_t *inputPxinRegister; // RC: port input address: PxIN | |||
uint8_t *inputPxdirRegister; // RC+PinOsc: port direction address | |||
uint8_t *referencePxoutRegister;// RC: port output address: PxOUT | |||
uint8_t *referencePxdirRegister;// RC: port direction address: PxDIR | |||
uint8_t referenceBits; // RC: port bit definition | |||
#endif | |||
uint16_t inputBits; // Comp_RO+FastRO+RC+PinOsc: bit | |||
// definition | |||
// | |||
// for comparator input bit | |||
// location in CACTL2 or CBCTL0 | |||
uint16_t threshold; // specific threshold for each button | |||
uint16_t maxResponse; // Special Case: Slider max counts | |||
}; | |||
//****************************************************************************** | |||
// The following structure definitons are application independent and are not | |||
// intended to be modified. | |||
// | |||
// The CT_handler 'groups' the sensor based upon function and capacitive | |||
// measurement method. | |||
//****************************************************************************** | |||
struct Sensor{ | |||
// the method acts as the switch to determine which HAL is called | |||
uint8_t halDefinition; // COMPARATOR_TYPE (RO), RC, etc | |||
// RO_COMPA, RO_COMPB, RO_PINOSC | |||
// RC_GPIO, RC_COMPA, RC_COMPB | |||
// FAST_SCAN_RO | |||
uint8_t numElements; // number of elements within group | |||
uint8_t baseOffset; // the offset within the global | |||
// base_cnt array | |||
struct Element const *arrayPtr[MAXIMUM_NUMBER_OF_ELEMENTS_PER_SENSOR]; | |||
// an array of pointers | |||
//****************************************************************************** | |||
// Reference structure definitions for comparator types, for the RC method the | |||
// reference is defined within the element. | |||
#ifdef RO_COMPAp_TYPE | |||
uint8_t * refPxoutRegister; // RO+FastRO: port output address | |||
uint8_t * refPxdirRegister; // RO+FastRO: port direction address | |||
uint8_t refBits; // RO+FastRO: port bit definition | |||
uint8_t * txclkDirRegister; // PxDIR | |||
uint8_t * txclkSelRegister; // PxSEL | |||
uint8_t txclkBits; // Bit field for register | |||
uint8_t *caoutDirRegister; // PxDIR | |||
uint8_t *caoutSelRegister; // PxSEL | |||
uint8_t caoutBits; // Bit field for register | |||
// This is only applicable to the RO_COMPAp_TYPE | |||
#ifdef SEL2REGISTER | |||
uint8_t *caoutSel2Register; | |||
uint8_t *txclkSel2Register; | |||
#endif | |||
uint8_t refCactl2Bits; // RO: CACTL2 input definition, | |||
// CA0 (P2CA0),CA1(P2CA4), | |||
// CA2(P2CA0+P2CA4) | |||
uint8_t capdBits; | |||
#endif | |||
#ifdef RO_COMPB_TYPE | |||
uint8_t *cboutTAxDirRegister; // CBOUT_TA0CLK | |||
uint8_t *cboutTAxSelRegister; // CBOUT_TA0CLK | |||
uint8_t cboutTAxBits; // Bit field for register | |||
uint16_t cbpdBits; | |||
#endif | |||
//***************************************************************************** | |||
// Timer definitions | |||
// The basic premise is to count a number of clock cycles within a time | |||
// period, where either the clock source or the timer period is a function | |||
// of the element capacitance. | |||
// | |||
// RC Method: | |||
// Period: accumulationCycles * charge and discharge time of RC | |||
// circuit where C is captouch element | |||
// | |||
// clock source: measGateSource/sourceScale | |||
// RO Method: | |||
// Period: accumulationCycles*measGateSource/sourceScale | |||
// (with WDT sourceScale = 1, accumulationCycles is WDT control | |||
// register settings) | |||
// | |||
// clock source: relaxation oscillator where freq is a function of C | |||
// | |||
// fRO Method: | |||
// Period: accumulationCycles * 1/freq, freq is a function of C | |||
// | |||
// clock source: measGateSource/sourceScale | |||
uint16_t measGateSource; // RC+FastRO: measurement timer source, | |||
// {ACLK, TACLK, SMCLK} | |||
// Comp_RO+PinOsc: gate timer source, | |||
// {ACLK, TACLK, SMCLK} | |||
uint16_t sourceScale; // Comp_RO+FastRO+PinOsc: gate timer, | |||
// TA/TB/TD, scale: 1,1/2,1/4,1/8 | |||
// RC+FastRO: measurement timer, TA/TB/TD | |||
// scale: 16, 8, 4, 2, 1, ½, ¼, 1/8 | |||
uint16_t accumulationCycles; | |||
//***************************************************************************** | |||
// Other definitions | |||
#ifdef SLIDER_WHEEL | |||
uint8_t points; // Special Case: Number of points | |||
// along slider or wheel | |||
uint8_t sensorThreshold; | |||
#endif | |||
}; | |||
//****************************************************************************** | |||
// The scheduler structure manages each handler group (CT_Handler object) using | |||
// one timer resource. | |||
// TBD | |||
//****************************************************************************** | |||
struct CT_scheduler{ | |||
void *callBacks; | |||
// pointer to function in the main application (can be an array of functions | |||
// if multiple groups). The order is important! The pointer here must point | |||
// to the first CT_Handler object! | |||
struct CT_Handler *handler; // order of this and *call_backs | |||
// must be the same. | |||
uint8_t Enable; // Each bit in this value will show | |||
// if the given group element | |||
// is being sheduled & measured. | |||
uint8_t delayTimer; // delay timer, {SW,WDT, TimerA, | |||
// TimerB, TimerD} | |||
uint8_t delayTimerSrc; // delay timer source, | |||
// {ACLK, TACLK, SMCLK} | |||
uint8_t delayTimerScale; // delay time scale (/1,/2,/4,/8) | |||
uint8_t delayTime; // wdt: delay {32768,8192,512,64} | |||
// RO+FastRO+PinOsc(TimerA,B,D): | |||
// delay time {257+x*256} | |||
}; | |||
#endif |
@ -0,0 +1,707 @@ | |||
<?xml version="1.0" encoding="iso-8859-1"?> | |||
<project> | |||
<fileVersion>2</fileVersion> | |||
<configuration> | |||
<name>Debug</name> | |||
<toolchain> | |||
<name>MSP430</name> | |||
</toolchain> | |||
<debug>1</debug> | |||
<settings> | |||
<name>C-SPY</name> | |||
<archiveVersion>4</archiveVersion> | |||
<data> | |||
<version>25</version> | |||
<wantNonLocal>1</wantNonLocal> | |||
<debug>1</debug> | |||
<option> | |||
<name>CInput</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>MacOverride</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>MacFile</name> | |||
<state></state> | |||
</option> | |||
<option> | |||
<name>IProcessor</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>GoToEnable</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>GoToName</name> | |||
<state>main</state> | |||
</option> | |||
<option> | |||
<name>DynDriver</name> | |||
<state>430FET</state> | |||
</option> | |||
<option> | |||
<name>dDllSlave</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>DdfFileSlave</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>DdfOverride</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>DdfFileName</name> | |||
<state>$TOOLKIT_DIR$\config\MSP430G2452.ddf</state> | |||
</option> | |||
<option> | |||
<name>ProcTMS</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>CExtraOptionsCheck</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>CExtraOptions</name> | |||
<state></state> | |||
</option> | |||
<option> | |||
<name>ProcMSP430X</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>CompilerDataModel</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>IVBASE</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>OCImagesSuppressCheck1</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>OCImagesPath1</name> | |||
<state></state> | |||
</option> | |||
<option> | |||
<name>OCImagesSuppressCheck2</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>OCImagesPath2</name> | |||
<state></state> | |||
</option> | |||
<option> | |||
<name>OCImagesSuppressCheck3</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>OCImagesPath3</name> | |||
<state></state> | |||
</option> | |||
<option> | |||
<name>CPUTAG</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>L092Mode</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>OCImagesOffset1</name> | |||
<state></state> | |||
</option> | |||
<option> | |||
<name>OCImagesOffset2</name> | |||
<state></state> | |||
</option> | |||
<option> | |||
<name>OCImagesOffset3</name> | |||
<state></state> | |||
</option> | |||
<option> | |||
<name>OCImagesUse1</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>OCImagesUse2</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>OCImagesUse3</name> | |||
<state>0</state> | |||
</option> | |||
</data> | |||
</settings> | |||
<settings> | |||
<name>430FET</name> | |||
<archiveVersion>1</archiveVersion> | |||
<data> | |||
<version>22</version> | |||
<wantNonLocal>1</wantNonLocal> | |||
<debug>1</debug> | |||
<option> | |||
<name>CFetMandatory</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>Erase</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>EMUVerifyDownloadP7</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>EraseOptionSlaveP7</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>ExitBreakpointP7</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>PutcharBreakpointP7</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>GetcharBreakpointP7</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>derivativeP7</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>ParallelPortP7</name> | |||
<version>0</version> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>TargetVoltage</name> | |||
<state>3.3</state> | |||
</option> | |||
<option> | |||
<name>AllowLockedFlashAccessP7</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>EMUAttach</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>AttachOptionSlave</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>CRadioProtocolType</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>CCRadioModuleTypeSlave</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>EEMLevel</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>DiasbleMemoryCache</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>NeedLockedFlashAccess</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>UsbComPort</name> | |||
<state>Automatic</state> | |||
</option> | |||
<option> | |||
<name>FetConnection</name> | |||
<version>2</version> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>SoftwareBreakpointEnable</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>RadioSoftwareBreakpointType</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>TargetSettlingtime</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>AllowAccessToBSL</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>OTargetVccTypeDefault</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>CCBetaDll</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>GPassword</name> | |||
<state></state> | |||
</option> | |||
<option> | |||
<name>DebugLPM5</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>LPM5Slave</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>CRadioAutoManualType</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>ExternalCodeDownload</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>CCVCCDefault</name> | |||
<state>1</state> | |||
</option> | |||
</data> | |||
</settings> | |||
<settings> | |||
<name>SIM430</name> | |||
<archiveVersion>1</archiveVersion> | |||
<data> | |||
<version>4</version> | |||
<wantNonLocal>1</wantNonLocal> | |||
<debug>1</debug> | |||
<option> | |||
<name>SimOddAddressCheckP7</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>CSimMandatory</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>derivativeSim</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>SimEnablePSP</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>SimPspOverrideConfig</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>SimPspConfigFile</name> | |||
<state>$TOOLKIT_DIR$\CONFIG\test.psp.config</state> | |||
</option> | |||
</data> | |||
</settings> | |||
<debuggerPlugins> | |||
<plugin> | |||
<file>$TOOLKIT_DIR$\plugins\Lcd\lcd.ewplugin</file> | |||
<loadFlag>1</loadFlag> | |||
</plugin> | |||
<plugin> | |||
<file>$TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin</file> | |||
<loadFlag>0</loadFlag> | |||
</plugin> | |||
<plugin> | |||
<file>$TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin</file> | |||
<loadFlag>0</loadFlag> | |||
</plugin> | |||
<plugin> | |||
<file>$TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin</file> | |||
<loadFlag>0</loadFlag> | |||
</plugin> | |||
<plugin> | |||
<file>$TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin</file> | |||
<loadFlag>0</loadFlag> | |||
</plugin> | |||
<plugin> | |||
<file>$EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin</file> | |||
<loadFlag>1</loadFlag> | |||
</plugin> | |||
<plugin> | |||
<file>$EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin</file> | |||
<loadFlag>0</loadFlag> | |||
</plugin> | |||
<plugin> | |||
<file>$EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin</file> | |||
<loadFlag>1</loadFlag> | |||
</plugin> | |||
<plugin> | |||
<file>$EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin</file> | |||
<loadFlag>1</loadFlag> | |||
</plugin> | |||
</debuggerPlugins> | |||
</configuration> | |||
<configuration> | |||
<name>Release</name> | |||
<toolchain> | |||
<name>MSP430</name> | |||
</toolchain> | |||
<debug>0</debug> | |||
<settings> | |||
<name>C-SPY</name> | |||
<archiveVersion>4</archiveVersion> | |||
<data> | |||
<version>25</version> | |||
<wantNonLocal>1</wantNonLocal> | |||
<debug>0</debug> | |||
<option> | |||
<name>CInput</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>MacOverride</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>MacFile</name> | |||
<state></state> | |||
</option> | |||
<option> | |||
<name>IProcessor</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>GoToEnable</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>GoToName</name> | |||
<state>main</state> | |||
</option> | |||
<option> | |||
<name>DynDriver</name> | |||
<state>SIM430</state> | |||
</option> | |||
<option> | |||
<name>dDllSlave</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>DdfFileSlave</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>DdfOverride</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>DdfFileName</name> | |||
<state></state> | |||
</option> | |||
<option> | |||
<name>ProcTMS</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>CExtraOptionsCheck</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>CExtraOptions</name> | |||
<state></state> | |||
</option> | |||
<option> | |||
<name>ProcMSP430X</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>CompilerDataModel</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>IVBASE</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>OCImagesSuppressCheck1</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>OCImagesPath1</name> | |||
<state></state> | |||
</option> | |||
<option> | |||
<name>OCImagesSuppressCheck2</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>OCImagesPath2</name> | |||
<state></state> | |||
</option> | |||
<option> | |||
<name>OCImagesSuppressCheck3</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>OCImagesPath3</name> | |||
<state></state> | |||
</option> | |||
<option> | |||
<name>CPUTAG</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>L092Mode</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>OCImagesOffset1</name> | |||
<state></state> | |||
</option> | |||
<option> | |||
<name>OCImagesOffset2</name> | |||
<state></state> | |||
</option> | |||
<option> | |||
<name>OCImagesOffset3</name> | |||
<state></state> | |||
</option> | |||
<option> | |||
<name>OCImagesUse1</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>OCImagesUse2</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>OCImagesUse3</name> | |||
<state>0</state> | |||
</option> | |||
</data> | |||
</settings> | |||
<settings> | |||
<name>430FET</name> | |||
<archiveVersion>1</archiveVersion> | |||
<data> | |||
<version>22</version> | |||
<wantNonLocal>1</wantNonLocal> | |||
<debug>0</debug> | |||
<option> | |||
<name>CFetMandatory</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>Erase</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>EMUVerifyDownloadP7</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>EraseOptionSlaveP7</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>ExitBreakpointP7</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>PutcharBreakpointP7</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>GetcharBreakpointP7</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>derivativeP7</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>ParallelPortP7</name> | |||
<version>0</version> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>TargetVoltage</name> | |||
<state>###Uninitialized###</state> | |||
</option> | |||
<option> | |||
<name>AllowLockedFlashAccessP7</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>EMUAttach</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>AttachOptionSlave</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>CRadioProtocolType</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>CCRadioModuleTypeSlave</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>EEMLevel</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>DiasbleMemoryCache</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>NeedLockedFlashAccess</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>UsbComPort</name> | |||
<state>Automatic</state> | |||
</option> | |||
<option> | |||
<name>FetConnection</name> | |||
<version>2</version> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>SoftwareBreakpointEnable</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>RadioSoftwareBreakpointType</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>TargetSettlingtime</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>AllowAccessToBSL</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>OTargetVccTypeDefault</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>CCBetaDll</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>GPassword</name> | |||
<state>###Uninitialized###</state> | |||
</option> | |||
<option> | |||
<name>DebugLPM5</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>LPM5Slave</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>CRadioAutoManualType</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>ExternalCodeDownload</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>CCVCCDefault</name> | |||
<state>1</state> | |||
</option> | |||
</data> | |||
</settings> | |||
<settings> | |||
<name>SIM430</name> | |||
<archiveVersion>1</archiveVersion> | |||
<data> | |||
<version>4</version> | |||
<wantNonLocal>1</wantNonLocal> | |||
<debug>0</debug> | |||
<option> | |||
<name>SimOddAddressCheckP7</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>CSimMandatory</name> | |||
<state>1</state> | |||
</option> | |||
<option> | |||
<name>derivativeSim</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>SimEnablePSP</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>SimPspOverrideConfig</name> | |||
<state>0</state> | |||
</option> | |||
<option> | |||
<name>SimPspConfigFile</name> | |||
<state>###Uninitialized###</state> | |||
</option> | |||
</data> | |||
</settings> | |||
<debuggerPlugins> | |||
<plugin> | |||
<file>$TOOLKIT_DIR$\plugins\Lcd\lcd.ewplugin</file> | |||
<loadFlag>1</loadFlag> | |||
</plugin> | |||
<plugin> | |||
<file>$TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin</file> | |||
<loadFlag>0</loadFlag> | |||
</plugin> | |||
<plugin> | |||
<file>$TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin</file> | |||
<loadFlag>0</loadFlag> | |||
</plugin> | |||
<plugin> | |||
<file>$TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin</file> | |||
<loadFlag>0</loadFlag> | |||
</plugin> | |||
<plugin> | |||
<file>$TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin</file> | |||
<loadFlag>0</loadFlag> | |||
</plugin> | |||
<plugin> | |||
<file>$EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin</file> | |||
<loadFlag>1</loadFlag> | |||
</plugin> | |||
<plugin> | |||
<file>$EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin</file> | |||
<loadFlag>0</loadFlag> | |||
</plugin> | |||
<plugin> | |||
<file>$EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin</file> | |||
<loadFlag>1</loadFlag> | |||
</plugin> | |||
<plugin> | |||
<file>$EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin</file> | |||
<loadFlag>1</loadFlag> | |||
</plugin> | |||
</debuggerPlugins> | |||
</configuration> | |||
</project> | |||
@ -0,0 +1,10 @@ | |||
<?xml version="1.0" encoding="iso-8859-1"?> | |||
<workspace> | |||
<project> | |||
<path>$WS_DIR$\CapTouch_BoosterPack_UserExperience.ewp</path> | |||
</project> | |||
<batchBuild/> | |||
</workspace> | |||
@ -0,0 +1,216 @@ | |||
------------MSP430G2-LaunchPad CapTouch BoosterPack User Experience------------- | |||
Ver.: 1.00 Initial Release | |||
February 2011 | |||
Dung Dang | |||
MSP430 Applications | |||
Texas Instruments, Inc. | |||
-------------------------------------------------------------------------------- | |||
CONTENTS | |||
I. DESCRIPTION | |||
II. PROJECT & FILE CONFIGURATION | |||
III. PROJECT IMPORT IN CCS & IAR | |||
IV. CAP TOUCH LIBRARY | |||
V. TOUCH & GESTURE DEFINITIONS | |||
VI. UART COMMUNICATION PROTOCOL | |||
VII. HISTORY | |||
I. DESCRIPTION | |||
----------------------------------- | |||
This application operates on the LaunchPad platform using the MSP430G2452 | |||
device and the CapTouch BoosterPack plugin board. The capacitive touch and | |||
proximity sensing are enabled by the pin oscillator feature new to the | |||
MSP430G2xx2 family devices. The User Experience application also utilizes | |||
the cap touch library to realize & measure the capacitive touch and proximity | |||
sensors. The cap touch library also provides layers of abstractions to | |||
generate higher logical outputs such as logical touches, geometry (in this | |||
hardware, a four-button wheel), and even gestures. | |||
The User Experience application starts up and remains in 'sleep' mode, | |||
sampling the proximity sensor every ~8.3ms [VLO/100=12kHz/100=120Hz]. Upon | |||
registering a valid proximity event [hand/finger/object hovering ~3-5cm from | |||
the BoosterPack], the application wakes up to operate in the 'active' mode. | |||
During the wake up period, the LEDs surrounding the wheel light in a wake-up | |||
sequence, starting with a slow clockwise and ending with a fast | |||
counter-clockwise motion. As this sequence ends, the device enters active mode. | |||
In active mode, the application samples and registers individual finger touches | |||
on the 16-position wheel or the center button as well as simple gestures | |||
[Clockwise & Counter-clockwise] while the finger moves along and remains on | |||
the wheel. Upon wheel position detection, the corresponding LEDs surrounding | |||
the wheel light up accordingly. Each individual tap on the center capactive | |||
touch button toggles the center LED. | |||
After a predetermined amount of time without any touch activity (on the wheel | |||
or on the center button) the application returns to sleep mode, enabling only | |||
the proximity sensor periodically. | |||
A 9600 baud UART link is also implemented using SW TimerA to provide | |||
application and cap touch data to the PC via the UART-USB back channel. | |||
The application sends UART data upon events such as wake up, sleep, touch, | |||
or gesture. | |||
II. PROJECT & FILE CONFIGURATION | |||
----------------------------------- | |||
PROJECT ROOT - CapTouchBoosterPack_UserExperience | |||
| CapTouchBoosterPack_UserExperience.c | |||
| <Main application code> | |||
| README <This file> | |||
| uart.c <C file: UART implementation using TimerA & SW> | |||
| uart.h <H file: UART implementation using TimerA & SW> | |||
| | |||
+---[CapTouchLibrary] <Capacitive Touch Library Code> | |||
| Cap_Touch_HAL.c | |||
| Cap_Touch_HAL.h | |||
| Cap_Touch_Layer.c | |||
| Cap_Touch_Layer.h | |||
| requirements.doc | |||
| structure.c <Created using template_structure.*> | |||
| structure.h <Configured/calibrated specifically for this HW> | |||
| | |||
+---[CCS] <CCS Project Configuration Files> | |||
| | <All listed files are required> | |||
| | <The non-listed can be safely removed> | |||
| | .ccsproject | |||
| | .cdtbuild | |||
| | .cdtproject | |||
| | .project <Contains links to portable project folders/files> | |||
| | lnk_msp430g2452.cmd | |||
| | macros.ini <Enables portable project> | |||
| | MSP430G2452.ccxml | |||
| | | |||
| \---All other folders & files: IDE/build generated files | |||
remove/ignore when exporting projects | |||
| | |||
\---[IAR] <CCS Project Configuration Files> | |||
| <All listed files are required> | |||
| <The non-listed can be safely removed> | |||
| CapTouch_BoosterPack_UserExperience.ewd | |||
| CapTouch_BoosterPack_UserExperience.ewp | |||
| CapTouch_BoosterPack_UserExperience.eww | |||
\---All other folders & files: IDE/build generated files | |||
remove/ignore when exporting projects | |||
Legend: [Directory] | |||
|---filename | |||
III. PROJECT IMPORT IN CCS & IAR | |||
----------------------------------- | |||
1. Project Import in CCS | |||
a. Open CCS. | |||
b. Select a new project workspace outside of the project folder* | |||
c. Select Project-->Import Existing Project | |||
d. Browse to the [PROJECT_ROOT]\CCS folder | |||
e. Select Finish | |||
*Ideally, workspace should be in completely independent folder, not | |||
containing or contained by the project/package folder. | |||
!Note: For CCS, while project root is in the outer directory, the CCS | |||
project files are located inside CCS. To enable the portability of | |||
the project, the file macros.ini is created to define the root. | |||
Additionally, all project code files (*.c, *.h) are added as linked | |||
resources with their relative path to the project root. | |||
2. Open project & workspace in IAR | |||
a. Browse to the [PROJECT_ROOT]\IAR folder | |||
b. Open the CapTouch_BoosterPack_UserExperience.eww workspace. | |||
IV. CAP TOUCH LIBRARY | |||
The MSP430G2-LaunchPad CapTouch BoosterPack User Experience uses the Cap Touch | |||
Library to configure, calibrate, and control the capacitive sensors. | |||
The sensor pads are configured in the structure.h & structure.c files. | |||
Specifically 6 elements are divided into three sensors: 1 proximity sensor, 1 | |||
cap touch button (center button), and a 4-element wheel. | |||
After each element is calibrated to determine the touch threshold as well as | |||
their maximum values in number of counts (which correlate to the measured | |||
capacitances), these calibration values are also registered inside structure.c. | |||
The cap_touch_hal.* files provide the hardware abstract layer for the cap touch | |||
library, which essentially provides different hardware/peripheral options to | |||
drive the cap touch functionality. Specifically for the CapTouch BoosterPack | |||
using an MSP430G2xx2/MSP430G2xx3 device, the Pin Oscillator peripheral is used. | |||
The cap_touch_layer.* files provides the cap touch layer, which offers functions | |||
that process the raw data into structured format. The main application utilizes | |||
this layer for their API calls to setup, measure baseline, detect touches, and | |||
detect wheel positions. | |||
For more information on the Cap Touch Library, refer to the Cap Touch Library | |||
documentation. | |||
V. TOUCH & GESTURE DEFINITIONS | |||
----------------------------------- | |||
Proximity Sensor | |||
The proximity sensor is made of the entire top PCB layer surface that covers the | |||
capacitive touch wheel. The proximity sensor detection occurs when the measured | |||
capacitance increases due to the presence of some conductive object within 1-2 | |||
inch from the surface. Generally, a hand wave motion in parallel and 1-2 inch | |||
from the CapTouch BoosterPack can trigger the detection. | |||
Individual Cap Touch Presses | |||
The center button (small round button in the middle of the board) can register | |||
an individual touch/press. | |||
The capactive touch wheel consists of four physical "ninja-star" elements | |||
arranged in a wheel formation that is calibrated & programed to provide | |||
16-position detection. These positions can be detected individually as a | |||
button press. A press by the application's definition is consituted by a | |||
separate and single position detection registered continously [i.e. press | |||
begins when the position is touched and after no other position was detected, | |||
and ends when another position is detected or no further position is dectected. | |||
Wheel Gesture | |||
A gesture on the capacitive touch wheel is formed when a continuous series of | |||
touches is detected (no no-detection is reported, i.e. finger never leaves the | |||
wheel). A complete continuous finger motion on the wheel might consist of | |||
several intermediate gestures, each with one separate direction (clockwise or | |||
counter-clockwise). | |||
VI. UART COMMUNICATION PROTOCOL | |||
----------------------------------- | |||
Per each event (wake up, go to sleep, touch/press, or gesture), a UART packet | |||
of two bytes is sent. They are specified as follows. | |||
WAKE UP [due to proximity sensor detection]: 0xBE 0xEF | |||
SLEEP [after period of inactivity]: 0xDE 0xAD | |||
CENTER BUTTON PRESS: 0x80 0x80 | |||
WHEEL POSITION TOUCH/PRESS [z = touch position]: 0x3z 0x3z [z=1 nibble 0x0-F] | |||
GESTURE START [z = touch position]: 0xFC 0x2z [z=1 nibble 0x0-F] | |||
GESTURE STOP: 0xFB 0xFB | |||
GESTURE & GESTURE END POSITION : 0xGG 0x2z | |||
GG = [binary] b???????? | |||
First bit is direction: 0 = clockwise, 1 = counter-clockwise | |||
Last 7 bits = count of gesture movement | |||
z = ending position of the immediate gesture [[z=1 nibble 0x0-F] | |||
The UART receiver can decipher the packets by comparing them against the fixed | |||
values (WAKE UP, SLEEP, CENTER BUTTON PRESS, GESTURE START & STOP) or against | |||
ranges (WHEEL TOUCH = 0x30-0x3F, GESTURE = 0x00-0x1F, GESTURE POSITION = | |||
0x20-0x2F) | |||
VII. HISTORY | |||
----------------------------------- | |||
Ver. 1.0 | |||
- Implemented 64-position detection in the cap touch layer (defined in | |||
structure.h/c fies). These 64 position are still translated into 16-position | |||
representational wheel. | |||
- Instead of sending continuous wheel touch packets, only send initial, last | |||
and every other WHEEL_TOUCH_DELAY wheel touch detections. This modification does | |||
not affect the MSP430G2-LaunchPad CapTouch BoosterPack User Experience GUI, but | |||
enables full and expected behavior of the MediaPad program in Windows. | |||
Ver. 0.9: | |||
-Initial firmware release for small lot production. Supports MSP430G2-LaunchPad | |||
CapTouch BoosterPack User Experience GUI. Partial support for MediaPad, | |||
application behavior might not be optimized. |
@ -0,0 +1,127 @@ | |||
/******************************************************************************* | |||
* | |||
* uart.c - c file for UART communication using MSP430 TimerA | |||
* - peripheral | |||
* | |||
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ | |||
* | |||
* Redistribution and use in source and binary forms, with or without | |||
* modification, are permitted provided that the following conditions | |||
* are met: | |||
* | |||
* Redistributions of source code must retain the above copyright | |||
* notice, this list of conditions and the following disclaimer. | |||
* | |||
* Redistributions in binary form must reproduce the above copyright | |||
* notice, this list of conditions and the following disclaimer in the | |||
* documentation and/or other materials provided with the | |||
* distribution. | |||
* | |||
* Neither the name of Texas Instruments Incorporated nor the names of | |||
* its contributors may be used to endorse or promote products derived | |||
* from this software without specific prior written permission. | |||
* | |||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* | |||
* | |||
******************************************************************************/ | |||
#include "uart.h" | |||
unsigned char timerA_UART_mode = 0; | |||
unsigned int txData; | |||
//------------------------------------------------------------------------------ | |||
// Function configures Timer_A for full-duplex UART operation | |||
//------------------------------------------------------------------------------ | |||
void TimerA_UART_init(void) | |||
{ | |||
DCOCTL = 0x00; // Set DCOCLK to 1MHz | |||
BCSCTL1 = CALBC1_1MHZ; | |||
DCOCTL = CALDCO_1MHZ; | |||
BCSCTL2 &= ~DIVS_3; // SMCLK = 1MHz | |||
P1SEL |= UART_TXD + UART_RXD; // Timer function for TXD/RXD pins | |||
// P1SEL |= UART_TXD ; | |||
P1DIR |= UART_TXD; // TXD | |||
P1DIR &= ~UART_RXD; | |||
TACCTL0 = OUT; // Set TXD Idle as Mark = '1' | |||
// TACCTL1 = SCS + CM1 + CAP + CCIE; // Sync, Neg Edge, Capture, Int | |||
TACTL |= TACLR; // SMCLK, start in continuous mode | |||
TACTL = TASSEL_2 + MC_2; // SMCLK, start in continuous mode | |||
timerA_UART_mode = 1; | |||
} | |||
//------------------------------------------------------------------------------ | |||
// Function unconfigures Timer_A for full-duplex UART operation | |||
//------------------------------------------------------------------------------ | |||
void TimerA_UART_shutdown(void) | |||
{ | |||
timerA_UART_mode = 0; | |||
P1SEL &= ~(UART_TXD + UART_RXD); // Timer function for TXD/RXD pins | |||
// P1SEL &= ~(UART_TXD ); // Timer function for TXD/RXD pins | |||
TACCTL1 &= ~CCIE; // Sync, Neg Edge, Capture, Int | |||
TACTL &= ~MC_3; // Clear TA modes --> Stop Timer Module | |||
P1OUT &= ~UART_TXD; | |||
} | |||
//------------------------------------------------------------------------------ | |||
// Outputs one byte using the Timer_A UART | |||
//------------------------------------------------------------------------------ | |||
void TimerA_UART_tx(unsigned char byte) | |||
{ | |||
while (TACCTL0 & CCIE); // Ensure last char got TX'd | |||
TACCR0 = TAR; // Current state of TA counter | |||
TACCR0 += UART_TBIT; // One bit time till first bit | |||
txData = byte; // Load global variable | |||
txData |= 0x100; // Add mark stop bit to TXData | |||
txData <<= 1; // Add space start bit | |||
TACCTL0 = OUTMOD0 + CCIE; // Set TXD on EQU2 (idle), Int | |||
__bis_SR_register( LPM0_bits + GIE); | |||
} | |||
//------------------------------------------------------------------------------ | |||
// Prints a string over using the Timer_A UART | |||
//------------------------------------------------------------------------------ | |||
void TimerA_UART_print(char *string) | |||
{ | |||
while (*string) { | |||
TimerA_UART_tx(*string++); | |||
} | |||
} | |||
//------------------------------------------------------------------------------ | |||
// Timer_A UART - Transmit Interrupt Handler | |||
//------------------------------------------------------------------------------ | |||
#pragma vector = TIMER0_A0_VECTOR | |||
__interrupt void Timer_A0_ISR(void) | |||
{ | |||
static unsigned char txBitCnt = 10; | |||
if (!timerA_UART_mode) | |||
__bic_SR_register_on_exit(LPM3_bits+GIE); | |||
else | |||
{ | |||
TACCR0 += UART_TBIT; // Add Offset to CCRx | |||
if (--txBitCnt == 0) // All bits TXed? | |||
{ | |||
TACCTL0 &= ~CCIE; // All bits TXed, disable interrupt | |||
txBitCnt = 10; | |||
__bic_SR_register_on_exit(LPM0_bits+GIE); | |||
} | |||
else { | |||
if (txData & 0x01) { | |||
TACCTL0 &= ~OUTMOD2; // TX Mark '1' | |||
} | |||
else { | |||
TACCTL0 |= OUTMOD2; // TX Space '0' | |||
} | |||
txData >>= 1; | |||
} | |||
} | |||
} | |||
@ -0,0 +1,53 @@ | |||
/******************************************************************************* | |||
* | |||
* uart.h - Definition file for UART communication using MSP430 TimerA | |||
* - peripheral | |||
* | |||
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ | |||
* | |||
* Redistribution and use in source and binary forms, with or without | |||
* modification, are permitted provided that the following conditions | |||
* are met: | |||
* | |||
* Redistributions of source code must retain the above copyright | |||
* notice, this list of conditions and the following disclaimer. | |||
* | |||
* Redistributions in binary form must reproduce the above copyright | |||
* notice, this list of conditions and the following disclaimer in the | |||
* documentation and/or other materials provided with the | |||
* distribution. | |||
* | |||
* Neither the name of Texas Instruments Incorporated nor the names of | |||
* its contributors may be used to endorse or promote products derived | |||
* from this software without specific prior written permission. | |||
* | |||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* | |||
* | |||
******************************************************************************/ | |||
//------------------------------------------------------------------------------ | |||
// Hardware-related definitions | |||
//------------------------------------------------------------------------------ | |||
#define UART_TXD 0x02 // TXD on P1.1 (Timer0_A.OUT0) | |||
#define UART_RXD 0x04 // RXD on P1.2 (Timer0_A.CCI1A) | |||
//------------------------------------------------------------------------------ | |||
// Conditions for 9600 Baud SW UART, SMCLK = 1MHz | |||
//------------------------------------------------------------------------------ | |||
#define UART_TBIT_DIV_2 (1000000 / (9600 * 2)) | |||
#define UART_TBIT (1000000 / 9600) | |||
#include "msp430g2452.h" | |||
void TimerA_UART_init(void); | |||
void TimerA_UART_shutdown(void); | |||
void TimerA_UART_tx(unsigned char byte); |
@ -0,0 +1,725 @@ | |||
/******************************************************************************* | |||
* | |||
* CapTouch_BoosterPack_UserExperience_GUI.pde | |||
* - PC demo application for establishing a serial connection | |||
* with the LaunchPad CapTouch BoosterPack. | |||
* | |||
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ | |||
* | |||
* Redistribution and use in source and binary forms, with or without | |||
* modification, are permitted provided that the following conditions | |||
* are met: | |||
* | |||
* Redistributions of source code must retain the above copyright | |||
* notice, this list of conditions and the following disclaimer. | |||
* | |||
* Redistributions in binary form must reproduce the above copyright | |||
* notice, this list of conditions and the following disclaimer in the | |||
* documentation and/or other materials provided with the | |||
* distribution. | |||
* | |||
* Neither the name of Texas Instruments Incorporated nor the names of | |||
* its contributors may be used to endorse or promote products derived | |||
* from this software without specific prior written permission. | |||
* | |||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* | |||
* | |||
******************************************************************************/ | |||
/****************************************************************************** | |||
* MSP430G2-LaunchPad CapTouch BoosterPack User Experience GUI | |||
* Desc: | |||
* This PC GUI application communicates with the LaunchPad specifically to | |||
* receive capacitive touch data from the LaunchPad CapTouch BoosterPack and | |||
* provides the visualization of said information in the GUI. | |||
* | |||
* The GUI uses a small .NET utility (FindAppUART.exe) to automatically detect | |||
* a proper LaunchPad/430Emulator device connected to the PC USB port. Upon | |||
* correct USB COM port discovery, the application initiates a 9600baud UART | |||
* connection and starts receiving data. | |||
* | |||
* Upon each LaunchPad event, data is transmitted [always] via a simple '2-byte' | |||
* protocol as described below. | |||
* [LaunchPad] Wake up : 0xBE 0xEF | |||
* [LaunchPad] Sleep : 0xDE 0xAD | |||
* [CapTouch] Center Button : 0x80 0x80 | |||
* [CapTouch] Wheel Tap : WT WT = pos. on wheel [0-0x0F] + 0x30 | |||
* [CapTouch] Gesture Start : 0xFC POS = pos. on wheel [0-0x0F] + 0x20 | |||
* [CapTouch] Gesture Stop : 0xFB POS = pos. on wheel [0-0x0F] + 0x20 | |||
* [CapTouch] Gesture Update: GES POS | |||
* Gesture = [0-0x0F] --> Clockwise gesture | |||
* = 0x10+ [0-0x0F] --> Counter-clockwise gesture | |||
* | |||
* The GUI grays out during sleep mode and returns to active mode upon wake up. | |||
* The 'Center Button' press data toggles the center circle color, mimicking the | |||
* behavior of the center LED on the BoosterPack. | |||
* The 'Wheel Tap' is represented by lighting up a single slice on the wheel. | |||
* The gesture tracking [Start, Stop, Update] is visualized on the wheel with | |||
* the coloration of the wheel slices. Gesture can be tracked for several | |||
* revolutions of the wheel, in both clockwise and counter-clockwise directions. | |||
* | |||
* A hidden code/lock is embedded in the wheel. Correct sequence [similar to a | |||
* rotational combination lock] reveals a secret address. | |||
* | |||
* D. Dang | |||
* Texas Instruments, Inc. | |||
* Ver 0.90 Feb 2011 | |||
******************************************************************************/ | |||
import pitaru.sonia_v2_9.*; | |||
import processing.serial.*; | |||
import java.io.BufferedReader; | |||
import java.io.IOException; | |||
import java.io.InputStreamReader; | |||
final int TIME_OUT = 140; | |||
/*--------Dimensions & coordinates------------*/ | |||
final int CANVAS_SIZE_X = 900; | |||
final int CANVAS_SIZE_Y = 580; | |||
final int OUT_CIRCLE_RADIUS = 248; | |||
final int IN_CIRCLE_RADIUS = 101; | |||
final int CENTER_CIRCLE_RADIUS = 37; | |||
final int CIRCLE_CENTER_X = 450; | |||
final int CIRCLE_CENTER_Y = 285; | |||
final int SOUND_ICON_X = 820; | |||
final int SOUND_ICON_Y = 20; | |||
/*--------Drawing definitions------------*/ | |||
final int NUMBER_OF_SLICES = 16; | |||
final int BACKGROUND_COLOR = 170; | |||
final int TAP_SLICE_COLOR = -100; | |||
final int SLICE_TRANSPARENCY = 30; | |||
final int SLICE_TRANSPARENCY_OFFSET = 80; | |||
/*--------UART protocol definitions------------*/ | |||
final int WAKE_UP_UART_CODE = 0xBE; | |||
final int WAKE_UP_UART_CODE2 = 0xEF; | |||
final int SLEEP_MODE_UART_CODE = 0xDE; | |||
final int SLEEP_MODE_UART_CODE2 = 0xAD; | |||
final int CENTER_BUTTON_CODE = 0x80; | |||
final int INVALID_WHEEL_POSITION = 0xFE; | |||
final int INVALID_GESTURE = 0xFD; | |||
final int GESTURE_START = 0xFC; | |||
final int GESTURE_STOP = 0xFB; | |||
final int GESTURE_POSITION_OFFSET = 0x20; | |||
final int WHEEL_POSITION_OFFSET = 0x30; | |||
final int NUMBER_OF_WHEEL_POSITIONS = 16; | |||
//final int INVALID_WHEEL_POSITION = -100; | |||
final int INVALID_GESTURE_DIRECTION = -100; | |||
final int GESTURE_CLOCKWISE = 1; | |||
final int GESTURE_COUNTERCLOCKWISE = -1; | |||
/*----------CapTouch-related variables----------------*/ | |||
int gestureStartingPosition = INVALID_WHEEL_POSITION, gestureStoppingPosition = INVALID_WHEEL_POSITION; | |||
int[] gestureCoverPositions = new int[16]; | |||
int gestureDirection = INVALID_GESTURE_DIRECTION; | |||
int gestureImmediateDirection = INVALID_GESTURE_DIRECTION; | |||
int allLit = 0; | |||
int inactivityCounter=0, sleeping=0, tapping=0, centerButton=0; | |||
int CenterButtonToggle=0; | |||
/*------Serial communication----------------*/ | |||
int LaunchPadComPortFound = 0, numberOfLookingDots=0; | |||
Serial LaunchPad; | |||
/*--------- Visual & audio elements-----------*/ | |||
PImage backgroundImage, innerCircleImage,innerCircleSelectedImage, innerCircleUnlockedImage ; | |||
int drawNumberEnabled = 0; | |||
Sample click,clickFound, clickOpen; | |||
int soundEnabled = 0; | |||
void drawSlice(int sliceIndex, int sliceLevel) | |||
{ | |||
int sliceAfter, sliceLabel; | |||
sliceLabel = sliceIndex; | |||
if (sliceIndex < 3) | |||
sliceIndex = sliceIndex + 16 - 4; | |||
else | |||
sliceIndex = sliceIndex - 4; | |||
sliceAfter = sliceIndex + 1; | |||
if (sliceAfter == NUMBER_OF_SLICES) | |||
sliceAfter = 0; | |||
noStroke(); | |||
stroke(255); | |||
strokeWeight(4); | |||
if (sliceLevel == TAP_SLICE_COLOR) | |||
fill(160,160,160, 225); | |||
else | |||
fill(252,236,54, sliceLevel * SLICE_TRANSPARENCY + SLICE_TRANSPARENCY_OFFSET); | |||
arc(CIRCLE_CENTER_X, CIRCLE_CENTER_Y, OUT_CIRCLE_RADIUS*2, OUT_CIRCLE_RADIUS*2, (((float)sliceIndex)-0.5) * 2 * PI /16, (((float)sliceIndex)+0.5) * 2 * PI /16); | |||
line( CIRCLE_CENTER_X + cos( (((float)sliceIndex)-0.5) * 2 * PI /16 ) * OUT_CIRCLE_RADIUS, CIRCLE_CENTER_Y + sin((((float)sliceIndex)-0.5) * 2 * PI /16 ) * OUT_CIRCLE_RADIUS, | |||
CIRCLE_CENTER_X + cos( (((float)sliceIndex)-0.5) * 2 * PI /16 ) * IN_CIRCLE_RADIUS, CIRCLE_CENTER_Y + sin((((float)sliceIndex)-0.5) * 2 * PI /16 ) * IN_CIRCLE_RADIUS); | |||
line( CIRCLE_CENTER_X + cos( (((float)sliceIndex)+0.5) * 2 * PI /16 ) * OUT_CIRCLE_RADIUS, CIRCLE_CENTER_Y + sin((((float)sliceIndex)+0.5) * 2 * PI /16 ) * OUT_CIRCLE_RADIUS, | |||
CIRCLE_CENTER_X + cos( (((float)sliceIndex)+0.5) * 2 * PI /16 ) * IN_CIRCLE_RADIUS, CIRCLE_CENTER_Y + sin((((float)sliceIndex)+0.5) * 2 * PI /16 ) * IN_CIRCLE_RADIUS); | |||
if (drawNumberEnabled == 1) | |||
{ | |||
fill(0); | |||
text( sliceLabel, | |||
CIRCLE_CENTER_X + cos( (((float)sliceIndex)) * 2 * PI /16 ) * (OUT_CIRCLE_RADIUS-40)-7, | |||
CIRCLE_CENTER_Y + sin( (((float)sliceIndex)) * 2 * PI /16 ) * (OUT_CIRCLE_RADIUS-40)); | |||
} | |||
} | |||
void drawCanvas() | |||
{ | |||
int i; | |||
background(BACKGROUND_COLOR); | |||
image(backgroundImage, 0 ,0); | |||
fill(0,0,0,255); | |||
if (unlocked == 1) | |||
{ | |||
fill(0); | |||
text("BoosterPack Unlocked",300,30); | |||
for (i=0;i<4;i++) | |||
drawSlice(code[i],4); | |||
fill(255); | |||
ellipse(CIRCLE_CENTER_X, CIRCLE_CENTER_Y, IN_CIRCLE_RADIUS*2 , IN_CIRCLE_RADIUS*2); | |||
image(innerCircleUnlockedImage, 0, 0); | |||
} | |||
} | |||
void goToSleep() | |||
{ | |||
tint(120,120,120,180); | |||
drawCanvas(); | |||
tint(120,120,120,180); | |||
fill(255); | |||
textSize(20); | |||
text(".",20,30); | |||
text(".",28,30); | |||
text(".",35,30); | |||
textSize(25); | |||
text("z",47,30); | |||
textSize(30); | |||
text("z",65,30); | |||
textSize(35); | |||
text("z",85,30); | |||
textSize(40); | |||
text("z",108,30); | |||
textSize(30); | |||
noTint(); | |||
sleeping = 1; | |||
inactivityCounter = TIME_OUT; | |||
} | |||
void findLaunchPad() | |||
{ | |||
String ComPortName =""; | |||
try | |||
{ | |||
Process proc = Runtime.getRuntime().exec("FindAppUART.exe"); | |||
proc.waitFor(); | |||
int exitVal = proc.exitValue(); | |||
// Get the first line from the process' STDOUT | |||
BufferedReader buf = new BufferedReader(new InputStreamReader(proc.getInputStream())); | |||
ComPortName = buf.readLine(); | |||
if (ComPortName.substring(0,3).equals("COM") != true) | |||
ComPortName = ""; | |||
else | |||
{ | |||
LaunchPadComPortFound = 1; | |||
LaunchPad = new Serial(this, ComPortName, 9600); | |||
} | |||
} | |||
catch(Exception e) | |||
{ | |||
println(e); | |||
} | |||
} | |||
void promptLookingForLaunchPad() | |||
{ | |||
fill(255,0,0); | |||
noStroke(); | |||
rect(100,CANVAS_SIZE_Y/2-100,CANVAS_SIZE_X-120,200); | |||
fill(255); | |||
textSize(50); | |||
numberOfLookingDots++; | |||
if (numberOfLookingDots==5) | |||
numberOfLookingDots = 1; | |||
switch(numberOfLookingDots) | |||
{ | |||
case 1: text("Looking for LaunchPad ", 175,CANVAS_SIZE_Y/2 ); break; | |||
case 2: text("Looking for LaunchPad . ", 175,CANVAS_SIZE_Y/2 ); break; | |||
case 3: text("Looking for LaunchPad .. ", 175,CANVAS_SIZE_Y/2 ); break; | |||
case 4: text("Looking for LaunchPad ...", 175,CANVAS_SIZE_Y/2 ); break; | |||
} | |||
} | |||
void setup() | |||
{ | |||
size(CANVAS_SIZE_X, CANVAS_SIZE_Y); | |||
background(255,0,0); | |||
Sonia.start(this); | |||
click = new Sample("click1.aiff"); | |||
clickOpen = new Sample("open.aiff"); | |||
clickFound = new Sample("unlock.aiff"); | |||
click.setVolume(3); | |||
clickFound.setVolume(3); | |||
frameRate(3); | |||
backgroundImage = loadImage("background.png"); | |||
innerCircleImage = loadImage("innerCircle.png"); | |||
innerCircleSelectedImage = loadImage("innerCircleSelected.png"); | |||
innerCircleUnlockedImage = loadImage("innerCircleUnlocked.png"); | |||
findLaunchPad(); | |||
if (LaunchPadComPortFound == 0) | |||
{ | |||
fill(255); | |||
textSize(40); | |||
text("LaunchPad Capacitive Touch BoosterPack", 70,50); | |||
textSize(55); | |||
fill(0); | |||
text("User Experience Demo", 150,100); | |||
fill(0); | |||
textSize(25); | |||
text("1. Plug your Capacitive Touch BoosterPack into the LaunchPad", 150,CANVAS_SIZE_Y - 70); | |||
text("2. Connect your LaunchPad to the PC via USB", 150,CANVAS_SIZE_Y - 45); | |||
promptLookingForLaunchPad(); | |||
} | |||
else | |||
{ | |||
frameRate(30); | |||
goToSleep(); | |||
} | |||
} | |||
void draw() | |||
{ | |||
int i; | |||
if (LaunchPadComPortFound==0) | |||
{ | |||
findLaunchPad(); | |||
if (LaunchPadComPortFound==1) | |||
{ | |||
goToSleep(); | |||
frameRate(30); | |||
} | |||
else | |||
promptLookingForLaunchPad(); | |||
} | |||
else | |||
if(LaunchPad.available() >= 0) | |||
{ | |||
int buf, buf1; | |||
buf = LaunchPad.read(); | |||
buf1 = -1; | |||
if (buf>=0) | |||
{ | |||
drawCanvas(); | |||
textSize(30); | |||
sleeping = 0; | |||
inactivityCounter=0; | |||
tapping = 0 ; | |||
centerButton = 0; | |||
switch(buf) | |||
{ | |||
case WAKE_UP_UART_CODE: | |||
while (buf1 <0) | |||
buf1 = LaunchPad.read(); | |||
if (buf1==WAKE_UP_UART_CODE2) | |||
text("Proximity Sensor Wake Up",20,30); | |||
else | |||
{ | |||
print("Error: invalid UART Wake up == "); | |||
println(buf1); | |||
} | |||
break; | |||
case SLEEP_MODE_UART_CODE: | |||
while (buf1 <0) | |||
buf1 = LaunchPad.read(); | |||
if (buf1==SLEEP_MODE_UART_CODE2) | |||
{ | |||
//tint(120,0,0,180); | |||
CenterButtonToggle = 0; | |||
backgroundImage = loadImage("background.png"); | |||
innerCircleImage = loadImage("innerCircle.png"); | |||
tint(120,120,120,180); | |||
drawCanvas(); | |||
text("Good night!",20,30); | |||
sleeping = 1; | |||
noTint(); | |||
} | |||
else | |||
{ | |||
print("Error: invalid UART Sleep == "); | |||
println(buf1); | |||
} | |||
break; | |||
case CENTER_BUTTON_CODE: | |||
while (buf1 <0) | |||
buf1 = LaunchPad.read(); | |||
if (buf==buf1) | |||
{ | |||
if (unlocked==1) | |||
{ | |||
unlocked = 0; | |||
link(secretURL); | |||
} | |||
CenterButtonToggle = 1 - CenterButtonToggle; | |||
if (CenterButtonToggle == 1) | |||
{ | |||
innerCircleImage= loadImage("innerCircleSelected.png"); | |||
backgroundImage = loadImage("backgroundSelected.png"); | |||
} | |||
else | |||
{ | |||
innerCircleImage= loadImage("innerCircle.png"); | |||
backgroundImage = loadImage("background.png"); | |||
} | |||
drawCanvas(); | |||
centerButton = 1; | |||
} | |||
else | |||
{ | |||
print("Error: invalid CENTER BUTTON code == "); | |||
println(buf1); | |||
} | |||
break; | |||
case GESTURE_STOP: | |||
while (buf1 <0) | |||
buf1 = LaunchPad.read(); | |||
if (buf==buf1) | |||
{ | |||
text("Gesture Released",20,30); | |||
gestureStartingPosition = INVALID_WHEEL_POSITION; | |||
gestureStoppingPosition = INVALID_WHEEL_POSITION; | |||
gestureDirection = INVALID_GESTURE_DIRECTION; | |||
allLit = 0; | |||
codeCheck = 0; | |||
codeLevel = 0; | |||
//unlocked = 0; | |||
} | |||
else | |||
{ | |||
print("Error: invalid GESTURE_STOP code == "); | |||
println(buf1); | |||
} | |||
break; | |||
case GESTURE_START: | |||
while (buf1 <0) | |||
buf1 = LaunchPad.read(); | |||
if ( (buf1 < GESTURE_POSITION_OFFSET ) || (buf1 > GESTURE_POSITION_OFFSET + NUMBER_OF_WHEEL_POSITIONS)) | |||
{ | |||
print("Error: invalid gesture start position == "); | |||
println(buf1); | |||
} | |||
else | |||
{ | |||
text("Gesture Detected",20,30); | |||
buf1 = buf1 - GESTURE_POSITION_OFFSET; | |||
if (buf1<0) | |||
println(buf); | |||
gestureStartingPosition = buf1; | |||
gestureStoppingPosition = buf1; | |||
if (buf1 == code[0]) | |||
codeCheck = 1; | |||
else | |||
codeCheck = -1; | |||
codeLevel = 0; | |||
changeDirection = 0; | |||
drawSlice(buf1, 1); | |||
fill(255); | |||
ellipse(CIRCLE_CENTER_X, CIRCLE_CENTER_Y, IN_CIRCLE_RADIUS*2 , IN_CIRCLE_RADIUS*2); | |||
image(innerCircleImage,0,0); | |||
} | |||
break; | |||
default: // data from LaunchPad is not code, but value | |||
if (buf > WHEEL_POSITION_OFFSET + NUMBER_OF_WHEEL_POSITIONS ) // Invalid Code | |||
{ | |||
print("Error: invalid UART code == "); | |||
println(buf); | |||
} | |||
else | |||
/*---------------------WHEEL POSITION-----------------------*/ | |||
if ((buf <= WHEEL_POSITION_OFFSET + NUMBER_OF_WHEEL_POSITIONS) && (buf >= WHEEL_POSITION_OFFSET )) // Tapping | |||
{ | |||
while (buf1 <0) | |||
buf1 = LaunchPad.read(); | |||
if (buf==buf1) | |||
{ | |||
buf = buf - WHEEL_POSITION_OFFSET; | |||
text("Press @ ",10,30); | |||
text(buf,125,30); | |||
tapping = 1; | |||
drawSlice(buf, TAP_SLICE_COLOR); | |||
fill(255); | |||
ellipse(CIRCLE_CENTER_X, CIRCLE_CENTER_Y, IN_CIRCLE_RADIUS*2 , IN_CIRCLE_RADIUS*2); | |||
image(innerCircleImage, 0,0); | |||
} | |||
else | |||
{ | |||
print("Error: invalid WHEEL POSITION code == "); | |||
println(buf); | |||
} | |||
} | |||
else | |||
/*---------------------GESTURE DATA-----------------------*/ | |||
if (buf < GESTURE_POSITION_OFFSET ) // Gesturing | |||
if (gestureStartingPosition != INVALID_WHEEL_POSITION) | |||
{ | |||
if (buf>=NUMBER_OF_WHEEL_POSITIONS) // Determine orientation: binary value 00000xxx = CW, 00001xxx = CC | |||
{ | |||
buf -= NUMBER_OF_WHEEL_POSITIONS; | |||
text(buf, 20,30); | |||
text("Counter-Clockwise",55,30); | |||
gestureImmediateDirection = GESTURE_COUNTERCLOCKWISE; | |||
} | |||
else | |||
{ | |||
text(buf, 20,30); | |||
text("Clockwise",55,30); | |||
gestureImmediateDirection = GESTURE_CLOCKWISE; | |||
} | |||
while (buf1 <0) | |||
buf1 = LaunchPad.read(); | |||
if ( (buf1 >= GESTURE_POSITION_OFFSET ) && (buf1 < GESTURE_POSITION_OFFSET + NUMBER_OF_WHEEL_POSITIONS)) | |||
{ | |||
buf1 = buf1 - GESTURE_POSITION_OFFSET; | |||
if (gestureDirection == INVALID_GESTURE_DIRECTION) | |||
gestureDirection = gestureImmediateDirection; | |||
// if (gestureImmediateDirection != gestureDirection) | |||
// gestureCoverPositions[gestureStoppingPosition] = 0; | |||
// | |||
while (buf-->0) | |||
{ | |||
if (gestureStoppingPosition == gestureStartingPosition) //If moving from the starting position | |||
if (gestureDirection != gestureImmediateDirection) //If moving against the current direction | |||
{ | |||
if (allLit == 0) //Starting at zero? Change direction | |||
gestureDirection = gestureImmediateDirection; | |||
else //Back to a previous revolution? | |||
allLit--; | |||
} | |||
gestureStoppingPosition += gestureImmediateDirection; | |||
if (gestureStoppingPosition == NUMBER_OF_WHEEL_POSITIONS) | |||
gestureStoppingPosition = 0; | |||
if (gestureStoppingPosition < 0) | |||
gestureStoppingPosition = NUMBER_OF_WHEEL_POSITIONS-1; | |||
if (gestureStoppingPosition == gestureStartingPosition) //If moving to the starting position | |||
{ | |||
if (gestureImmediateDirection == gestureDirection) //complete a revolution? | |||
allLit += 1; | |||
else | |||
if (allLit == 0) //Back to zero | |||
gestureDirection = INVALID_GESTURE_DIRECTION; | |||
//Undo | |||
} | |||
} | |||
for ( i = 0; i < NUMBER_OF_WHEEL_POSITIONS; i++) | |||
gestureCoverPositions[i] = allLit; | |||
i = gestureStartingPosition; | |||
while (i != gestureStoppingPosition) | |||
{ | |||
gestureCoverPositions[i]= allLit + 1; | |||
i += gestureDirection; | |||
if (i<0) | |||
i = NUMBER_OF_WHEEL_POSITIONS-1; | |||
if (i == NUMBER_OF_WHEEL_POSITIONS) | |||
i = 0; | |||
} | |||
gestureCoverPositions[i]= allLit + 1; | |||
for ( i = 0; i < NUMBER_OF_WHEEL_POSITIONS; i++) | |||
if (gestureCoverPositions[i] > 0) | |||
drawSlice(i, gestureCoverPositions[i]); | |||
fill(255); | |||
ellipse(CIRCLE_CENTER_X, CIRCLE_CENTER_Y, IN_CIRCLE_RADIUS*2 , IN_CIRCLE_RADIUS*2); | |||
image(innerCircleImage,0,0); | |||
if (changeDirection !=0) | |||
{ | |||
if (gestureImmediateDirection != changeDirection) | |||
codeCheck = -1; | |||
changeDirection = 0; | |||
} | |||
if (soundEnabled == 1) | |||
click.play(); | |||
if (codeModeEnabled == 1) | |||
{ | |||
if (codeCheck==1) | |||
{ | |||
codeValid = 1; | |||
for ( i = 0; i < NUMBER_OF_WHEEL_POSITIONS; i++) | |||
if (gestureCoverPositions[i] != codeValues[codeLevel][i]) | |||
codeValid = 0; | |||
if (codeRotate[codeLevel] != gestureImmediateDirection) | |||
codeValid = 0; | |||
if (codeValid == 1) | |||
{ | |||
if (codeLevel++ < 2) | |||
{ | |||
changeDirection = -gestureImmediateDirection; | |||
if (soundEnabled == 1) | |||
clickFound.play(); | |||
} | |||
else | |||
{ | |||
fill(0); | |||
text("Unlocked!!",400,30); | |||
text("Press Center",500,90); | |||
unlocked = 1; | |||
codeLevel = 0; | |||
codeCheck = -1; | |||
if (soundEnabled == 1) | |||
clickOpen.play(); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
// invalid gesture data | |||
else | |||
{ | |||
print("Error: invalid gesture position data == "); | |||
println(buf1); | |||
} | |||
} | |||
else | |||
{ // Should not happen | |||
buf = buf - GESTURE_POSITION_OFFSET; | |||
println("Invalid UART Data, not expecting such data"); | |||
} | |||
break; | |||
} | |||
} | |||
else | |||
{ | |||
if (++inactivityCounter==TIME_OUT) | |||
{ | |||
if (sleeping==1) | |||
{ | |||
goToSleep(); | |||
} | |||
else | |||
drawCanvas(); | |||
} | |||
} | |||
} | |||
} | |||
void mouseReleased() | |||
{ | |||
if ( (mouseX-CANVAS_SIZE_X/2)*(mouseX-CANVAS_SIZE_X/2) + (mouseY-CANVAS_SIZE_Y/2)*(mouseY-CANVAS_SIZE_Y/2) < IN_CIRCLE_RADIUS * IN_CIRCLE_RADIUS ) | |||
if (LaunchPadComPortFound ==1) | |||
{ | |||
soundEnabled = 1 - soundEnabled; | |||
codeModeEnabled = 1 - codeModeEnabled; | |||
drawNumberEnabled = 1 - drawNumberEnabled; | |||
} | |||
} | |||
/*---------Embedded code validation------------------*/ | |||
// Ideally nobody should ever bother scrolling down here | |||
// But good job, you've found it the easy way! | |||
// Anyways, don't spoil the fun for others would ya? | |||
int[] code = { 0, 4, 3, 0}; | |||
int[] codeRotate = {1, -1, 1}; | |||
int[][] codeValues = { {1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |||
{1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, | |||
{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; | |||
String secretURL = "http://ti.com/msp430rr"; | |||
int codeCheck, codeLevel, codeValid, changeDirection, unlocked=0, codeModeEnabled = 0; | |||
@ -0,0 +1,133 @@ | |||
----------MSP430G2-LaunchPad CapTouch BoosterPack User Experience GUI----------- | |||
Ver.: 1.00 Initial Release | |||
February 2011 | |||
Dung Dang | |||
MSP430 Applications | |||
Texas Instruments, Inc. | |||
-------------------------------------------------------------------------------- | |||
CONTENTS | |||
I. DESCRIPTION | |||
II. APPLICATION USAGE | |||
III. PROJECT SETUP & RESOURCES | |||
IV. OTHER PLATFORM SUPPORT | |||
I. DESCRIPTION | |||
----------------------------------- | |||
Written in processing, this Windows PC GUI application communicates with the | |||
LaunchPad to receive specific capacitive touch data from the LaunchPad CapTouch | |||
BoosterPack and provides the visualization of said information in the GUI. | |||
The GUI uses a small .NET utility (FindAppUART.exe) to automatically detect | |||
a proper LaunchPad/430Emulator device connected to the PC USB port. Upon | |||
correct USB COM port discovery, the application initiates a 9600baud UART | |||
connection and starts receiving data. | |||
Upon each LaunchPad event, data is transmitted [always] via a simple '2-byte' | |||
protocol as described below. | |||
[LaunchPad] Wake up : 0xBE 0xEF | |||
[LaunchPad] Sleep : 0xDE 0xAD | |||
[CapTouch] Center Button : 0x80 0x80 | |||
[CapTouch] Wheel Tap : WT WT = pos. on wheel [0-0x0F] + 0x30 | |||
[CapTouch] Gesture Start : 0xFC POS = pos. on wheel [0-0x0F] + 0x20 | |||
[CapTouch] Gesture Stop : 0xFB POS = pos. on wheel [0-0x0F] + 0x20 | |||
[CapTouch] Gesture Update: GES POS | |||
[GES] Gesture = [0-0x0F] --> Clockwise gesture | |||
= 0x10+ [0-0x0F] --> Counter-clockwise gesture | |||
II. APPLICATION USAGE | |||
----------------------------------- | |||
1. Startup | |||
Upon startup, the GUI checks for a valid LaunchPad USB serial COM port. If | |||
no compatible port connection is available, the GUI prompts user to plug in | |||
the LaunchPad CapTouch BoosterPack. The GUI will continue as normal whenever | |||
a LaunchPad is plugged into the PC. | |||
2. Sleep Mode | |||
Upon start-up or after long period of inactivity, the device goes into sleep | |||
mode. The GUI grays out accordingly indicate such inactivity. | |||
Upon proximity sensor detection (wave hand 1-2 inch above the BoosterPack) the | |||
device returns to active mode and triggers the GUI to wake up as well. | |||
3. Active Mode | |||
- The 'Center Button' press data toggles the center circle color, mimicking the | |||
behavior of the center LED on the BoosterPack. | |||
- The 'Wheel Tap' is represented by lighting up a single slice on the wheel. | |||
- The gesture tracking [Start, Stop, Update] is visualized on the wheel with | |||
the coloration of the wheel slices. Gesture can be tracked for several | |||
revolutions of the wheel, in both clockwise and counter-clockwise directions. | |||
* A hidden code/lock is embedded in the wheel. Correct sequence [similar to a | |||
rotational combination lock] reveals a secret. | |||
III. PROJECT SETUP & RESOURCES | |||
----------------------------------- | |||
Below is the directory structure of the processing project | |||
[CapTouch_BoosterPack_UserExperience_GUI] [PROJECT_ROOT] | |||
| | |||
| CapTouch_BoosterPack_UserExperience_GUI.pde <Processing appcalition code> | |||
| FindAppUART.exe <to copy to application.windows after each processing build> | |||
| README <this file> | |||
| | |||
+---[data] <images & sounds> | |||
| |---*.png | |||
| \---*.aiff | |||
| | |||
+---[application.windows] <processing java source export & binary build> | |||
| |---[lib] | |||
| |---[source] | |||
| |---CapTouch_BoosterPack_UserExperience_GUI.exe <Main application> | |||
| |---FindAppUART.exe <.NET utility to detect LaunchPad USB serial COM port> | |||
| \--- . . . | |||
Legend: [Directory] | |||
|---filename | |||
The processing application code is contained within one file, | |||
CapTouch_BoosterPack_UserExperience_GUI.pde, which must reside in a similarly | |||
named workspace-acting folder. The code invokes two additional libraries, serial | |||
[comes with processing] for serial communication through the USB COM port and | |||
pitaru.sonia_v2_9.* (available at http://sonia.pitaru.com/download.htm) for | |||
sound processing feature [optional in the GUI]. The libraries DLLs will be | |||
generated in the [application.windows] folder when the application is exported. | |||
The application also invokes a small .NET utility <FindAppUART.exe> to | |||
automatically detect a compatible LaunchPad USB COM port available to the PC. | |||
The code expects this executable file to be present locally to the effective | |||
working directory during execution. | |||
* Specifically, during debug, processing's working directory is | |||
C:\processing-1.1\java\bin and processing expects to be able to locate | |||
<FindAppUART.exe> here. For the sake of simplicity, simply create a copy of the | |||
file here. | |||
* After application export and the final application executable has been | |||
created, <FindAppUART.exe> should be placed in the same directory with the file | |||
CapTouch_BoosterPack_UserExperience_GUI.exe. By default this directory is | |||
[application.windows] | |||
!NOTE: The FindUART.exe file must be copied back into the [application.windows] | |||
directory after each export, as processing removes the entire directory during | |||
the application export process. Make sure to keep a local copy of the file | |||
FindUART.exe. | |||
IV. OTHER PLATFORM SUPPORT | |||
----------------------------------- | |||
The main application code is written in processing, a java-based language that | |||
is portable to different OS platforms such as Windows, Linux or Mac. However | |||
it utilizes the serial driver & the .NET COM port utility that is developed | |||
for Windows only. Replacing this component with the equivalent [driver] in Linux | |||
or Mac would enable a complete port of this application. | |||
Additionally, a Linux or Mac USB/COM port driver must also be installed in order | |||
to connect and communicate with the LaunchPad. | |||
@ -0,0 +1,5 @@ | |||
# only export the jar file for applets.. | |||
# everything else is installed as a separate browser plugin | |||
applet=sonia_v2_9.jar | |||
# application needs everything | |||
application=sonia_v2_9.jar,JSynClasses.jar,JSynV142.dll,libJSynV142.jnilib |
@ -0,0 +1,3 @@ | |||
CapTouch_BoosterPack_UserExperience_GUI | |||
CapTouch_BoosterPack_UserExperience_GUI.jar,core.jar,JSynClasses.jar,sonia_v2_9.jar,serial.jar,RXTXcomm.jar |
@ -0,0 +1,755 @@ | |||
import processing.core.*; | |||
import processing.xml.*; | |||
import pitaru.sonia_v2_9.*; | |||
import processing.serial.*; | |||
import java.io.BufferedReader; | |||
import java.io.IOException; | |||
import java.io.InputStreamReader; | |||
import java.applet.*; | |||
import java.awt.Dimension; | |||
import java.awt.Frame; | |||
import java.awt.event.MouseEvent; | |||
import java.awt.event.KeyEvent; | |||
import java.awt.event.FocusEvent; | |||
import java.awt.Image; | |||
import java.io.*; | |||
import java.net.*; | |||
import java.text.*; | |||
import java.util.*; | |||
import java.util.zip.*; | |||
import java.util.regex.*; | |||
public class CapTouch_BoosterPack_UserExperience_GUI extends PApplet { | |||
/******************************************************************************* | |||
* | |||
* CapTouch_BoosterPack_UserExperience_GUI.pde | |||
* - PC demo application for establishing a serial connection | |||
* with the LaunchPad CapTouch BoosterPack. | |||
* | |||
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ | |||
* | |||
* Redistribution and use in source and binary forms, with or without | |||
* modification, are permitted provided that the following conditions | |||
* are met: | |||
* | |||
* Redistributions of source code must retain the above copyright | |||
* notice, this list of conditions and the following disclaimer. | |||
* | |||
* Redistributions in binary form must reproduce the above copyright | |||
* notice, this list of conditions and the following disclaimer in the | |||
* documentation and/or other materials provided with the | |||
* distribution. | |||
* | |||
* Neither the name of Texas Instruments Incorporated nor the names of | |||
* its contributors may be used to endorse or promote products derived | |||
* from this software without specific prior written permission. | |||
* | |||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* | |||
* | |||
******************************************************************************/ | |||
/****************************************************************************** | |||
* MSP430G2-LaunchPad CapTouch BoosterPack User Experience GUI | |||
* Desc: | |||
* This PC GUI application communicates with the LaunchPad specifically to | |||
* receive capacitive touch data from the LaunchPad CapTouch BoosterPack and | |||
* provides the visualization of said information in the GUI. | |||
* | |||
* The GUI uses a small .NET utility (FindAppUART.exe) to automatically detect | |||
* a proper LaunchPad/430Emulator device connected to the PC USB port. Upon | |||
* correct USB COM port discovery, the application initiates a 9600baud UART | |||
* connection and starts receiving data. | |||
* | |||
* Upon each LaunchPad event, data is transmitted [always] via a simple '2-byte' | |||
* protocol as described below. | |||
* [LaunchPad] Wake up : 0xBE 0xEF | |||
* [LaunchPad] Sleep : 0xDE 0xAD | |||
* [CapTouch] Center Button : 0x80 0x80 | |||
* [CapTouch] Wheel Tap : WT WT = pos. on wheel [0-0x0F] + 0x30 | |||
* [CapTouch] Gesture Start : 0xFC POS = pos. on wheel [0-0x0F] + 0x20 | |||
* [CapTouch] Gesture Stop : 0xFB POS = pos. on wheel [0-0x0F] + 0x20 | |||
* [CapTouch] Gesture Update: GES POS | |||
* Gesture = [0-0x0F] --> Clockwise gesture | |||
* = 0x10+ [0-0x0F] --> Counter-clockwise gesture | |||
* | |||
* The GUI grays out during sleep mode and returns to active mode upon wake up. | |||
* The 'Center Button' press data toggles the center circle color, mimicking the | |||
* behavior of the center LED on the BoosterPack. | |||
* The 'Wheel Tap' is represented by lighting up a single slice on the wheel. | |||
* The gesture tracking [Start, Stop, Update] is visualized on the wheel with | |||
* the coloration of the wheel slices. Gesture can be tracked for several | |||
* revolutions of the wheel, in both clockwise and counter-clockwise directions. | |||
* | |||
* A hidden code/lock is embedded in the wheel. Correct sequence [similar to a | |||
* rotational combination lock] reveals a secret address. | |||
* | |||
* D. Dang | |||
* Texas Instruments, Inc. | |||
* Ver 0.90 Feb 2011 | |||
******************************************************************************/ | |||
final int TIME_OUT = 140; | |||
/*--------Dimensions & coordinates------------*/ | |||
final int CANVAS_SIZE_X = 900; | |||
final int CANVAS_SIZE_Y = 580; | |||
final int OUT_CIRCLE_RADIUS = 248; | |||
final int IN_CIRCLE_RADIUS = 101; | |||
final int CENTER_CIRCLE_RADIUS = 37; | |||
final int CIRCLE_CENTER_X = 450; | |||
final int CIRCLE_CENTER_Y = 285; | |||
final int SOUND_ICON_X = 820; | |||
final int SOUND_ICON_Y = 20; | |||
/*--------Drawing definitions------------*/ | |||
final int NUMBER_OF_SLICES = 16; | |||
final int BACKGROUND_COLOR = 170; | |||
final int TAP_SLICE_COLOR = -100; | |||
final int SLICE_TRANSPARENCY = 30; | |||
final int SLICE_TRANSPARENCY_OFFSET = 80; | |||
/*--------UART protocol definitions------------*/ | |||
final int WAKE_UP_UART_CODE = 0xBE; | |||
final int WAKE_UP_UART_CODE2 = 0xEF; | |||
final int SLEEP_MODE_UART_CODE = 0xDE; | |||
final int SLEEP_MODE_UART_CODE2 = 0xAD; | |||
final int CENTER_BUTTON_CODE = 0x80; | |||
final int INVALID_WHEEL_POSITION = 0xFE; | |||
final int INVALID_GESTURE = 0xFD; | |||
final int GESTURE_START = 0xFC; | |||
final int GESTURE_STOP = 0xFB; | |||
final int GESTURE_POSITION_OFFSET = 0x20; | |||
final int WHEEL_POSITION_OFFSET = 0x30; | |||
final int NUMBER_OF_WHEEL_POSITIONS = 16; | |||
//final int INVALID_WHEEL_POSITION = -100; | |||
final int INVALID_GESTURE_DIRECTION = -100; | |||
final int GESTURE_CLOCKWISE = 1; | |||
final int GESTURE_COUNTERCLOCKWISE = -1; | |||
/*----------CapTouch-related variables----------------*/ | |||
int gestureStartingPosition = INVALID_WHEEL_POSITION, gestureStoppingPosition = INVALID_WHEEL_POSITION; | |||
int[] gestureCoverPositions = new int[16]; | |||
int gestureDirection = INVALID_GESTURE_DIRECTION; | |||
int gestureImmediateDirection = INVALID_GESTURE_DIRECTION; | |||
int allLit = 0; | |||
int inactivityCounter=0, sleeping=0, tapping=0, centerButton=0; | |||
int CenterButtonToggle=0; | |||
/*------Serial communication----------------*/ | |||
int LaunchPadComPortFound = 0, numberOfLookingDots=0; | |||
Serial LaunchPad; | |||
/*--------- Visual & audio elements-----------*/ | |||
PImage backgroundImage, innerCircleImage,innerCircleSelectedImage, innerCircleUnlockedImage ; | |||
int drawNumberEnabled = 0; | |||
Sample click,clickFound, clickOpen; | |||
int soundEnabled = 0; | |||
public void drawSlice(int sliceIndex, int sliceLevel) | |||
{ | |||
int sliceAfter, sliceLabel; | |||
sliceLabel = sliceIndex; | |||
if (sliceIndex < 3) | |||
sliceIndex = sliceIndex + 16 - 4; | |||
else | |||
sliceIndex = sliceIndex - 4; | |||
sliceAfter = sliceIndex + 1; | |||
if (sliceAfter == NUMBER_OF_SLICES) | |||
sliceAfter = 0; | |||
noStroke(); | |||
stroke(255); | |||
strokeWeight(4); | |||
if (sliceLevel == TAP_SLICE_COLOR) | |||
fill(160,160,160, 225); | |||
else | |||
fill(252,236,54, sliceLevel * SLICE_TRANSPARENCY + SLICE_TRANSPARENCY_OFFSET); | |||
arc(CIRCLE_CENTER_X, CIRCLE_CENTER_Y, OUT_CIRCLE_RADIUS*2, OUT_CIRCLE_RADIUS*2, (((float)sliceIndex)-0.5f) * 2 * PI /16, (((float)sliceIndex)+0.5f) * 2 * PI /16); | |||
line( CIRCLE_CENTER_X + cos( (((float)sliceIndex)-0.5f) * 2 * PI /16 ) * OUT_CIRCLE_RADIUS, CIRCLE_CENTER_Y + sin((((float)sliceIndex)-0.5f) * 2 * PI /16 ) * OUT_CIRCLE_RADIUS, | |||
CIRCLE_CENTER_X + cos( (((float)sliceIndex)-0.5f) * 2 * PI /16 ) * IN_CIRCLE_RADIUS, CIRCLE_CENTER_Y + sin((((float)sliceIndex)-0.5f) * 2 * PI /16 ) * IN_CIRCLE_RADIUS); | |||
line( CIRCLE_CENTER_X + cos( (((float)sliceIndex)+0.5f) * 2 * PI /16 ) * OUT_CIRCLE_RADIUS, CIRCLE_CENTER_Y + sin((((float)sliceIndex)+0.5f) * 2 * PI /16 ) * OUT_CIRCLE_RADIUS, | |||
CIRCLE_CENTER_X + cos( (((float)sliceIndex)+0.5f) * 2 * PI /16 ) * IN_CIRCLE_RADIUS, CIRCLE_CENTER_Y + sin((((float)sliceIndex)+0.5f) * 2 * PI /16 ) * IN_CIRCLE_RADIUS); | |||
if (drawNumberEnabled == 1) | |||
{ | |||
fill(0); | |||
text( sliceLabel, | |||
CIRCLE_CENTER_X + cos( (((float)sliceIndex)) * 2 * PI /16 ) * (OUT_CIRCLE_RADIUS-40)-7, | |||
CIRCLE_CENTER_Y + sin( (((float)sliceIndex)) * 2 * PI /16 ) * (OUT_CIRCLE_RADIUS-40)); | |||
} | |||
} | |||
public void drawCanvas() | |||
{ | |||
int i; | |||
background(BACKGROUND_COLOR); | |||
image(backgroundImage, 0 ,0); | |||
fill(0,0,0,255); | |||
if (unlocked == 1) | |||
{ | |||
fill(0); | |||
text("BoosterPack Unlocked",300,30); | |||
for (i=0;i<4;i++) | |||
drawSlice(code[i],4); | |||
fill(255); | |||
ellipse(CIRCLE_CENTER_X, CIRCLE_CENTER_Y, IN_CIRCLE_RADIUS*2 , IN_CIRCLE_RADIUS*2); | |||
image(innerCircleUnlockedImage, 0, 0); | |||
} | |||
} | |||
public void goToSleep() | |||
{ | |||
tint(120,120,120,180); | |||
drawCanvas(); | |||
tint(120,120,120,180); | |||
fill(255); | |||
textSize(20); | |||
text(".",20,30); | |||
text(".",28,30); | |||
text(".",35,30); | |||
textSize(25); | |||
text("z",47,30); | |||
textSize(30); | |||
text("z",65,30); | |||
textSize(35); | |||
text("z",85,30); | |||
textSize(40); | |||
text("z",108,30); | |||
textSize(30); | |||
noTint(); | |||
sleeping = 1; | |||
inactivityCounter = TIME_OUT; | |||
} | |||
public void findLaunchPad() | |||
{ | |||
String ComPortName =""; | |||
try | |||
{ | |||
Process proc = Runtime.getRuntime().exec("FindAppUART.exe"); | |||
proc.waitFor(); | |||
int exitVal = proc.exitValue(); | |||
// Get the first line from the process' STDOUT | |||
BufferedReader buf = new BufferedReader(new InputStreamReader(proc.getInputStream())); | |||
ComPortName = buf.readLine(); | |||
if (ComPortName.substring(0,3).equals("COM") != true) | |||
ComPortName = ""; | |||
else | |||
{ | |||
LaunchPadComPortFound = 1; | |||
LaunchPad = new Serial(this, ComPortName, 9600); | |||
} | |||
} | |||
catch(Exception e) | |||
{ | |||
println(e); | |||
} | |||
} | |||
public void promptLookingForLaunchPad() | |||
{ | |||
fill(255,0,0); | |||
noStroke(); | |||
rect(100,CANVAS_SIZE_Y/2-100,CANVAS_SIZE_X-120,200); | |||
fill(255); | |||
textSize(50); | |||
numberOfLookingDots++; | |||
if (numberOfLookingDots==5) | |||
numberOfLookingDots = 1; | |||
switch(numberOfLookingDots) | |||
{ | |||
case 1: text("Looking for LaunchPad ", 175,CANVAS_SIZE_Y/2 ); break; | |||
case 2: text("Looking for LaunchPad . ", 175,CANVAS_SIZE_Y/2 ); break; | |||
case 3: text("Looking for LaunchPad .. ", 175,CANVAS_SIZE_Y/2 ); break; | |||
case 4: text("Looking for LaunchPad ...", 175,CANVAS_SIZE_Y/2 ); break; | |||
} | |||
} | |||
public void setup() | |||
{ | |||
size(CANVAS_SIZE_X, CANVAS_SIZE_Y); | |||
background(255,0,0); | |||
Sonia.start(this); | |||
click = new Sample("click1.aiff"); | |||
clickOpen = new Sample("open.aiff"); | |||
clickFound = new Sample("unlock.aiff"); | |||
click.setVolume(3); | |||
clickFound.setVolume(3); | |||
frameRate(3); | |||
backgroundImage = loadImage("background.png"); | |||
innerCircleImage = loadImage("innerCircle.png"); | |||
innerCircleSelectedImage = loadImage("innerCircleSelected.png"); | |||
innerCircleUnlockedImage = loadImage("innerCircleUnlocked.png"); | |||
findLaunchPad(); | |||
if (LaunchPadComPortFound == 0) | |||
{ | |||
fill(255); | |||
textSize(40); | |||
text("LaunchPad Capacitive Touch BoosterPack", 70,50); | |||
textSize(55); | |||
fill(0); | |||
text("User Experience Demo", 150,100); | |||
fill(0); | |||
textSize(25); | |||
text("1. Plug your Capacitive Touch BoosterPack into the LaunchPad", 150,CANVAS_SIZE_Y - 70); | |||
text("2. Connect your LaunchPad to the PC via USB", 150,CANVAS_SIZE_Y - 45); | |||
promptLookingForLaunchPad(); | |||
} | |||
else | |||
{ | |||
frameRate(30); | |||
goToSleep(); | |||
} | |||
} | |||
public void draw() | |||
{ | |||
int i; | |||
if (LaunchPadComPortFound==0) | |||
{ | |||
findLaunchPad(); | |||
if (LaunchPadComPortFound==1) | |||
{ | |||
goToSleep(); | |||
frameRate(30); | |||
} | |||
else | |||
promptLookingForLaunchPad(); | |||
} | |||
else | |||
if(LaunchPad.available() >= 0) | |||
{ | |||
int buf, buf1; | |||
buf = LaunchPad.read(); | |||
buf1 = -1; | |||
if (buf>=0) | |||
{ | |||
drawCanvas(); | |||
textSize(30); | |||
sleeping = 0; | |||
inactivityCounter=0; | |||
tapping = 0 ; | |||
centerButton = 0; | |||
switch(buf) | |||
{ | |||
case WAKE_UP_UART_CODE: | |||
while (buf1 <0) | |||
buf1 = LaunchPad.read(); | |||
if (buf1==WAKE_UP_UART_CODE2) | |||
text("Proximity Sensor Wake Up",20,30); | |||
else | |||
{ | |||
print("Error: invalid UART Wake up == "); | |||
println(buf1); | |||
} | |||
break; | |||
case SLEEP_MODE_UART_CODE: | |||
while (buf1 <0) | |||
buf1 = LaunchPad.read(); | |||
if (buf1==SLEEP_MODE_UART_CODE2) | |||
{ | |||
//tint(120,0,0,180); | |||
CenterButtonToggle = 0; | |||
backgroundImage = loadImage("background.png"); | |||
innerCircleImage = loadImage("innerCircle.png"); | |||
tint(120,120,120,180); | |||
drawCanvas(); | |||
text("Good night!",20,30); | |||
sleeping = 1; | |||
noTint(); | |||
} | |||
else | |||
{ | |||
print("Error: invalid UART Sleep == "); | |||
println(buf1); | |||
} | |||
break; | |||
case CENTER_BUTTON_CODE: | |||
while (buf1 <0) | |||
buf1 = LaunchPad.read(); | |||
if (buf==buf1) | |||
{ | |||
if (unlocked==1) | |||
{ | |||
unlocked = 0; | |||
link(secretURL); | |||
} | |||
CenterButtonToggle = 1 - CenterButtonToggle; | |||
if (CenterButtonToggle == 1) | |||
{ | |||
innerCircleImage= loadImage("innerCircleSelected.png"); | |||
backgroundImage = loadImage("backgroundSelected.png"); | |||
} | |||
else | |||
{ | |||
innerCircleImage= loadImage("innerCircle.png"); | |||
backgroundImage = loadImage("background.png"); | |||
} | |||
drawCanvas(); | |||
centerButton = 1; | |||
} | |||
else | |||
{ | |||
print("Error: invalid CENTER BUTTON code == "); | |||
println(buf1); | |||
} | |||
break; | |||
case GESTURE_STOP: | |||
while (buf1 <0) | |||
buf1 = LaunchPad.read(); | |||
if (buf==buf1) | |||
{ | |||
text("Gesture Released",20,30); | |||
gestureStartingPosition = INVALID_WHEEL_POSITION; | |||
gestureStoppingPosition = INVALID_WHEEL_POSITION; | |||
gestureDirection = INVALID_GESTURE_DIRECTION; | |||
allLit = 0; | |||
codeCheck = 0; | |||
codeLevel = 0; | |||
//unlocked = 0; | |||
} | |||
else | |||
{ | |||
print("Error: invalid GESTURE_STOP code == "); | |||
println(buf1); | |||
} | |||
break; | |||
case GESTURE_START: | |||
while (buf1 <0) | |||
buf1 = LaunchPad.read(); | |||
if ( (buf1 < GESTURE_POSITION_OFFSET ) || (buf1 > GESTURE_POSITION_OFFSET + NUMBER_OF_WHEEL_POSITIONS)) | |||
{ | |||
print("Error: invalid gesture start position == "); | |||
println(buf1); | |||
} | |||
else | |||
{ | |||
text("Gesture Detected",20,30); | |||
buf1 = buf1 - GESTURE_POSITION_OFFSET; | |||
if (buf1<0) | |||
println(buf); | |||
gestureStartingPosition = buf1; | |||
gestureStoppingPosition = buf1; | |||
if (buf1 == code[0]) | |||
codeCheck = 1; | |||
else | |||
codeCheck = -1; | |||
codeLevel = 0; | |||
changeDirection = 0; | |||
drawSlice(buf1, 1); | |||
fill(255); | |||
ellipse(CIRCLE_CENTER_X, CIRCLE_CENTER_Y, IN_CIRCLE_RADIUS*2 , IN_CIRCLE_RADIUS*2); | |||
image(innerCircleImage,0,0); | |||
} | |||
break; | |||
default: // data from LaunchPad is not code, but value | |||
if (buf > WHEEL_POSITION_OFFSET + NUMBER_OF_WHEEL_POSITIONS ) // Invalid Code | |||
{ | |||
print("Error: invalid UART code == "); | |||
println(buf); | |||
} | |||
else | |||
/*---------------------WHEEL POSITION-----------------------*/ | |||
if ((buf <= WHEEL_POSITION_OFFSET + NUMBER_OF_WHEEL_POSITIONS) && (buf >= WHEEL_POSITION_OFFSET )) // Tapping | |||
{ | |||
while (buf1 <0) | |||
buf1 = LaunchPad.read(); | |||
if (buf==buf1) | |||
{ | |||
buf = buf - WHEEL_POSITION_OFFSET; | |||
text("Press @ ",10,30); | |||
text(buf,125,30); | |||
tapping = 1; | |||
drawSlice(buf, TAP_SLICE_COLOR); | |||
fill(255); | |||
ellipse(CIRCLE_CENTER_X, CIRCLE_CENTER_Y, IN_CIRCLE_RADIUS*2 , IN_CIRCLE_RADIUS*2); | |||
image(innerCircleImage, 0,0); | |||
} | |||
else | |||
{ | |||
print("Error: invalid WHEEL POSITION code == "); | |||
println(buf); | |||
} | |||
} | |||
else | |||
/*---------------------GESTURE DATA-----------------------*/ | |||
if (buf < GESTURE_POSITION_OFFSET ) // Gesturing | |||
if (gestureStartingPosition != INVALID_WHEEL_POSITION) | |||
{ | |||
if (buf>=NUMBER_OF_WHEEL_POSITIONS) // Determine orientation: binary value 00000xxx = CW, 00001xxx = CC | |||
{ | |||
buf -= NUMBER_OF_WHEEL_POSITIONS; | |||
text(buf, 20,30); | |||
text("Counter-Clockwise",55,30); | |||
gestureImmediateDirection = GESTURE_COUNTERCLOCKWISE; | |||
} | |||
else | |||
{ | |||
text(buf, 20,30); | |||
text("Clockwise",55,30); | |||
gestureImmediateDirection = GESTURE_CLOCKWISE; | |||
} | |||
while (buf1 <0) | |||
buf1 = LaunchPad.read(); | |||
if ( (buf1 >= GESTURE_POSITION_OFFSET ) && (buf1 < GESTURE_POSITION_OFFSET + NUMBER_OF_WHEEL_POSITIONS)) | |||
{ | |||
buf1 = buf1 - GESTURE_POSITION_OFFSET; | |||
if (gestureDirection == INVALID_GESTURE_DIRECTION) | |||
gestureDirection = gestureImmediateDirection; | |||
// if (gestureImmediateDirection != gestureDirection) | |||
// gestureCoverPositions[gestureStoppingPosition] = 0; | |||
// | |||
while (buf-->0) | |||
{ | |||
if (gestureStoppingPosition == gestureStartingPosition) //If moving from the starting position | |||
if (gestureDirection != gestureImmediateDirection) //If moving against the current direction | |||
{ | |||
if (allLit == 0) //Starting at zero? Change direction | |||
gestureDirection = gestureImmediateDirection; | |||
else //Back to a previous revolution? | |||
allLit--; | |||
} | |||
gestureStoppingPosition += gestureImmediateDirection; | |||
if (gestureStoppingPosition == NUMBER_OF_WHEEL_POSITIONS) | |||
gestureStoppingPosition = 0; | |||
if (gestureStoppingPosition < 0) | |||
gestureStoppingPosition = NUMBER_OF_WHEEL_POSITIONS-1; | |||
if (gestureStoppingPosition == gestureStartingPosition) //If moving to the starting position | |||
{ | |||
if (gestureImmediateDirection == gestureDirection) //complete a revolution? | |||
allLit += 1; | |||
else | |||
if (allLit == 0) //Back to zero | |||
gestureDirection = INVALID_GESTURE_DIRECTION; | |||
//Undo | |||
} | |||
} | |||
for ( i = 0; i < NUMBER_OF_WHEEL_POSITIONS; i++) | |||
gestureCoverPositions[i] = allLit; | |||
i = gestureStartingPosition; | |||
while (i != gestureStoppingPosition) | |||
{ | |||
gestureCoverPositions[i]= allLit + 1; | |||
i += gestureDirection; | |||
if (i<0) | |||
i = NUMBER_OF_WHEEL_POSITIONS-1; | |||
if (i == NUMBER_OF_WHEEL_POSITIONS) | |||
i = 0; | |||
} | |||
gestureCoverPositions[i]= allLit + 1; | |||
for ( i = 0; i < NUMBER_OF_WHEEL_POSITIONS; i++) | |||
if (gestureCoverPositions[i] > 0) | |||
drawSlice(i, gestureCoverPositions[i]); | |||
fill(255); | |||
ellipse(CIRCLE_CENTER_X, CIRCLE_CENTER_Y, IN_CIRCLE_RADIUS*2 , IN_CIRCLE_RADIUS*2); | |||
image(innerCircleImage,0,0); | |||
if (changeDirection !=0) | |||
{ | |||
if (gestureImmediateDirection != changeDirection) | |||
codeCheck = -1; | |||
changeDirection = 0; | |||
} | |||
if (soundEnabled == 1) | |||
click.play(); | |||
if (codeModeEnabled == 1) | |||
{ | |||
if (codeCheck==1) | |||
{ | |||
codeValid = 1; | |||
for ( i = 0; i < NUMBER_OF_WHEEL_POSITIONS; i++) | |||
if (gestureCoverPositions[i] != codeValues[codeLevel][i]) | |||
codeValid = 0; | |||
if (codeRotate[codeLevel] != gestureImmediateDirection) | |||
codeValid = 0; | |||
if (codeValid == 1) | |||
{ | |||
if (codeLevel++ < 2) | |||
{ | |||
changeDirection = -gestureImmediateDirection; | |||
if (soundEnabled == 1) | |||
clickFound.play(); | |||
} | |||
else | |||
{ | |||
fill(0); | |||
text("Unlocked!!",400,30); | |||
text("Press Center",500,90); | |||
unlocked = 1; | |||
codeLevel = 0; | |||
codeCheck = -1; | |||
if (soundEnabled == 1) | |||
clickOpen.play(); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
// invalid gesture data | |||
else | |||
{ | |||
print("Error: invalid gesture position data == "); | |||
println(buf1); | |||
} | |||
} | |||
else | |||
{ // Should not happen | |||
buf = buf - GESTURE_POSITION_OFFSET; | |||
println("Invalid UART Data, not expecting such data"); | |||
} | |||
break; | |||
} | |||
} | |||
else | |||
{ | |||
if (++inactivityCounter==TIME_OUT) | |||
{ | |||
if (sleeping==1) | |||
{ | |||
goToSleep(); | |||
} | |||
else | |||
drawCanvas(); | |||
} | |||
} | |||
} | |||
} | |||
public void mouseReleased() | |||
{ | |||
if ( (mouseX-CANVAS_SIZE_X/2)*(mouseX-CANVAS_SIZE_X/2) + (mouseY-CANVAS_SIZE_Y/2)*(mouseY-CANVAS_SIZE_Y/2) < IN_CIRCLE_RADIUS * IN_CIRCLE_RADIUS ) | |||
if (LaunchPadComPortFound ==1) | |||
{ | |||
soundEnabled = 1 - soundEnabled; | |||
codeModeEnabled = 1 - codeModeEnabled; | |||
drawNumberEnabled = 1 - drawNumberEnabled; | |||
} | |||
} | |||
/*---------Embedded code validation------------------*/ | |||
// Ideally nobody should ever bother scrolling down here | |||
// But good job, you've found it the easy way! | |||
// Anyways, don't spoil the fun for others would ya? | |||
int[] code = { 0, 4, 3, 0}; | |||
int[] codeRotate = {1, -1, 1}; | |||
int[][] codeValues = { {1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |||
{1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, | |||
{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; | |||
String secretURL = "http://ti.com/msp430rr"; | |||
int codeCheck, codeLevel, codeValid, changeDirection, unlocked=0, codeModeEnabled = 0; | |||
static public void main(String args[]) { | |||
PApplet.main(new String[] { "--bgcolor=#E2E2E2", "CapTouch_BoosterPack_UserExperience_GUI" }); | |||
} | |||
} |
@ -0,0 +1,725 @@ | |||
/******************************************************************************* | |||
* | |||
* CapTouch_BoosterPack_UserExperience_GUI.pde | |||
* - PC demo application for establishing a serial connection | |||
* with the LaunchPad CapTouch BoosterPack. | |||
* | |||
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ | |||
* | |||
* Redistribution and use in source and binary forms, with or without | |||
* modification, are permitted provided that the following conditions | |||
* are met: | |||
* | |||
* Redistributions of source code must retain the above copyright | |||
* notice, this list of conditions and the following disclaimer. | |||
* | |||
* Redistributions in binary form must reproduce the above copyright | |||
* notice, this list of conditions and the following disclaimer in the | |||
* documentation and/or other materials provided with the | |||
* distribution. | |||
* | |||
* Neither the name of Texas Instruments Incorporated nor the names of | |||
* its contributors may be used to endorse or promote products derived | |||
* from this software without specific prior written permission. | |||
* | |||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* | |||
* | |||
******************************************************************************/ | |||
/****************************************************************************** | |||
* MSP430G2-LaunchPad CapTouch BoosterPack User Experience GUI | |||
* Desc: | |||
* This PC GUI application communicates with the LaunchPad specifically to | |||
* receive capacitive touch data from the LaunchPad CapTouch BoosterPack and | |||
* provides the visualization of said information in the GUI. | |||
* | |||
* The GUI uses a small .NET utility (FindAppUART.exe) to automatically detect | |||
* a proper LaunchPad/430Emulator device connected to the PC USB port. Upon | |||
* correct USB COM port discovery, the application initiates a 9600baud UART | |||
* connection and starts receiving data. | |||
* | |||
* Upon each LaunchPad event, data is transmitted [always] via a simple '2-byte' | |||
* protocol as described below. | |||
* [LaunchPad] Wake up : 0xBE 0xEF | |||
* [LaunchPad] Sleep : 0xDE 0xAD | |||
* [CapTouch] Center Button : 0x80 0x80 | |||
* [CapTouch] Wheel Tap : WT WT = pos. on wheel [0-0x0F] + 0x30 | |||
* [CapTouch] Gesture Start : 0xFC POS = pos. on wheel [0-0x0F] + 0x20 | |||
* [CapTouch] Gesture Stop : 0xFB POS = pos. on wheel [0-0x0F] + 0x20 | |||
* [CapTouch] Gesture Update: GES POS | |||
* Gesture = [0-0x0F] --> Clockwise gesture | |||
* = 0x10+ [0-0x0F] --> Counter-clockwise gesture | |||
* | |||
* The GUI grays out during sleep mode and returns to active mode upon wake up. | |||
* The 'Center Button' press data toggles the center circle color, mimicking the | |||
* behavior of the center LED on the BoosterPack. | |||
* The 'Wheel Tap' is represented by lighting up a single slice on the wheel. | |||
* The gesture tracking [Start, Stop, Update] is visualized on the wheel with | |||
* the coloration of the wheel slices. Gesture can be tracked for several | |||
* revolutions of the wheel, in both clockwise and counter-clockwise directions. | |||
* | |||
* A hidden code/lock is embedded in the wheel. Correct sequence [similar to a | |||
* rotational combination lock] reveals a secret address. | |||
* | |||
* D. Dang | |||
* Texas Instruments, Inc. | |||
* Ver 0.90 Feb 2011 | |||
******************************************************************************/ | |||
import pitaru.sonia_v2_9.*; | |||
import processing.serial.*; | |||
import java.io.BufferedReader; | |||
import java.io.IOException; | |||
import java.io.InputStreamReader; | |||
final int TIME_OUT = 140; | |||
/*--------Dimensions & coordinates------------*/ | |||
final int CANVAS_SIZE_X = 900; | |||
final int CANVAS_SIZE_Y = 580; | |||
final int OUT_CIRCLE_RADIUS = 248; | |||
final int IN_CIRCLE_RADIUS = 101; | |||
final int CENTER_CIRCLE_RADIUS = 37; | |||
final int CIRCLE_CENTER_X = 450; | |||
final int CIRCLE_CENTER_Y = 285; | |||
final int SOUND_ICON_X = 820; | |||
final int SOUND_ICON_Y = 20; | |||
/*--------Drawing definitions------------*/ | |||
final int NUMBER_OF_SLICES = 16; | |||
final int BACKGROUND_COLOR = 170; | |||
final int TAP_SLICE_COLOR = -100; | |||
final int SLICE_TRANSPARENCY = 30; | |||
final int SLICE_TRANSPARENCY_OFFSET = 80; | |||
/*--------UART protocol definitions------------*/ | |||
final int WAKE_UP_UART_CODE = 0xBE; | |||
final int WAKE_UP_UART_CODE2 = 0xEF; | |||
final int SLEEP_MODE_UART_CODE = 0xDE; | |||
final int SLEEP_MODE_UART_CODE2 = 0xAD; | |||
final int CENTER_BUTTON_CODE = 0x80; | |||
final int INVALID_WHEEL_POSITION = 0xFE; | |||
final int INVALID_GESTURE = 0xFD; | |||
final int GESTURE_START = 0xFC; | |||
final int GESTURE_STOP = 0xFB; | |||
final int GESTURE_POSITION_OFFSET = 0x20; | |||
final int WHEEL_POSITION_OFFSET = 0x30; | |||
final int NUMBER_OF_WHEEL_POSITIONS = 16; | |||
//final int INVALID_WHEEL_POSITION = -100; | |||
final int INVALID_GESTURE_DIRECTION = -100; | |||
final int GESTURE_CLOCKWISE = 1; | |||
final int GESTURE_COUNTERCLOCKWISE = -1; | |||
/*----------CapTouch-related variables----------------*/ | |||
int gestureStartingPosition = INVALID_WHEEL_POSITION, gestureStoppingPosition = INVALID_WHEEL_POSITION; | |||
int[] gestureCoverPositions = new int[16]; | |||
int gestureDirection = INVALID_GESTURE_DIRECTION; | |||
int gestureImmediateDirection = INVALID_GESTURE_DIRECTION; | |||
int allLit = 0; | |||
int inactivityCounter=0, sleeping=0, tapping=0, centerButton=0; | |||
int CenterButtonToggle=0; | |||
/*------Serial communication----------------*/ | |||
int LaunchPadComPortFound = 0, numberOfLookingDots=0; | |||
Serial LaunchPad; | |||
/*--------- Visual & audio elements-----------*/ | |||
PImage backgroundImage, innerCircleImage,innerCircleSelectedImage, innerCircleUnlockedImage ; | |||
int drawNumberEnabled = 0; | |||
Sample click,clickFound, clickOpen; | |||
int soundEnabled = 0; | |||
void drawSlice(int sliceIndex, int sliceLevel) | |||
{ | |||
int sliceAfter, sliceLabel; | |||
sliceLabel = sliceIndex; | |||
if (sliceIndex < 3) | |||
sliceIndex = sliceIndex + 16 - 4; | |||
else | |||
sliceIndex = sliceIndex - 4; | |||
sliceAfter = sliceIndex + 1; | |||
if (sliceAfter == NUMBER_OF_SLICES) | |||
sliceAfter = 0; | |||
noStroke(); | |||
stroke(255); | |||
strokeWeight(4); | |||
if (sliceLevel == TAP_SLICE_COLOR) | |||
fill(160,160,160, 225); | |||
else | |||
fill(252,236,54, sliceLevel * SLICE_TRANSPARENCY + SLICE_TRANSPARENCY_OFFSET); | |||
arc(CIRCLE_CENTER_X, CIRCLE_CENTER_Y, OUT_CIRCLE_RADIUS*2, OUT_CIRCLE_RADIUS*2, (((float)sliceIndex)-0.5) * 2 * PI /16, (((float)sliceIndex)+0.5) * 2 * PI /16); | |||
line( CIRCLE_CENTER_X + cos( (((float)sliceIndex)-0.5) * 2 * PI /16 ) * OUT_CIRCLE_RADIUS, CIRCLE_CENTER_Y + sin((((float)sliceIndex)-0.5) * 2 * PI /16 ) * OUT_CIRCLE_RADIUS, | |||
CIRCLE_CENTER_X + cos( (((float)sliceIndex)-0.5) * 2 * PI /16 ) * IN_CIRCLE_RADIUS, CIRCLE_CENTER_Y + sin((((float)sliceIndex)-0.5) * 2 * PI /16 ) * IN_CIRCLE_RADIUS); | |||
line( CIRCLE_CENTER_X + cos( (((float)sliceIndex)+0.5) * 2 * PI /16 ) * OUT_CIRCLE_RADIUS, CIRCLE_CENTER_Y + sin((((float)sliceIndex)+0.5) * 2 * PI /16 ) * OUT_CIRCLE_RADIUS, | |||
CIRCLE_CENTER_X + cos( (((float)sliceIndex)+0.5) * 2 * PI /16 ) * IN_CIRCLE_RADIUS, CIRCLE_CENTER_Y + sin((((float)sliceIndex)+0.5) * 2 * PI /16 ) * IN_CIRCLE_RADIUS); | |||
if (drawNumberEnabled == 1) | |||
{ | |||
fill(0); | |||
text( sliceLabel, | |||
CIRCLE_CENTER_X + cos( (((float)sliceIndex)) * 2 * PI /16 ) * (OUT_CIRCLE_RADIUS-40)-7, | |||
CIRCLE_CENTER_Y + sin( (((float)sliceIndex)) * 2 * PI /16 ) * (OUT_CIRCLE_RADIUS-40)); | |||
} | |||
} | |||
void drawCanvas() | |||
{ | |||
int i; | |||
background(BACKGROUND_COLOR); | |||
image(backgroundImage, 0 ,0); | |||
fill(0,0,0,255); | |||
if (unlocked == 1) | |||
{ | |||
fill(0); | |||
text("BoosterPack Unlocked",300,30); | |||
for (i=0;i<4;i++) | |||
drawSlice(code[i],4); | |||
fill(255); | |||
ellipse(CIRCLE_CENTER_X, CIRCLE_CENTER_Y, IN_CIRCLE_RADIUS*2 , IN_CIRCLE_RADIUS*2); | |||
image(innerCircleUnlockedImage, 0, 0); | |||
} | |||
} | |||
void goToSleep() | |||
{ | |||
tint(120,120,120,180); | |||
drawCanvas(); | |||
tint(120,120,120,180); | |||
fill(255); | |||
textSize(20); | |||
text(".",20,30); | |||
text(".",28,30); | |||
text(".",35,30); | |||
textSize(25); | |||
text("z",47,30); | |||
textSize(30); | |||
text("z",65,30); | |||
textSize(35); | |||
text("z",85,30); | |||
textSize(40); | |||
text("z",108,30); | |||
textSize(30); | |||
noTint(); | |||
sleeping = 1; | |||
inactivityCounter = TIME_OUT; | |||
} | |||
void findLaunchPad() | |||
{ | |||
String ComPortName =""; | |||
try | |||
{ | |||
Process proc = Runtime.getRuntime().exec("FindAppUART.exe"); | |||
proc.waitFor(); | |||
int exitVal = proc.exitValue(); | |||
// Get the first line from the process' STDOUT | |||
BufferedReader buf = new BufferedReader(new InputStreamReader(proc.getInputStream())); | |||
ComPortName = buf.readLine(); | |||
if (ComPortName.substring(0,3).equals("COM") != true) | |||
ComPortName = ""; | |||
else | |||
{ | |||
LaunchPadComPortFound = 1; | |||
LaunchPad = new Serial(this, ComPortName, 9600); | |||
} | |||
} | |||
catch(Exception e) | |||
{ | |||
println(e); | |||
} | |||
} | |||
void promptLookingForLaunchPad() | |||
{ | |||
fill(255,0,0); | |||
noStroke(); | |||
rect(100,CANVAS_SIZE_Y/2-100,CANVAS_SIZE_X-120,200); | |||
fill(255); | |||
textSize(50); | |||
numberOfLookingDots++; | |||
if (numberOfLookingDots==5) | |||
numberOfLookingDots = 1; | |||
switch(numberOfLookingDots) | |||
{ | |||
case 1: text("Looking for LaunchPad ", 175,CANVAS_SIZE_Y/2 ); break; | |||
case 2: text("Looking for LaunchPad . ", 175,CANVAS_SIZE_Y/2 ); break; | |||
case 3: text("Looking for LaunchPad .. ", 175,CANVAS_SIZE_Y/2 ); break; | |||
case 4: text("Looking for LaunchPad ...", 175,CANVAS_SIZE_Y/2 ); break; | |||
} | |||
} | |||
void setup() | |||
{ | |||
size(CANVAS_SIZE_X, CANVAS_SIZE_Y); | |||
background(255,0,0); | |||
Sonia.start(this); | |||
click = new Sample("click1.aiff"); | |||
clickOpen = new Sample("open.aiff"); | |||
clickFound = new Sample("unlock.aiff"); | |||
click.setVolume(3); | |||
clickFound.setVolume(3); | |||
frameRate(3); | |||
backgroundImage = loadImage("background.png"); | |||
innerCircleImage = loadImage("innerCircle.png"); | |||
innerCircleSelectedImage = loadImage("innerCircleSelected.png"); | |||
innerCircleUnlockedImage = loadImage("innerCircleUnlocked.png"); | |||
findLaunchPad(); | |||
if (LaunchPadComPortFound == 0) | |||
{ | |||
fill(255); | |||
textSize(40); | |||
text("LaunchPad Capacitive Touch BoosterPack", 70,50); | |||
textSize(55); | |||
fill(0); | |||
text("User Experience Demo", 150,100); | |||
fill(0); | |||
textSize(25); | |||
text("1. Plug your Capacitive Touch BoosterPack into the LaunchPad", 150,CANVAS_SIZE_Y - 70); | |||
text("2. Connect your LaunchPad to the PC via USB", 150,CANVAS_SIZE_Y - 45); | |||
promptLookingForLaunchPad(); | |||
} | |||
else | |||
{ | |||
frameRate(30); | |||
goToSleep(); | |||
} | |||
} | |||
void draw() | |||
{ | |||
int i; | |||
if (LaunchPadComPortFound==0) | |||
{ | |||
findLaunchPad(); | |||
if (LaunchPadComPortFound==1) | |||
{ | |||
goToSleep(); | |||
frameRate(30); | |||
} | |||
else | |||
promptLookingForLaunchPad(); | |||
} | |||
else | |||
if(LaunchPad.available() >= 0) | |||
{ | |||
int buf, buf1; | |||
buf = LaunchPad.read(); | |||
buf1 = -1; | |||
if (buf>=0) | |||
{ | |||
drawCanvas(); | |||
textSize(30); | |||
sleeping = 0; | |||
inactivityCounter=0; | |||
tapping = 0 ; | |||
centerButton = 0; | |||
switch(buf) | |||
{ | |||
case WAKE_UP_UART_CODE: | |||
while (buf1 <0) | |||
buf1 = LaunchPad.read(); | |||
if (buf1==WAKE_UP_UART_CODE2) | |||
text("Proximity Sensor Wake Up",20,30); | |||
else | |||
{ | |||
print("Error: invalid UART Wake up == "); | |||
println(buf1); | |||
} | |||
break; | |||
case SLEEP_MODE_UART_CODE: | |||
while (buf1 <0) | |||
buf1 = LaunchPad.read(); | |||
if (buf1==SLEEP_MODE_UART_CODE2) | |||
{ | |||
//tint(120,0,0,180); | |||
CenterButtonToggle = 0; | |||
backgroundImage = loadImage("background.png"); | |||
innerCircleImage = loadImage("innerCircle.png"); | |||
tint(120,120,120,180); | |||
drawCanvas(); | |||
text("Good night!",20,30); | |||
sleeping = 1; | |||
noTint(); | |||
} | |||
else | |||
{ | |||
print("Error: invalid UART Sleep == "); | |||
println(buf1); | |||
} | |||
break; | |||
case CENTER_BUTTON_CODE: | |||
while (buf1 <0) | |||
buf1 = LaunchPad.read(); | |||
if (buf==buf1) | |||
{ | |||
if (unlocked==1) | |||
{ | |||
unlocked = 0; | |||
link(secretURL); | |||
} | |||
CenterButtonToggle = 1 - CenterButtonToggle; | |||
if (CenterButtonToggle == 1) | |||
{ | |||
innerCircleImage= loadImage("innerCircleSelected.png"); | |||
backgroundImage = loadImage("backgroundSelected.png"); | |||
} | |||
else | |||
{ | |||
innerCircleImage= loadImage("innerCircle.png"); | |||
backgroundImage = loadImage("background.png"); | |||
} | |||
drawCanvas(); | |||
centerButton = 1; | |||
} | |||
else | |||
{ | |||
print("Error: invalid CENTER BUTTON code == "); | |||
println(buf1); | |||
} | |||
break; | |||
case GESTURE_STOP: | |||
while (buf1 <0) | |||
buf1 = LaunchPad.read(); | |||
if (buf==buf1) | |||
{ | |||
text("Gesture Released",20,30); | |||
gestureStartingPosition = INVALID_WHEEL_POSITION; | |||
gestureStoppingPosition = INVALID_WHEEL_POSITION; | |||
gestureDirection = INVALID_GESTURE_DIRECTION; | |||
allLit = 0; | |||
codeCheck = 0; | |||
codeLevel = 0; | |||
//unlocked = 0; | |||
} | |||
else | |||
{ | |||
print("Error: invalid GESTURE_STOP code == "); | |||
println(buf1); | |||
} | |||
break; | |||
case GESTURE_START: | |||
while (buf1 <0) | |||
buf1 = LaunchPad.read(); | |||
if ( (buf1 < GESTURE_POSITION_OFFSET ) || (buf1 > GESTURE_POSITION_OFFSET + NUMBER_OF_WHEEL_POSITIONS)) | |||
{ | |||
print("Error: invalid gesture start position == "); | |||
println(buf1); | |||
} | |||
else | |||
{ | |||
text("Gesture Detected",20,30); | |||
buf1 = buf1 - GESTURE_POSITION_OFFSET; | |||
if (buf1<0) | |||
println(buf); | |||
gestureStartingPosition = buf1; | |||
gestureStoppingPosition = buf1; | |||
if (buf1 == code[0]) | |||
codeCheck = 1; | |||
else | |||
codeCheck = -1; | |||
codeLevel = 0; | |||
changeDirection = 0; | |||
drawSlice(buf1, 1); | |||
fill(255); | |||
ellipse(CIRCLE_CENTER_X, CIRCLE_CENTER_Y, IN_CIRCLE_RADIUS*2 , IN_CIRCLE_RADIUS*2); | |||
image(innerCircleImage,0,0); | |||
} | |||
break; | |||
default: // data from LaunchPad is not code, but value | |||
if (buf > WHEEL_POSITION_OFFSET + NUMBER_OF_WHEEL_POSITIONS ) // Invalid Code | |||
{ | |||
print("Error: invalid UART code == "); | |||
println(buf); | |||
} | |||
else | |||
/*---------------------WHEEL POSITION-----------------------*/ | |||
if ((buf <= WHEEL_POSITION_OFFSET + NUMBER_OF_WHEEL_POSITIONS) && (buf >= WHEEL_POSITION_OFFSET )) // Tapping | |||
{ | |||
while (buf1 <0) | |||
buf1 = LaunchPad.read(); | |||
if (buf==buf1) | |||
{ | |||
buf = buf - WHEEL_POSITION_OFFSET; | |||
text("Press @ ",10,30); | |||
text(buf,125,30); | |||
tapping = 1; | |||
drawSlice(buf, TAP_SLICE_COLOR); | |||
fill(255); | |||
ellipse(CIRCLE_CENTER_X, CIRCLE_CENTER_Y, IN_CIRCLE_RADIUS*2 , IN_CIRCLE_RADIUS*2); | |||
image(innerCircleImage, 0,0); | |||
} | |||
else | |||
{ | |||
print("Error: invalid WHEEL POSITION code == "); | |||
println(buf); | |||
} | |||
} | |||
else | |||
/*---------------------GESTURE DATA-----------------------*/ | |||
if (buf < GESTURE_POSITION_OFFSET ) // Gesturing | |||
if (gestureStartingPosition != INVALID_WHEEL_POSITION) | |||
{ | |||
if (buf>=NUMBER_OF_WHEEL_POSITIONS) // Determine orientation: binary value 00000xxx = CW, 00001xxx = CC | |||
{ | |||
buf -= NUMBER_OF_WHEEL_POSITIONS; | |||
text(buf, 20,30); | |||
text("Counter-Clockwise",55,30); | |||
gestureImmediateDirection = GESTURE_COUNTERCLOCKWISE; | |||
} | |||
else | |||
{ | |||
text(buf, 20,30); | |||
text("Clockwise",55,30); | |||
gestureImmediateDirection = GESTURE_CLOCKWISE; | |||
} | |||
while (buf1 <0) | |||
buf1 = LaunchPad.read(); | |||
if ( (buf1 >= GESTURE_POSITION_OFFSET ) && (buf1 < GESTURE_POSITION_OFFSET + NUMBER_OF_WHEEL_POSITIONS)) | |||
{ | |||
buf1 = buf1 - GESTURE_POSITION_OFFSET; | |||
if (gestureDirection == INVALID_GESTURE_DIRECTION) | |||
gestureDirection = gestureImmediateDirection; | |||
// if (gestureImmediateDirection != gestureDirection) | |||
// gestureCoverPositions[gestureStoppingPosition] = 0; | |||
// | |||
while (buf-->0) | |||
{ | |||
if (gestureStoppingPosition == gestureStartingPosition) //If moving from the starting position | |||
if (gestureDirection != gestureImmediateDirection) //If moving against the current direction | |||
{ | |||
if (allLit == 0) //Starting at zero? Change direction | |||
gestureDirection = gestureImmediateDirection; | |||
else //Back to a previous revolution? | |||
allLit--; | |||
} | |||
gestureStoppingPosition += gestureImmediateDirection; | |||
if (gestureStoppingPosition == NUMBER_OF_WHEEL_POSITIONS) | |||
gestureStoppingPosition = 0; | |||
if (gestureStoppingPosition < 0) | |||
gestureStoppingPosition = NUMBER_OF_WHEEL_POSITIONS-1; | |||
if (gestureStoppingPosition == gestureStartingPosition) //If moving to the starting position | |||
{ | |||
if (gestureImmediateDirection == gestureDirection) //complete a revolution? | |||
allLit += 1; | |||
else | |||
if (allLit == 0) //Back to zero | |||
gestureDirection = INVALID_GESTURE_DIRECTION; | |||
//Undo | |||
} | |||
} | |||
for ( i = 0; i < NUMBER_OF_WHEEL_POSITIONS; i++) | |||
gestureCoverPositions[i] = allLit; | |||
i = gestureStartingPosition; | |||
while (i != gestureStoppingPosition) | |||
{ | |||
gestureCoverPositions[i]= allLit + 1; | |||
i += gestureDirection; | |||
if (i<0) | |||
i = NUMBER_OF_WHEEL_POSITIONS-1; | |||
if (i == NUMBER_OF_WHEEL_POSITIONS) | |||
i = 0; | |||
} | |||
gestureCoverPositions[i]= allLit + 1; | |||
for ( i = 0; i < NUMBER_OF_WHEEL_POSITIONS; i++) | |||
if (gestureCoverPositions[i] > 0) | |||
drawSlice(i, gestureCoverPositions[i]); | |||
fill(255); | |||
ellipse(CIRCLE_CENTER_X, CIRCLE_CENTER_Y, IN_CIRCLE_RADIUS*2 , IN_CIRCLE_RADIUS*2); | |||
image(innerCircleImage,0,0); | |||
if (changeDirection !=0) | |||
{ | |||
if (gestureImmediateDirection != changeDirection) | |||
codeCheck = -1; | |||
changeDirection = 0; | |||
} | |||
if (soundEnabled == 1) | |||
click.play(); | |||
if (codeModeEnabled == 1) | |||
{ | |||
if (codeCheck==1) | |||
{ | |||
codeValid = 1; | |||
for ( i = 0; i < NUMBER_OF_WHEEL_POSITIONS; i++) | |||
if (gestureCoverPositions[i] != codeValues[codeLevel][i]) | |||
codeValid = 0; | |||
if (codeRotate[codeLevel] != gestureImmediateDirection) | |||
codeValid = 0; | |||
if (codeValid == 1) | |||
{ | |||
if (codeLevel++ < 2) | |||
{ | |||
changeDirection = -gestureImmediateDirection; | |||
if (soundEnabled == 1) | |||
clickFound.play(); | |||
} | |||
else | |||
{ | |||
fill(0); | |||
text("Unlocked!!",400,30); | |||
text("Press Center",500,90); | |||
unlocked = 1; | |||
codeLevel = 0; | |||
codeCheck = -1; | |||
if (soundEnabled == 1) | |||
clickOpen.play(); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
// invalid gesture data | |||
else | |||
{ | |||
print("Error: invalid gesture position data == "); | |||
println(buf1); | |||
} | |||
} | |||
else | |||
{ // Should not happen | |||
buf = buf - GESTURE_POSITION_OFFSET; | |||
println("Invalid UART Data, not expecting such data"); | |||
} | |||
break; | |||
} | |||
} | |||
else | |||
{ | |||
if (++inactivityCounter==TIME_OUT) | |||
{ | |||
if (sleeping==1) | |||
{ | |||
goToSleep(); | |||
} | |||
else | |||
drawCanvas(); | |||
} | |||
} | |||
} | |||
} | |||
void mouseReleased() | |||
{ | |||
if ( (mouseX-CANVAS_SIZE_X/2)*(mouseX-CANVAS_SIZE_X/2) + (mouseY-CANVAS_SIZE_Y/2)*(mouseY-CANVAS_SIZE_Y/2) < IN_CIRCLE_RADIUS * IN_CIRCLE_RADIUS ) | |||
if (LaunchPadComPortFound ==1) | |||
{ | |||
soundEnabled = 1 - soundEnabled; | |||
codeModeEnabled = 1 - codeModeEnabled; | |||
drawNumberEnabled = 1 - drawNumberEnabled; | |||
} | |||
} | |||
/*---------Embedded code validation------------------*/ | |||
// Ideally nobody should ever bother scrolling down here | |||
// But good job, you've found it the easy way! | |||
// Anyways, don't spoil the fun for others would ya? | |||
int[] code = { 0, 4, 3, 0}; | |||
int[] codeRotate = {1, -1, 1}; | |||
int[][] codeValues = { {1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |||
{1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, | |||
{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; | |||
String secretURL = "http://ti.com/msp430rr"; | |||
int codeCheck, codeLevel, codeValid, changeDirection, unlocked=0, codeModeEnabled = 0; | |||