summaryrefslogtreecommitdiff
path: root/keyboards/ymdk/sp64
diff options
context:
space:
mode:
authorDavid Hoelscher <infinityis@users.noreply.github.com>2024-01-17 07:05:38 -0600
committerGitHub <noreply@github.com>2024-01-17 14:05:38 +0100
commite9bd7d7ad308f9c72c86863bf9f19382c7e2d892 (patch)
treec46ce87aaa57b8f49dc0a2b56527f0bc606038ab /keyboards/ymdk/sp64
parent2b0965944d9065daa65cd25540cf2dd007f23eda (diff)
I2C driver cleanup (#21273)
* remove i2c_start and i2c_stop from i2c drivers * remove static i2c_address variable from chibios i2c driver
Diffstat (limited to 'keyboards/ymdk/sp64')
-rw-r--r--keyboards/ymdk/sp64/matrix.c4
-rw-r--r--keyboards/ymdk/sp64/sp64.c6
-rw-r--r--keyboards/ymdk/sp64/sp64.h4
3 files changed, 6 insertions, 8 deletions
diff --git a/keyboards/ymdk/sp64/matrix.c b/keyboards/ymdk/sp64/matrix.c
index b5f0e10462..6f8c7962eb 100644
--- a/keyboards/ymdk/sp64/matrix.c
+++ b/keyboards/ymdk/sp64/matrix.c
@@ -114,7 +114,7 @@ uint8_t matrix_scan(void)
#ifdef RIGHT_HALF
uint8_t data = 0x7F;
// Receive the columns from right half
- i2c_receive(I2C_ADDR_WRITE, &data, 1, MCP23018_I2C_TIMEOUT);
+ i2c_receive(I2C_ADDR, &data, 1, MCP23018_I2C_TIMEOUT);
cols |= ((~(data) & 0x7F) << 7);
#endif
@@ -162,7 +162,7 @@ static void matrix_select_row(uint8_t row)
//Set the remote row on port A
txdata[0] = GPIOA;
txdata[1] = 0xFF & ~(1<<row);
- mcp23018_status = i2c_transmit(I2C_ADDR_WRITE, (uint8_t *)txdata, 2, MCP23018_I2C_TIMEOUT);
+ mcp23018_status = i2c_transmit(I2C_ADDR, (uint8_t *)txdata, 2, MCP23018_I2C_TIMEOUT);
#endif
// select other half
diff --git a/keyboards/ymdk/sp64/sp64.c b/keyboards/ymdk/sp64/sp64.c
index 12f2577713..e9f30d91f9 100644
--- a/keyboards/ymdk/sp64/sp64.c
+++ b/keyboards/ymdk/sp64/sp64.c
@@ -39,7 +39,7 @@ uint8_t init_mcp23018(void)
data[0] = IODIRA;
data[1] = 0b00000000;
data[2] = 0b11111111;
- mcp23018_status = i2c_transmit(I2C_ADDR_WRITE, (uint8_t *)data, 3, MCP23018_I2C_TIMEOUT);
+ mcp23018_status = i2c_transmit(I2C_ADDR, (uint8_t *)data, 3, MCP23018_I2C_TIMEOUT);
if (mcp23018_status != I2C_STATUS_SUCCESS)
goto out;
@@ -50,7 +50,7 @@ uint8_t init_mcp23018(void)
data[0] = GPPUA;
data[1] = 0b00000000;
data[2] = 0b11111111;
- mcp23018_status = i2c_transmit(I2C_ADDR_WRITE, (uint8_t *)data, 3, MCP23018_I2C_TIMEOUT);
+ mcp23018_status = i2c_transmit(I2C_ADDR, (uint8_t *)data, 3, MCP23018_I2C_TIMEOUT);
if (mcp23018_status != I2C_STATUS_SUCCESS)
goto out;
@@ -61,7 +61,7 @@ uint8_t init_mcp23018(void)
data[0] = OLATA;
data[1] = 0b11111111;
data[2] = 0b11111111;
- mcp23018_status = i2c_transmit(I2C_ADDR_WRITE, (uint8_t *)data, 3, MCP23018_I2C_TIMEOUT);
+ mcp23018_status = i2c_transmit(I2C_ADDR, (uint8_t *)data, 3, MCP23018_I2C_TIMEOUT);
out:
return (mcp23018_status);
diff --git a/keyboards/ymdk/sp64/sp64.h b/keyboards/ymdk/sp64/sp64.h
index afad36ee9a..0e3e3c38b8 100644
--- a/keyboards/ymdk/sp64/sp64.h
+++ b/keyboards/ymdk/sp64/sp64.h
@@ -23,9 +23,7 @@
# include "i2c_master.h"
// I2C aliases and register addresses (see "mcp23018.md")
-# define I2C_ADDR 0b0100000
-# define I2C_ADDR_WRITE ( (I2C_ADDR<<1) | I2C_WRITE )
-# define I2C_ADDR_READ ( (I2C_ADDR<<1) | I2C_READ )
+# define I2C_ADDR (0b0100000<<1)
# define IODIRA 0x00 // i/o direction register
# define IODIRB 0x01
# define GPPUA 0x0C // GPIO pull-up resistor register