Extension on RotaryEncoder.h, Host.h... Represesnts a room with PWM LED lightning

Committer:
nzupcic
Date:
Tue Sep 21 16:45:59 2021 +0000
Revision:
0:04a5d18ab628
1st commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nzupcic 0:04a5d18ab628 1 #ifndef ROOM_H
nzupcic 0:04a5d18ab628 2 #define ROOM_H
nzupcic 0:04a5d18ab628 3
nzupcic 0:04a5d18ab628 4 #include "Host.h"
nzupcic 0:04a5d18ab628 5 #include "Bluetooth.h"
nzupcic 0:04a5d18ab628 6 #include "RotaryEncoder.h"
nzupcic 0:04a5d18ab628 7 #include "mbed.h"
nzupcic 0:04a5d18ab628 8 #include "rtos.h"
nzupcic 0:04a5d18ab628 9
nzupcic 0:04a5d18ab628 10 class Room{
nzupcic 0:04a5d18ab628 11 public:
nzupcic 0:04a5d18ab628 12 Room(PinName pRoomLight, PinName pRotaryA, PinName pRotaryB,
nzupcic 0:04a5d18ab628 13 PinName pSwitch, PinName pBtTx, PinName pBtRx, PinName pHostTx,
nzupcic 0:04a5d18ab628 14 PinName pHostRx);
nzupcic 0:04a5d18ab628 15 bool Enable;
nzupcic 0:04a5d18ab628 16 float LastState;
nzupcic 0:04a5d18ab628 17 private:
nzupcic 0:04a5d18ab628 18 void Init();
nzupcic 0:04a5d18ab628 19 void Loop();
nzupcic 0:04a5d18ab628 20 float SetBrightness();
nzupcic 0:04a5d18ab628 21 void CheckEnables();
nzupcic 0:04a5d18ab628 22 void ListenHost();
nzupcic 0:04a5d18ab628 23 void ListenHardware();
nzupcic 0:04a5d18ab628 24 void ListenBluetooth();
nzupcic 0:04a5d18ab628 25 void SwitchStates();
nzupcic 0:04a5d18ab628 26 void Refresh();
nzupcic 0:04a5d18ab628 27 void Update();
nzupcic 0:04a5d18ab628 28 protected:
nzupcic 0:04a5d18ab628 29 Thread pc_thread;
nzupcic 0:04a5d18ab628 30 PwmOut roomLight;
nzupcic 0:04a5d18ab628 31 Host pc;
nzupcic 0:04a5d18ab628 32 Bluetooth bt;
nzupcic 0:04a5d18ab628 33 RotaryEncoder re;
nzupcic 0:04a5d18ab628 34 InterruptIn swButton;
nzupcic 0:04a5d18ab628 35 Ticker tickerEnable;
nzupcic 0:04a5d18ab628 36 Ticker updateValues;
nzupcic 0:04a5d18ab628 37 Timer debounce;
nzupcic 0:04a5d18ab628 38 Timer timeout_pc;
nzupcic 0:04a5d18ab628 39 };
nzupcic 0:04a5d18ab628 40
nzupcic 0:04a5d18ab628 41 #endif