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.
main.cpp
00001 #include "mbed.h" 00002 #include "MAX14720.h" 00003 #include "MAX30102.h" 00004 #include "USBSerial.h" 00005 #include "System.h" 00006 #include "algorithm.h" 00007 00008 /// define the HVOUT Boost Voltage default for the MAX14720 PMIC 00009 #define HVOUT_VOLTAGE 4500 // set to 4500 mV 00010 00011 #define MAX14720_I2C_SLAVE_ADDR (0x54) 00012 00013 #define MAX_BRIGHTNESS 255 00014 #define MAX_SAMPLES_PER_CYCLE 500 00015 00016 ///SpO2 variables 00017 uint32_t aun_ir_buffer[MAX_SAMPLES_PER_CYCLE]; //IR LED sensor data 00018 uint32_t aun_red_buffer[MAX_SAMPLES_PER_CYCLE]; //Red LED sensor data 00019 uint32_t n_buffer_length; // Data buffer length 00020 int32_t n_spo2; //SPO2 value 00021 int8_t ch_spo2_valid; //indicator to show if the SP02 calculation is valid 00022 int32_t n_heart_rate; //heart rate value 00023 int8_t ch_hr_valid; //indicator to show if the heart rate calculation is valid 00024 00025 USBSerial usbSerial(0x0b6a, 0x0122, 0x0001, false); 00026 /// I2C Master 2 00027 I2C i2c2(I2C2_SDA, I2C2_SCL); // used by MAX14720, MAX30101, LIS2DH 00028 MAX14720 max14720(&i2c2, MAX14720_I2C_SLAVE_ADDR); 00029 00030 DigitalIn INT(P4_0); 00031 DigitalOut led(LED1); 00032 int main() 00033 { 00034 usbSerial.printf("Starting measurement..."); 00035 int result; 00036 result = max14720.init(); 00037 if (result == MAX14720_ERROR) { 00038 printf("Error initializing MAX14720"); 00039 } 00040 max14720.boostEn = MAX14720::BOOST_ENABLED; 00041 max14720.boostSetVoltage(HVOUT_VOLTAGE); 00042 00043 00044 00045 00046 }
Generated on Thu Jul 14 2022 12:12:37 by
