pwm period is now 200us instead of the default 20ms veml6040 config is now AF_BIT | TRIG_BIT
Dependencies: mbed MMA8451Q USBDevice WakeUp vt100
Fork of afero_node_suntory_2017_06_15 by
sensors/ToDoQ.cpp@21:d03c7bbb9f37, 2017-06-09 (annotated)
- Committer:
- wataloh
- Date:
- Fri Jun 09 01:49:53 2017 +0000
- Revision:
- 21:d03c7bbb9f37
- Parent:
- 19:b45b077c88bc
Added the following process; When VEML6040 library returns NACK, forces software reset
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
wataloh | 0:20bce0dcc921 | 1 | #include "ToDoQ.h" |
wataloh | 1:b2a9a6f2c30e | 2 | |
wataloh | 1:b2a9a6f2c30e | 3 | #include "SensorsMain.hpp" |
wataloh | 1:b2a9a6f2c30e | 4 | |
wataloh | 1:b2a9a6f2c30e | 5 | ToDoQ* |
wataloh | 1:b2a9a6f2c30e | 6 | ToDoQ::create(onGetTodo callback) |
wataloh | 0:20bce0dcc921 | 7 | { |
wataloh | 1:b2a9a6f2c30e | 8 | if(self == NULL) |
wataloh | 0:20bce0dcc921 | 9 | { |
wataloh | 1:b2a9a6f2c30e | 10 | self = new ToDoQ(); |
wataloh | 0:20bce0dcc921 | 11 | } |
wataloh | 1:b2a9a6f2c30e | 12 | self->setOnToDo(callback); |
wataloh | 1:b2a9a6f2c30e | 13 | return self; |
wataloh | 1:b2a9a6f2c30e | 14 | } |
wataloh | 1:b2a9a6f2c30e | 15 | |
wataloh | 1:b2a9a6f2c30e | 16 | ToDoQ::ToDoQ() |
wataloh | 1:b2a9a6f2c30e | 17 | { |
wataloh | 14:b205267fa5f6 | 18 | todoQ = new USQueue<ToDo*>(NULL,USQueue<ToDo*>::QSIZE_16); |
wataloh | 1:b2a9a6f2c30e | 19 | } |
wataloh | 1:b2a9a6f2c30e | 20 | |
wataloh | 1:b2a9a6f2c30e | 21 | void |
wataloh | 1:b2a9a6f2c30e | 22 | ToDoQ::setOnToDo(onGetTodo callback) |
wataloh | 1:b2a9a6f2c30e | 23 | { |
wataloh | 1:b2a9a6f2c30e | 24 | _onGetTodo = callback; |
wataloh | 1:b2a9a6f2c30e | 25 | } |
wataloh | 1:b2a9a6f2c30e | 26 | |
wataloh | 1:b2a9a6f2c30e | 27 | void |
wataloh | 1:b2a9a6f2c30e | 28 | ToDoQ::loop() |
wataloh | 1:b2a9a6f2c30e | 29 | { |
wataloh | 21:d03c7bbb9f37 | 30 | SensorsMain::getSelf()->loop(); |
wataloh | 14:b205267fa5f6 | 31 | |
wataloh | 19:b45b077c88bc | 32 | ToDo* todoP = todoQ->pkq(NULL); |
wataloh | 14:b205267fa5f6 | 33 | |
wataloh | 14:b205267fa5f6 | 34 | if(todoP != NULL) |
wataloh | 1:b2a9a6f2c30e | 35 | { |
wataloh | 14:b205267fa5f6 | 36 | if(_onGetTodo(todoP)!=true) |
wataloh | 0:20bce0dcc921 | 37 | { |
wataloh | 14:b205267fa5f6 | 38 | ++(todoP->retry_count); |
wataloh | 19:b45b077c88bc | 39 | //todoQ->enq(todoP); |
wataloh | 14:b205267fa5f6 | 40 | } |
wataloh | 14:b205267fa5f6 | 41 | else |
wataloh | 14:b205267fa5f6 | 42 | { |
wataloh | 19:b45b077c88bc | 43 | todoQ->deq(); |
wataloh | 14:b205267fa5f6 | 44 | SERIAL_PRINT_DBG("ToDoQ retry count : %d\n", todoP->retry_count); |
wataloh | 14:b205267fa5f6 | 45 | todoP->retry_count = 0; |
wataloh | 19:b45b077c88bc | 46 | todoP->success(); |
wataloh | 0:20bce0dcc921 | 47 | } |
wataloh | 0:20bce0dcc921 | 48 | } |
wataloh | 1:b2a9a6f2c30e | 49 | } |
wataloh | 1:b2a9a6f2c30e | 50 | |
wataloh | 1:b2a9a6f2c30e | 51 | void |
wataloh | 1:b2a9a6f2c30e | 52 | ToDoQ::_queuePut(ToDo *todo) |
wataloh | 1:b2a9a6f2c30e | 53 | { |
wataloh | 1:b2a9a6f2c30e | 54 | SERIAL_PRINT_DBG("ToDoQ::_queuePut entered\n"); |
wataloh | 14:b205267fa5f6 | 55 | todoQ->enq(todo); |
wataloh | 1:b2a9a6f2c30e | 56 | } |
wataloh | 1:b2a9a6f2c30e | 57 | |
wataloh | 1:b2a9a6f2c30e | 58 | void |
wataloh | 1:b2a9a6f2c30e | 59 | ToDoQ::queuePut(ToDo *todo) |
wataloh | 1:b2a9a6f2c30e | 60 | { |
wataloh | 21:d03c7bbb9f37 | 61 | ToDoQ::getSelf()->_queuePut(todo); |
wataloh | 21:d03c7bbb9f37 | 62 | } |