diff options
| author | bigmagic <[email protected]> | 2020-02-06 16:03:31 +0800 |
|---|---|---|
| committer | bigmagic <[email protected]> | 2020-02-06 16:03:31 +0800 |
| commit | 3e533e9992d668891b09276e2d3594a1ebd74e8b (patch) | |
| tree | 4439013fd1d4b66128c993386022ccf797a2d676 | |
| parent | 4ec07a04e6aa31b597317ca6b214cc68f9ce4afe (diff) | |
fix spi bug
| -rw-r--r-- | bsp/raspberry-pi/raspi3-32/driver/drv_spi.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/bsp/raspberry-pi/raspi3-32/driver/drv_spi.c b/bsp/raspberry-pi/raspi3-32/driver/drv_spi.c index 32de9970e7..eab7a08b39 100644 --- a/bsp/raspberry-pi/raspi3-32/driver/drv_spi.c +++ b/bsp/raspberry-pi/raspi3-32/driver/drv_spi.c @@ -18,9 +18,9 @@ void spi_gpio_write(rt_uint8_t pin, rt_uint8_t val) { if (val) - BCM283X_GPIO_GPSET(pin / 32) = 1 << (pin % 32); + BCM283X_GPIO_GPSET((pin / 32)) = 1 << (pin % 32); else - BCM283X_GPIO_GPCLR(pin / 32) = 0 << (pin % 32); + BCM283X_GPIO_GPCLR((pin / 32)) = 1 << (pin % 32); } struct raspi_spi_hw_config @@ -147,11 +147,10 @@ static rt_uint32_t raspi_spi_xfer(struct rt_spi_device *device, struct rt_spi_me flag = 0; else flag = 1; - - if (message->cs_take) - (config.mode & RT_SPI_CS_HIGH)? - spi_gpio_write(cs_pin, 1): - spi_gpio_write(cs_pin, 0); + if (message->cs_take); + // (config.mode & RT_SPI_CS_HIGH)? + // spi_gpio_write(cs_pin, 1): + // spi_gpio_write(cs_pin, 0); /* deal data */ res = spi_transfernb((rt_uint8_t *)message->send_buf, (rt_uint8_t *)message->recv_buf, |
