Skip to content

Commit e51d634

Browse files
committed
drivers: adapted gpio_init(_x)() calls
1 parent 03efb5b commit e51d634

File tree

18 files changed

+38
-38
lines changed

18 files changed

+38
-38
lines changed

drivers/adt7310/adt7310.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ int adt7310_init(adt7310_t *dev, spi_t spi, gpio_t cs)
153153
dev->high_res = false;
154154

155155
/* CS */
156-
gpio_init(dev->cs, GPIO_DIR_OUT, GPIO_NOPULL);
156+
gpio_init(dev->cs, GPIO_OUT);
157157
gpio_set(dev->cs);
158158

159159
#if ENABLE_DEBUG

drivers/at86rf2xx/at86rf2xx.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ int at86rf2xx_init(at86rf2xx_t *dev, spi_t spi, spi_speed_t spi_speed,
6363
/* initialise SPI */
6464
spi_init_master(dev->spi, SPI_CONF_FIRST_RISING, spi_speed);
6565
/* initialise GPIOs */
66-
gpio_init(dev->cs_pin, GPIO_DIR_OUT, GPIO_NOPULL);
66+
gpio_init(dev->cs_pin, GPIO_OUT);
6767
gpio_set(dev->cs_pin);
68-
gpio_init(dev->sleep_pin, GPIO_DIR_OUT, GPIO_NOPULL);
68+
gpio_init(dev->sleep_pin, GPIO_OUT);
6969
gpio_clear(dev->sleep_pin);
70-
gpio_init(dev->reset_pin, GPIO_DIR_OUT, GPIO_NOPULL);
70+
gpio_init(dev->reset_pin, GPIO_OUT);
7171
gpio_set(dev->reset_pin);
72-
gpio_init_int(dev->int_pin, GPIO_NOPULL, GPIO_RISING, _irq_handler, dev);
72+
gpio_init_int(dev->int_pin, GPIO_IN, GPIO_RISING, _irq_handler, dev);
7373

7474
/* make sure device is not sleeping, so we can query part number */
7575
at86rf2xx_assert_awake(dev);

drivers/cc110x/cc110x-netdev2.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ static int _init(netdev2_t *dev)
199199

200200
cc110x_t *cc110x = &((netdev2_cc110x_t*) dev)->cc110x;
201201

202-
gpio_init_int(cc110x->params.gdo2, GPIO_NOPULL, GPIO_BOTH,
202+
gpio_init_int(cc110x->params.gdo2, GPIO_IN, GPIO_BOTH,
203203
&_netdev2_cc110x_isr, (void*)dev);
204204

205205
gpio_set(cc110x->params.gdo2);

drivers/cc110x/cc110x-spi.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ void cc110x_cs(cc110x_t *dev)
4444
volatile int retry_count = 0;
4545
/* Switch MISO/GDO1 to GPIO input mode */
4646
#ifndef GPIO_READS_SPI_PINS
47-
gpio_init(dev->params.gdo1, GPIO_DIR_IN, GPIO_NOPULL);
47+
gpio_init(dev->params.gdo1, GPIO_IN);
4848
#endif
4949
/* CS to low */
5050
gpio_clear(dev->params.cs);

drivers/cc110x/cc110x.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ int cc110x_setup(cc110x_t *dev, const cc110x_params_t *params)
5555
dev->params = *params;
5656

5757
/* Configure chip-select */
58-
gpio_init(dev->params.cs, GPIO_DIR_OUT, GPIO_NOPULL);
58+
gpio_init(dev->params.cs, GPIO_OUT);
5959
gpio_set(dev->params.cs);
6060

6161
/* Configure GDO1 */
62-
gpio_init(dev->params.gdo1, GPIO_DIR_IN, GPIO_NOPULL);
62+
gpio_init(dev->params.gdo1, GPIO_IN);
6363

6464
/* Configure SPI */
6565
spi_acquire(dev->params.spi);

drivers/dht/dht.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ int dht_init(dht_t *dev, const dht_params_t *params)
8080

8181
memcpy(dev, params, sizeof(dht_t));
8282

83-
if (gpio_init(dev->pin, GPIO_DIR_OUT, dev->pull) == -1) {
83+
if (gpio_init(dev->pin, GPIO_OUT) == -1) {
8484
return -1;
8585
}
8686
gpio_set(dev->pin);
@@ -103,9 +103,9 @@ int dht_read(dht_t *dev, int16_t *temp, int16_t *hum)
103103
xtimer_usleep(40);
104104

105105
/* sync on device */
106-
gpio_init(dev->pin, GPIO_DIR_IN, dev->pull);
107-
while (!gpio_read(dev->pin)) ;
108-
while (gpio_read(dev->pin)) ;
106+
gpio_init(dev, dev->in_mode);
107+
while (!gpio_read(dev)) ;
108+
while (gpio_read(dev)) ;
109109

110110
/*
111111
* data is read in sequentially, highest bit first:
@@ -120,7 +120,7 @@ int dht_read(dht_t *dev, int16_t *temp, int16_t *hum)
120120

121121
/* set pin high again - so we can trigger the next reading by pulling it low
122122
* again */
123-
gpio_init(dev->pin, GPIO_DIR_OUT, dev->pull);
123+
gpio_init(dev->pin, GPIO_OUT);
124124
gpio_set(dev->pin);
125125

126126
/* validate the checksum */

drivers/enc28j60/enc28j60.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -288,11 +288,11 @@ static int nd_init(netdev2_t *netdev)
288288
mutex_lock(&dev->devlock);
289289

290290
/* setup the low-level interfaces */
291-
gpio_init(dev->reset_pin, GPIO_DIR_OUT, GPIO_NOPULL);
291+
gpio_init(dev->reset_pin, GPIO_OUT);
292292
gpio_clear(dev->reset_pin); /* this puts the device into reset state */
293-
gpio_init(dev->cs_pin, GPIO_DIR_OUT, GPIO_NOPULL);
293+
gpio_init(dev->cs_pin, GPIO_OUT);
294294
gpio_set(dev->cs_pin);
295-
gpio_init_int(dev->int_pin, GPIO_NOPULL, GPIO_FALLING, on_int, (void *)dev);
295+
gpio_init_int(dev->int_pin, GPIO_IN, GPIO_FALLING, on_int, (void *)dev);
296296
res = spi_init_master(dev->spi, SPI_CONF_FIRST_RISING, SPI_SPEED);
297297
if (res < 0) {
298298
DEBUG("[enc28j60] init: error initializing SPI bus [%i]\n", res);

drivers/encx24j600/encx24j600.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,9 @@ static int _init(netdev2_t *encdev)
250250
DEBUG("encx24j600: starting initialization...\n");
251251

252252
/* setup IO */
253-
gpio_init(dev->cs, GPIO_DIR_OUT, GPIO_PULLUP);
253+
gpio_init(dev->cs, GPIO_OUT);
254254
gpio_set(dev->cs);
255-
gpio_init_int(dev->int_pin, GPIO_PULLUP, GPIO_FALLING, encx24j600_isr, (void*)dev);
255+
gpio_init_int(dev->int_pin, GPIO_IN_PU, GPIO_FALLING, encx24j600_isr, (void*)dev);
256256

257257
if (spi_init_master(dev->spi, SPI_CONF_FIRST_RISING, ENCX24J600_SPI_SPEED) < 0) {
258258
return -1;

drivers/include/dht.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ typedef enum {
5959
typedef struct {
6060
gpio_t pin; /**< GPIO pin of the device's data pin */
6161
dht_type_t type; /**< type of the DHT device */
62-
gpio_pp_t pull; /**< internal pull resistor configuration, set to
62+
gpio_mode_t in_mode; /**< internal pull resistor configuration, set to
6363
* GPIO_NOPULL when using an external pull-up */
6464
} dht_t;
6565

drivers/kw2xrf/kw2xrf.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ void kw2xrf_init_interrupts(kw2xrf_t *dev, gpio_t int_pin)
304304
kw2xrf_write_dreg(MKW2XDM_PHY_CTRL3, reg);
305305

306306
/* set up GPIO-pin used for IRQ */
307-
gpio_init_int(int_pin, GPIO_NOPULL, GPIO_FALLING, &kw2xrf_irq_handler, dev);
307+
gpio_init_int(int_pin, GPIO_IN, GPIO_FALLING, &kw2xrf_irq_handler, dev);
308308
}
309309

310310
int kw2xrf_set_pan(kw2xrf_t *dev, uint16_t pan)

drivers/kw2xrf/kw2xrf_spi.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ int kw2xrf_spi_init(spi_t spi, spi_speed_t spi_speed,
6464
res = spi_init_master(kw2xrf_spi, SPI_CONF_FIRST_RISING, spi_speed);
6565
#if KW2XRF_SHARED_SPI
6666
spi_release(kw2xrf_spi);
67-
gpio_init(kw2xrf_cs_pin, GPIO_DIR_OUT, GPIO_NOPULL);
67+
gpio_init(kw2xrf_cs_pin, GPIO_OUT);
6868
gpio_set(kw2xrf_cs_pin);
6969
#endif
7070

drivers/lis3dh/lis3dh.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ int lis3dh_init(lis3dh_t *dev, spi_t spi, gpio_t cs_pin, uint8_t scale)
3939
dev->scale = 0;
4040

4141
/* CS */
42-
gpio_init(dev->cs, GPIO_DIR_OUT, GPIO_NOPULL);
42+
gpio_init(dev->cs, GPIO_OUT);
4343
gpio_set(dev->cs);
4444

4545
if (lis3dh_read_regs(dev, LIS3DH_REG_WHO_AM_I, 1, &in) < 0) {

drivers/lsm303dlhc/lsm303dlhc.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ int lsm303dlhc_init(lsm303dlhc_t *dev, i2c_t i2c, gpio_t acc_pin, gpio_t mag_pin
7272
res += i2c_write_reg(dev->i2c, dev->acc_address,
7373
LSM303DLHC_REG_CTRL3_A, LSM303DLHC_CTRL3_A_I1_NONE);
7474
/* configure acc data ready pin */
75-
gpio_init(acc_pin, GPIO_DIR_IN, GPIO_NOPULL);
75+
gpio_init(acc_pin, GPIO_IN);
7676

7777
/* configure magnetometer and temperature */
7878
/* enable temperature output and set sample rate */
@@ -87,7 +87,7 @@ int lsm303dlhc_init(lsm303dlhc_t *dev, i2c_t i2c, gpio_t acc_pin, gpio_t mag_pin
8787
LSM303DLHC_REG_MR_M, LSM303DLHC_MAG_MODE_CONTINUOUS);
8888
i2c_release(dev->i2c);
8989
/* configure mag data ready pin */
90-
gpio_init(mag_pin, GPIO_DIR_IN, GPIO_NOPULL);
90+
gpio_init(mag_pin, GPIO_IN);
9191

9292
return (res < 7) ? -1 : 0;
9393
}
@@ -217,7 +217,7 @@ int lsm303dlhc_enable(lsm303dlhc_t *dev)
217217
tmp = (LSM303DLHC_CTRL4_A_BDU| LSM303DLHC_CTRL4_A_SCALE_2G | LSM303DLHC_CTRL4_A_HR);
218218
res += i2c_write_reg(dev->i2c, dev->acc_address, LSM303DLHC_REG_CTRL4_A, tmp);
219219
res += i2c_write_reg(dev->i2c, dev->acc_address, LSM303DLHC_REG_CTRL3_A, LSM303DLHC_CTRL3_A_I1_DRDY1);
220-
gpio_init(dev->acc_pin, GPIO_DIR_IN, GPIO_NOPULL);
220+
gpio_init(dev->acc_pin, GPIO_IN);
221221

222222
tmp = LSM303DLHC_TEMP_EN | LSM303DLHC_TEMP_SAMPLE_75HZ;
223223
res += i2c_write_reg(dev->i2c, dev->mag_address, LSM303DLHC_REG_CRA_M, tmp);
@@ -229,7 +229,7 @@ int lsm303dlhc_enable(lsm303dlhc_t *dev)
229229
LSM303DLHC_REG_MR_M, LSM303DLHC_MAG_MODE_CONTINUOUS);
230230
i2c_release(dev->i2c);
231231

232-
gpio_init(dev->mag_pin, GPIO_DIR_IN, GPIO_NOPULL);
232+
gpio_init(dev->mag_pin, GPIO_IN);
233233

234234
return (res < 6) ? -1 : 0;
235235
}

drivers/nrf24l01p/nrf24l01p.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,14 @@ int nrf24l01p_init(nrf24l01p_t *dev, spi_t spi, gpio_t ce, gpio_t cs, gpio_t irq
8181
dev->listener = KERNEL_PID_UNDEF;
8282

8383
/* Init CE pin */
84-
gpio_init(dev->ce, GPIO_DIR_OUT, GPIO_NOPULL);
84+
gpio_init(dev->ce, GPIO_OUT);
8585

8686
/* Init CS pin */
87-
gpio_init(dev->cs, GPIO_DIR_OUT, GPIO_NOPULL);
87+
gpio_init(dev->cs, GPIO_OUT);
8888
gpio_set(dev->cs);
8989

9090
/* Init IRQ pin */
91-
gpio_init_int(dev->irq, GPIO_PULLUP, GPIO_FALLING, nrf24l01p_rx_cb, dev);
91+
gpio_init_int(dev->irq, GPIO_IN_PU, GPIO_FALLING, nrf24l01p_rx_cb, dev);
9292

9393

9494
/* Init SPI */

drivers/nvram_spi/nvram-spi.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ int nvram_spi_init(nvram_t *dev, nvram_spi_params_t *spi_params, size_t size)
114114
}
115115
dev->extra = spi_params;
116116

117-
gpio_init(spi_params->cs, GPIO_DIR_OUT, GPIO_NOPULL);
117+
gpio_init(spi_params->cs, GPIO_OUT);
118118
gpio_set(spi_params->cs);
119119

120120
return 0;

drivers/pcd8544/pcd8544.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,9 @@ int pcd8544_init(pcd8544_t *dev, spi_t spi, gpio_t cs, gpio_t reset, gpio_t mode
231231
DEBUG("done setting dev members\n");
232232

233233
/* initialze pins */
234-
gpio_init(cs, GPIO_DIR_OUT, GPIO_NOPULL);
235-
gpio_init(reset, GPIO_DIR_OUT, GPIO_NOPULL);
236-
gpio_init(mode, GPIO_DIR_OUT, GPIO_NOPULL);
234+
gpio_init(cs, GPIO_OUT);
235+
gpio_init(reset, GPIO_OUT);
236+
gpio_init(mode, GPIO_OUT);
237237
DEBUG("done with gpios\n");
238238
/* clear CS line */
239239
gpio_set(cs);

drivers/pir/pir.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ int pir_init(pir_t *dev, gpio_t gpio)
4141
{
4242
dev->gpio_dev = gpio;
4343
dev->msg_thread_pid = KERNEL_PID_UNDEF;
44-
return gpio_init(dev->gpio_dev, GPIO_DIR_IN, GPIO_NOPULL);
44+
return gpio_init(dev->gpio_dev, GPIO_IN);
4545
}
4646

4747
pir_event_t pir_get_status(pir_t *dev)
@@ -106,5 +106,5 @@ static void pir_callback(void *arg)
106106

107107
static int pir_activate_int(pir_t *dev)
108108
{
109-
return gpio_init_int(dev->gpio_dev, GPIO_NOPULL, GPIO_BOTH, pir_callback, dev);
109+
return gpio_init_int(dev->gpio_dev, GPIO_IN, GPIO_BOTH, pir_callback, dev);
110110
}

drivers/xbee/xbee.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -428,14 +428,14 @@ int xbee_init(xbee_t *dev, uart_t uart, uint32_t baudrate,
428428
return -ENXIO;
429429
}
430430
if (reset_pin != GPIO_UNDEF) {
431-
if (gpio_init(reset_pin, GPIO_DIR_OUT, GPIO_NOPULL) < 0) {
431+
if (gpio_init(reset_pin, GPIO_OUT) < 0) {
432432
DEBUG("xbee: Error initializing RESET pin\n");
433433
return -ENXIO;
434434
}
435435
gpio_set(reset_pin);
436436
}
437437
if (sleep_pin != GPIO_UNDEF) {
438-
if (gpio_init(sleep_pin, GPIO_DIR_OUT, GPIO_NOPULL) < 0) {
438+
if (gpio_init(sleep_pin, GPIO_OUT) < 0) {
439439
DEBUG("xbee: Error initializing SLEEP pin\n");
440440
return -ENXIO;
441441
}

0 commit comments

Comments
 (0)