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:
5:9d5c7ee80f3b
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 #ifndef _TODO_QUEUE_H_
wataloh 0:20bce0dcc921 2 #define _TODO_QUEUE_H_
wataloh 0:20bce0dcc921 3
wataloh 0:20bce0dcc921 4 #include "mbed.h"
wataloh 1:b2a9a6f2c30e 5 #include "CommonTemplateRoutines.hpp"
wataloh 2:dfe671e31221 6 #include "Preferences.hpp"
wataloh 14:b205267fa5f6 7 #include "USQueue.hpp"
wataloh 0:20bce0dcc921 8
wataloh 0:20bce0dcc921 9 #define TODO_QUEUE_SIZE 10
wataloh 0:20bce0dcc921 10
wataloh 0:20bce0dcc921 11 namespace MaruSolSensorManager
wataloh 0:20bce0dcc921 12 {
wataloh 0:20bce0dcc921 13 class ToDo;
wataloh 1:b2a9a6f2c30e 14
wataloh 0:20bce0dcc921 15 class ToDoQ
wataloh 0:20bce0dcc921 16 {
wataloh 0:20bce0dcc921 17 public:
wataloh 14:b205267fa5f6 18 typedef bool (*onGetTodo)(ToDo*);
wataloh 0:20bce0dcc921 19 static ToDoQ* create(onGetTodo);
wataloh 0:20bce0dcc921 20 void loop();
wataloh 0:20bce0dcc921 21 static void queuePut(ToDo*);
wataloh 0:20bce0dcc921 22 private:
wataloh 14:b205267fa5f6 23 USQueue<ToDo*> *todoQ;
wataloh 0:20bce0dcc921 24 ToDo *q[TODO_QUEUE_SIZE];
wataloh 0:20bce0dcc921 25 onGetTodo _onGetTodo;
wataloh 1:b2a9a6f2c30e 26 DECL_GET_INSTANCE(ToDoQ);
wataloh 1:b2a9a6f2c30e 27 DECL_SELF(ToDoQ);
wataloh 1:b2a9a6f2c30e 28 void setOnToDo(onGetTodo);
wataloh 0:20bce0dcc921 29 void _queuePut(ToDo*);
wataloh 1:b2a9a6f2c30e 30 ToDoQ();
wataloh 0:20bce0dcc921 31 };
wataloh 1:b2a9a6f2c30e 32
wataloh 0:20bce0dcc921 33 class ToDo
wataloh 0:20bce0dcc921 34 {
wataloh 14:b205267fa5f6 35 protected:
wataloh 14:b205267fa5f6 36 int error_count;
wataloh 14:b205267fa5f6 37 uint8_t serialNum;
wataloh 0:20bce0dcc921 38 public:
wataloh 14:b205267fa5f6 39 ToDo() : retry_count(0),error_count(0),serialNum(0) {}
wataloh 14:b205267fa5f6 40 int retry_count;
wataloh 0:20bce0dcc921 41 virtual void toJSON(char *buf) = 0;
wataloh 0:20bce0dcc921 42 virtual void getBytes(uint8_t *buf) = 0;
wataloh 2:dfe671e31221 43 virtual void toBASE64(char *buf, PREFERENCES::_crc32 *crc32)
wataloh 2:dfe671e31221 44 {
wataloh 2:dfe671e31221 45 }
wataloh 14:b205267fa5f6 46 virtual void error_count_clear()
wataloh 14:b205267fa5f6 47 {
wataloh 14:b205267fa5f6 48 error_count = 0;
wataloh 14:b205267fa5f6 49 }
wataloh 14:b205267fa5f6 50 virtual void error_count_inc()
wataloh 14:b205267fa5f6 51 {
wataloh 14:b205267fa5f6 52 ++error_count;
wataloh 14:b205267fa5f6 53 }
wataloh 0:20bce0dcc921 54 };
wataloh 1:b2a9a6f2c30e 55 }
wataloh 0:20bce0dcc921 56 #endif //_TODO_QUEUE_H_