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