mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-21 11:54:15 +01:00
Add ability to change the SPI bus runs at
This commit is contained in:
parent
bf98630851
commit
c080080810
@ -62,8 +62,9 @@ void PIOS_MPU6000_Init(const struct pios_mpu6000_cfg * new_cfg)
|
|||||||
fifoBuf_init(&pios_mpu6000_fifo, (uint8_t *) pios_mpu6000_buffer, sizeof(pios_mpu6000_buffer));
|
fifoBuf_init(&pios_mpu6000_fifo, (uint8_t *) pios_mpu6000_buffer, sizeof(pios_mpu6000_buffer));
|
||||||
|
|
||||||
/* Configure the MPU6050 Sensor */
|
/* Configure the MPU6050 Sensor */
|
||||||
|
PIOS_SPI_SetPrescalar(pios_spi_gyro, SPI_BaudRatePrescaler_256);
|
||||||
PIOS_MPU6000_Config(cfg);
|
PIOS_MPU6000_Config(cfg);
|
||||||
PIOS_MPU6000_Config(cfg);
|
PIOS_SPI_SetPrescalar(pios_spi_gyro, SPI_BaudRatePrescaler_8);
|
||||||
|
|
||||||
/* Configure EOC pin as input floating */
|
/* Configure EOC pin as input floating */
|
||||||
GPIO_Init(cfg->drdy.gpio, &cfg->drdy.init);
|
GPIO_Init(cfg->drdy.gpio, &cfg->drdy.init);
|
||||||
|
@ -582,6 +582,17 @@ int32_t PIOS_SPI_Busy(uint32_t spi_id)
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PIOS_SPI_SetPrescalar(uint32_t spi_id, uint32_t prescaler)
|
||||||
|
{
|
||||||
|
struct pios_spi_dev * spi_dev = (struct pios_spi_dev *)spi_id;
|
||||||
|
|
||||||
|
bool valid = PIOS_SPI_validate(spi_dev);
|
||||||
|
PIOS_Assert(valid);
|
||||||
|
PIOS_Assert(IS_SPI_BAUDRATE_PRESCALER(prescaler));
|
||||||
|
|
||||||
|
spi_dev->cfg->regs->CR1 = (spi_dev->cfg->regs->CR1 & ~0x0038) | prescaler;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void PIOS_SPI_IRQ_Handler(uint32_t spi_id)
|
void PIOS_SPI_IRQ_Handler(uint32_t spi_id)
|
||||||
{
|
{
|
||||||
|
@ -56,6 +56,7 @@ extern int32_t PIOS_SPI_Busy(uint32_t spi_id);
|
|||||||
extern int32_t PIOS_SPI_ClaimBus(uint32_t spi_id);
|
extern int32_t PIOS_SPI_ClaimBus(uint32_t spi_id);
|
||||||
extern int32_t PIOS_SPI_ReleaseBus(uint32_t spi_id);
|
extern int32_t PIOS_SPI_ReleaseBus(uint32_t spi_id);
|
||||||
extern void PIOS_SPI_IRQ_Handler(uint32_t spi_id);
|
extern void PIOS_SPI_IRQ_Handler(uint32_t spi_id);
|
||||||
|
extern void PIOS_SPI_SetPrescalar(uint32_t spi_id, uint32_t prescalar);
|
||||||
|
|
||||||
#endif /* PIOS_SPI_H */
|
#endif /* PIOS_SPI_H */
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ void PIOS_SPI_gyro_irq_handler(void)
|
|||||||
|
|
||||||
|
|
||||||
/* SPI3 Interface
|
/* SPI3 Interface
|
||||||
* - Used for gyro communications
|
* - Used for flash communications
|
||||||
*/
|
*/
|
||||||
void PIOS_SPI_flash_irq_handler(void);
|
void PIOS_SPI_flash_irq_handler(void);
|
||||||
void DMA1_Stream0_IRQHandler(void) __attribute__((alias("PIOS_SPI_flash_irq_handler")));
|
void DMA1_Stream0_IRQHandler(void) __attribute__((alias("PIOS_SPI_flash_irq_handler")));
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<xml>
|
<xml>
|
||||||
<object name="Accels" singleinstance="true" settings="false">
|
<object name="Accels" singleinstance="true" settings="false">
|
||||||
<description>The accel data.</description>
|
<description>The accel data.</description>
|
||||||
<field name="x" units="deg/s" type="float" elements="1"/>
|
<field name="x" units="m/s^2" type="float" elements="1"/>
|
||||||
<field name="y" units="deg/s" type="float" elements="1"/>
|
<field name="y" units="m/s^2" type="float" elements="1"/>
|
||||||
<field name="z" units="deg/s" type="float" elements="1"/>
|
<field name="z" units="m/s^2" type="float" elements="1"/>
|
||||||
<field name="temperature" units="deg C" type="float" elements="1"/>
|
<field name="temperature" units="deg C" type="float" elements="1"/>
|
||||||
<access gcs="readwrite" flight="readwrite"/>
|
<access gcs="readwrite" flight="readwrite"/>
|
||||||
<telemetrygcs acked="false" updatemode="manual" period="0"/>
|
<telemetrygcs acked="false" updatemode="manual" period="0"/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user