Color sensor reset at the end of calibration added. sensor id auto assignment was changed to be a fixed value assignment to avoid sensor id shift when some sensor is absent.

Dependencies:   UniGraphic mbed vt100

Committer:
Rhyme
Date:
Fri Feb 23 07:51:55 2018 +0000
Revision:
1:8818b793d147
Parent:
0:ce97f6d34336
Wrong behavior when one of color sensor is missing has been fixed.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Rhyme 0:ce97f6d34336 1 #ifndef _EDGE_TEMP_H_
Rhyme 0:ce97f6d34336 2 #define _EDGE_TEMP_H_
Rhyme 0:ce97f6d34336 3 #include "mbed.h"
Rhyme 0:ce97f6d34336 4 #include "edge_sensor.h"
Rhyme 0:ce97f6d34336 5 #include "LM75B.h"
Rhyme 0:ce97f6d34336 6 #include "SMTC502AT.h"
Rhyme 0:ce97f6d34336 7
Rhyme 0:ce97f6d34336 8 /**
Rhyme 0:ce97f6d34336 9 * edge_temp edge_sensor to measre temperature sensors
Rhyme 0:ce97f6d34336 10 */
Rhyme 0:ce97f6d34336 11
Rhyme 0:ce97f6d34336 12 class edge_temp : public edge_sensor {
Rhyme 0:ce97f6d34336 13 public:
Rhyme 0:ce97f6d34336 14 /**
Rhyme 0:ce97f6d34336 15 * constructor
Rhyme 0:ce97f6d34336 16 * @param *temp1 LM75B temperature sensor object (with Color1)
Rhyme 0:ce97f6d34336 17 * @param *temp2 SMTC502AT temperature sensor object (befor)
Rhyme 0:ce97f6d34336 18 * @param *temp3 SMTC502AT temperature sensor object (after)
Rhyme 0:ce97f6d34336 19 * @param *temp4 LM75B temperature sensor object (with Color2)
Rhyme 0:ce97f6d34336 20 */
Rhyme 0:ce97f6d34336 21 edge_temp(LM75B *temp1, SMTC502AT *temp2, SMTC502AT *temp3, LM75B *temp4) ;
Rhyme 0:ce97f6d34336 22
Rhyme 0:ce97f6d34336 23 /**
Rhyme 0:ce97f6d34336 24 * destructor
Rhyme 0:ce97f6d34336 25 */
Rhyme 0:ce97f6d34336 26 ~edge_temp(void) ;
Rhyme 0:ce97f6d34336 27
Rhyme 0:ce97f6d34336 28 /**
Rhyme 0:ce97f6d34336 29 * reset and clear the internal values
Rhyme 0:ce97f6d34336 30 */
Rhyme 0:ce97f6d34336 31 virtual void reset(void) ;
Rhyme 0:ce97f6d34336 32
Rhyme 0:ce97f6d34336 33 /**
Rhyme 0:ce97f6d34336 34 * prepare for sampling
Rhyme 0:ce97f6d34336 35 */
Rhyme 0:ce97f6d34336 36 virtual void prepare(void) ;
Rhyme 0:ce97f6d34336 37
Rhyme 0:ce97f6d34336 38 /**
Rhyme 0:ce97f6d34336 39 * sample measure and store sensor values
Rhyme 0:ce97f6d34336 40 * @return 0: success non-0: failure
Rhyme 0:ce97f6d34336 41 */
Rhyme 0:ce97f6d34336 42 virtual int sample(void) ;
Rhyme 0:ce97f6d34336 43
Rhyme 0:ce97f6d34336 44 /**
Rhyme 0:ce97f6d34336 45 * deliver the values to the afero cloud
Rhyme 0:ce97f6d34336 46 */
Rhyme 0:ce97f6d34336 47 virtual int deliver(void) ;
Rhyme 0:ce97f6d34336 48
Rhyme 0:ce97f6d34336 49 /**
Rhyme 0:ce97f6d34336 50 * Show the value(s) in the display (TFT)
Rhyme 0:ce97f6d34336 51 */
Rhyme 0:ce97f6d34336 52 virtual void show(void) ;
Rhyme 0:ce97f6d34336 53
Rhyme 0:ce97f6d34336 54 private:
Rhyme 0:ce97f6d34336 55 LM75B *_temp1 ;
Rhyme 0:ce97f6d34336 56 SMTC502AT *_temp2 ;
Rhyme 0:ce97f6d34336 57 SMTC502AT *_temp3 ;
Rhyme 0:ce97f6d34336 58 LM75B *_temp4 ;
Rhyme 0:ce97f6d34336 59 float _ftemp[4] ;
Rhyme 0:ce97f6d34336 60 } ;
Rhyme 0:ce97f6d34336 61
Rhyme 0:ce97f6d34336 62 extern float *current_temp ;
Rhyme 0:ce97f6d34336 63 #endif /* _EDGE_TEMP_H_ */