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.

129 lines
4.7 KiB

5 years ago
  1. /* --COPYRIGHT--,BSD
  2. * Copyright (c) 2013, Texas Instruments Incorporated
  3. * All rights reserved.
  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 distribution.
  15. *
  16. * * Neither the name of Texas Instruments Incorporated nor the names of
  17. * its contributors may be used to endorse or promote products derived
  18. * from this software without specific prior written permission.
  19. *
  20. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  21. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  22. * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  23. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  24. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  25. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  26. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  27. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  28. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  29. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  30. * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. * --/COPYRIGHT--*/
  32. /*!
  33. * @file CTS_Layer.h
  34. *
  35. * @brief
  36. *
  37. * @par Project:
  38. * MSP430 Capacitive Touch Library
  39. *
  40. * @par Developed using:
  41. * CCS Version : 5.4.0.00048, w/support for GCC extensions (--gcc)
  42. * \n IAR Version : 5.51.6
  43. *
  44. * @author C. Sterzik
  45. * @author T. Hwang
  46. * @version 1.2
  47. * Updated HALs.
  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_H_
  64. #define CTS_LAYER_H_
  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 /* CTS_LAYER_H_ */