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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers AferoCommHndlr.h Source File

AferoCommHndlr.h

00001 #ifndef _AFERO_COMM_HNDLR_
00002 #define _AFERO_COMM_HNDLR_
00003 
00004 #include "mbed.h"
00005 //#include "pin_defines.h"
00006 #include "mbedSPI.h"
00007 #include "afLib.h"
00008 #include "ToDoQ.h"
00009 #include "Preferences.hpp"
00010 #include "RTC_Handler.h"
00011 #include "WatchDogWrapper.hpp"
00012 
00013 #define ATTR_ID_SENSE_VAL 1
00014 #define ATTR_ID_FLOW_CONTROL 4
00015 #define ATTR_ID_SENSING_INTERVAL 3
00016 
00017 class AferoCommHndlr
00018 {
00019 public:
00020     void loop();
00021     static void init();
00022     static AferoCommHndlr *create(mbedSPI *spi);
00023     void update();
00024     int32_t sanitizeSensingInterval(uint16_t attributeId, int32_t interval);
00025     Timeout *deathWish;
00026     static void kick_the_bucket();
00027     void _myOnAttributeSetComplete(const uint8_t requestId, const uint16_t attributeId, const uint16_t valueLen, const uint8_t *value);
00028 private:
00029     bool _onGetTodo(ToDo *todo);
00030     bool _onGetTodoFalsy(ToDo *todo);
00031     bool (AferoCommHndlr::*_onGetTodoP)(ToDo *todo);
00032     bool flowControlEnabled; //ATTR_ID_FLOW_CONTROL;
00033     ToDoQ *todoQ;
00034     uint8_t sem;
00035     AferoCommHndlr();
00036     iafLib *piafLib;
00037     static void fco_irq_fall();
00038     static void myOnAttributeSet(const uint8_t requestId, const uint16_t attributeId, const uint16_t valueLen, const uint8_t *value);
00039     static void myOnAttributeSetComplete(const uint8_t requestId, const uint16_t attributeId, const uint16_t valueLen, const uint8_t *value);
00040     static bool onGetTodo(ToDo *todo);
00041     mbedSPI *spi;
00042     Timer *timer;
00043     Timeout *setAttrCmpDelay;
00044     void onSetAttrCmpDelay();
00045 };
00046 
00047 #endif //_AFERO_COMM_HNDLR_