4 #include "pgmstrings.h"
6 // Satisfy the IDE, which needs to see the include statment in the ino too.
8 #include <spi4teensy3.h>
12 class ACMAsyncOper : public CDCAsyncOper
15 uint8_t OnInit(ACM *pacm);
18 uint8_t ACMAsyncOper::OnInit(ACM *pacm)
22 rcode = pacm->SetControlLineState(3);
26 ErrorMessage<uint8_t>(PSTR("SetControlLineState"), rcode);
31 lc.dwDTERate = 115200;
36 rcode = pacm->SetLineCoding(&lc);
39 ErrorMessage<uint8_t>(PSTR("SetLineCoding"), rcode);
46 ACMAsyncOper AsyncOper;
47 ACM Acm(&Usb, &AsyncOper);
51 Serial.begin( 115200 );
52 #if !defined(__MIPSEL__)
53 while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
55 Serial.println("Start");
58 Serial.println("OSCOKIRQ failed to assert");
70 /* reading the keyboard */
71 if(Serial.available()) {
72 uint8_t data= Serial.read();
73 /* sending to the phone */
74 rcode = Acm.SndData(1, &data);
76 ErrorMessage<uint8_t>(PSTR("SndData"), rcode);
77 }//if(Serial.available()...
81 /* reading the phone */
82 /* buffer size must be greater or equal to max.packet size */
83 /* it it set to 64 (largest possible max.packet size) here, can be tuned down
84 for particular endpoint */
87 rcode = Acm.RcvData(&rcvd, buf);
88 if (rcode && rcode != hrNAK)
89 ErrorMessage<uint8_t>(PSTR("Ret"), rcode);
91 if( rcvd ) { //more than zero bytes received
92 for(uint16_t i=0; i < rcvd; i++ ) {
93 Serial.print((char)buf[i]); //printing on the screen
97 }//if( Usb.getUsbTaskState() == USB_STATE_RUNNING..