Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: NerfUSXbee PinDetect EthernetInterface JSON MFRC522 WebSocketClient mbed-rtos mbed
BtnHandler.hpp
00001 #pragma once 00002 #include "ports.hpp" 00003 #include "PinDetect.h" 00004 #include "ServerData.hpp" 00005 #include "serverEvents.hpp" 00006 00007 class BtnHandler { 00008 PinDetect _interrupt; 00009 ServerEvent event; 00010 public: 00011 BtnHandler(PinName pin, const char *eventName) : _interrupt(pin) { 00012 strcpy(event.event, eventName); 00013 _interrupt.mode( PullDown ); 00014 _interrupt.setSampleFrequency(); 00015 _interrupt.attach_asserted(this, &BtnHandler::sendEvent); 00016 } 00017 BtnHandler(PinName pin, const char *eventName, const char *direction) : BtnHandler(pin, eventName) { 00018 strcpy(event.data.direction, direction); 00019 } 00020 void sendEvent() 00021 { 00022 websocket_message_send(event); 00023 } 00024 };
Generated on Tue Jul 12 2022 15:36:49 by
1.7.2