porting a OS5
Dependencies: BSP_B-L475E-IOT01
Revision 0:faa406d23ae7, committed 2018-08-07
- Comitter:
- fabio_gatti
- Date:
- Tue Aug 07 10:47:14 2018 +0000
- Commit message:
- porting a OS5
Changed in this revision
diff -r 000000000000 -r faa406d23ae7 BSP_B-L475E-IOT01.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BSP_B-L475E-IOT01.lib Tue Aug 07 10:47:14 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/Farnell24-IOT-Team/code/BSP_B-L475E-IOT01/#8cb54b28bc45
diff -r 000000000000 -r faa406d23ae7 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Aug 07 10:47:14 2018 +0000 @@ -0,0 +1,93 @@ +#include "mbed.h" + +// Sensors drivers present in the BSP library +#include "stm32l475e_iot01_tsensor.h" +#include "stm32l475e_iot01_hsensor.h" +#include "stm32l475e_iot01_psensor.h" +#include "stm32l475e_iot01_magneto.h" +#include "stm32l475e_iot01_gyro.h" +#include "stm32l475e_iot01_accelero.h" + +// laser driver +//#include "lis3mdl_class.h" +#include "VL53L0X.h" + + +DigitalOut led(LED1); +Serial pc(USBTX, USBRX); //use these pins for serial coms + +#ifdef TARGET_DISCO_L475VG_IOT01A +static DevI2C devI2c(PB_11,PB_10); +static DigitalOut shutdown_pin(PC_6); +static VL53L0X range(&devI2c, &shutdown_pin, PC_7); +#endif + +int main() +{ + float sensor_value = 0; + int16_t pDataXYZ[3] = {0}; + float pGyroDataXYZ[3] = {0}; + + pc.baud(115200); + + range.init_sensor(VL53L0X_DEFAULT_ADDRESS); + + + + + + BSP_TSENSOR_Init(); + BSP_HSENSOR_Init(); + BSP_PSENSOR_Init(); + + BSP_MAGNETO_Init(); + BSP_GYRO_Init(); + BSP_ACCELERO_Init(); + + while(1) { + + led = 1; + + sensor_value = BSP_TSENSOR_ReadTemp(); + printf("TEMPERATURE = %.2f degC\n", sensor_value); + + sensor_value = BSP_HSENSOR_ReadHumidity(); + printf("HUMIDITY = %.2f %%\n", sensor_value); + + sensor_value = BSP_PSENSOR_ReadPressure(); + printf("PRESSURE is = %.2f mBar\n", sensor_value); + + led = 0; + + wait(1); + + led = 1; + + BSP_MAGNETO_GetXYZ(pDataXYZ); + printf("MAGNETO_X = %d\n", pDataXYZ[0]); + printf("MAGNETO_Y = %d\n", pDataXYZ[1]); + printf("MAGNETO_Z = %d\n", pDataXYZ[2]); + + BSP_GYRO_GetXYZ(pGyroDataXYZ); + printf("GYRO_X = %.2f\n", pGyroDataXYZ[0]); + printf("GYRO_Y = %.2f\n", pGyroDataXYZ[1]); + printf("GYRO_Z = %.2f\n", pGyroDataXYZ[2]); + + BSP_ACCELERO_AccGetXYZ(pDataXYZ); + printf("ACCELERO_X = %d\n", pDataXYZ[0]); + printf("ACCELERO_Y = %d\n", pDataXYZ[1]); + printf("ACCELERO_Z = %d\n", pDataXYZ[2]); + + uint32_t distance; + int status = range.get_distance(&distance); + if (status == VL53L0X_ERROR_NONE) { + printf("VL53L0X [mm]: %6ld\r\n", distance); + } else { + printf("VL53L0X [mm]: --\r\n"); + } + led = 0; + + wait(1); + + } +}
diff -r 000000000000 -r faa406d23ae7 mbed-os.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-os.lib Tue Aug 07 10:47:14 2018 +0000 @@ -0,0 +1,1 @@ +https://github.com/ARMmbed/mbed-os/#485bdeee150e2bc8ed75e27d936060fb63a7a7d1