Commit bf3c8796cc05bd91753484c29cdfe3e10e1d8926

Authored by Emilio Soca Herrera
1 parent 34ed5975

--no commit message

Project/applications/smartcities/sensors.c
... ... @@ -304,6 +304,40 @@ char* sound_value(uint32_t sound)
304 304 return value;
305 305 }
306 306  
  307 +void collecData(char* valueSensors[], uint8_t* sensors){
  308 + uint8_t i;
  309 + for(i=0;i<TOTAL_SENSORS;i++){
  310 +
  311 + if(valueSensors[i]!=NULL)
  312 + chHeapFree(valueSensors[i]);
  313 +
  314 + if(sensors[i]==0){
  315 + //valueSensors[i]="no hay sensor";
  316 + continue;
  317 + }
  318 + else if(sensors[i]==LIGHT_ADDR){
  319 + valueSensors[i]=light_value(get_light_data());
  320 + continue;
  321 + }
  322 + else if(sensors[i]==DISTANCE_ADDR){
  323 + valueSensors[i]=distance_value(get_distance_data());
  324 + continue;
  325 + }
  326 + else if(sensors[i]==PRESSURE_ADDR){
  327 + valueSensors[i]=pressure_value(get_pressure_data());
  328 + continue;
  329 + }
  330 + else if(sensors[i]==SOUND_ADDR){
  331 + valueSensors[i]=sound_value(get_sound_data());
  332 + continue;
  333 + }
  334 + else if(sensors[i]==HUMIDITY_TEMP_ADDR){
  335 + valueSensors[i]=temp_humidity_value(get_temperature_data(),get_humidity_data());
  336 + continue;
  337 + }
  338 + }
  339 +}
  340 +
307 341 void init_battery(void)
308 342 {
309 343 adc_batt_init();
... ...