-
Notifications
You must be signed in to change notification settings - Fork 0
/
teensy_device.h
74 lines (59 loc) · 2.95 KB
/
teensy_device.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#pragma once
#include "device.h"
#include <FastLED.h>
#include <OctoWS2811.h>
#include "common/constants.h"
class TeensyDevice : public Device
{
public:
TeensyDevice(CRGB* leds);
virtual void sleep_millis(const int millis) override;
virtual void sleep_micros(const int micros) override;
virtual void gpio_setup(const uint8_t pin, const PinMode mode) override;
virtual void gpio_write(const uint8_t pin, const PinState value) override;
virtual PinState gpio_read(const uint8_t pin) override;
virtual void set_keyboard_key1(const uint8_t code) override;
virtual void set_keyboard_key2(const uint8_t code) override;
virtual void set_keyboard_key3(const uint8_t code) override;
virtual void set_keyboard_key4(const uint8_t code) override;
virtual void set_keyboard_key5(const uint8_t code) override;
virtual void set_keyboard_key6(const uint8_t code) override;
virtual void set_keyboard_modifier(const uint16_t modifier) override;
virtual void set_keyboard_media(const uint16_t media) override;
virtual void keyboard_send() override;
virtual bool serial_data_available() override;
virtual void serial_read(char*& buffer, uint32_t& num_read_bytes) override;
virtual void serial_clear() override;
virtual bool sd_init() override;
virtual bool sd_read(const char* filename, char*& buffer, uint32_t& num_read_bytes) const override;
virtual bool sd_write(const char* filename, const char* buffer, const uint32_t num_bytes) override;
virtual uint16_t get_keyboard_leds() override;
virtual void serial_begin(const uint32_t baud) override;
virtual void serial_print(const char* str) override;
virtual void serial_print(uint8_t val) override;
virtual void serial_print(uint16_t val) override;
virtual void serial_print(uint32_t val) override;
virtual void serial_print(int8_t val) override;
virtual void serial_print(int16_t val) override;
virtual void serial_print(int32_t val) override;
virtual void serial_println(const char* str) override;
virtual void serial_println(uint8_t val) override;
virtual void serial_println(uint16_t val) override;
virtual void serial_println(uint32_t val) override;
virtual void serial_println(int8_t val) override;
virtual void serial_println(int16_t val) override;
virtual void serial_println(int32_t val) override;
virtual void mouse_init() override;
virtual void mouse_move(int8_t dx, int8_t dy, int8_t wheel) override;
virtual void mouse_press(DeviceMouseButton button) override;
virtual void mouse_release(DeviceMouseButton button) override;
virtual void start_timer() override;
virtual uint32_t get_timer_micros() override;
virtual uint32_t milliseconds_since_start() const override;
virtual void set_led(uint16_t index, uint8_t r, uint8_t g, uint8_t b) override;
virtual void update_leds() override;
virtual void reboot() override;
private:
uint32_t start_time;
CRGB* leds;
};