1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 05:12:57 +01:00

drivers: adjusted drivers to changed GPIO interface

This commit is contained in:
Hauke Petersen 2015-06-12 19:10:29 +02:00
parent 315ac1bedb
commit 2cc2d9f740
14 changed files with 29 additions and 29 deletions

View File

@ -420,11 +420,11 @@ void at86rf231_gpio_spi_interrupts_init(void)
/* IRQ0 */
gpio_init_int(AT86RF231_INT, GPIO_NOPULL, GPIO_RISING, (gpio_cb_t)at86rf231_rx_irq, NULL);
/* CS */
gpio_init_out(AT86RF231_CS, GPIO_NOPULL);
gpio_init(AT86RF231_CS, GPIO_DIR_OUT, GPIO_NOPULL);
/* SLEEP */
gpio_init_out(AT86RF231_SLEEP, GPIO_NOPULL);
gpio_init(AT86RF231_SLEEP, GPIO_DIR_OUT, GPIO_NOPULL);
/* RESET */
gpio_init_out(AT86RF231_RESET, GPIO_NOPULL);
gpio_init(AT86RF231_RESET, GPIO_DIR_OUT, GPIO_NOPULL);
}
void at86rf231_reset(void)

View File

@ -39,7 +39,7 @@ void cc110x_cs(void)
{
volatile int retry_count = 0;
/* Switch MISO/GDO1 to GPIO input mode */
gpio_init_in(CC110X_GDO1, GPIO_NOPULL);
gpio_init(CC110X_GDO1, GPIO_DIR_IN, GPIO_NOPULL);
/* CS to low */
gpio_clear(CC110X_CS);
/* Wait for SO to go low (voltage regulator

View File

@ -66,11 +66,11 @@ int cc110x_initialize(netdev_t *dev)
rx_buffer_next = 0;
/* Configure chip-select */
gpio_init_out(CC110X_CS, GPIO_NOPULL);
gpio_init(CC110X_CS, GPIO_DIR_OUT, GPIO_NOPULL);
gpio_set(CC110X_CS);
/* Configure GDO0, GDO1, GDO2 */
gpio_init_in(CC110X_GDO0, GPIO_NOPULL);
gpio_init_in(CC110X_GDO1, GPIO_NOPULL);
gpio_init(CC110X_GDO0, GPIO_DIR_IN, GPIO_NOPULL);
gpio_init(CC110X_GDO1, GPIO_DIR_IN, GPIO_NOPULL);
gpio_init_int(CC110X_GDO2, GPIO_NOPULL, GPIO_FALLING, &cc110x_rx_handler, 0);
gpio_irq_disable(CC110X_GDO2);

View File

@ -84,7 +84,7 @@ static void dht_read_data(gpio_t dev, uint32_t *data, uint8_t *checksum)
hwtimer_wait(HWTIMER_TICKS(40));
/* sync on device */
gpio_init_in(dev, GPIO_PULLUP);
gpio_init(dev, GPIO_DIR_IN, GPIO_PULLUP);
while (!gpio_read(dev)) ;
while (gpio_read(dev)) ;
@ -123,7 +123,7 @@ static void dht_read_data(gpio_t dev, uint32_t *data, uint8_t *checksum)
*checksum = les_bits & 0x00000000000000FF;
*data = (les_bits >> 8) & 0x00000000FFFFFFFF;
gpio_init_out(dev, GPIO_PULLUP);
gpio_init(dev, GPIO_DIR_OUT, GPIO_PULLUP);
gpio_set(dev);
}
@ -138,7 +138,7 @@ int dht_init(dht_t *dev, dht_type_t type, gpio_t gpio)
dev->gpio = gpio;
dev->type = type;
if (gpio_init_out(gpio, GPIO_PULLUP) == -1) {
if (gpio_init(gpio, GPIO_DIR_OUT, GPIO_PULLUP) == -1) {
return -1;
}
gpio_set(gpio);

View File

@ -109,7 +109,7 @@ int gpio_init(gpio_t pin, gpio_dir_t dir, gpio_pp_t pullup);
* @return 0 on success
* @return -1 on error
*/
int gpio_init_exti(gpio_t pin, gpio_pp_t pullup, gpio_flank_t flank,
int gpio_init_int(gpio_t pin, gpio_pp_t pullup, gpio_flank_t flank,
gpio_cb_t cb, void *arg);
/**

View File

@ -64,7 +64,7 @@ int kw2xrf_spi_init(spi_t spi, spi_speed_t spi_speed,
res = spi_init_master(kw2xrf_spi, SPI_CONF_FIRST_RISING, spi_speed);
#if KW2XRF_SHARED_SPI
spi_release(kw2xrf_spi);
gpio_init_out(kw2xrf_cs_pin, GPIO_NOPULL);
gpio_init(kw2xrf_cs_pin, GPIO_DIR_OUT, GPIO_NOPULL);
gpio_set(kw2xrf_cs_pin);
#endif

View File

@ -41,7 +41,7 @@ int lis3dh_init(lis3dh_t *dev, spi_t spi, gpio_t cs_pin, gpio_t int1_pin, gpio_t
dev->scale = 0;
/* CS */
gpio_init_out(dev->cs, GPIO_NOPULL);
gpio_init(dev->cs, GPIO_DIR_OUT, GPIO_NOPULL);
gpio_set(dev->cs);
if (lis3dh_read_regs(dev, LIS3DH_REG_WHO_AM_I, 1, &in) < 0) {

View File

@ -70,7 +70,7 @@ int lsm303dlhc_init(lsm303dlhc_t *dev, i2c_t i2c, gpio_t acc_pin, gpio_t mag_pin
res += i2c_write_reg(dev->i2c, dev->acc_address,
LSM303DLHC_REG_CTRL3_A, LSM303DLHC_CTRL3_A_I1_NONE);
/* configure acc data ready pin */
gpio_init_in(acc_pin, GPIO_NOPULL);
gpio_init(acc_pin, GPIO_DIR_IN, GPIO_NOPULL);
/* configure magnetometer and temperature */
/* enable temperature output and set sample rate */
@ -85,7 +85,7 @@ int lsm303dlhc_init(lsm303dlhc_t *dev, i2c_t i2c, gpio_t acc_pin, gpio_t mag_pin
LSM303DLHC_REG_MR_M, LSM303DLHC_MAG_MODE_CONTINUOUS);
i2c_release(dev->i2c);
/* configure mag data ready pin */
gpio_init_in(mag_pin, GPIO_NOPULL);
gpio_init(mag_pin, GPIO_DIR_IN, GPIO_NOPULL);
return (res < 7) ? -1 : 0;
}
@ -215,7 +215,7 @@ int lsm303dlhc_enable(lsm303dlhc_t *dev)
tmp = (LSM303DLHC_CTRL4_A_BDU| LSM303DLHC_CTRL4_A_SCALE_2G | LSM303DLHC_CTRL4_A_HR);
res += i2c_write_reg(dev->i2c, dev->acc_address, LSM303DLHC_REG_CTRL4_A, tmp);
res += i2c_write_reg(dev->i2c, dev->acc_address, LSM303DLHC_REG_CTRL3_A, LSM303DLHC_CTRL3_A_I1_DRDY1);
gpio_init_in(dev->acc_pin, GPIO_NOPULL);
gpio_init(dev->acc_pin, GPIO_DIR_IN, GPIO_NOPULL);
tmp = LSM303DLHC_TEMP_EN | LSM303DLHC_TEMP_SAMPLE_75HZ;
res += i2c_write_reg(dev->i2c, dev->mag_address, LSM303DLHC_REG_CRA_M, tmp);
@ -227,7 +227,7 @@ int lsm303dlhc_enable(lsm303dlhc_t *dev)
LSM303DLHC_REG_MR_M, LSM303DLHC_MAG_MODE_CONTINUOUS);
i2c_release(dev->i2c);
gpio_init_in(dev->mag_pin, GPIO_NOPULL);
gpio_init(dev->mag_pin, GPIO_DIR_IN, GPIO_NOPULL);
return (res < 6) ? -1 : 0;
}

View File

@ -65,11 +65,11 @@ int ng_at86rf2xx_init(ng_at86rf2xx_t *dev, spi_t spi, spi_speed_t spi_speed,
/* initialise SPI */
spi_init_master(dev->spi, SPI_CONF_FIRST_RISING, spi_speed);
/* initialise GPIOs */
gpio_init_out(dev->cs_pin, GPIO_NOPULL);
gpio_init(dev->cs_pin, GPIO_DIR_OUT, GPIO_NOPULL);
gpio_set(dev->cs_pin);
gpio_init_out(dev->sleep_pin, GPIO_NOPULL);
gpio_init(dev->sleep_pin, GPIO_DIR_OUT, GPIO_NOPULL);
gpio_clear(dev->sleep_pin);
gpio_init_out(dev->reset_pin, GPIO_NOPULL);
gpio_init(dev->reset_pin, GPIO_DIR_OUT, GPIO_NOPULL);
gpio_set(dev->reset_pin);
gpio_init_int(dev->int_pin, GPIO_NOPULL, GPIO_RISING, _irq_handler, dev);

View File

@ -80,10 +80,10 @@ int nrf24l01p_init(nrf24l01p_t *dev, spi_t spi, gpio_t ce, gpio_t cs, gpio_t irq
dev->listener = KERNEL_PID_UNDEF;
/* Init CE pin */
gpio_init_out(dev->ce, GPIO_NOPULL);
gpio_init(dev->ce, GPIO_DIR_OUT, GPIO_NOPULL);
/* Init CS pin */
gpio_init_out(dev->cs, GPIO_NOPULL);
gpio_init(dev->cs, GPIO_DIR_OUT, GPIO_NOPULL);
gpio_set(dev->cs);
/* Init IRQ pin */

View File

@ -114,7 +114,7 @@ int nvram_spi_init(nvram_t *dev, nvram_spi_params_t *spi_params, size_t size)
}
dev->extra = spi_params;
gpio_init_out(spi_params->cs, GPIO_NOPULL);
gpio_init(spi_params->cs, GPIO_DIR_OUT, GPIO_NOPULL);
gpio_set(spi_params->cs);
return 0;

View File

@ -231,9 +231,9 @@ int pcd8544_init(pcd8544_t *dev, spi_t spi, gpio_t cs, gpio_t reset, gpio_t mode
DEBUG("done setting dev members\n");
/* initialze pins */
gpio_init_out(cs, GPIO_NOPULL);
gpio_init_out(reset, GPIO_NOPULL);
gpio_init_out(mode, GPIO_NOPULL);
gpio_init(cs, GPIO_DIR_OUT, GPIO_NOPULL);
gpio_init(reset, GPIO_DIR_OUT, GPIO_NOPULL);
gpio_init(mode, GPIO_DIR_OUT, GPIO_NOPULL);
DEBUG("done with gpios\n");
/* clear CS line */
gpio_set(cs);

View File

@ -41,7 +41,7 @@ int pir_init(pir_t *dev, gpio_t gpio)
{
dev->gpio_dev = gpio;
dev->msg_thread_pid = KERNEL_PID_UNDEF;
return gpio_init_in(dev->gpio_dev, GPIO_NOPULL);
return gpio_init(dev->gpio_dev, GPIO_DIR_IN, GPIO_NOPULL);
}
pir_event_t pir_get_status(pir_t *dev)

View File

@ -437,14 +437,14 @@ int xbee_init(xbee_t *dev, uart_t uart, uint32_t baudrate,
return -ENXIO;
}
if (reset_pin < GPIO_NUMOF) {
if (gpio_init_out(reset_pin, GPIO_NOPULL) < 0) {
if (gpio_init(reset_pin, GPIO_DIR_OUT, GPIO_NOPULL) < 0) {
DEBUG("xbee: Error initializing RESET pin\n");
return -ENXIO;
}
gpio_set(reset_pin);
}
if (sleep_pin < GPIO_NUMOF) {
if (gpio_init_out(sleep_pin, GPIO_NOPULL) < 0) {
if (gpio_init(sleep_pin, GPIO_DIR_OUT, GPIO_NOPULL) < 0) {
DEBUG("xbee: Error initializing SLEEP pin\n");
return -ENXIO;
}