mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
Got SPI IRQ from mainboard firing
This commit is contained in:
parent
80c2d45d93
commit
02d5e27e93
@ -450,9 +450,15 @@ uint32_t total_conversion_blocks;
|
||||
int32_t gyro_error;
|
||||
int16_t gyro[4];
|
||||
int16_t mag[3];
|
||||
int16_t accel[3];
|
||||
float altitude;
|
||||
int32_t pressure;
|
||||
|
||||
int32_t dr;
|
||||
|
||||
int32_t sclk, sclk_prev;
|
||||
int32_t sclk_count;
|
||||
|
||||
int main()
|
||||
{
|
||||
gps_data.quality = -1;
|
||||
@ -480,8 +486,8 @@ int main()
|
||||
if(PIOS_IMU3000_Test() != 0)
|
||||
panic(1);
|
||||
|
||||
//if(PIOS_BMA180_Test() != 0)
|
||||
// panic(2);
|
||||
if(PIOS_BMA180_Test() != 0)
|
||||
panic(2);
|
||||
|
||||
if(PIOS_HMC5883_Test() != 0)
|
||||
panic(3);
|
||||
@ -489,6 +495,19 @@ int main()
|
||||
if(PIOS_BMP085_Test() != 0)
|
||||
panic(4);
|
||||
|
||||
PIOS_LED_On(LED1);
|
||||
PIOS_LED_Off(LED2);
|
||||
|
||||
/*
|
||||
while(1) {
|
||||
sclk = GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_15);
|
||||
if(sclk_prev != sclk)
|
||||
sclk_count++;
|
||||
sclk_prev = sclk;
|
||||
dr = SPI2->DR;
|
||||
}
|
||||
*/
|
||||
/*
|
||||
uint32_t count = 500;
|
||||
while(count--) {
|
||||
// Update the pressure data
|
||||
@ -504,14 +523,11 @@ int main()
|
||||
|
||||
PIOS_HMC5883_ReadMag(mag);
|
||||
PIOS_DELAY_WaitmS(50);
|
||||
|
||||
PIOS_BMA180_ReadAccels(accel);
|
||||
PIOS_DELAY_WaitmS(50);;
|
||||
}
|
||||
|
||||
if(PIOS_IMU3000_Test() != 0)
|
||||
panic(1);
|
||||
|
||||
pressure++;
|
||||
gyro[0]++;
|
||||
mag[0]++;
|
||||
*/
|
||||
// Flash warning light while trying to connect
|
||||
uint16_t time_val = PIOS_DELAY_GetuS();
|
||||
uint16_t ms_count = 0;
|
||||
|
@ -42,10 +42,11 @@
|
||||
* .rodata section (ie. Flash) rather than in the .bss section (RAM).
|
||||
*/
|
||||
void PIOS_SPI_op_irq_handler(void);
|
||||
void DMA1_Stream3_IRQ_Handler(void) __attribute__((alias("PIOS_SPI_op_irq_handler")));
|
||||
void DMA1_Stream4_IRQ_Handler(void) __attribute__((alias("PIOS_SPI_op_irq_handler")));
|
||||
void DMA1_Stream3_IRQHandler(void) __attribute__((alias("PIOS_SPI_op_irq_handler")));
|
||||
void DMA1_Stream4_IRQHandler(void) __attribute__((alias("PIOS_SPI_op_irq_handler")));
|
||||
static const struct pios_spi_cfg pios_spi_op_cfg = {
|
||||
.regs = SPI2,
|
||||
.remap = GPIO_AF_SPI2,
|
||||
.init = {
|
||||
.SPI_Mode = SPI_Mode_Slave,
|
||||
.SPI_Direction = SPI_Direction_2Lines_FullDuplex,
|
||||
@ -61,9 +62,9 @@ static const struct pios_spi_cfg pios_spi_op_cfg = {
|
||||
.ahb_clk = RCC_AHB1Periph_DMA1,
|
||||
|
||||
.irq = {
|
||||
.flags = (DMA_IT_TCIF3 | DMA_IT_TEIF3 | DMA_IT_HTIF3),
|
||||
.flags = (DMA_IT_TCIF4 | DMA_IT_TEIF4 | DMA_IT_HTIF4),
|
||||
.init = {
|
||||
.NVIC_IRQChannel = DMA1_Stream0_IRQn,
|
||||
.NVIC_IRQChannel = DMA1_Stream3_IRQn,
|
||||
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGH,
|
||||
.NVIC_IRQChannelSubPriority = 0,
|
||||
.NVIC_IRQChannelCmd = ENABLE,
|
||||
@ -114,7 +115,7 @@ static const struct pios_spi_cfg pios_spi_op_cfg = {
|
||||
.GPIO_Pin = GPIO_Pin_13,
|
||||
.GPIO_Speed = GPIO_Speed_100MHz,
|
||||
.GPIO_Mode = GPIO_Mode_AF,
|
||||
.GPIO_OType = GPIO_OType_OD,
|
||||
.GPIO_OType = GPIO_OType_PP,
|
||||
.GPIO_PuPd = GPIO_PuPd_NOPULL
|
||||
},
|
||||
},
|
||||
@ -162,10 +163,11 @@ void PIOS_SPI_op_irq_handler(void)
|
||||
* - Used for BMA180 accelerometer
|
||||
*/
|
||||
void PIOS_SPI_accel_irq_handler(void);
|
||||
void DMA2_Stream0_IRQ_Handler(void) __attribute__((alias("PIOS_SPI_accel_irq_handler")));
|
||||
void DMA2_Stream3_IRQ_Handler(void) __attribute__((alias("PIOS_SPI_accel_irq_handler")));
|
||||
void DMA2_Stream0_IRQHandler(void) __attribute__((alias("PIOS_SPI_accel_irq_handler")));
|
||||
void DMA2_Stream3_IRQHandler(void) __attribute__((alias("PIOS_SPI_accel_irq_handler")));
|
||||
static const struct pios_spi_cfg pios_spi_accel_cfg = {
|
||||
.regs = SPI1,
|
||||
.remap = GPIO_AF_SPI1,
|
||||
.init = {
|
||||
.SPI_Mode = SPI_Mode_Master,
|
||||
.SPI_Direction = SPI_Direction_2Lines_FullDuplex,
|
||||
@ -742,8 +744,8 @@ void PIOS_Board_Init(void) {
|
||||
if (PIOS_SPI_Init(&pios_spi_accel_id, &pios_spi_accel_cfg)) {
|
||||
PIOS_DEBUG_Assert(0);
|
||||
}
|
||||
/*PIOS_BMA180_Attach(pios_spi_accel_id);
|
||||
PIOS_BMA180_Init(&pios_bma180_cfg);*/
|
||||
PIOS_BMA180_Attach(pios_spi_accel_id);
|
||||
PIOS_BMA180_Init(&pios_bma180_cfg);
|
||||
PIOS_IMU3000_Init(&pios_imu3000_cfg);
|
||||
PIOS_HMC5883_Init(&pios_hmc5883_cfg);
|
||||
PIOS_BMP085_Init(&pios_bmp085_cfg);
|
||||
|
Loading…
x
Reference in New Issue
Block a user