Kaleidoscope
ConsumerControl.h
Go to the documentation of this file.
1 /*
2 Copyright (c) 2014-2015 NicoHood
3 See the readme for credit to other people.
4 
5 Permission is hereby granted, free of charge, to any person obtaining a copy
6 of this software and associated documentation files (the "Software"), to deal
7 in the Software without restriction, including without limitation the rights
8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 copies of the Software, and to permit persons to whom the Software is
10 furnished to do so, subject to the following conditions:
11 
12 The above copyright notice and this permission notice shall be included in
13 all copies or substantial portions of the Software.
14 
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 THE SOFTWARE.
22 */
23 
24 // Include guard
25 #pragma once
26 
27 #include <Arduino.h>
28 #include "PluggableUSB.h"
29 #include "HID.h"
30 #include "HID-Settings.h"
31 
32 typedef union {
33  // Every usable Consumer key possible, up to 4 keys presses possible
34  uint16_t keys[4];
35  struct {
36  uint16_t key1;
37  uint16_t key2;
38  uint16_t key3;
39  uint16_t key4;
40  };
42 
43 
45  public:
46  ConsumerControl_(void);
47  void begin(void);
48  void end(void);
49  void write(uint16_t m);
50  void press(uint16_t m);
51  void release(uint16_t m);
52  void releaseAll(void);
53 
54  // Sending is public in the base class for advanced users.
55  void sendReport(void* data, int length);
56 
57 
58  protected:
60 };
void sendReport(void *data, int length)
Definition: ConsumerControl.cpp:90
Definition: ConsumerControl.h:44
uint16_t key1
Definition: ConsumerControl.h:36
void release(uint16_t m)
Definition: ConsumerControl.cpp:75
uint16_t key2
Definition: ConsumerControl.h:37
void begin(void)
Definition: ConsumerControl.cpp:49
HID_ConsumerControlReport_Data_t _report
Definition: ConsumerControl.h:59
uint16_t key3
Definition: ConsumerControl.h:38
void write(uint16_t m)
Definition: ConsumerControl.cpp:59
void releaseAll(void)
Definition: ConsumerControl.cpp:86
uint16_t key4
Definition: ConsumerControl.h:39
ConsumerControl_ ConsumerControl
Definition: ConsumerControl.cpp:94
Definition: ConsumerControl.h:32
void end(void)
Definition: ConsumerControl.cpp:54
ConsumerControl_(void)
Definition: ConsumerControl.cpp:44
void press(uint16_t m)
Definition: ConsumerControl.cpp:64