gergo.h 813 B

123456789101112131415161718192021222324252627
  1. // Jane Bernhardt (https://github.com/germ)
  2. // SPDX-License-Identifier: GPL-2.0+
  3. #pragma once
  4. #include "quantum.h"
  5. #include <stdint.h>
  6. #include <stdbool.h>
  7. #include "i2c_master.h"
  8. #include <util/delay.h>
  9. extern i2c_status_t mcp23018_status;
  10. #define I2C_TIMEOUT 1000
  11. // I2C aliases and register addresses (see "mcp23018.md")
  12. #define I2C_ADDR (0x20<<1)
  13. #define IODIRA 0x00 // i/o direction register
  14. #define IODIRB 0x01
  15. #define GPPUA 0x0C // GPIO pull-up resistor register
  16. #define GPPUB 0x0D
  17. #define GPIOA 0x12 // general purpose i/o port register (write modifies OLAT)
  18. #define GPIOB 0x13
  19. #define OLATA 0x14 // output latch register
  20. #define OLATB 0x15
  21. uint8_t init_mcp23018(void);