Make use of the pio and gpio config functions - eeprom part
authorCyprien Laplace <cyprien@cypou.net>
Sun, 14 Dec 2014 17:08:17 +0000 (18:08 +0100)
committerNathael Pajani <nathael.pajani@ed3l.fr>
Tue, 8 Nov 2022 16:03:04 +0000 (17:03 +0100)
extdrv/eeprom.c

index 2f35fec..24af641 100644 (file)
@@ -27,6 +27,7 @@
 #include "core/system.h"
 #include "core/pio.h"
 #include "lib/string.h"
+#include "drivers/gpio.h"
 #include "drivers/i2c.h"
 #include "extdrv/eeprom.h"
 
  *   and the EEPROM should not be accessed by the module.
  * Other I2C EEPROMs should not need these functions.
  */
-static struct pio i2c_eeprom_cs = LPC_GPIO_0_15;
+static const struct pio i2c_eeprom_cs = LPC_GPIO_0_15;
 int mod_gpio_demo_eeprom_cs_pull_low(void)
 {
-    struct lpc_gpio* gpio_port_regs = LPC_GPIO_REGS(i2c_eeprom_cs.port);
-    config_pio(&i2c_eeprom_cs, (LPC_IO_MODE_PULL_UP | LPC_IO_DIGITAL));
     /* Configure SPI_CS as output and set it low. */
-    gpio_port_regs->data_dir |= (1 << i2c_eeprom_cs.pin);
-    gpio_port_regs->clear = (1 << i2c_eeprom_cs.pin);
+    config_gpio(&i2c_eeprom_cs, 0, GPIO_DIR_OUT, 0);
        return 0;
 }
 void mod_gpio_demo_eeprom_cs_release(void)