Files
Yona-W_OpeNITHM/Firmware/SerialOutput.h
T
veroxzik 6d8a12c455 Fixes (again)
It didn't build but now it does
Fixed the USB def for switching between 32U4/328P
Fixes indents on all files
2019-04-19 00:29:37 -04:00

42 lines
770 B
C++

// SerialOutput.h
#ifndef _SERIALOUTPUT_h
#define _SERIALOUTPUT_h
#if defined(ARDUINO) && ARDUINO >= 100
#include "arduino.h"
#else
#include "WProgram.h"
#endif
#include "Output.h"
//All events can fit within one byte to save time sending over serial
union Packet
{
uint8_t data;
struct
{
bool isKeyboard : 1;
bool isPressed : 1;
bool isDoublePressed : 1;
unsigned int key : 5;
} keyEvent;
struct
{
bool isKeyboard : 1;
int position : 7;
} sensorEvent;
};
class SerialOutput : public Output
{
private:
Packet builtPacket = Packet();
public:
void sendKeyEvent(int key, bool pressed, bool doublePressed) override;
void sendSensorEvent(float position) override;
};
#endif