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:
Wed Mar 22 23:39:41 2017 +0000
Revision:
6:88cc04eb613a
Parent:
5:9d5c7ee80f3b
Child:
14:b205267fa5f6
New calib vals for LED RGB.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wataloh 0:20bce0dcc921 1 #ifndef _AFERO_COMM_HNDLR_
wataloh 0:20bce0dcc921 2 #define _AFERO_COMM_HNDLR_
wataloh 0:20bce0dcc921 3
wataloh 0:20bce0dcc921 4 #include "mbed.h"
wataloh 0:20bce0dcc921 5 #include "pin_defines.h"
wataloh 0:20bce0dcc921 6 #include "mbedSPI.h"
wataloh 0:20bce0dcc921 7 #include "afLib.h"
wataloh 0:20bce0dcc921 8 #include "ToDoQ.h"
wataloh 2:dfe671e31221 9 #include "Preferences.hpp"
wataloh 2:dfe671e31221 10 #include "RTC_Handler.h"
wataloh 6:88cc04eb613a 11 #include "WatchDoggy.hpp"
wataloh 0:20bce0dcc921 12
wataloh 0:20bce0dcc921 13 #define ATTR_ID_SENSE_VAL 1
wataloh 1:b2a9a6f2c30e 14 #define ATTR_ID_FLOW_CONTROL 4
wataloh 0:20bce0dcc921 15 #define ATTR_ID_SENSING_INTERVAL 3
wataloh 0:20bce0dcc921 16
wataloh 0:20bce0dcc921 17 using namespace MaruSolSensorManager;
wataloh 0:20bce0dcc921 18
wataloh 1:b2a9a6f2c30e 19 class Necochan
wataloh 1:b2a9a6f2c30e 20 {
wataloh 1:b2a9a6f2c30e 21 DigitalOut *out;
wataloh 1:b2a9a6f2c30e 22 Timeout timeout;
wataloh 1:b2a9a6f2c30e 23 static Necochan *ref;
wataloh 6:88cc04eb613a 24 Timeout *deathWish;
wataloh 1:b2a9a6f2c30e 25 public:
wataloh 1:b2a9a6f2c30e 26 Necochan();
wataloh 1:b2a9a6f2c30e 27 static void release();
wataloh 1:b2a9a6f2c30e 28 void push();
wataloh 1:b2a9a6f2c30e 29 };
wataloh 1:b2a9a6f2c30e 30
wataloh 0:20bce0dcc921 31 class AferoCommHndlr
wataloh 0:20bce0dcc921 32 {
wataloh 0:20bce0dcc921 33 public:
wataloh 0:20bce0dcc921 34 void loop();
wataloh 0:20bce0dcc921 35 static void init();
wataloh 0:20bce0dcc921 36 static AferoCommHndlr *create(Timer *timer, mbedSPI *spi);
wataloh 0:20bce0dcc921 37 void update();
wataloh 4:b38e09f24711 38 int32_t sanitizeSensingInterval(uint16_t attributeId, int32_t interval);
wataloh 6:88cc04eb613a 39 Timeout *deathWish;
wataloh 6:88cc04eb613a 40 static void kick_the_bucket();
wataloh 0:20bce0dcc921 41 private:
wataloh 1:b2a9a6f2c30e 42 bool flowControlEnabled; //ATTR_ID_FLOW_CONTROL;
wataloh 0:20bce0dcc921 43 ToDoQ *todoQ;
wataloh 0:20bce0dcc921 44 uint8_t sem;
wataloh 0:20bce0dcc921 45 AferoCommHndlr();
wataloh 0:20bce0dcc921 46 iafLib *piafLib;
wataloh 0:20bce0dcc921 47 static void fco_irq_fall();
wataloh 0:20bce0dcc921 48 static void myOnAttributeSet(const uint8_t requestId, const uint16_t attributeId, const uint16_t valueLen, const uint8_t *value);
wataloh 0:20bce0dcc921 49 static void myOnAttributeSetComplete(const uint8_t requestId, const uint16_t attributeId, const uint16_t valueLen, const uint8_t *value);
wataloh 0:20bce0dcc921 50 static void onGetTodo(ToDo *todo);
wataloh 0:20bce0dcc921 51 mbedSPI *spi;
wataloh 0:20bce0dcc921 52 Timer *timer;
wataloh 1:b2a9a6f2c30e 53 Necochan *necochan;
wataloh 0:20bce0dcc921 54 };
wataloh 0:20bce0dcc921 55
wataloh 0:20bce0dcc921 56 #endif //_AFERO_COMM_HNDLR_