1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-20 14:55:21 +03:00

Use csn instead of cs for chip select.

This commit is contained in:
jflyper 2017-07-18 17:21:46 +09:00
parent eefa2a8e88
commit 8fe8da975b
3 changed files with 9 additions and 9 deletions

View file

@ -3032,7 +3032,7 @@ const cliResourceValue_t resourceTable[] = {
{ OWNER_ESCSERIAL, PG_ESCSERIAL_CONFIG, offsetof(escSerialConfig_t, ioTag), 0 }, { OWNER_ESCSERIAL, PG_ESCSERIAL_CONFIG, offsetof(escSerialConfig_t, ioTag), 0 },
#endif #endif
#ifdef BARO #ifdef BARO
{ OWNER_BARO_CS, PG_BAROMETER_CONFIG, offsetof(barometerConfig_t, baro_spi_cs), 0 }, { OWNER_BARO_CS, PG_BAROMETER_CONFIG, offsetof(barometerConfig_t, baro_spi_csn), 0 },
#endif #endif
}; };

View file

@ -64,12 +64,12 @@ void pgResetFn_barometerConfig(barometerConfig_t *barometerConfig)
barometerConfig->baro_i2c_device = I2C_DEV_TO_CFG(BARO_I2C_INSTANCE); barometerConfig->baro_i2c_device = I2C_DEV_TO_CFG(BARO_I2C_INSTANCE);
barometerConfig->baro_i2c_address = BMP085_I2C_ADDR; barometerConfig->baro_i2c_address = BMP085_I2C_ADDR;
barometerConfig->baro_spi_device = SPI_DEV_TO_CFG(SPIINVALID); barometerConfig->baro_spi_device = SPI_DEV_TO_CFG(SPIINVALID);
barometerConfig->baro_spi_cs = IO_TAG_NONE; barometerConfig->baro_spi_csn = IO_TAG_NONE;
#elif defined(USE_BARO_MS5611) || defined(USE_BARO_SPI_MS5611) #elif defined(USE_BARO_MS5611) || defined(USE_BARO_SPI_MS5611)
#if defined(USE_BARO_SPI_MS5611) #if defined(USE_BARO_SPI_MS5611)
barometerConfig->baro_bustype = BUSTYPE_SPI; barometerConfig->baro_bustype = BUSTYPE_SPI;
barometerConfig->baro_spi_device = SPI_DEV_TO_CFG(spiDeviceByInstance(MS5611_SPI_INSTANCE)); barometerConfig->baro_spi_device = SPI_DEV_TO_CFG(spiDeviceByInstance(MS5611_SPI_INSTANCE));
barometerConfig->baro_spi_cs = IO_TAG(MS5611_CS_PIN); barometerConfig->baro_spi_csn = IO_TAG(MS5611_CS_PIN);
barometerConfig->baro_i2c_device = I2C_DEV_TO_CFG(I2CINVALID); barometerConfig->baro_i2c_device = I2C_DEV_TO_CFG(I2CINVALID);
barometerConfig->baro_i2c_address = 0; barometerConfig->baro_i2c_address = 0;
#else #else
@ -77,13 +77,13 @@ void pgResetFn_barometerConfig(barometerConfig_t *barometerConfig)
barometerConfig->baro_i2c_device = I2C_DEV_TO_CFG(BARO_I2C_INSTANCE); barometerConfig->baro_i2c_device = I2C_DEV_TO_CFG(BARO_I2C_INSTANCE);
barometerConfig->baro_i2c_address = MS5611_I2C_ADDR; barometerConfig->baro_i2c_address = MS5611_I2C_ADDR;
barometerConfig->baro_spi_device = SPI_DEV_TO_CFG(SPIINVALID); barometerConfig->baro_spi_device = SPI_DEV_TO_CFG(SPIINVALID);
barometerConfig->baro_spi_cs = IO_TAG_NONE; barometerConfig->baro_spi_csn = IO_TAG_NONE;
#endif #endif
#elif defined(USE_BARO_BMP280) || defined(USE_BARO_SPI_BMP280) #elif defined(USE_BARO_BMP280) || defined(USE_BARO_SPI_BMP280)
#if defined(USE_BARO_SPI_BMP280) #if defined(USE_BARO_SPI_BMP280)
barometerConfig->baro_bustype = BUSTYPE_SPI; barometerConfig->baro_bustype = BUSTYPE_SPI;
barometerConfig->baro_spi_device = SPI_DEV_TO_CFG(spiDeviceByInstance(BMP280_SPI_INSTANCE)); barometerConfig->baro_spi_device = SPI_DEV_TO_CFG(spiDeviceByInstance(BMP280_SPI_INSTANCE));
barometerConfig->baro_spi_cs = IO_TAG(BMP280_CS_PIN); barometerConfig->baro_spi_csn = IO_TAG(BMP280_CS_PIN);
barometerConfig->baro_i2c_device = I2C_DEV_TO_CFG(I2CINVALID); barometerConfig->baro_i2c_device = I2C_DEV_TO_CFG(I2CINVALID);
barometerConfig->baro_i2c_address = 0; barometerConfig->baro_i2c_address = 0;
#else #else
@ -91,7 +91,7 @@ void pgResetFn_barometerConfig(barometerConfig_t *barometerConfig)
barometerConfig->baro_i2c_device = I2C_DEV_TO_CFG(BARO_I2C_INSTANCE); barometerConfig->baro_i2c_device = I2C_DEV_TO_CFG(BARO_I2C_INSTANCE);
barometerConfig->baro_i2c_address = BMP280_I2C_ADDR; barometerConfig->baro_i2c_address = BMP280_I2C_ADDR;
barometerConfig->baro_spi_device = SPI_DEV_TO_CFG(SPIINVALID); barometerConfig->baro_spi_device = SPI_DEV_TO_CFG(SPIINVALID);
barometerConfig->baro_spi_cs = IO_TAG_NONE; barometerConfig->baro_spi_csn = IO_TAG_NONE;
#endif #endif
#else #else
barometerConfig->baro_hardware = BARO_NONE; barometerConfig->baro_hardware = BARO_NONE;
@ -99,7 +99,7 @@ void pgResetFn_barometerConfig(barometerConfig_t *barometerConfig)
barometerConfig->baro_i2c_device = I2C_DEV_TO_CFG(I2CINVALID); barometerConfig->baro_i2c_device = I2C_DEV_TO_CFG(I2CINVALID);
barometerConfig->baro_i2c_address = 0; barometerConfig->baro_i2c_address = 0;
barometerConfig->baro_spi_device = SPI_DEV_TO_CFG(SPIINVALID); barometerConfig->baro_spi_device = SPI_DEV_TO_CFG(SPIINVALID);
barometerConfig->baro_spi_cs = IO_TAG_NONE; barometerConfig->baro_spi_csn = IO_TAG_NONE;
#endif #endif
} }
@ -136,7 +136,7 @@ bool baroDetect(baroDev_t *dev, baroSensor_e baroHardwareToUse)
#ifdef USE_SPI #ifdef USE_SPI
dev->busdev.bustype = BUSTYPE_SPI; dev->busdev.bustype = BUSTYPE_SPI;
spiBusSetInstance(&dev->busdev, spiInstanceByDevice(SPI_CFG_TO_DEV(barometerConfig()->baro_spi_device))); spiBusSetInstance(&dev->busdev, spiInstanceByDevice(SPI_CFG_TO_DEV(barometerConfig()->baro_spi_device)));
dev->busdev.busdev_u.spi.csnPin = IOGetByTag(barometerConfig()->baro_spi_cs); dev->busdev.busdev_u.spi.csnPin = IOGetByTag(barometerConfig()->baro_spi_csn);
#endif #endif
break; break;

View file

@ -33,7 +33,7 @@ typedef enum {
typedef struct barometerConfig_s { typedef struct barometerConfig_s {
uint8_t baro_bustype; uint8_t baro_bustype;
uint8_t baro_spi_device; uint8_t baro_spi_device;
ioTag_t baro_spi_cs; ioTag_t baro_spi_csn; // Also used as XCLR (positive logic) for BMP085
uint8_t baro_i2c_device; uint8_t baro_i2c_device;
uint8_t baro_i2c_address; uint8_t baro_i2c_address;
uint8_t baro_hardware; // Barometer hardware to use uint8_t baro_hardware; // Barometer hardware to use