11 #ifndef __USB_HID_HEADER
12 #define __USB_HID_HEADER
16 #include <UsbKeyboardMod.h>
33 TIMSK0 &= !(1<<TOIE0);
35 usbDeviceDisconnect();
40 for(
int i = 0;
i < 150; ++
i) {
47 for(
unsigned int i = 0;
i < ms;
i++) {
48 delayMicroseconds(1000);
107 if((_mod & 1) == 1) {
111 if((_mod & 2) == 2) {
115 if((_mod & 4) == 4) {
119 if((_mod & 8) == 8) {
128 if((_mod & 1) == 1) {
129 if(--(mod_vec_[0]) == 0)
132 if((_mod & 2) == 2) {
133 if(--(mod_vec_[1]) == 0)
136 if((_mod & 4) == 4) {
137 if(--(mod_vec_[2]) == 0)
140 if((_mod & 8) == 8) {
141 if(--(mod_vec_[3]) == 0)
157 press((uint8_t)_key, (uint8_t)_mod);
160 release((uint8_t)_key, (uint8_t)_mod);
172 return (data_[0] + data_[1] + data_[2] + data_[3]);
178 for(uint8_t
i = 0;
i < BUFFER_SIZE; ++
i) {
185 UsbKeyboard.sendBuffer(data_.
data());
186 UsbKeyboard.update();
195 #endif //__USB_HID_HEADER
bool any_pressed()
Definition: usb_hid.hpp:171
void press(key const &_key, key const &_mod=key::none)
Definition: usb_hid.hpp:156
void release_all()
Definition: usb_hid.hpp:162
void push_back(T const &in)
Definition: static_vector.hpp:40
void set_mod(uint8_t const &_mod)
Definition: usb_hid.hpp:104
void release(uint8_t const &_key, uint8_t const &_mod=(uint8_t) key::none)
Definition: usb_hid.hpp:151
usb_hid_class()
Definition: usb_hid.hpp:23
void connect()
Definition: usb_hid.hpp:32
size_type find(T const &val, size_type pos=0) const
Definition: static_vector.hpp:49
void delay_ms(unsigned int const &ms)
Definition: usb_hid.hpp:46
void press(uint8_t const &_key, uint8_t const &_mod=(uint8_t) key::none)
Definition: usb_hid.hpp:146
void unset_mod(uint8_t const &_mod)
Definition: usb_hid.hpp:124
constexpr size_type capacity()
Definition: static_vector.hpp:125
void erase(size_type const &pos)
Definition: static_vector.hpp:59
struct ustd::endl_class endl
void set_key(uint8_t const &_key)
Definition: usb_hid.hpp:52
static constexpr uint8_t buffer_size()
Definition: usb_hid.hpp:174
void update()
Definition: usb_hid.hpp:184
void print_buffer()
Definition: usb_hid.hpp:177
T * data()
Definition: static_vector.hpp:90
void release(key const &_key, key const &_mod=key::none)
Definition: usb_hid.hpp:159
key
Definition: hid_keys.hpp:14
size_type const & size() const
Definition: static_vector.hpp:118
void unset_key(uint8_t const &_key)
Definition: usb_hid.hpp:79
Definition: usb_hid.hpp:20
void clear()
set all elements to "zero"
Definition: array.hpp:138