diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2018-12-25 11:19:30 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2019-01-07 19:30:17 -0500 |
commit | 7707d5a74e5dc13c07fa637447e00be30cca582b (patch) | |
tree | 5d047fc7a2e6df01ad42c28c6a5b96183d41fef5 /src/sam4e8e/i2c.c | |
parent | f0715de0049b238b4bbcb0389fe5848fd271118e (diff) | |
download | kutter-7707d5a74e5dc13c07fa637447e00be30cca582b.tar.gz kutter-7707d5a74e5dc13c07fa637447e00be30cca582b.tar.xz kutter-7707d5a74e5dc13c07fa637447e00be30cca582b.zip |
sam4e8e: Rename gpio_set_peripheral() to gpio_peripheral()
Use the same definition for gpio_peripheral() that the sam3x8e code
uses.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/sam4e8e/i2c.c')
-rw-r--r-- | src/sam4e8e/i2c.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/sam4e8e/i2c.c b/src/sam4e8e/i2c.c index 454de61b..caf05f0a 100644 --- a/src/sam4e8e/i2c.c +++ b/src/sam4e8e/i2c.c @@ -14,20 +14,16 @@ #include "sched.h" // sched_shutdown // I2C pin definitions -#define TWI0_SCL_BANK 'A' -#define TWI0_SCL_PIN PIO_PA4A_TWCK0 +#define TWI0_SCL_GPIO GPIO('A', 4) #define TWI0_SCL_PERIPH 'A' -#define TWI0_SDA_BANK 'A' -#define TWI0_SDA_PIN PIO_PA3A_TWD0 +#define TWI0_SDA_GPIO GPIO('A', 3) #define TWI0_SDA_PERIPH 'A' -#define TWI1_SCL_BANK 'B' -#define TWI1_SCL_PIN PIO_PB5A_TWCK1 +#define TWI1_SCL_GPIO GPIO('B', 5) #define TWI1_SCL_PERIPH 'A' -#define TWI1_SDA_BANK 'B' -#define TWI1_SDA_PIN PIO_PB4A_TWD1 +#define TWI1_SDA_GPIO GPIO('B', 4) #define TWI1_SDA_PERIPH 'A' void @@ -38,11 +34,11 @@ i2c_init(Twi *p_twi, uint32_t rate) PMC->PMC_PCER0 = 1 << twi_id; } if (p_twi == TWI0) { - gpio_set_peripheral(TWI0_SCL_BANK, TWI0_SCL_PIN, TWI0_SCL_PERIPH, 0); - gpio_set_peripheral(TWI0_SDA_BANK, TWI0_SDA_PIN, TWI0_SDA_PERIPH, 0); + gpio_peripheral(TWI0_SCL_GPIO, TWI0_SCL_PERIPH, 0); + gpio_peripheral(TWI0_SDA_GPIO, TWI0_SDA_PERIPH, 0); } else { - gpio_set_peripheral(TWI1_SCL_BANK, TWI1_SCL_PIN, TWI1_SCL_PERIPH, 0); - gpio_set_peripheral(TWI1_SDA_BANK, TWI1_SDA_PIN, TWI1_SDA_PERIPH, 0); + gpio_peripheral(TWI1_SCL_GPIO, TWI1_SCL_PERIPH, 0); + gpio_peripheral(TWI1_SDA_GPIO, TWI1_SDA_PERIPH, 0); } p_twi->TWI_IDR = 0xFFFFFFFF; (void)p_twi->TWI_SR; |