Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: I2C_FUNCTION LSM6DS0 MAX30100 mbed BLE_API
main.cpp
- Committer:
- ajeje41
- Date:
- 2016-04-03
- Revision:
- 0:285a4bb14ae3
- Child:
- 2:4cac3109599d
File content as of revision 0:285a4bb14ae3:
#include "mbed.h"
#include "functions.h"
#include "lsm6ds0.h"
static Serial pc(SERIAL_TX, SERIAL_RX);
InterruptIn LSM6DS0_int(D4);
DigitalOut led(LED1);
LSM6DS0 *gyro_accel;
xl_output data_FIFO[FIFO_length_by_five];
int offset;
char data_read[192];
void get_data() {
LSM6DS0_int.disable_irq(); //Disable IRQ interrupt
led = !led; //Blink led
gyro_accel->storeFIFO(&offset, data_FIFO); //Store the data from FIFO to data_FIFO variable
LSM6DS0_int.enable_irq(); //Re-enable IRQ interrupt
}
int main()
{
LSM6DS0_ACC_ODR_t odr;
LSM6DS0_ACC_HR_t high_res;
LSM6DS0_FIFO_mode_t work_mode;
offset = 0; //Offset in the data_FIFO vector. It is useful to store the FIFO value in the data_FIFO vector without overwritting (after 5 FIFO value the data_FIFO vector has been overwritten)
odr = LSM6DS0_ACC_ODR_50Hz ;
high_res = LSM6DS0_ACC_HR_Disabled;
work_mode = LSM6DS0_FIFO_mode_CONTINUOUS;
LSM6DS0_int.rise(&get_data); //LSM6DS0's interrupt initializzation
gyro_accel->LSM6DS0_reset(); //LSM6DS0 reset
gyro_accel->Init(odr, high_res, work_mode); //LSM6DS0 initializzation
while(1)
{
wait(5);
pc.printf("\n\r#################################\n\r");
gyro_accel->computeValue(data_FIFO);
}
}