para el ventilador

Dependencies:   QEI FastPWM

main.cpp

Committer:
miguelangel_2511
Date:
2020-04-26
Revision:
9:95fdcdc0977e
Parent:
8:208d965a3bd2
Child:
11:5cb7ae8bd831

File content as of revision 9:95fdcdc0977e:

#include "mbed.h"
#include "stdint.h"
#include "project_defines.h"
#include "buttons.h"
#include "encoder_interface.h"
#include "nextion_interface.h"
#include "stepper_motor_driver.h"
#include "pressure_sensors.h"
#include "ventilator.h"


int main(void) {
    
    System_Initialize();

    while(1){
         
         Nextion_Encoder_Interaction();     
         Stepper_Driver_State_Machine();
         
         if(read_pressure_sensors_flag){
             Pressure_Sensors_Read();
             Calculate_Flow_From_Pressure();
             Calculate_Volume_From_Flow();
             read_pressure_sensors_flag = 0;
         }
         
         if((stepper_driver_state != Stepper_Inspiration_Finish) && 
            (stepper_driver_state != Stepper_Expiration_Finish)){
            /* Display sensed values if necessary */    
            if(pressure_sensor_display_update_flag){
               Nextion_Update_Sensor_Values();
               pressure_sensor_display_update_flag = 0;
            }
            /* Plot sensed values if necessary */
            if(pressure_sensor_waveform_update_flag){
                Nextion_Update_Waveform_Values();
                pressure_sensor_waveform_update_flag = 0;
            }  
                 
         }      
    }
  
    return 0;
}