/** * @brief Release the SPI bus sempahore and ensure flash chip not using bus */ static int32_t PIOS_Flash_Jedec_ReleaseBus(struct jedec_flash_dev *flash_dev) { PIOS_SPI_RC_PinSet(flash_dev->spi_id, flash_dev->slave_num, 1); PIOS_SPI_ReleaseBus(flash_dev->spi_id); flash_dev->claimed = false; return 0; }
/** * @brief Release the SPI bus for the accel communications and end the transaction * @return 0 if successful */ static int32_t PIOS_MPU6000_ReleaseBus() { if (PIOS_MPU6000_Validate(dev) != 0) { return -1; } PIOS_SPI_RC_PinSet(dev->spi_id, dev->slave_num, 1); return PIOS_SPI_ReleaseBus(dev->spi_id); }
/** * @brief Release the SPI bus for the accel communications and end the transaction * @return 0 if successful */ static int32_t PIOS_MPU6000_ReleaseBus() { if (PIOS_MPU6000_Validate(pios_mpu6000_dev) != 0) return -1; PIOS_SPI_RC_PinSet(pios_mpu6000_dev->spi_id, pios_mpu6000_dev->slave_num, 1); return PIOS_SPI_ReleaseBus(pios_mpu6000_dev->spi_id); }
/** * @brief Release the SPI bus for the accel communications and end the transaction * @return 0 if successful */ int32_t PIOS_BMA180_ReleaseBus() { if(PIOS_BMA180_Validate(dev) != 0) return -1; PIOS_SPI_RC_PinSet(dev->spi_id,dev->slave_num,1); return PIOS_SPI_ReleaseBus(dev->spi_id); }
/** * @brief Release the SPI bus sempahore and ensure flash chip not using bus */ static int32_t PIOS_Flash_Jedec_ReleaseBus() { if(PIOS_Flash_Jedec_Validate(flash_dev) != 0) return -1; PIOS_SPI_RC_PinSet(flash_dev->spi_id, flash_dev->slave_num, 1); PIOS_SPI_ReleaseBus(flash_dev->spi_id); flash_dev->claimed = false; return 0; }
/** * @brief Release the SPI bus for the accel communications and end the transaction * @return 0 if success or <0 for failure */ static int32_t PIOS_ADXL345_ReleaseBus() { if(PIOS_ADXL345_Validate(dev) != 0) return -1; PIOS_SPI_RC_PinSet(dev->spi_id, dev->slave_num, 1); if(PIOS_SPI_ReleaseBus(dev->spi_id) != 0) return -2; return 0; }
/** * @brief Release the SPI bus for the communications and end the transaction * \param[in] must be true when bus was claimed in lowspeed mode * @return 0 if successful */ static int32_t PIOS_MPU9250_ReleaseBus(bool lowspeed) { if (PIOS_MPU9250_Validate(dev) != 0) return -1; PIOS_SPI_RC_PinSet(dev->spi_id, dev->slave_num, 1); if (lowspeed) PIOS_SPI_SetClockSpeed(dev->spi_id, MPU9250_SPI_HIGH_SPEED); PIOS_SPI_ReleaseBus(dev->spi_id); return 0; }
/** * @brief Release the SPI bus sempahore and ensure flash chip not using bus */ static void PIOS_Flash_W25X_ReleaseBus() { PIOS_FLASH_DISABLE; PIOS_SPI_ReleaseBus(PIOS_SPI_FLASH); }