You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
750 B

  1. #pragma once
  2. #include "quantum.h"
  3. #include <stdint.h>
  4. #include <stdbool.h>
  5. #include "i2c_master.h"
  6. #include <util/delay.h>
  7. /* I2C aliases and register addresses (see "mcp23018.md") */
  8. #define I2C_ADDR (0b0100000 << 1)
  9. #define I2C_TIMEOUT 100
  10. #define IODIRA 0x00 /* i/o direction register */
  11. #define IODIRB 0x01
  12. #define GPPUA 0x0C /* GPIO pull-up resistor register */
  13. #define GPPUB 0x0D
  14. #define GPIOA 0x12 /* general purpose i/o port register (write modifies OLAT) */
  15. #define GPIOB 0x13
  16. #define OLATA 0x14 /* output latch register */
  17. #define OLATB 0x15
  18. extern uint8_t mcp23018_status;
  19. uint8_t init_mcp23018(void);