]> git.gir.st - tmk_keyboard.git/blob - protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/scale/scale.ino
Squashed 'tmk_core/' changes from caca2c0..dc0e46e
[tmk_keyboard.git] / protocol / usb_hid / USB_Host_Shield_2.0 / examples / HID / scale / scale.ino
1 /* Digital Scale Output. Written for Stamps.com Model 510 */
2 /* 5lb Digital Scale; any HID scale with Usage page 0x8d should work */
3
4 #include <hid.h>
5 #include <hiduniversal.h>
6 #include <usbhub.h>
7
8 #include "scale_rptparser.h"
9
10 // Satisfy the IDE, which needs to see the include statment in the ino too.
11 #ifdef dobogusinclude
12 #include <spi4teensy3.h>
13 #include <SPI.h>
14 #endif
15
16 USB Usb;
17 USBHub Hub(&Usb);
18 HIDUniversal Hid(&Usb);
19 Max_LCD LCD(&Usb);
20 ScaleEvents ScaleEvents(&LCD);
21 ScaleReportParser Scale(&ScaleEvents);
22
23 void setup()
24 {
25 Serial.begin( 115200 );
26 #if !defined(__MIPSEL__)
27 while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
28 #endif
29 Serial.println("Start");
30
31 if (Usb.Init() == -1)
32 Serial.println("OSC did not start.");
33
34 // set up the LCD's number of rows and columns:
35 LCD.begin(16, 2);
36 LCD.clear();
37 LCD.home();
38 LCD.setCursor(0,0);
39 LCD.write('R');
40
41 delay( 200 );
42
43 if (!Hid.SetReportParser(0, &Scale))
44 ErrorMessage<uint8_t>(PSTR("SetReportParser"), 1 );
45 }
46
47 void loop()
48 {
49 Usb.Task();
50 }
51
Imprint / Impressum