cirque_pinnacle_regdefs.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  1. // Copyright (c) 2018 Cirque Corp. Restrictions apply. See: www.cirque.com/sw-license
  2. // based on https://github.com/cirque-corp/Cirque_Pinnacle_1CA027/tree/master/Additional_Examples
  3. // with modifications and changes for QMK
  4. // refer to documentation: Gen2 and Gen3 (Pinnacle ASIC) at https://www.cirque.com/gen2gen3-asic-details
  5. #pragma once
  6. // clang-format off
  7. #define HostReg__0 (0x00)
  8. #define HostReg__1 (0x01)
  9. #define HostReg__2 (0x02)
  10. #define HostReg__3 (0x03)
  11. #define HostReg__4 (0x04)
  12. #define HostReg__5 (0x05)
  13. #define HostReg__6 (0x06)
  14. #define HostReg__7 (0x07)
  15. #define HostReg__8 (0x08)
  16. #define HostReg__9 (0x09)
  17. #define HostReg__10 (0x0A)
  18. #define HostReg__11 (0x0B)
  19. #define HostReg__12 (0x0C)
  20. #define HostReg__13 (0x0D)
  21. #define HostReg__14 (0x0E)
  22. #define HostReg__15 (0x0F)
  23. #define HostReg__16 (0x10)
  24. #define HostReg__17 (0x11)
  25. #define HostReg__18 (0x12)
  26. #define HostReg__19 (0x13)
  27. #define HostReg__20 (0x14)
  28. #define HostReg__21 (0x15)
  29. #define HostReg__22 (0x16)
  30. #define HostReg__23 (0x17)
  31. #define HostReg__24 (0x18)
  32. #define HostReg__25 (0x19)
  33. #define HostReg__26 (0x1A)
  34. #define HostReg__27 (0x1B)
  35. #define HostReg__28 (0x1C)
  36. #define HostReg__29 (0x1D)
  37. #define HostReg__30 (0x1E)
  38. #define HostReg__31 (0x1F)
  39. // ---------------- Register Assignments -------------------------------------
  40. /*--------------------------------------------------------------------------*\
  41. Chip ID / Version
  42. \*--------------------------------------------------------------------------*/
  43. // Chip ID Register
  44. #define HOSTREG__CHIPID HostReg__0
  45. // Chip Version Register
  46. #define HOSTREG__VERSION HostReg__1
  47. /*--------------------------------------------------------------------------*\
  48. Status Register
  49. \*--------------------------------------------------------------------------*/
  50. // Status 1 Register -- MUST BE HOSTREG__2
  51. #define HOSTREG__STATUS1 HostReg__2
  52. # define HOSTREG__STATUS1__DATA_READY 0x04
  53. # define HOSTREG__STATUS1__COMMAND_COMPLETE 0x08
  54. #define HOSTREG__STATUS1_DEFVAL 0x00
  55. /*--------------------------------------------------------------------------*\
  56. System Config Register
  57. \*--------------------------------------------------------------------------*/
  58. #define HOSTREG__SYSCONFIG1 HostReg__3
  59. # define HOSTREG__SYSCONFIG1__RESET 0x01
  60. # define HOSTREG__SYSCONFIG1__STANDBY 0x02
  61. # define HOSTREG__SYSCONFIG1__AUTO_SLEEP 0x04
  62. # define HOSTREG__SYSCONFIG1__TRACK_DISABLE 0x08
  63. # define HOSTREG__SYSCONFIG1__ANYMEAS_ENABLE 0x10
  64. # define HOSTREG__SYSCONFIG1__GPIO_CTRL_ENABLE 0x20
  65. # define HOSTREG__SYSCONFIG1__WAKEUP_TOGGLE 0x40
  66. # define HOSTREG__SYSCONFIG1__FORCE_WAKEUP 0x80
  67. #define HOSTREG__SYSCONFIG1_DEFVAL 0x00
  68. /*--------------------------------------------------------------------------*\
  69. Feed Config Registers
  70. \*--------------------------------------------------------------------------*/
  71. // Feed Config Register1
  72. #define HOSTREG__FEEDCONFIG1 HostReg__4
  73. # define HOSTREG__FEEDCONFIG1__FEED_ENABLE 0x01
  74. # define HOSTREG__FEEDCONFIG1__DATA_TYPE__REL0_ABS1 0x02
  75. # define HOSTREG__FEEDCONFIG1__FILTER_DISABLE 0x04
  76. # define HOSTREG__FEEDCONFIG1__X_AXIS_DISABLE 0x08
  77. # define HOSTREG__FEEDCONFIG1__Y_AXIS_DISABLE 0x10
  78. # define HOSTREG__FEEDCONFIG1__AXIS_FOR_Z__Y0_X1 0x20
  79. # define HOSTREG__FEEDCONFIG1__X_DATA_INVERT 0x40
  80. # define HOSTREG__FEEDCONFIG1__Y_DATA_INVERT 0x80
  81. #define HOSTREG__FEEDCONFIG1_DEFVAL 0x00
  82. // Feed Config Register2
  83. #define HOSTREG__FEEDCONFIG2 HostReg__5
  84. # define HOSTREG__FEEDCONFIG2__INTELLIMOUSE_MODE 0x01
  85. # define HOSTREG__FEEDCONFIG2__ALL_TAP_DISABLE 0x02
  86. # define HOSTREG__FEEDCONFIG2__SECONDARY_TAP_DISABLE 0x04
  87. # define HOSTREG__FEEDCONFIG2__SCROLL_DISABLE 0x08
  88. # define HOSTREG__FEEDCONFIG2__GLIDE_EXTEND_DISABLE 0x10
  89. # define HOSTREG__FEEDCONFIG2__PALM_BEFORE_Z_ENABLE 0x20
  90. # define HOSTREG__FEEDCONFIG2__BUTNS_46_SCROLL_5_MIDDLE 0x40
  91. # define HOSTREG__FEEDCONFIG2__SWAP_XY_RELATIVE 0x80
  92. #define HOSTREG__FEEDCONFIG2_DEFVAL 0x00
  93. // Feed Config Register3
  94. #define HOSTREG__FEEDCONFIG3 HostReg__6
  95. # define HOSTREG__FEEDCONFIG3__BTNS_456_TO_123_IN_REL 0x01
  96. # define HOSTREG__FEEDCONFIG3__DISABLE_CROSS_RATE_SMOOTHING 0x02
  97. # define HOSTREG__FEEDCONFIG3__DISABLE_PALM_NERD_MEAS 0x04
  98. # define HOSTREG__FEEDCONFIG3__DISABLE_NOISE_AVOIDANCE 0x08
  99. # define HOSTREG__FEEDCONFIG3__DISABLE_WRAP_LOCKOUT 0x10
  100. # define HOSTREG__FEEDCONFIG3__DISABLE_DYNAMIC_EMI_ADJUST 0x20
  101. # define HOSTREG__FEEDCONFIG3__DISABLE_HW_EMI_DETECT 0x40
  102. # define HOSTREG__FEEDCONFIG3__DISABLE_SW_EMI_DETECT 0x80
  103. #define HOSTREG__FEEDCONFIG3_DEFVAL 0x00
  104. /*--------------------------------------------------------------------------*\
  105. Calibration Config
  106. \*--------------------------------------------------------------------------*/
  107. #define HOSTREG__CALCONFIG1 HostReg__7
  108. # define HOSTREG__CALCONFIG1__CALIBRATE 0x01
  109. # define HOSTREG__CALCONFIG1__BACKGROUND_COMP_ENABLE 0x02
  110. # define HOSTREG__CALCONFIG1__NERD_COMP_ENABLE 0x04
  111. # define HOSTREG__CALCONFIG1__TRACK_ERROR_COMP_ENABLE 0x08
  112. # define HOSTREG__CALCONFIG1__TAP_COMP_ENABLE 0x10
  113. # define HOSTREG__CALCONFIG1__PALM_ERROR_COMP_ENABLE 0x20
  114. # define HOSTREG__CALCONFIG1__CALIBRATION_MATRIX_DISABLE 0x40
  115. # define HOSTREG__CALCONFIG1__FORCE_PRECALIBRATION_NOISE_CHECK 0x80
  116. #define HOSTREG__CALCONFIG1_DEFVAL (HOSTREG__CALCONFIG1__BACKGROUND_COMP_ENABLE | HOSTREG__CALCONFIG1__NERD_COMP_ENABLE | HOSTREG__CALCONFIG1__TRACK_ERROR_COMP_ENABLE | HOSTREG__CALCONFIG1__TAP_COMP_ENABLE | HOSTREG__CALCONFIG1__PALM_ERROR_COMP_ENABLE)
  117. /*--------------------------------------------------------------------------*\
  118. PS2 Aux Control Register
  119. \*--------------------------------------------------------------------------*/
  120. #define HOSTREG__PS2AUX_CTRL HostReg__8
  121. # define HOSTREG__PS2AUX_CTRL__CMD_PASSTHRU_ENABLE 0x01
  122. # define HOSTREG__PS2AUX_CTRL__SP_EXTENDED_MODE 0x02
  123. # define HOSTREG__PS2AUX_CTRL__GS_DISABLE 0x04
  124. # define HOSTREG__PS2AUX_CTRL__SP_DISABLE 0x08
  125. # define HOSTREG__PS2AUX_CTRL__GS_COORDINATE_DISABLE 0x10
  126. # define HOSTREG__PS2AUX_CTRL__SP_COORDINATE_DISABLE 0x20
  127. # define HOSTREG__PS2AUX_CTRL__DISABLE_AA00_DETECT 0x40
  128. # define HOSTREG__PS2AUX_CTRL__AUX_PRESENT 0x80
  129. #define HOSTREG__PR2AUX_CTRL_DEFVAL 0x00
  130. /*--------------------------------------------------------------------------*\
  131. Sample Rate Value
  132. \*--------------------------------------------------------------------------*/
  133. #define HOSTREG__SAMPLERATE HostReg__9
  134. # define HOSTREG__SAMPLERATE__10_SPS 0x0A
  135. # define HOSTREG__SAMPLERATE__20_SPS 0x14
  136. # define HOSTREG__SAMPLERATE__40_SPS 0x28
  137. # define HOSTREG__SAMPLERATE__60_SPS 0x3C
  138. # define HOSTREG__SAMPLERATE__80_SPS 0x50
  139. # define HOSTREG__SAMPLERATE__100_SPS 0x64
  140. # define HOSTREG__SAMPLERATE__200_SPS 0xC8 // 200sps not supported
  141. // only for ps2 compatibility
  142. // rate set to 100sps
  143. #define HOSTREG__SAMPLERATE_DEFVAL HOSTREG__SAMPLERATE__100_SPS
  144. /*--------------------------------------------------------------------------*\
  145. Z Idle Value
  146. \*--------------------------------------------------------------------------*/
  147. #define HOSTREG__ZIDLE HostReg__10
  148. #define HOSTREG__ZIDLE_DEFVAL 30 // 0x1E
  149. /*--------------------------------------------------------------------------*\
  150. Z Scaler Value
  151. \*--------------------------------------------------------------------------*/
  152. #define HOSTREG__ZSCALER HostReg__11
  153. #define HOSTREG__ZSCALER_DEFVAL 8 // 0x08
  154. /*--------------------------------------------------------------------------*\
  155. Sleep Interval Value
  156. \*--------------------------------------------------------------------------*/
  157. #define HOSTREG__SLEEP_INTERVAL HostReg__12
  158. #define HOSTREG__SLEEP_INTERVAL_DEFVAL 73 // 0x49
  159. /*--------------------------------------------------------------------------*\
  160. Sleep Delay Value
  161. \*--------------------------------------------------------------------------*/
  162. #define HOSTREG__SLEEP_DELAY HostReg__13
  163. #define HOSTREG__SLEEP_DELAY_DEFVAL 39 // 0x27
  164. /*--------------------------------------------------------------------------*\
  165. Dynamic EMI Bad Channel Count Thresholds
  166. \*--------------------------------------------------------------------------*/
  167. #define HOSTREG__DYNAMIC_EMI_ADJUST_THRESHOLD HostReg__14
  168. #define HOSTREG__DYNAMIC_EMI_ADJUST_THRESHOLD_DEFVAL 66 // 0x42
  169. /*--------------------------------------------------------------------------*\
  170. Packet Registers
  171. \*--------------------------------------------------------------------------*/
  172. #define HOSTREG__PACKETBYTE_0 HostReg__18
  173. #define HOSTREG__PACKETBYTE_1 HostReg__19
  174. #define HOSTREG__PACKETBYTE_2 HostReg__20
  175. #define HOSTREG__PACKETBYTE_3 HostReg__21
  176. #define HOSTREG__PACKETBYTE_4 HostReg__22
  177. #define HOSTREG__PACKETBYTE_5 HostReg__23
  178. /*--------------------------------------------------------------------------*\
  179. Port A GPIO Control
  180. \*--------------------------------------------------------------------------*/
  181. #define HOSTREG__PORTA_GPIO_CTRL HostReg__24
  182. #define HOSTREG__PORTA_GPIO_CTRL_DEFVAL 0xFF
  183. /*--------------------------------------------------------------------------*\
  184. Port A GPIO Data
  185. \*--------------------------------------------------------------------------*/
  186. #define HOSTREG__PORTA_GPIO_DATA HostReg__25
  187. #define HOSTREG__PORTA_GPIO_DATA_DEFVAL 0x00
  188. /*--------------------------------------------------------------------------*\
  189. Port B GPIO Control And Data
  190. \*--------------------------------------------------------------------------*/
  191. #define HOSTREG__PORTB_GPIO_CTRL_DATA HostReg__26
  192. # define HOSTREG__PORTB_GPIO_DATA__PB0 0x01
  193. # define HOSTREG__PORTB_GPIO_DATA__PB1 0x02
  194. # define HOSTREG__PORTB_GPIO_DATA__PB2 0x04
  195. # define HOSTREG__PORTB_GPIO_CTRL__PB0 0x08
  196. # define HOSTREG__PORTB_GPIO_CTRL__PB1 0x10
  197. # define HOSTREG__PORTB_GPIO_CTRL__PB2 0x20
  198. # define HOSTREG__PORTB_GPIO_RSVD_0 0x40
  199. # define HOSTREG__PORTB_GPIO_READ1_WRITE0 0x80
  200. #define HOSTREG__PORTB_GPIO_CTRL_DATA_DEFVAL (HOSTREG__PORTB_GPIO_CTRL__PB0 | HOSTREG__PORTB_GPIO_CTRL__PB1 | HOSTREG__PORTB_GPIO_CTRL__PB2)
  201. /*--------------------------------------------------------------------------*\
  202. Extended Register Access
  203. \*--------------------------------------------------------------------------*/
  204. #define HOSTREG__EXT_REG_AXS_VALUE HostReg__27
  205. #define HOSTREG__EXT_REG_AXS_ADDR_HIGH HostReg__28
  206. #define HOSTREG__EXT_REG_AXS_ADDR_LOW HostReg__29
  207. #define HOSTREG__EXT_REG_AXS_CTRL HostReg__30
  208. # define HOSTREG__EREG_AXS__READ 0x01
  209. # define HOSTREG__EREG_AXS__WRITE 0x02
  210. # define HOSTREG__EREG_AXS__INC_ADDR_READ 0x04
  211. # define HOSTREG__EREG_AXS__INC_ADDR_WRITE 0x08
  212. # define HOSTREG__EREG_AXS__RSVD_3 0x10
  213. # define HOSTREG__EREG_AXS__RSVD_2 0x20
  214. # define HOSTREG__EREG_AXS__RSVD_1 0x40
  215. # define HOSTREG__EREG_AXS__RSVD_0 0x80
  216. #define HOSTREG__EXT_REG_AXS_VALUE_DEFVAL 0x00
  217. #define HOSTREG__EXT_REG_AXS_ADDR_HIGH_DEFVAL 0x00
  218. #define HOSTREG__EXT_REG_AXS_ADDR_LOW_DEFVAL 0x00
  219. #define HOSTREG__EXT_REG_AXS_CTRL_DEFVAL 0x00
  220. /*--------------------------------------------------------------------------*\
  221. Product ID
  222. \*--------------------------------------------------------------------------*/
  223. #define HOSTREG__PRODUCT_ID HostReg__31
  224. //Some useful values
  225. #define I2C_ADDRESS_DEFAULT 0x2A
  226. #define FIRMWARE_ID 0x07
  227. #define FIRMWARE_VERSION 0x9D
  228. //Anymeas config options
  229. //First setting is HostReg 5. This sets toggle frequency (EF) and gain.
  230. //Gain is upper two bits (0xC0), frequency is lower 6 bits (0x3F)
  231. #define AnyMeas_AccumBits_ElecFreq HostReg__5
  232. # define ADCCNFG_ELEC_FREQ 0x3F /* Bit 4, 3, 2, 1, 0 */
  233. # define ADCCNFG_EF_0 0x02 // 500,000Hz
  234. # define ADCCNFG_EF_1 0x03 // 444,444Hz
  235. # define ADCCNFG_EF_2 0x04 // 400,000Hz
  236. # define ADCCNFG_EF_3 0x05 // 363,636Hz
  237. # define ADCCNFG_EF_4 0x06 // 333,333Hz
  238. # define ADCCNFG_EF_5 0x07 // 307,692Hz
  239. # define ADCCNFG_EF_6 0x09 // 267,000Hz
  240. # define ADCCNFG_EF_7 0x0B // 235,000Hz
  241. # define ADCCNFG_ACCUMBITSSELECT 0xC0 /* Bit 7, 6 */
  242. # define ADCCNFG_ACCBITS_17_14_0 0x00 //This is about 2x gain
  243. # define ADCCNFG_ACCBITS_17_15_1 0x40 //This is about 1.6x gain
  244. # define ADCCNFG_ACCBITS_17_2__80 0x80 //This is about 1.3x gain
  245. # define ADCCNFG_ACCBITS_17_2__C0 0xC0 //This is lowest gain
  246. //Note, all frequencies above are based on default 500ns aperture. If aperture is shorter the frequencies will be faster and if aperture is longer the frequencies will be slower.
  247. //Next is HostReg 6. This sets the sample length. There are four possible settings to bit length. All other settings are not normally used and should be a 0.
  248. #define AnyMeas_BitLength HostReg__6
  249. # define ADCCTRL_BIT_LENGTH 0x03 /* Bit 1, 0 */
  250. # define ADCCTRL_SAMPLES_32 0x00 //Note: this does not work.
  251. # define ADCCTRL_SAMPLES_128 0x01
  252. # define ADCCTRL_SAMPLES_256 0x02
  253. # define ADCCTRL_SAMPLES_512 0x03
  254. # define ADCCTRL_ENABLE 0x20 /* Bit 5 */
  255. # define ADCCTRL_INT_FLAG 0x40 /* Bit 6 */
  256. # define ADCCTRL_START_BUSY 0x80 /* Bit 7 */
  257. //The smaller the sample length the faster the measurement but the lower the SNR. For high SNR requirements 512 sample length is recommended. Alternatively, multiple 128 or 256 length measurements could be averaged.
  258. //Next is HostReg 7. This sets the sense mux. Pinnacle has 2 sense lines, Sense N and Sense P1. There is also a Sense P2 but it is not bonded out, it is only internal.
  259. //Signal on Sense N will be inverted from signal on Sense P1. Other than sign inversion, signal strength should be the same.
  260. #define AnyMeas_ADC_MuxControl HostReg__7
  261. # define ADCMUXCTRL_SENSEP1GATE 0x01 //Enables Sense P1. Can be combined with Sense N input or exclusivly Sense P1 alone.
  262. # define ADCMUXCTRL_SENSEP2GATE 0x02 //Not used.
  263. # define ADCMUXCTRL_SENSENGATE 0x04 //Enables Sense N. Can be combined with Sense P inputs or exclusivly Sense N alone.
  264. # define ADCMUXCTRL_REF0GATE 0x08 //This enables the RefCap0. This is a capacitor inside the chip that is roughly 0.25pF. It is also controlled with the toggle and polarity bits so those bits must be set properly as well in order to use it.
  265. # define ADCMUXCTRL_REF1GATE 0x10 //This enables the RefCap1. This is a capacitor inside the chip that is roughly 0.5pF. It is also controlled with the toggle and polarity bits so those bits must be set properly as well in order to use it.
  266. # define ADCMUXCTRL_OSCMEASEN 0x80 //this is a test mode for measuring the internal oscillator. It is for IC test only.
  267. //Next is HostReg 8. This contains various ADC config settings that are not likely to be used.
  268. #define AnyMeas_ADC_Config2 HostReg__8
  269. # define ADCCNFG2_ADC_CLK_SELECT 0x01 /* Bit 0 */ //If 0 use the standard 8Mhz clock. If 1 use a divide by 2, 4Mhz clock. Only used if extra slow toggle frequencies are required.
  270. # define ADCCNFG2_EMI_FLAG 0x02 /* Bit 1 */ //EMI flag threshold only used with internal FW. Not valid in anymeas mode.
  271. # define ADCCNFG2_EMI_FLAG_THRESHOLD_0 0x04 /* Bit 2 */ //EMI flag threshold only used with internal FW. Not valid in anymeas mode.
  272. # define ADCCNFG2_EMI_FLAG_THRESHOLD_1 0x08 /* Bit 3 */ //EMI flag threshold only used with internal FW. Not valid in anymeas mode.
  273. # define ADCCNFG2_DSX2_EXTEND 0x10 /* Bit 4 */ //extend one signal on the receive. Could also be helpful in situations where sensor cap is extremely high.
  274. # define ADCCNFG2_ETOGGLE_DELAY 0x20 /* Bit 5 */ //delay a bit before toggling electrodes. Could be helpful in situations where sensor cap is extremely high.
  275. //Next is HostReg 9. This sets the aperture length. Bottom 4 bits set the aperture width
  276. #define AnyMeas_ADC_AWidth HostReg__9
  277. # define ADCAWIDTH_AWIDTHMASK 0x0F
  278. # define ADCAWIDTH_APERTURE_OPEN 0x00 //does not work
  279. # define ADCAWIDTH_APERTURE_125NS 0x01 //does not work
  280. # define ADCAWIDTH_APERTURE_250NS 0x02
  281. # define ADCAWIDTH_APERTURE_375NS 0x03
  282. # define ADCAWIDTH_APERTURE_500NS 0x04
  283. # define ADCAWIDTH_APERTURE_625NS 0x05
  284. # define ADCAWIDTH_APERTURE_750NS 0x06
  285. # define ADCAWIDTH_APERTURE_875NS 0x07
  286. # define ADCAWIDTH_APERTURE_1000NS 0x08
  287. # define ADCAWIDTH_APERTURE_1125NS 0x09
  288. # define ADCAWIDTH_APERTURE_1250NS 0x0A
  289. # define ADCAWIDTH_APERTURE_1375NS 0x0B
  290. # define ADCAWIDTH_APERTURE_1500NS 0x0C
  291. # define ADCAWIDTH_APERTURE_1625NS 0x0D
  292. # define ADCAWIDTH_APERTURE_1750NS 0x0E
  293. # define ADCAWIDTH_APERTURE_1875NS 0x0F
  294. # define ADCAWIDTH_AWIDTHPLUSHALF 0x10
  295. # define ADCAWIDTH_AOPEN 0x20
  296. # define ADCAWIDTH_W2WAIT 0x40
  297. //next two registers give the high and low bytes to the 16 bit address where Pinnacle will pull the measurement data. Normally these addresses are within the base 32 registers.
  298. #define AnyMeas_pADCMeasInfoStart_High_Byte HostReg__10
  299. #define AnyMeas_pADCMeasInfoStart_Low_Byte HostReg__11
  300. //Next is the measurement index, this sets the measurement state machine to the start and should be a 0 at start.
  301. #define AnyMeas_MeasIndex HostReg__12
  302. # define ANYMEASSTATE_RESET_START 0x00
  303. # define ANYMEASSTATE_START_MEASUREMENT 0x01
  304. # define ANYMEASSTATE_WAIT_FOR_MEASUREMENT_AND_HOST 0x02
  305. //next is the state itself of the measurement, should always be 0.
  306. #define AnyMeas_State HostReg__13
  307. //next is the number of measurements. Use 0x80 to repeat the single measurement or repeat a number of measurements.
  308. //0x40 will turn the ADC off after measurements. This will result in longer startup time for a subsequent measurement, but lower idle power draw.
  309. #define AnyMeas_Control_NumMeas HostReg__14
  310. # define ANYMEAS_CONTROL__NUM_MEAS_MASK 0x3F
  311. # define ANYMEAS_CONTROL__ADC_POST_MEAS_PWR 0x40
  312. # define ANYMEAS_CONTROL__REPEAT 0x80
  313. //These are not used
  314. #define AnyMeas_pADCMeasInfo_High_Byte HostReg__15
  315. #define AnyMeas_pADCMeasInfo_Low_Byte HostReg__16
  316. //16 bit result of measurement will be found in these two registers.
  317. #define AnyMeas_Result_High_Byte HostReg__17
  318. #define AnyMeas_Result_Low_Byte HostReg__18
  319. // ---------------- Extended Register Assignments ----------------------------
  320. /*--------------------------------------------------------------------------*\
  321. ADC Mux Control
  322. \*--------------------------------------------------------------------------*/
  323. #define EXTREG__ADCMUX_CTRL 0x00EB
  324. # define EXTREG__ADCMUX_CTRL__SNSP_ENABLE 0x01
  325. # define EXTREG__ADCMUX_CTRL__SNSN_ENABLE 0x04
  326. /*--------------------------------------------------------------------------*\
  327. Timer Reload Registers
  328. \*--------------------------------------------------------------------------*/
  329. #define EXTREG__PACKET_TIMER_RELOAD 0x019F
  330. #define EXTREG__TRACK_TIMER_RELOAD 0x019E
  331. // These two registers should have matching content.
  332. # define EXTREG__TIMER_RELOAD__300_SPS 0x06
  333. # define EXTREG__TIMER_RELOAD__200_SPS 0x09
  334. # define EXTREG__TIMER_RELOAD__100_SPS 0x13
  335. /*--------------------------------------------------------------------------*\
  336. Track ADC Config
  337. \*--------------------------------------------------------------------------*/
  338. #define EXTREG__TRACK_ADCCONFIG 0x0187
  339. // ADC-attenuation settings (held in BIT_7 and BIT_6)
  340. // 1X = most sensitive, 4X = least sensitive
  341. # define EXTREG__TRACK_ADCCONFIG__ADC_ATTENUATE_MASK 0x3F
  342. # define EXTREG__TRACK_ADCCONFIG__ADC_ATTENUATE_1X 0x00
  343. # define EXTREG__TRACK_ADCCONFIG__ADC_ATTENUATE_2X 0x40
  344. # define EXTREG__TRACK_ADCCONFIG__ADC_ATTENUATE_3X 0x80
  345. # define EXTREG__TRACK_ADCCONFIG__ADC_ATTENUATE_4X 0xC0
  346. #define EXTREG__TRACK_ADCCONFIG_DEFVAL 0x4E
  347. /*--------------------------------------------------------------------------*\
  348. Tune Edge Sensitivity
  349. \*--------------------------------------------------------------------------*/
  350. // These registers are not detailed in any publically available documentation
  351. // Names inferred from debug prints in https://github.com/cirque-corp/Cirque_Pinnacle_1CA027/blob/master/Circular_Trackpad
  352. #define EXTREG__XAXIS_WIDEZMIN 0x0149
  353. #define EXTREG__YAXIS_WIDEZMIN 0x0168
  354. #define EXTREG__XAXIS_WIDEZMIN_DEFVAL 0x06
  355. #define EXTREG__YAXIS_WIDEZMIN_DEFVAL 0x05
  356. // clang-format on