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 Orefatoi

Committer:
wataloh
Date:
Tue May 16 08:58:26 2017 +0000
Revision:
14:b205267fa5f6
Parent:
1:b2a9a6f2c30e
Child:
19:b45b077c88bc
+ flow control; + 1 second interval between each transaction

Who changed what in which revision?

UserRevisionLine numberNew 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 for (int i = 0; i < TODO_QUEUE_SIZE; i++)
wataloh 0:20bce0dcc921 24 {
wataloh 1:b2a9a6f2c30e 25 q[i] = NULL;
wataloh 1:b2a9a6f2c30e 26 }
wataloh 1:b2a9a6f2c30e 27 }
wataloh 1:b2a9a6f2c30e 28
wataloh 1:b2a9a6f2c30e 29 void
wataloh 1:b2a9a6f2c30e 30 ToDoQ::setOnToDo(onGetTodo callback)
wataloh 1:b2a9a6f2c30e 31 {
wataloh 1:b2a9a6f2c30e 32 _onGetTodo = callback;
wataloh 1:b2a9a6f2c30e 33 }
wataloh 1:b2a9a6f2c30e 34
wataloh 1:b2a9a6f2c30e 35 void
wataloh 1:b2a9a6f2c30e 36 ToDoQ::loop()
wataloh 1:b2a9a6f2c30e 37 {
wataloh 1:b2a9a6f2c30e 38 SensorsMain::getInstance()->loop();
wataloh 14:b205267fa5f6 39
wataloh 14:b205267fa5f6 40 ToDo* todoP = todoQ->deq();
wataloh 14:b205267fa5f6 41
wataloh 14:b205267fa5f6 42 if(todoP != NULL)
wataloh 1:b2a9a6f2c30e 43 {
wataloh 14:b205267fa5f6 44 if(_onGetTodo(todoP)!=true)
wataloh 0:20bce0dcc921 45 {
wataloh 14:b205267fa5f6 46 // SERIAL_PRINT_DBG("ToDoQ::_onGetTodo returned false\n");
wataloh 14:b205267fa5f6 47 ++(todoP->retry_count);
wataloh 14:b205267fa5f6 48 todoQ->enq(todoP);
wataloh 14:b205267fa5f6 49 }
wataloh 14:b205267fa5f6 50 else
wataloh 14:b205267fa5f6 51 {
wataloh 14:b205267fa5f6 52 SERIAL_PRINT_DBG("ToDoQ retry count : %d\n", todoP->retry_count);
wataloh 14:b205267fa5f6 53 todoP->retry_count = 0;
wataloh 0:20bce0dcc921 54 }
wataloh 0:20bce0dcc921 55 }
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 1:b2a9a6f2c30e 61 SERIAL_PRINT_DBG("ToDoQ::_queuePut entered\n");
wataloh 14:b205267fa5f6 62 todoQ->enq(todo);
wataloh 1:b2a9a6f2c30e 63 }
wataloh 1:b2a9a6f2c30e 64
wataloh 1:b2a9a6f2c30e 65 void
wataloh 1:b2a9a6f2c30e 66 ToDoQ::queuePut(ToDo *todo)
wataloh 1:b2a9a6f2c30e 67 {
wataloh 1:b2a9a6f2c30e 68 getInstance<ToDoQ>()->_queuePut(todo);
wataloh 1:b2a9a6f2c30e 69 }
wataloh 1:b2a9a6f2c30e 70
wataloh 14:b205267fa5f6 71 NAMESPACE_MARUSOLSENSORMANAGER_END