pca9532.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*****************************************************************************
  2. *
  3. * Copyright(C) 2011, Embedded Artists AB
  4. * All rights reserved.
  5. *
  6. ******************************************************************************
  7. * Software that is described herein is for illustrative purposes only
  8. * which provides customers with programming information regarding the
  9. * products. This software is supplied "AS IS" without any warranties.
  10. * Embedded Artists AB assumes no responsibility or liability for the
  11. * use of the software, conveys no license or title under any patent,
  12. * copyright, or mask work right to the product. Embedded Artists AB
  13. * reserves the right to make changes in the software without
  14. * notification. Embedded Artists AB also make no representation or
  15. * warranty that such application will be suitable for the specified
  16. * use without further testing or modification.
  17. *****************************************************************************/
  18. #ifndef __PCA9532C_H
  19. #define __PCA9532C_H
  20. #define PCA9532_I2C_ADDR (0xC0>>1)
  21. #define PCA9532_INPUT0 0x00
  22. #define PCA9532_INPUT1 0x01
  23. #define PCA9532_PSC0 0x02
  24. #define PCA9532_PWM0 0x03
  25. #define PCA9532_PSC1 0x04
  26. #define PCA9532_PWM1 0x05
  27. #define PCA9532_LS0 0x06
  28. #define PCA9532_LS1 0x07
  29. #define PCA9532_LS2 0x08
  30. #define PCA9532_LS3 0x09
  31. #define PCA9532_AUTO_INC 0x10
  32. /*
  33. * The Keys on the base board are mapped to LED0 -> LED3 on
  34. * the PCA9532.
  35. */
  36. #define KEY1 0x0001
  37. #define KEY2 0x0002
  38. #define KEY3 0x0004
  39. #define KEY4 0x0008
  40. #define KEY_MASK 0x000F
  41. /*
  42. * MMC Card Detect and MMC Write Protect are mapped to LED4
  43. * and LED5 on the PCA9532. Please note that WP is active low.
  44. */
  45. #define MMC_CD 0x0010
  46. #define MMC_WP 0x0020
  47. #define MMC_MASK 0x30
  48. /* NOTE: LED6 and LED7 on PCA9532 are not connected to anything */
  49. #define PCA9532_NOT_USED 0xC0
  50. /*
  51. * Below are the LED constants to use when enabling/disabling a LED.
  52. * The LED names are the names printed on the base board and not
  53. * the names from the PCA9532 device. base_LED1 -> LED8 on PCA9532,
  54. * base_LED2 -> LED9, and so on.
  55. */
  56. #define LED1 0x0100
  57. #define LED2 0x0200
  58. #define LED3 0x0400
  59. #define LED4 0x0800
  60. #define LED5 0x1000
  61. #define LED6 0x2000
  62. #define LED7 0x4000
  63. #define LED8 0x8000
  64. #define LED_MASK 0xFF00
  65. void pca9532_init (void);
  66. uint16_t pca9532_getLedState (uint32_t shadow);
  67. void pca9532_setLeds (uint16_t ledOnMask, uint16_t ledOffMask);
  68. void pca9532_setBlink0Period(uint8_t period);
  69. void pca9532_setBlink0Duty(uint8_t duty);
  70. void pca9532_setBlink0Leds(uint16_t ledMask);
  71. void pca9532_setBlink1Period(uint8_t period);
  72. void pca9532_setBlink1Duty(uint8_t duty);
  73. void pca9532_setBlink1Leds(uint16_t ledMask);
  74. #endif /* end __PCA9532C_H */
  75. /****************************************************************************
  76. ** End Of File
  77. *****************************************************************************/