diff options
Diffstat (limited to 'quantum/split_common/i2c.h')
| -rw-r--r-- | quantum/split_common/i2c.h | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/quantum/split_common/i2c.h b/quantum/split_common/i2c.h deleted file mode 100644 index 91e8e96f4..000000000 --- a/quantum/split_common/i2c.h +++ /dev/null | |||
| @@ -1,59 +0,0 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include <stdint.h> | ||
| 4 | |||
| 5 | #ifndef F_CPU | ||
| 6 | #define F_CPU 16000000UL | ||
| 7 | #endif | ||
| 8 | |||
| 9 | #define I2C_READ 1 | ||
| 10 | #define I2C_WRITE 0 | ||
| 11 | |||
| 12 | #define I2C_ACK 1 | ||
| 13 | #define I2C_NACK 0 | ||
| 14 | |||
| 15 | // Address location defines (Keymap should be last, as it's size is dynamic) | ||
| 16 | #define I2C_BACKLIT_START 0x00 | ||
| 17 | // Need 4 bytes for RGB (32 bit) | ||
| 18 | #define I2C_RGB_START 0x01 | ||
| 19 | #define I2C_KEYMAP_START 0x06 | ||
| 20 | |||
| 21 | // Slave buffer (8bit per) | ||
| 22 | // Rows per hand + backlit space + rgb space | ||
| 23 | // TODO : Make this dynamically sized | ||
| 24 | #define SLAVE_BUFFER_SIZE 0x20 | ||
| 25 | |||
| 26 | // i2c SCL clock frequency | ||
| 27 | #ifndef SCL_CLOCK | ||
| 28 | #define SCL_CLOCK 100000L | ||
| 29 | #endif | ||
| 30 | |||
| 31 | // Support 8bits right now (8 cols) will need to edit to take higher (code exists in delta split?) | ||
| 32 | extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; | ||
| 33 | |||
| 34 | void i2c_master_init(void); | ||
| 35 | uint8_t i2c_master_start(uint8_t address); | ||
| 36 | void i2c_master_stop(void); | ||
| 37 | uint8_t i2c_master_write(uint8_t data); | ||
| 38 | uint8_t i2c_master_write_data(void *const TXdata, uint8_t dataLen); | ||
| 39 | uint8_t i2c_master_read(int); | ||
| 40 | void i2c_reset_state(void); | ||
| 41 | void i2c_slave_init(uint8_t address); | ||
| 42 | |||
| 43 | |||
| 44 | static inline unsigned char i2c_start_read(unsigned char addr) { | ||
| 45 | return i2c_master_start((addr << 1) | I2C_READ); | ||
| 46 | } | ||
| 47 | |||
| 48 | static inline unsigned char i2c_start_write(unsigned char addr) { | ||
| 49 | return i2c_master_start((addr << 1) | I2C_WRITE); | ||
| 50 | } | ||
| 51 | |||
| 52 | // from SSD1306 scrips | ||
| 53 | extern unsigned char i2c_rep_start(unsigned char addr); | ||
| 54 | extern void i2c_start_wait(unsigned char addr); | ||
| 55 | extern unsigned char i2c_readAck(void); | ||
| 56 | extern unsigned char i2c_readNak(void); | ||
| 57 | extern unsigned char i2c_read(unsigned char ack); | ||
| 58 | |||
| 59 | #define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak(); | ||
