pca9552.h 866 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * PCA9552 I2C LED blinker
  3. *
  4. * Copyright (c) 2017-2018, IBM Corporation.
  5. *
  6. * This work is licensed under the terms of the GNU GPL, version 2 or
  7. * later. See the COPYING file in the top-level directory.
  8. */
  9. #ifndef PCA9552_H
  10. #define PCA9552_H
  11. #include "hw/i2c/i2c.h"
  12. #include "qom/object.h"
  13. #define TYPE_PCA9552 "pca9552"
  14. #define TYPE_PCA955X "pca955x"
  15. typedef struct PCA955xState PCA955xState;
  16. DECLARE_INSTANCE_CHECKER(PCA955xState, PCA955X,
  17. TYPE_PCA955X)
  18. #define PCA955X_NR_REGS 10
  19. #define PCA955X_PIN_COUNT_MAX 16
  20. struct PCA955xState {
  21. /*< private >*/
  22. I2CSlave i2c;
  23. /*< public >*/
  24. uint8_t len;
  25. uint8_t pointer;
  26. uint8_t regs[PCA955X_NR_REGS];
  27. qemu_irq gpio_out[PCA955X_PIN_COUNT_MAX];
  28. uint8_t ext_state[PCA955X_PIN_COUNT_MAX];
  29. char *description; /* For debugging purpose only */
  30. };
  31. #endif