capt.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * lpc8xx_capt.h
  3. *
  4. * Created on: This day
  5. * Author: The Creator
  6. */
  7. #ifndef LPC8XX_CAPT_H_
  8. #define LPC8XX_CAPT_H_
  9. #define CAPT_X_PIN_COUNT 5U
  10. // CTRL register
  11. #define POLLMODE_INACTIVE (0x0<<0)
  12. #define POLLMODE_NOW (0x1<<0)
  13. #define POLLMODE_CONTINUOUS (0x2<<0)
  14. #define POLLMODE_LOWPWR (0x3<<0)
  15. #define POLLMODE 0 // Use this as a shifter for a 2-bit value
  16. #define TYPE_NORMAL (0x0<<2)
  17. #define TYPE_3x3 (0x1<<2)
  18. #define TYPE_5_INTERLEAVE (0x2<<2)
  19. #define TYPE_TRIGGER_YH (0x0<<4)
  20. #define TYPE_TRIGGER_ACMP (0x1<<4)
  21. #define WAIT (0x1<<5)
  22. #define DMA_NONE (0x0<<6)
  23. #define DMA_TOUCH (0x1<<6)
  24. #define DMA_BOTH (0x2<<6)
  25. #define DMA_BOTH_PLUS_TO (0x3<<6)
  26. #define FDIV 8 // Use this as a shifter for a 4-bit value
  27. #define XPINUSE_HIGHZ (0x0<<12)
  28. #define XPINUSE_LOW (0x1<<12)
  29. #define INCHANGE (0x1<<15) // Use as an AND-mask, when reading this bit
  30. #define X0_ACTV 1<<0
  31. #define X1_ACTV 1<<1
  32. #define X2_ACTV 1<<2
  33. #define X3_ACTV 1<<3
  34. #define X4_ACTV 1<<4
  35. #define X5_ACTV 1<<5
  36. #define X6_ACTV 1<<6
  37. #define X7_ACTV 1<<7
  38. #define X8_ACTV 1<<8
  39. #define X9_ACTV 1<<9
  40. #define X10_ACTV 1<<10
  41. #define X11_ACTV 1<<11
  42. #define X12_ACTV 1<<12
  43. #define X13_ACTV 1<<13
  44. #define X14_ACTV 1<<14
  45. #define X15_ACTV 1<<15
  46. #define XPINSEL 16 // Use this as a shifter for a 16-bit value
  47. // STATUS, INTENSET, INTENCLR, INTSTAT registers
  48. #define YESTOUCH (1<<0)
  49. #define NOTOUCH (1<<1)
  50. #define POLLDONE (1<<2)
  51. #define TIMEOUT (1<<3)
  52. #define OVERRUN (1<<4)
  53. #define BUSY (1<<8)
  54. #define XMAX (0xFF<<16) // Use as an AND-mask, when reading this field
  55. // POLL_TCNT register
  56. #define TCNT 0 // Use this as a shifter for a 12-bit value
  57. #define TOUT 12 // Use this as a shifter for a 4-bit value
  58. #define POLL 16 // Use this as a shifter for an 8-bit value
  59. #define MDELAY 24 // Use this as a shifter for a 2-bit value
  60. #define RDELAY 26 // Use this as a shifter for a 2-bit value
  61. #define TCHLOWER 31 // Use this as a shifter for a 1-bit value
  62. // TOUCH register
  63. #define TOUCH_COUNT (0xFFF<<0) // Use as an AND-mask, when reading this field
  64. #define TOUCH_XVAL (0xF<<12) // Use as an AND-mask, when reading this field
  65. #define TOUCH_ISTOUCH (0x1<<16) // Use as an AND-mask, when reading this field
  66. #define TOUCH_ISTO (0x1<<17) // Use as an AND-mask, when reading this field
  67. #define TOUCH_SEQ (0xF<<20) // Use as an AND-mask, when reading this field
  68. #define TOUCH_CHANGE (0x1<<31) // Use as an AND-mask, when reading this field
  69. #endif /* LPC8XX_CAPT_H_ */