コード例 #1
0
/*
 * La idea de que mdata sea ** es que se guarden directamente
 * en la estructura que se creo en el main los datos de la FIFO que se lean
 */
char Read_FIFO(uint8_t samples_cant, uint8_t* readbuff )
{
	uint16_t fifo_count=0; //packet_count=0;

	//TODO: Por que sucede esto a partir del 39????
	//Delay(80); // accumulate 80 samples in 80 milliseconds = 960 bytes (FUNCIONA Y DEVUELVE 80 SAMPLES)
	//Delay(39); // accumulate 80 samples in 80 milliseconds = 960 bytes (A PARTIR DE ESTE PUNTO PARA ABAJO TOMA 1 SAMPLE MENOS)
	if(samples_cant<39) //HOTFIX VILLERO
	{
		Delay(samples_cant+1);
	}
	else
	{
		Delay(samples_cant);
	}

	fifo_count = FIFO_Count();
	//packet_count = fifo_count/12;

	if(samples_cant <= fifo_count)
		Read_MPU(MPU6050_RA_FIFO_R_W, readbuff, samples_cant); //Lectura de muestras requeridas
	else
		return 0;

	return 1;
}
コード例 #2
0
/****************************************************************************
* DESCRIPTION: Returns the empty/full status of the ring buffer
* RETURN:      true if the ring buffer is full, false if it is not.
* ALGORITHM:   none
* NOTES:       none
*****************************************************************************/
static u8 FIFO_Full (fifo_buffer const *b)
{
    return (b ? (FIFO_Count(b) == b->buffer_len) : true);
}
コード例 #3
0
/****************************************************************************
* DESCRIPTION: Returns the empty/full status of the ring buffer
* RETURN:      true if the ring buffer is empty, false if it is not.
* ALGORITHM:   none
* NOTES:       none
*****************************************************************************/
u8 FIFO_Empty(fifo_buffer const *b)
{
    return (b ? (FIFO_Count(b) == 0) : true);
}