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@1:b2a9a6f2c30e, 2017-01-19 (annotated)
- Committer:
- wataloh
- Date:
- Thu Jan 19 09:17:16 2017 +0000
- Revision:
- 1:b2a9a6f2c30e
- Parent:
- 0:20bce0dcc921
- Child:
- 14:b205267fa5f6
simplified
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 | 1:b2a9a6f2c30e | 22 | for (int i = 0; i < TODO_QUEUE_SIZE; i++) |
wataloh | 0:20bce0dcc921 | 23 | { |
wataloh | 1:b2a9a6f2c30e | 24 | q[i] = NULL; |
wataloh | 1:b2a9a6f2c30e | 25 | } |
wataloh | 1:b2a9a6f2c30e | 26 | } |
wataloh | 1:b2a9a6f2c30e | 27 | |
wataloh | 1:b2a9a6f2c30e | 28 | void |
wataloh | 1:b2a9a6f2c30e | 29 | ToDoQ::setOnToDo(onGetTodo callback) |
wataloh | 1:b2a9a6f2c30e | 30 | { |
wataloh | 1:b2a9a6f2c30e | 31 | _onGetTodo = callback; |
wataloh | 1:b2a9a6f2c30e | 32 | } |
wataloh | 1:b2a9a6f2c30e | 33 | |
wataloh | 1:b2a9a6f2c30e | 34 | void |
wataloh | 1:b2a9a6f2c30e | 35 | ToDoQ::loop() |
wataloh | 1:b2a9a6f2c30e | 36 | { |
wataloh | 1:b2a9a6f2c30e | 37 | SensorsMain::getInstance()->loop(); |
wataloh | 1:b2a9a6f2c30e | 38 | for (int i = 0; i < TODO_QUEUE_SIZE; i++) |
wataloh | 1:b2a9a6f2c30e | 39 | { |
wataloh | 1:b2a9a6f2c30e | 40 | if (q[i] != NULL) |
wataloh | 0:20bce0dcc921 | 41 | { |
wataloh | 1:b2a9a6f2c30e | 42 | _onGetTodo(q[i]); |
wataloh | 1:b2a9a6f2c30e | 43 | q[i]=NULL; |
wataloh | 1:b2a9a6f2c30e | 44 | break; |
wataloh | 0:20bce0dcc921 | 45 | } |
wataloh | 0:20bce0dcc921 | 46 | } |
wataloh | 1:b2a9a6f2c30e | 47 | } |
wataloh | 1:b2a9a6f2c30e | 48 | |
wataloh | 1:b2a9a6f2c30e | 49 | void |
wataloh | 1:b2a9a6f2c30e | 50 | ToDoQ::_queuePut(ToDo *todo) |
wataloh | 1:b2a9a6f2c30e | 51 | { |
wataloh | 1:b2a9a6f2c30e | 52 | SERIAL_PRINT_DBG("ToDoQ::_queuePut entered\n"); |
wataloh | 1:b2a9a6f2c30e | 53 | for (int i = 0; i < TODO_QUEUE_SIZE; i++) |
wataloh | 0:20bce0dcc921 | 54 | { |
wataloh | 1:b2a9a6f2c30e | 55 | if(q[i] == NULL) |
wataloh | 0:20bce0dcc921 | 56 | { |
wataloh | 1:b2a9a6f2c30e | 57 | SERIAL_PRINT_DBG("ToDoQ::_queuePut found empty slot\n"); |
wataloh | 1:b2a9a6f2c30e | 58 | q[i] = todo; |
wataloh | 1:b2a9a6f2c30e | 59 | break; |
wataloh | 0:20bce0dcc921 | 60 | } |
wataloh | 0:20bce0dcc921 | 61 | } |
wataloh | 1:b2a9a6f2c30e | 62 | } |
wataloh | 1:b2a9a6f2c30e | 63 | |
wataloh | 1:b2a9a6f2c30e | 64 | void |
wataloh | 1:b2a9a6f2c30e | 65 | ToDoQ::queuePut(ToDo *todo) |
wataloh | 1:b2a9a6f2c30e | 66 | { |
wataloh | 1:b2a9a6f2c30e | 67 | getInstance<ToDoQ>()->_queuePut(todo); |
wataloh | 1:b2a9a6f2c30e | 68 | } |
wataloh | 1:b2a9a6f2c30e | 69 | |
wataloh | 1:b2a9a6f2c30e | 70 | NAMESPACE_MARUSOLSENSORMANAGER_END |