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

spi/AferoCommHndlr.h

Committer:
wataloh
Date:
2017-01-25
Revision:
4:b38e09f24711
Parent:
2:dfe671e31221
Child:
5:9d5c7ee80f3b

File content as of revision 4:b38e09f24711:

#ifndef _AFERO_COMM_HNDLR_
#define _AFERO_COMM_HNDLR_

#include "mbed.h"
#include "pin_defines.h"
#include "mbedSPI.h"
#include "afLib.h"
#include "debugIO.h"
#include "ToDoQ.h"
#include "Preferences.hpp"
#include "RTC_Handler.h"

#define ATTR_ID_SENSE_VAL 1
#define ATTR_ID_FLOW_CONTROL 4
#define ATTR_ID_SENSING_INTERVAL 3

using namespace MaruSolSensorManager;

class Necochan
{
    DigitalOut *out;
    Timeout timeout;
    static Necochan *ref;
public:
    Necochan();
    static void release();
    void push();
};

class AferoCommHndlr
{
public:
    void loop();
    static void init();
    static AferoCommHndlr *create(Timer *timer, mbedSPI *spi);
    void update();
    int32_t sanitizeSensingInterval(uint16_t attributeId, int32_t interval);
private:
    bool flowControlEnabled; //ATTR_ID_FLOW_CONTROL;
    ToDoQ *todoQ;
    uint8_t sem;
    AferoCommHndlr();
    iafLib *piafLib;
    static void fco_irq_fall();
    static void myOnAttributeSet(const uint8_t requestId, const uint16_t attributeId, const uint16_t valueLen, const uint8_t *value);
    static void myOnAttributeSetComplete(const uint8_t requestId, const uint16_t attributeId, const uint16_t valueLen, const uint8_t *value);
    static void onGetTodo(ToDo *todo);
    mbedSPI *spi;
    Timer *timer;
    Necochan *necochan;
};

#endif //_AFERO_COMM_HNDLR_