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@19:b45b077c88bc, 2017-06-02 (annotated)
- Committer:
- wataloh
- Date:
- Fri Jun 02 00:55:55 2017 +0000
- Revision:
- 19:b45b077c88bc
- Parent:
- 14:b205267fa5f6
- Child:
- 21:d03c7bbb9f37
please take a look at diff_0601_0602.html
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 | NAMESPACE_MARUSOLSENSORMANAGER_START |
wataloh | 0:20bce0dcc921 | 6 | |
wataloh | 1:b2a9a6f2c30e | 7 | DEF_SELF(ToDoQ); |
wataloh | 1:b2a9a6f2c30e | 8 | |
wataloh | 1:b2a9a6f2c30e | 9 | ToDoQ* |
wataloh | 1:b2a9a6f2c30e | 10 | ToDoQ::create(onGetTodo callback) |
wataloh | 0:20bce0dcc921 | 11 | { |
wataloh | 1:b2a9a6f2c30e | 12 | if(self == NULL) |
wataloh | 0:20bce0dcc921 | 13 | { |
wataloh | 1:b2a9a6f2c30e | 14 | self = new ToDoQ(); |
wataloh | 0:20bce0dcc921 | 15 | } |
wataloh | 1:b2a9a6f2c30e | 16 | self->setOnToDo(callback); |
wataloh | 1:b2a9a6f2c30e | 17 | return self; |
wataloh | 1:b2a9a6f2c30e | 18 | } |
wataloh | 1:b2a9a6f2c30e | 19 | |
wataloh | 1:b2a9a6f2c30e | 20 | ToDoQ::ToDoQ() |
wataloh | 1:b2a9a6f2c30e | 21 | { |
wataloh | 14:b205267fa5f6 | 22 | todoQ = new USQueue<ToDo*>(NULL,USQueue<ToDo*>::QSIZE_16); |
wataloh | 1:b2a9a6f2c30e | 23 | } |
wataloh | 1:b2a9a6f2c30e | 24 | |
wataloh | 1:b2a9a6f2c30e | 25 | void |
wataloh | 1:b2a9a6f2c30e | 26 | ToDoQ::setOnToDo(onGetTodo callback) |
wataloh | 1:b2a9a6f2c30e | 27 | { |
wataloh | 1:b2a9a6f2c30e | 28 | _onGetTodo = callback; |
wataloh | 1:b2a9a6f2c30e | 29 | } |
wataloh | 1:b2a9a6f2c30e | 30 | |
wataloh | 1:b2a9a6f2c30e | 31 | void |
wataloh | 1:b2a9a6f2c30e | 32 | ToDoQ::loop() |
wataloh | 1:b2a9a6f2c30e | 33 | { |
wataloh | 1:b2a9a6f2c30e | 34 | SensorsMain::getInstance()->loop(); |
wataloh | 14:b205267fa5f6 | 35 | |
wataloh | 19:b45b077c88bc | 36 | ToDo* todoP = todoQ->pkq(NULL); |
wataloh | 14:b205267fa5f6 | 37 | |
wataloh | 14:b205267fa5f6 | 38 | if(todoP != NULL) |
wataloh | 1:b2a9a6f2c30e | 39 | { |
wataloh | 14:b205267fa5f6 | 40 | if(_onGetTodo(todoP)!=true) |
wataloh | 0:20bce0dcc921 | 41 | { |
wataloh | 14:b205267fa5f6 | 42 | ++(todoP->retry_count); |
wataloh | 19:b45b077c88bc | 43 | //todoQ->enq(todoP); |
wataloh | 14:b205267fa5f6 | 44 | } |
wataloh | 14:b205267fa5f6 | 45 | else |
wataloh | 14:b205267fa5f6 | 46 | { |
wataloh | 19:b45b077c88bc | 47 | todoQ->deq(); |
wataloh | 14:b205267fa5f6 | 48 | SERIAL_PRINT_DBG("ToDoQ retry count : %d\n", todoP->retry_count); |
wataloh | 14:b205267fa5f6 | 49 | todoP->retry_count = 0; |
wataloh | 19:b45b077c88bc | 50 | todoP->success(); |
wataloh | 0:20bce0dcc921 | 51 | } |
wataloh | 0:20bce0dcc921 | 52 | } |
wataloh | 1:b2a9a6f2c30e | 53 | } |
wataloh | 1:b2a9a6f2c30e | 54 | |
wataloh | 1:b2a9a6f2c30e | 55 | void |
wataloh | 1:b2a9a6f2c30e | 56 | ToDoQ::_queuePut(ToDo *todo) |
wataloh | 1:b2a9a6f2c30e | 57 | { |
wataloh | 1:b2a9a6f2c30e | 58 | SERIAL_PRINT_DBG("ToDoQ::_queuePut entered\n"); |
wataloh | 14:b205267fa5f6 | 59 | todoQ->enq(todo); |
wataloh | 1:b2a9a6f2c30e | 60 | } |
wataloh | 1:b2a9a6f2c30e | 61 | |
wataloh | 1:b2a9a6f2c30e | 62 | void |
wataloh | 1:b2a9a6f2c30e | 63 | ToDoQ::queuePut(ToDo *todo) |
wataloh | 1:b2a9a6f2c30e | 64 | { |
wataloh | 1:b2a9a6f2c30e | 65 | getInstance<ToDoQ>()->_queuePut(todo); |
wataloh | 1:b2a9a6f2c30e | 66 | } |
wataloh | 1:b2a9a6f2c30e | 67 | |
wataloh | 14:b205267fa5f6 | 68 | NAMESPACE_MARUSOLSENSORMANAGER_END |