0c1e003e |
1 | #include <stdint.h> |
2 | #include <stdio.h> |
3 | #include <string.h> |
4 | #include "teensy3/core_pins.h" |
5 | #include "teensy3/usb_seremu.h" |
6 | #include "teensy3/usb_rawhid.h" |
7 | |
8 | ssize_t _write(int fd, const void *buf, size_t nbyte) |
9 | { |
10 | char tbuf[64]; |
11 | int ret; |
12 | |
13 | if (fd != 1 && fd != 2) { |
14 | snprintf(tbuf, sizeof(tbuf), "write to fd %d\n", fd); |
15 | usb_seremu_write(tbuf, strlen(tbuf)); |
16 | } |
17 | |
18 | ret = usb_seremu_write(buf, nbyte); |
19 | return ret < 0 ? ret : nbyte; |
20 | } |
21 | |
22 | void yield(void) |
23 | { |
24 | } |
25 | |
26 | int main(void) |
27 | { |
28 | int ret; |
29 | |
30 | delay(1000); // wait for usb.. |
31 | |
32 | printf("starting, rawhid: %d\n", usb_rawhid_available()); |
33 | |
34 | // ret = usb_rawhid_recv(buf, 2000); |
35 | // ret = usb_rawhid_send(buf, 2000); |
36 | |
37 | pinMode(13, OUTPUT); |
38 | pinMode(14, OUTPUT); |
39 | while (1) { |
40 | CORE_PIN13_PORTSET = CORE_PIN13_BITMASK; |
41 | CORE_PIN14_PORTSET = CORE_PIN14_BITMASK; |
42 | delay(500*4); |
43 | CORE_PIN13_PORTCLEAR = CORE_PIN13_BITMASK; |
44 | CORE_PIN14_PORTCLEAR = CORE_PIN14_BITMASK; |
45 | delay(500*4); |
46 | } |
47 | } |