You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

215 lines
10 KiB

5 years ago
  1. ------------MSP430G2-LaunchPad CapTouch BoosterPack User Experience-------------
  2. Ver.: 1.00 Initial Release
  3. February 2011
  4. Dung Dang
  5. MSP430 Applications
  6. Texas Instruments, Inc.
  7. --------------------------------------------------------------------------------
  8. CONTENTS
  9. I. DESCRIPTION
  10. II. PROJECT & FILE CONFIGURATION
  11. III. PROJECT IMPORT IN CCS & IAR
  12. IV. CAP TOUCH LIBRARY
  13. V. TOUCH & GESTURE DEFINITIONS
  14. VI. UART COMMUNICATION PROTOCOL
  15. VII. HISTORY
  16. I. DESCRIPTION
  17. -----------------------------------
  18. This application operates on the LaunchPad platform using the MSP430G2452
  19. device and the CapTouch BoosterPack plugin board. The capacitive touch and
  20. proximity sensing are enabled by the pin oscillator feature new to the
  21. MSP430G2xx2 family devices. The User Experience application also utilizes
  22. the cap touch library to realize & measure the capacitive touch and proximity
  23. sensors. The cap touch library also provides layers of abstractions to
  24. generate higher logical outputs such as logical touches, geometry (in this
  25. hardware, a four-button wheel), and even gestures.
  26. The User Experience application starts up and remains in 'sleep' mode,
  27. sampling the proximity sensor every ~8.3ms [VLO/100=12kHz/100=120Hz]. Upon
  28. registering a valid proximity event [hand/finger/object hovering ~3-5cm from
  29. the BoosterPack], the application wakes up to operate in the 'active' mode.
  30. During the wake up period, the LEDs surrounding the wheel light in a wake-up
  31. sequence, starting with a slow clockwise and ending with a fast
  32. counter-clockwise motion. As this sequence ends, the device enters active mode.
  33. In active mode, the application samples and registers individual finger touches
  34. on the 16-position wheel or the center button as well as simple gestures
  35. [Clockwise & Counter-clockwise] while the finger moves along and remains on
  36. the wheel. Upon wheel position detection, the corresponding LEDs surrounding
  37. the wheel light up accordingly. Each individual tap on the center capactive
  38. touch button toggles the center LED.
  39. After a predetermined amount of time without any touch activity (on the wheel
  40. or on the center button) the application returns to sleep mode, enabling only
  41. the proximity sensor.
  42. A 9600 baud UART link is also implemented using SW TimerA to provide
  43. application and cap touch data to the PC via the UART-USB back channel.
  44. The application sends UART data upon events such as wake up, sleep, touch,
  45. or gesture.
  46. II. PROJECT & FILE CONFIGURATION
  47. -----------------------------------
  48. PROJECT ROOT - CapTouchBoosterPack_UserExperience
  49. | CapTouchBoosterPack_UserExperience.c
  50. | <Main application code>
  51. | README <This file>
  52. | uart.c <C file: UART implementation using TimerA & SW>
  53. | uart.h <H file: UART implementation using TimerA & SW>
  54. |
  55. +---[CapTouchLibrary] <Capacitive Touch Library Code>
  56. | Cap_Touch_HAL.c
  57. | Cap_Touch_HAL.h
  58. | Cap_Touch_Layer.c
  59. | Cap_Touch_Layer.h
  60. | requirements.doc
  61. | structure.c <Created using template_structure.*>
  62. | structure.h <Configured/calibrated specifically for this HW>
  63. |
  64. +---[CCS] <CCS Project Configuration Files>
  65. | | <All listed files are required>
  66. | | <The non-listed can be safely removed>
  67. | | .ccsproject
  68. | | .cdtbuild
  69. | | .cdtproject
  70. | | .project <Contains links to portable project folders/files>
  71. | | lnk_msp430g2452.cmd
  72. | | macros.ini <Enables portable project>
  73. | | MSP430G2452.ccxml
  74. | |
  75. | \---All other folders & files: IDE/build generated files
  76. remove/ignore when exporting projects
  77. |
  78. \---[IAR] <CCS Project Configuration Files>
  79. | <All listed files are required>
  80. | <The non-listed can be safely removed>
  81. | CapTouch_BoosterPack_UserExperience.ewd
  82. | CapTouch_BoosterPack_UserExperience.ewp
  83. | CapTouch_BoosterPack_UserExperience.eww
  84. \---All other folders & files: IDE/build generated files
  85. remove/ignore when exporting projects
  86. Legend: [Directory]
  87. |---filename
  88. III. PROJECT IMPORT IN CCS & IAR
  89. -----------------------------------
  90. 1. Project Import in CCS
  91. a. Open CCS.
  92. b. Select a new project workspace outside of the project folder*
  93. c. Select Project-->Import Existing Project
  94. d. Browse to the [PROJECT_ROOT]\CCS folder
  95. e. Select Finish
  96. *Ideally, workspace should be in completely independent folder, not
  97. containing or contained by the project/package folder.
  98. !Note: For CCS, while project root is in the outer directory, the CCS
  99. project files are located inside CCS. To enable the portability of
  100. the project, the file macros.ini is created to define the root.
  101. Additionally, all project code files (*.c, *.h) are added as linked
  102. resources with their relative path to the project root.
  103. 2. Open project & workspace in IAR
  104. a. Browse to the [PROJECT_ROOT]\IAR folder
  105. b. Open the CapTouch_BoosterPack_UserExperience.eww workspace.
  106. IV. CAP TOUCH LIBRARY
  107. The MSP430G2-LaunchPad CapTouch BoosterPack User Experience uses the Cap Touch
  108. Library to configure, calibrate, and control the capacitive sensors.
  109. The sensor pads are configured in the structure.h & structure.c files.
  110. Specifically 6 elements are divided into three sensors: 1 proximity sensor, 1
  111. cap touch button (center button), and a 4-element wheel.
  112. After each element is calibrated to determine the touch threshold as well as
  113. their maximum values in number of counts (which correlate to the measured
  114. capacitances), these calibration values are also registered inside structure.c.
  115. The cap_touch_hal.* files provide the hardware abstract layer for the cap touch
  116. library, which essentially provides different hardware/peripheral options to
  117. drive the cap touch functionality. Specifically for the CapTouch BoosterPack
  118. using an MSP430G2xx2/MSP430G2xx3 device, the Pin Oscillator peripheral is used.
  119. The cap_touch_layer.* files provides the cap touch layer, which offers functions
  120. that process the raw data into structured format. The main application utilizes
  121. this layer for their API calls to setup, measure baseline, detect touches, and
  122. detect wheel positions.
  123. For more information on the Cap Touch Library, refer to the Cap Touch Library
  124. documentation.
  125. V. TOUCH & GESTURE DEFINITIONS
  126. -----------------------------------
  127. Proximity Sensor
  128. The proximity sensor is made of the entire top PCB layer surface that covers the
  129. capacitive touch wheel. The proximity sensor detection occurs when the measured
  130. capacitance increases due to the presence of some conductive object within 1-2
  131. inch from the surface. Generally, a hand wave motion in parallel and 1-2 inch
  132. from the CapTouch BoosterPack can trigger the detection.
  133. Individual Cap Touch Presses
  134. The center button (small round button in the middle of the board) can register
  135. an individual touch/press.
  136. The capactive touch wheel consists of four physical "ninja-star" elements
  137. arranged in a wheel formation that is calibrated & programed to provide
  138. 16-position detection. These positions can be detected individually as a
  139. button press. A press by the application's definition is consituted by a
  140. separate and single position detection registered continously [i.e. press
  141. begins when the position is touched and after no other position was detected,
  142. and ends when another position is detected or no further position is dectected.
  143. Wheel Gesture
  144. A gesture on the capacitive touch wheel is formed when a continuous series of
  145. touches is detected (no no-detection is reported, i.e. finger never leaves the
  146. wheel). A complete continuous finger motion on the wheel might consist of
  147. several intermediate gestures, each with one separate direction (clockwise or
  148. counter-clockwise).
  149. VI. UART COMMUNICATION PROTOCOL
  150. -----------------------------------
  151. Per each event (wake up, go to sleep, touch/press, or gesture), a UART packet
  152. of two bytes is sent. They are specified as follows.
  153. WAKE UP [due to proximity sensor detection]: 0xBE 0xEF
  154. SLEEP [after period of inactivity]: 0xDE 0xAD
  155. CENTER BUTTON PRESS: 0x80 0x80
  156. WHEEL POSITION TOUCH/PRESS [z = touch position]: 0x3z 0x3z [z=1 nibble 0x0-F]
  157. GESTURE START [z = touch position]: 0xFC 0x2z [z=1 nibble 0x0-F]
  158. GESTURE STOP: 0xFB 0xFB
  159. GESTURE & GESTURE END POSITION : 0xGG 0x2z
  160. GG = [binary] b????????
  161. First bit is direction: 0 = clockwise, 1 = counter-clockwise
  162. Last 7 bits = count of gesture movement
  163. z = ending position of the immediate gesture [[z=1 nibble 0x0-F]
  164. The UART receiver can decipher the packets by comparing them against the fixed
  165. values (WAKE UP, SLEEP, CENTER BUTTON PRESS, GESTURE START & STOP) or against
  166. ranges (WHEEL TOUCH = 0x30-0x3F, GESTURE = 0x00-0x1F, GESTURE POSITION =
  167. 0x20-0x2F)
  168. VII. HISTORY
  169. -----------------------------------
  170. Ver. 1.0
  171. - Implemented 64-position detection in the cap touch layer (defined in
  172. structure.h/c fies). These 64 position are still translated into 16-position
  173. representational wheel.
  174. - Instead of sending continuous wheel touch packets, only send initial, last
  175. and every other WHEEL_TOUCH_DELAY wheel touch detections. This modification does
  176. not affect the MSP430G2-LaunchPad CapTouch BoosterPack User Experience GUI, but
  177. enables full and expected behavior of the MediaPad program in Windows.
  178. Ver. 0.9:
  179. -Initial firmware release for small lot production. Supports MSP430G2-LaunchPad
  180. CapTouch BoosterPack User Experience GUI. Partial support for MediaPad,
  181. application behavior might not be optimized.