Simple project that creates a device capable of controlling MS teams. It can Mute, Decline a Call, Answer Audio, or Answer Video. This is using the Sparkfun Joystick Shield attached to a KL25Z, but can be easily modified to work with whatever buttons you want.
Dependencies: mbed TSI USBDevice
Diff: main.cpp
- Revision:
- 2:4097fa431680
- Parent:
- 1:b5afa5af13d5
diff -r b5afa5af13d5 -r 4097fa431680 main.cpp --- a/main.cpp Sun Apr 11 05:21:23 2021 +0000 +++ b/main.cpp Mon Apr 12 15:12:41 2021 +0000 @@ -2,6 +2,8 @@ #include "USBKeyboard.h" #include "TSISensor.h" +#define SWITCH_TIMEOUT 10 + USBKeyboard keyboard; typedef enum @@ -51,8 +53,7 @@ int main(void) { -// rled.period(0.001); -// TSISensor tsi; + int switchTime = 0; up.mode(PullUp); down.mode(PullUp); left.mode(PullUp); @@ -60,13 +61,38 @@ while(1) { -// rled = 1.0 - tsi.readPercentage(); + if (switchTime == 0) + { + if(!up) + { + switchTime = SWITCH_TIMEOUT; + sendKeyboardCommand(TOGGLE_MUTE); +// keyboard.keyCode(UP_ARROW); + } + if(!down) + { + switchTime = SWITCH_TIMEOUT; + sendKeyboardCommand(DECLINE_CALL); +// keyboard.keyCode(DOWN_ARROW); + } + if(!left) + { + switchTime = SWITCH_TIMEOUT; + sendKeyboardCommand(ACCEPT_VIDEO_CALL); +// keyboard.keyCode(LEFT_ARROW); + } + if(!right) + { + switchTime = SWITCH_TIMEOUT; + sendKeyboardCommand(ACCCEPT_AUDIO_CALL); +// keyboard.keyCode(RIGHT_ARROW); + } + } + else + { + switchTime--; + } wait(0.1); - if(!up) - keyboard.printf("Hello World\r\n"); -// wait(1); -// keyboard.printf("Hello World\r\n"); - }; } \ No newline at end of file