Vincent Neo / Mbed 2 deprecated HSP_CS3237

Dependencies:   mbed

Revision:
7:94fa5b72481d
Parent:
6:d4c401190320
--- a/baro_main.cpp	Sun Sep 15 13:13:10 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,117 +0,0 @@
-#include "mbed.h"
-#include "MAX14720.h"
-#include "MAX30205.h"
-#include "BMP280.h"
-#include "USBSerial.h"
-//#include "MAX30001.h"
-//#include "QuadSpiInterface.h"
-//#include "S25FS512.h"
-//#include "MAX30101.h"
-
-//Define all I2C addresses
-#define MAX30205_I2C_SLAVE_ADDR_TOP (0x92)
-#define MAX30205_I2C_SLAVE_ADDR_BOTTOM (0x90)
-#define MAX14720_I2C_SLAVE_ADDR (0x54)
-#define BMP280_I2C_SLAVE_ADDR (0xEC)
-
-
-#define HVOUT_VOLTAGE 4500 // set to 4500 mV
-
- // Define with Maxim VID and a Maxim assigned PID, set to version 0x0001 and non-blocking
- USBSerial usbSerial(0x0b6a, 0x0100, 0x0001, false);
- 
-// I2C Masters
-I2C i2c1(I2C1_SDA, I2C1_SCL);
-I2C i2c2(I2C2_SDA, I2C2_SCL);
-
-// Top local Temperature Sensor
-MAX30205 MAX30205_top(&i2c1, MAX30205_I2C_SLAVE_ADDR_TOP);
-
-// Botttom local Temperature Sensor
-MAX30205 MAX30205_bottom(&i2c1, MAX30205_I2C_SLAVE_ADDR_BOTTOM);
-
-// Barometric Pressure Sensor
-BMP280 bmp280_pres(&i2c1, BMP280_I2C_SLAVE_ADDR);
-
-//PMIC
-MAX14720 max14720(&i2c2,MAX14720_I2C_SLAVE_ADDR);
-
-///// External Flash
-//S25FS512 s25fs512(&quadSpiInterface);
-
-/// PWM used as fclk for the MAX30001
-PwmOut pwmout(P1_7);
-
-
-DigitalOut led(LED1);
-
-
-void turnOff()
-{
-    //write the power down command to PMIC
-    max14720.shutdown();    
-}
-int main()
-{
-    
-    // Override the default value of boostEn to BOOST_ENABLED
-    max14720.boostEn = MAX14720::BOOST_ENABLED;
-    // Note that writing the local value does directly affect the part
-    // The buck-boost regulator will remain off until init is called
-    max14720.init();
-    // Turn LED signal on to make buck-boost output visible
-    max14720.boostSetVoltage(HVOUT_VOLTAGE);
-    led = 0;
-    
-    // Initialise the BMP280
-    bmp280_pres.init(BMP280::OVERSAMPLING_X16_P, BMP280::OVERSAMPLING_X2_T, BMP280::FILT_4, BMP280::NORMAL_MODE, BMP280::T_62_5);
-
-    //Temperature sensor variables
-    uint16_t rawTemp_top;
-    uint16_t rawTemp_bottom ;
-    float celsius_top, celsius_bottom;
-    float fahrenheit_top, fahrenheit_bottom;
-    
-    //barometric sensor variables
-    char bmp280_rawData = 0;
-    float Temp_degC, Press_Pa, Press_Bar;
-    
-    
-    //Endless loop
-    while(1) 
-    {
-        /* Temperature Sensor Settings */
-        
-        //Read Temperature
-        MAX30205_top.readTemperature(&rawTemp_top);
-        MAX30205_bottom.readTemperature(&rawTemp_bottom);   
-        // Read BMP280 Temp. and Pressure
-        bmp280_pres.ReadCompDataRaw(&bmp280_rawData);
-        bmp280_pres.ToFloat(&bmp280_rawData, &Temp_degC, &Press_Pa);
-        // Convert to Celsius
-        celsius_top = MAX30205_top.toCelsius(rawTemp_top);
-        celsius_bottom = MAX30205_bottom.toCelsius(rawTemp_bottom);
-        
-        // Convert to Fahrenheit
-        fahrenheit_top = MAX30205_top.toFahrenheit(celsius_top);
-        fahrenheit_bottom = MAX30205_bottom.toFahrenheit(celsius_bottom);
-        
-        /* Barometric Sensor Settings */
-    
-        Press_Bar = Press_Pa / 100000;
-
-        /* Printing various sensor values */
-        usbSerial.printf("***** MAX30205 Temperature Sensor Reading *****\n\r");
-        usbSerial.printf("Top Temperature: %.2f\370 C\n\rBottom Temperature: %.2f\370 C \n\rTop Temperature in Farenheit: %.2f\370 F\n\rBottom Temperature in Farenheit %.2f\370 F\n\n\r", celsius_top, celsius_bottom, fahrenheit_top, fahrenheit_bottom);
-        
-        usbSerial.printf("***** BMP280 Barometric Sensor Reading *****\n\r");
-        usbSerial.printf("Temp_degC : %.2f , Press_Bar is %.2f , Press_pa is %.2f\n\n\r",Temp_degC, Press_Bar, Press_Pa);
-        
-        usbSerial.printf("-------------------------------------------------\n\n\n\r");
-
-        wait(0.2);
-        
-    
-       
-    }
-}