mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
L3GD20 data now running through IRQ -> FIFO
This commit is contained in:
parent
35025303cd
commit
ce2d0fcbb1
@ -247,7 +247,7 @@ static void SensorsTask(void *parameters)
|
||||
#elif defined(PIOS_INCLUDE_L3GD20)
|
||||
struct pios_l3gd20_data gyro;
|
||||
count = 0;
|
||||
/*while((read_good = PIOS_L3GD20_ReadFifo(&gyro)) != 0);
|
||||
while((read_good = PIOS_L3GD20_ReadFifo(&gyro)) != 0);
|
||||
while(read_good == 0) {
|
||||
count++;
|
||||
|
||||
@ -256,14 +256,8 @@ static void SensorsTask(void *parameters)
|
||||
gyro_accum[2] += gyro.gyro_z;
|
||||
|
||||
read_good = PIOS_L3GD20_ReadFifo(&gyro);
|
||||
} */
|
||||
|
||||
PIOS_L3GD20_ReadGyros(&gyro);
|
||||
gyro_accum[0] = gyro.gyro_x;
|
||||
gyro_accum[1] = gyro.gyro_y;
|
||||
gyro_accum[2] = gyro.gyro_z;
|
||||
count = 1;
|
||||
|
||||
}
|
||||
|
||||
gyro_samples = count;
|
||||
gyro_scaling = PIOS_L3GD20_GetScale();
|
||||
|
||||
|
@ -77,6 +77,10 @@ void PIOS_L3GD20_Init(const struct pios_l3gd20_cfg * new_cfg)
|
||||
|
||||
/* Enable and set EOC EXTI Interrupt to the lowest priority */
|
||||
NVIC_Init(&cfg->eoc_irq.init);
|
||||
|
||||
// An initial read is needed to get it running
|
||||
struct pios_l3gd20_data data;
|
||||
PIOS_L3GD20_ReadGyros(&data);
|
||||
|
||||
}
|
||||
|
||||
@ -315,7 +319,6 @@ uint32_t l3gd20_fifo_full = 0;
|
||||
|
||||
void PIOS_L3GD20_IRQHandler(void)
|
||||
{
|
||||
/*
|
||||
struct pios_l3gd20_data data;
|
||||
PIOS_L3GD20_ReadGyros(&data);
|
||||
|
||||
@ -323,11 +326,11 @@ void PIOS_L3GD20_IRQHandler(void)
|
||||
|
||||
if(fifoBuf_getFree(&pios_l3gd20_fifo) < sizeof(data)) {
|
||||
l3gd20_fifo_full++;
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
fifoBuf_putData(&pios_l3gd20_fifo, (uint8_t *) &data, sizeof(data));
|
||||
*/
|
||||
|
||||
l3gd20_irq++;
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user