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.

130 lines
4.9 KiB

5 years ago
  1. /*******************************************************************************
  2. *
  3. * CTS_HAL.h
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions
  7. * are met:
  8. *
  9. * Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions and the following disclaimer.
  11. *
  12. * Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the
  15. * distribution.
  16. *
  17. * Neither the name of Texas Instruments Incorporated nor the names of
  18. * its contributors may be used to endorse or promote products derived
  19. * from this software without specific prior written permission.
  20. *
  21. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  24. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  25. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  26. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  27. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  28. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  29. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  30. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. *
  33. ******************************************************************************/
  34. /***************************************************************************//**
  35. * @file CTS_Layer.h
  36. *
  37. * @brief
  38. *
  39. * @par Project:
  40. * MSP430 Capacitive Touch Library
  41. *
  42. * @par Developed using:
  43. * IAR Version : 5.10.6 [Kickstart] (5.10.6.30180)
  44. * CCS Version : 4.2.1.00004, w/support for GCC extensions (--gcc)
  45. *
  46. *
  47. * @version 1.0.0 Initial Release
  48. *
  49. * @par Supported API Calls:
  50. * - TI_CAPT_Init_Baseline()
  51. * - TI_CAPT_Update_Baseline()
  52. * - TI_CAPT_Reset_Tracking()
  53. * - TI_CAPT_Update_Tracking_DOI()
  54. * - TI_CAPT_Update_Tracking_Rate()
  55. * - TI_CAPT_Update_Baseline()
  56. * - TI_CAPT_Raw()
  57. * - TI_CAPT_Custom()
  58. * - TI_CAPT_Button()
  59. * - TI_CAPT_Buttons()
  60. * - TI_CAPT_Slider()
  61. * - TI_CAPT_Wheel()
  62. ******************************************************************************/
  63. #ifndef CTS_LAYER
  64. #define CTS_LAYER
  65. #include "CTS_HAL.h"
  66. //! \name Status Register Definitions
  67. //! @{
  68. //
  69. //! (bit 0): Event Flag: this indicates that a threshold crossing occured
  70. #define EVNT 0x01
  71. //! (bit 1): Direction of Interest: This indicates if the measurement is looking
  72. //! for an increasing (set) or decreasing (clr) capacitance.
  73. #define DOI_MASK 0x02
  74. #define DOI_INC 0x02
  75. #define DOI_DEC 0x00
  76. //! (bit 2): Past Event Flag: this indicates that a prior element within the
  77. //! sensor group has detected a threshold crossing
  78. #define PAST_EVNT 0x04
  79. //! (bits 4-5): Tracking Rate in Direction of Interest: this indicates at what
  80. //! rate the baseline will adjust to the current measurement when the
  81. //! when the measurement is changing in the direction of interst but does not
  82. //! result in a threshold crossing:
  83. //! \n Very Slow
  84. //! \n Slow
  85. //! \n Medium
  86. //! \n Fast
  87. #define TRIDOI_VSLOW 0x00
  88. #define TRIDOI_SLOW 0x10
  89. #define TRIDOI_MED 0x20
  90. #define TRIDOI_FAST 0x30
  91. //! (bits 5-6): Tracking Rate Against Direction of Interest: this indicates at
  92. //! what rate the baseline will adjust to the current measurement when the
  93. //! when the measurement is changing against the direction of interst:
  94. //! \n Fast
  95. //! \n Medium
  96. //! \n Slow
  97. //! \n Very Slow
  98. #define TRADOI_FAST 0x00
  99. #define TRADOI_MED 0x40
  100. #define TRADOI_SLOW 0x80
  101. #define TRADOI_VSLOW 0xC0
  102. //! @}
  103. // API Calls
  104. void TI_CAPT_Init_Baseline(const struct Sensor*);
  105. void TI_CAPT_Update_Baseline(const struct Sensor*, uint8_t);
  106. void TI_CAPT_Reset_Tracking(void);
  107. void TI_CAPT_Update_Tracking_DOI(uint8_t);
  108. void TI_CAPT_Update_Tracking_Rate(uint8_t);
  109. void TI_CAPT_Raw(const struct Sensor*, uint16_t*);
  110. void TI_CAPT_Custom(const struct Sensor *, uint16_t*);
  111. uint8_t TI_CAPT_Button(const struct Sensor *);
  112. const struct Element * TI_CAPT_Buttons(const struct Sensor *);
  113. uint16_t TI_CAPT_Slider(const struct Sensor*);
  114. uint16_t TI_CAPT_Wheel(const struct Sensor*);
  115. // Internal Calls
  116. uint8_t Dominant_Element (const struct Sensor*, uint16_t*);
  117. #endif