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 05:40:22 2018 +0000
Revision:
0:ce97f6d34336
color sensor reset was added at the end of calibration

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Rhyme 0:ce97f6d34336 1 #include "mbed.h"
Rhyme 0:ce97f6d34336 2 #include "edge_time.h"
Rhyme 0:ce97f6d34336 3 #include "pending.h"
Rhyme 0:ce97f6d34336 4
Rhyme 0:ce97f6d34336 5 /*
Rhyme 0:ce97f6d34336 6 class pending_class {
Rhyme 0:ce97f6d34336 7 public:
Rhyme 0:ce97f6d34336 8 pending_class() ;
Rhyme 0:ce97f6d34336 9 ~pending_class() ;
Rhyme 0:ce97f6d34336 10
Rhyme 0:ce97f6d34336 11 request_t *request ;
Rhyme 0:ce97f6d34336 12 uint32_t submit_time ;
Rhyme 0:ce97f6d34336 13 uint32_t replied_time ;
Rhyme 0:ce97f6d34336 14 } ;
Rhyme 0:ce97f6d34336 15 */
Rhyme 0:ce97f6d34336 16
Rhyme 0:ce97f6d34336 17 pending_class::pending_class()
Rhyme 0:ce97f6d34336 18 {
Rhyme 0:ce97f6d34336 19 submit_time = edge_time ; /* save current time */
Rhyme 0:ce97f6d34336 20 replied_time = 0 ;
Rhyme 0:ce97f6d34336 21 request = new request_t ;
Rhyme 0:ce97f6d34336 22 request->messageType = 0 ;
Rhyme 0:ce97f6d34336 23 request->attrId = 0 ;
Rhyme 0:ce97f6d34336 24 request->requestId = 0 ;
Rhyme 0:ce97f6d34336 25 request->valueLen = 0 ;
Rhyme 0:ce97f6d34336 26 request->p_value = new uint8_t[256] ;
Rhyme 0:ce97f6d34336 27 }
Rhyme 0:ce97f6d34336 28
Rhyme 0:ce97f6d34336 29 pending_class::pending_class(
Rhyme 0:ce97f6d34336 30 uint8_t messageType,
Rhyme 0:ce97f6d34336 31 uint16_t attrId,
Rhyme 0:ce97f6d34336 32 uint8_t requestId,
Rhyme 0:ce97f6d34336 33 uint16_t valueLen,
Rhyme 0:ce97f6d34336 34 uint8_t *value
Rhyme 0:ce97f6d34336 35 )
Rhyme 0:ce97f6d34336 36 {
Rhyme 0:ce97f6d34336 37 submit_time = edge_time ; /* save current time */
Rhyme 0:ce97f6d34336 38 replied_time = 0 ;
Rhyme 0:ce97f6d34336 39 request = new request_t ;
Rhyme 0:ce97f6d34336 40 request->p_value = new uint8_t[256] ;
Rhyme 0:ce97f6d34336 41 request->messageType = messageType ;
Rhyme 0:ce97f6d34336 42 request->attrId = attrId ;
Rhyme 0:ce97f6d34336 43 request->requestId = requestId ;
Rhyme 0:ce97f6d34336 44 request->valueLen = valueLen ;
Rhyme 0:ce97f6d34336 45 memcpy(request->p_value, value, valueLen) ;
Rhyme 0:ce97f6d34336 46 }
Rhyme 0:ce97f6d34336 47
Rhyme 0:ce97f6d34336 48 pending_class::~pending_class()
Rhyme 0:ce97f6d34336 49 {
Rhyme 0:ce97f6d34336 50 submit_time = 0 ;
Rhyme 0:ce97f6d34336 51 replied_time = 0 ;
Rhyme 0:ce97f6d34336 52 delete [] request->p_value ;
Rhyme 0:ce97f6d34336 53 request->p_value = 0 ;
Rhyme 0:ce97f6d34336 54 delete request ;
Rhyme 0:ce97f6d34336 55 }