NerfUS / Mbed 2 deprecated NerfUS-Coord

Dependencies:   NerfUSXbee PinDetect EthernetInterface JSON MFRC522 WebSocketClient mbed-rtos mbed

Committer:
Ismael Balafrej
Date:
Mon Apr 10 15:02:24 2017 -0400
Revision:
1:e1c5259b7d9a
V1

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Ismael Balafrej 1:e1c5259b7d9a 1 #pragma once
Ismael Balafrej 1:e1c5259b7d9a 2 #include "ports.hpp"
Ismael Balafrej 1:e1c5259b7d9a 3 #include "PinDetect.h"
Ismael Balafrej 1:e1c5259b7d9a 4 #include "ServerData.hpp"
Ismael Balafrej 1:e1c5259b7d9a 5 #include "serverEvents.hpp"
Ismael Balafrej 1:e1c5259b7d9a 6
Ismael Balafrej 1:e1c5259b7d9a 7 class BtnHandler {
Ismael Balafrej 1:e1c5259b7d9a 8 PinDetect _interrupt;
Ismael Balafrej 1:e1c5259b7d9a 9 ServerEvent event;
Ismael Balafrej 1:e1c5259b7d9a 10 public:
Ismael Balafrej 1:e1c5259b7d9a 11 BtnHandler(PinName pin, const char *eventName) : _interrupt(pin) {
Ismael Balafrej 1:e1c5259b7d9a 12 strcpy(event.event, eventName);
Ismael Balafrej 1:e1c5259b7d9a 13 _interrupt.mode( PullDown );
Ismael Balafrej 1:e1c5259b7d9a 14 _interrupt.setSampleFrequency();
Ismael Balafrej 1:e1c5259b7d9a 15 _interrupt.attach_asserted(this, &BtnHandler::sendEvent);
Ismael Balafrej 1:e1c5259b7d9a 16 }
Ismael Balafrej 1:e1c5259b7d9a 17 BtnHandler(PinName pin, const char *eventName, const char *direction) : BtnHandler(pin, eventName) {
Ismael Balafrej 1:e1c5259b7d9a 18 strcpy(event.data.direction, direction);
Ismael Balafrej 1:e1c5259b7d9a 19 }
Ismael Balafrej 1:e1c5259b7d9a 20 void sendEvent()
Ismael Balafrej 1:e1c5259b7d9a 21 {
Ismael Balafrej 1:e1c5259b7d9a 22 websocket_message_send(event);
Ismael Balafrej 1:e1c5259b7d9a 23 }
Ismael Balafrej 1:e1c5259b7d9a 24 };