driver_pcal6416a.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef _DRIVER_PCAL6416A_H_
  2. #define _DRIVER_PCAL6416A_H_
  3. /****************************************************************
  4. * Includes
  5. ****************************************************************/
  6. #include <stdbool.h>
  7. /****************************************************************
  8. * Defines
  9. ****************************************************************/
  10. // Chip physical address
  11. #define PCAL6416A_I2C_ADDR 0x20
  12. #define PCAL9539A_I2C_ADDR 0x76
  13. // Chip registers adresses
  14. #define PCAL6416A_INPUT 0x00 /* Input port [RO] */
  15. #define PCAL6416A_DAT_OUT 0x02 /* GPIO DATA OUT [R/W] */
  16. #define PCAL6416A_POLARITY 0x04 /* Polarity Inversion port [R/W] */
  17. #define PCAL6416A_CONFIG 0x06 /* Configuration port [R/W] */
  18. #define PCAL6416A_DRIVE0 0x40 /* Output drive strength Port0 [R/W] */
  19. #define PCAL6416A_DRIVE1 0x42 /* Output drive strength Port1 [R/W] */
  20. #define PCAL6416A_INPUT_LATCH 0x44 /* Port0 Input latch [R/W] */
  21. #define PCAL6416A_EN_PULLUPDOWN 0x46 /* Port0 Pull-up/Pull-down enbl [R/W] */
  22. #define PCAL6416A_SEL_PULLUPDOWN 0x48 /* Port0 Pull-up/Pull-down slct [R/W] */
  23. #define PCAL6416A_INT_MASK 0x4A /* Interrupt mask [R/W] */
  24. #define PCAL6416A_INT_STATUS 0x4C /* Interrupt status [RO] */
  25. #define PCAL6416A_OUTPUT_CONFIG 0x4F /* Output port config [R/W] */
  26. /****************************************************************
  27. * Public functions
  28. ****************************************************************/
  29. bool pcal6416a_init(void);
  30. bool pcal6416a_deinit(void);
  31. int pcal6416a_read_mask_interrupts(void);
  32. int pcal6416a_read_mask_active_GPIOs(void);
  33. #endif //_DRIVER_PCAL6416A_H_