JSensor_Status jsensor_app_read_sensor(uint16_t sid, void *data) { // user should pass data to store data otherwise do not call me? assert_param(data); if (sid == JSENSOR_TYPE_HUMITY_TEMP) read_temp_hum(data); else if (sid == JSENSOR_TYPE_PRESSURE) read_pressure(data); else if (sid == JSENSOR_TYPE_MOTION_6AXIS) read_6_Axis_data(data); else if (sid == JSENSOR_TYPE_MAGNET) read_raw_magnetometer_data(data); return JSENSOR_OK; }
static inline void read_child_node (GWeatherInfo *info, xmlNodePtr node) { if (strcmp ((char*) node->name, "symbol") == 0) read_symbol (info, node); else if (strcmp ((char*) node->name, "windDirection") == 0) read_wind_direction (info, node); else if (strcmp ((char*) node->name, "windSpeed") == 0) read_wind_speed (info, node); else if (strcmp ((char*) node->name, "temperature") == 0) read_temperature (info, node); else if (strcmp ((char*) node->name, "pressure") == 0) read_pressure (info, node); else if (strcmp ((char*) node->name, "humidity") == 0) read_humidity (info, node); }
int main(void) { /* Init */ int pump_timer = 0; int i = 0; uint16_t tzero = 0; DDRD = 0xff; // initialize port B for output LEDs PORTD = 0xff; // all LEDs initially OFF init_timer2(); initIO(); sei(); for (int j=0; j < NUM_CYCLES; j++) { /* Retain for testing: Use to test delay function */ //Delay(120); //while(1) PORTD=0; /* Retain for testing: use to cycle pressure read */ //while(1) //read_pressure(); read_pressure(); close_valve(); tzero = second; // start time for each section of test // 'second' is a global RTC variable /*---- Initial pump cycle ----*/ while ((second - tzero) < PUMP_TIME && pressure < MAX_HI_PRESS) { read_pressure(); start_pump(); if (pressure > (MAX_HI_PRESS + 200)) // overpressure while (error(1)); } stop_pump(); if (pressure < MAX_HI_PRESS) // error if target pressure no reached while (error(2)); /*---- Vacuum dwell starts here ----*/ tzero = second; while ((second - tzero) < DWELL_TIME) { read_pressure(); if (pressure > (MAX_HI_PRESS + 200)) //overpressure while (error(1)); if (pressure < MIN_HI_PRESS) { pump_timer = 0; while (pressure < MAX_HI_PRESS && ((second - tzero) < DWELL_TIME)) { start_pump(); read_pressure(); for (i=0; i<1000; i++) // 1 sec busy-wait delay_ms(1.0); pump_timer++; if (pump_timer >= 120) // don't run pump 120 seconds while (error(3)); if (pressure > (MAX_HI_PRESS + 200)) //overpressure while (error(1)); } stop_pump(); } } stop_pump(); /*---- Bleed cycle start ----*/ open_valve(); tzero = second; while ((second - tzero) < BLEED_TIME && pressure > MAX_LO_PRESS) read_pressure(); if (pressure > MAX_LO_PRESS) while (error(4)); /*---- Ambient pressure dwell ----*/ delay(DWELL_TIME); //lower = pressure & 0x00ff; //upper = (pressure & 0xff00)>>8; //PORTD = lower; //for (i=0; i<1000; i++) _delay_ms(1.0); //Delay(1); //PORTD = upper; //for (i=0; i<1000; i++) _delay_ms(1.0); //while(1); } while(1) // completed successfully without errors! error(0); return 0; }