Skip to content
Snippets Groups Projects
Commit bcb55c3a authored by Jean-Christophe BUDA's avatar Jean-Christophe BUDA
Browse files

use SERIAL_PORT_MONITOR Insteed of Serial5

parent 28b3bd09
No related branches found
No related tags found
No related merge requests found
......@@ -345,14 +345,6 @@
<SubType>compile</SubType>
<Link>core\Stream.h</Link>
</Compile>
<None Include="..\..\..\arduino\syscalls.c">
<SubType>compile</SubType>
<Link>core\syscalls.c</Link>
</None>
<None Include="..\..\..\arduino\syscalls.h">
<SubType>compile</SubType>
<Link>core\syscalls.h</Link>
</None>
<Compile Include="..\..\..\arduino\Tone.h">
<SubType>compile</SubType>
<Link>core\Tone.h</Link>
......
......@@ -33,39 +33,39 @@ void PrintAllAddresses(UsbDeviceDefinition *pdev)
{
UsbDeviceAddress adr;
adr.devAddress = pdev->address.devAddress;
Serial5.print("\r\nAddr:");
Serial5.print(adr.devAddress, HEX);
Serial5.print("(");
Serial5.print(adr.bmHub, HEX);
Serial5.print(".");
Serial5.print(adr.bmParent, HEX);
Serial5.print(".");
Serial5.print(adr.bmAddress, HEX);
Serial5.println(")");
SERIAL_PORT_MONITOR.print("\r\nAddr:");
SERIAL_PORT_MONITOR.print(adr.devAddress, HEX);
SERIAL_PORT_MONITOR.print("(");
SERIAL_PORT_MONITOR.print(adr.bmHub, HEX);
SERIAL_PORT_MONITOR.print(".");
SERIAL_PORT_MONITOR.print(adr.bmParent, HEX);
SERIAL_PORT_MONITOR.print(".");
SERIAL_PORT_MONITOR.print(adr.bmAddress, HEX);
SERIAL_PORT_MONITOR.println(")");
}
void PrintAddress(uint8_t addr)
{
UsbDeviceAddress adr;
adr.devAddress = addr;
Serial5.print("\r\nADDR:\t");
Serial5.println(adr.devAddress,HEX);
Serial5.print("DEV:\t");
Serial5.println(adr.bmAddress,HEX);
Serial5.print("PRNT:\t");
Serial5.println(adr.bmParent,HEX);
Serial5.print("HUB:\t");
Serial5.println(adr.bmHub,HEX);
SERIAL_PORT_MONITOR.print("\r\nADDR:\t");
SERIAL_PORT_MONITOR.println(adr.devAddress,HEX);
SERIAL_PORT_MONITOR.print("DEV:\t");
SERIAL_PORT_MONITOR.println(adr.bmAddress,HEX);
SERIAL_PORT_MONITOR.print("PRNT:\t");
SERIAL_PORT_MONITOR.println(adr.bmParent,HEX);
SERIAL_PORT_MONITOR.print("HUB:\t");
SERIAL_PORT_MONITOR.println(adr.bmHub,HEX);
}
void setup()
{
Serial5.begin( 115200 );
SERIAL_PORT_MONITOR.begin( 115200 );
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
Serial5.println("Start USB Desc");
SERIAL_PORT_MONITOR.println("Start USB Desc");
if (usb.Init() == -1)
Serial5.println("OSC did not start.");
SERIAL_PORT_MONITOR.println("OSC did not start.");
delay( 20 );
......@@ -85,7 +85,7 @@ void PrintDescriptors(uint8_t addr)
printProgStr(Gen_Error_str);
print_hex( rcode, 8 );
}
Serial5.print("\r\n");
SERIAL_PORT_MONITOR.print("\r\n");
for (int i=0; i<num_conf; i++)
{
......@@ -95,15 +95,15 @@ void PrintDescriptors(uint8_t addr)
printProgStr(Gen_Error_str);
print_hex(rcode, 8);
}
Serial5.println("\r\n");
SERIAL_PORT_MONITOR.println("\r\n");
}
}
void PrintAllDescriptors(UsbDeviceDefinition *pdev)
{
Serial5.println("\r\n");
SERIAL_PORT_MONITOR.println("\r\n");
print_hex(pdev->address.devAddress, 8);
Serial5.println("\r\n--");
SERIAL_PORT_MONITOR.println("\r\n--");
PrintDescriptors( pdev->address.devAddress );
}
......@@ -171,37 +171,37 @@ void printhubdescr(uint8_t *descrptr, uint8_t addr)
printProgStr(PSTR("\r\n\r\nHub Descriptor:\r\n"));
printProgStr(PSTR("bDescLength:\t\t"));
Serial5.println(pHub->bDescLength, HEX);
SERIAL_PORT_MONITOR.println(pHub->bDescLength, HEX);
printProgStr(PSTR("bDescriptorType:\t"));
Serial5.println(pHub->bDescriptorType, HEX);
SERIAL_PORT_MONITOR.println(pHub->bDescriptorType, HEX);
printProgStr(PSTR("bNbrPorts:\t\t"));
Serial5.println(pHub->bNbrPorts, HEX);
SERIAL_PORT_MONITOR.println(pHub->bNbrPorts, HEX);
printProgStr(PSTR("LogPwrSwitchMode:\t"));
Serial5.println(pHub->LogPwrSwitchMode, BIN);
SERIAL_PORT_MONITOR.println(pHub->LogPwrSwitchMode, BIN);
printProgStr(PSTR("CompoundDevice:\t\t"));
Serial5.println(pHub->CompoundDevice, BIN);
SERIAL_PORT_MONITOR.println(pHub->CompoundDevice, BIN);
printProgStr(PSTR("OverCurrentProtectMode:\t"));
Serial5.println(pHub->OverCurrentProtectMode, BIN);
SERIAL_PORT_MONITOR.println(pHub->OverCurrentProtectMode, BIN);
printProgStr(PSTR("TTThinkTime:\t\t"));
Serial5.println(pHub->TTThinkTime, BIN);
SERIAL_PORT_MONITOR.println(pHub->TTThinkTime, BIN);
printProgStr(PSTR("PortIndicatorsSupported:"));
Serial5.println(pHub->PortIndicatorsSupported, BIN);
SERIAL_PORT_MONITOR.println(pHub->PortIndicatorsSupported, BIN);
printProgStr(PSTR("Reserved:\t\t"));
Serial5.println(pHub->Reserved, HEX);
SERIAL_PORT_MONITOR.println(pHub->Reserved, HEX);
printProgStr(PSTR("bPwrOn2PwrGood:\t\t"));
Serial5.println(pHub->bPwrOn2PwrGood, HEX);
SERIAL_PORT_MONITOR.println(pHub->bPwrOn2PwrGood, HEX);
printProgStr(PSTR("bHubContrCurrent:\t"));
Serial5.println(pHub->bHubContrCurrent, HEX);
SERIAL_PORT_MONITOR.println(pHub->bHubContrCurrent, HEX);
for (uint8_t i=7; i<len; i++)
print_hex(descrptr[i], 8);
......@@ -271,7 +271,7 @@ void print_hex(int v, int num_places)
}
do {
digit = ((v >> (num_nibbles-1) * 4)) & 0x0f;
Serial5.print(digit, HEX);
SERIAL_PORT_MONITOR.print(digit, HEX);
}
while(--num_nibbles);
}
......@@ -383,5 +383,5 @@ void printProgStr(const prog_char str[])
char c;
if(!str) return;
while((c = pgm_read_byte(str++)))
Serial5.print(c);
SERIAL_PORT_MONITOR.print(c);
}
......@@ -25,59 +25,59 @@ void printKey();
// This function intercepts key press
void keyPressed() {
Serial5.print("Pressed: ");
SERIAL_PORT_MONITOR.print("Pressed: ");
printKey();
}
// This function intercepts key release
void keyReleased() {
Serial5.print("Released: ");
SERIAL_PORT_MONITOR.print("Released: ");
printKey();
}
void printKey() {
// getOemKey() returns the OEM-code associated with the key
Serial5.print(" key:");
Serial5.print(keyboard.getOemKey());
SERIAL_PORT_MONITOR.print(" key:");
SERIAL_PORT_MONITOR.print(keyboard.getOemKey());
// getModifiers() returns a bits field with the modifiers-keys
int mod = keyboard.getModifiers();
Serial5.print(" mod:");
Serial5.print(mod);
SERIAL_PORT_MONITOR.print(" mod:");
SERIAL_PORT_MONITOR.print(mod);
Serial5.print(" => ");
SERIAL_PORT_MONITOR.print(" => ");
if (mod & LeftCtrl)
Serial5.print("L-Ctrl ");
SERIAL_PORT_MONITOR.print("L-Ctrl ");
if (mod & LeftShift)
Serial5.print("L-Shift ");
SERIAL_PORT_MONITOR.print("L-Shift ");
if (mod & Alt)
Serial5.print("Alt ");
SERIAL_PORT_MONITOR.print("Alt ");
if (mod & LeftCmd)
Serial5.print("L-Cmd ");
SERIAL_PORT_MONITOR.print("L-Cmd ");
if (mod & RightCtrl)
Serial5.print("R-Ctrl ");
SERIAL_PORT_MONITOR.print("R-Ctrl ");
if (mod & RightShift)
Serial5.print("R-Shift ");
SERIAL_PORT_MONITOR.print("R-Shift ");
if (mod & AltGr)
Serial5.print("AltGr ");
SERIAL_PORT_MONITOR.print("AltGr ");
if (mod & RightCmd)
Serial5.print("R-Cmd ");
SERIAL_PORT_MONITOR.print("R-Cmd ");
// getKey() returns the ASCII translation of OEM key
// combined with modifiers.
Serial5.write(keyboard.getKey());
Serial5.println();
SERIAL_PORT_MONITOR.write(keyboard.getKey());
SERIAL_PORT_MONITOR.println();
}
void setup()
{
Serial5.begin( 115200 );
while (!Serial5); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
Serial5.println("Keyboard Controller Program started");
SERIAL_PORT_MONITOR.begin( 115200 );
while (!SERIAL_PORT_MONITOR); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
SERIAL_PORT_MONITOR.println("Keyboard Controller Program started");
if (usb.Init() == -1)
Serial5.println("OSC did not start.");
SERIAL_PORT_MONITOR.println("OSC did not start.");
delay( 20 );
}
......
......@@ -28,64 +28,64 @@ boolean rightButton = false;
// This function intercepts mouse movements
void mouseMoved() {
Serial5.print("Move: ");
Serial5.print(mouse.getXChange());
Serial5.print(", ");
Serial5.println(mouse.getYChange());
SERIAL_PORT_MONITOR.print("Move: ");
SERIAL_PORT_MONITOR.print(mouse.getXChange());
SERIAL_PORT_MONITOR.print(", ");
SERIAL_PORT_MONITOR.println(mouse.getYChange());
}
// This function intercepts mouse movements while a button is pressed
void mouseDragged() {
Serial5.print("DRAG: ");
Serial5.print(mouse.getXChange());
Serial5.print(", ");
Serial5.println(mouse.getYChange());
SERIAL_PORT_MONITOR.print("DRAG: ");
SERIAL_PORT_MONITOR.print(mouse.getXChange());
SERIAL_PORT_MONITOR.print(", ");
SERIAL_PORT_MONITOR.println(mouse.getYChange());
}
// This function intercepts mouse button press
void mousePressed() {
Serial5.print("Pressed: ");
SERIAL_PORT_MONITOR.print("Pressed: ");
if (mouse.getButton(LEFT_BUTTON)) {
Serial5.print("L");
SERIAL_PORT_MONITOR.print("L");
leftButton = true;
}
if (mouse.getButton(MIDDLE_BUTTON)) {
Serial5.print("M");
SERIAL_PORT_MONITOR.print("M");
middleButton = true;
}
if (mouse.getButton(RIGHT_BUTTON)) {
Serial5.print("R");
Serial5.println();
SERIAL_PORT_MONITOR.print("R");
SERIAL_PORT_MONITOR.println();
rightButton = true;
}
}
// This function intercepts mouse button release
void mouseReleased() {
Serial5.print("Released: ");
SERIAL_PORT_MONITOR.print("Released: ");
if (!mouse.getButton(LEFT_BUTTON) && leftButton == true) {
Serial5.print("L");
SERIAL_PORT_MONITOR.print("L");
leftButton = false;
}
if (!mouse.getButton(MIDDLE_BUTTON) && middleButton == true) {
Serial5.print("M");
SERIAL_PORT_MONITOR.print("M");
middleButton = false;
}
if (!mouse.getButton(RIGHT_BUTTON) && rightButton == true) {
Serial5.print("R");
SERIAL_PORT_MONITOR.print("R");
rightButton = false;
}
Serial5.println();
SERIAL_PORT_MONITOR.println();
}
void setup()
{
Serial5.begin( 115200 );
while (!Serial5); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
Serial5.println("Mouse Controller Program started");
SERIAL_PORT_MONITOR.begin( 115200 );
while (!SERIAL_PORT_MONITOR); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
SERIAL_PORT_MONITOR.println("Mouse Controller Program started");
if (usb.Init() == -1)
Serial5.println("OSC did not start.");
SERIAL_PORT_MONITOR.println("OSC did not start.");
delay( 20 );
}
......
......@@ -33,12 +33,12 @@ ADK adk(&usb,"Arduino SA",
void setup(void)
{
Serial5.begin( 115200 );
while (!Serial5); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
Serial5.println("\r\nADK demo start");
SERIAL_PORT_MONITOR.begin( 115200 );
while (!SERIAL_PORT_MONITOR); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
SERIAL_PORT_MONITOR.println("\r\nADK demo start");
if (usb.Init() == -1)
Serial5.println("OSC did not start.");
SERIAL_PORT_MONITOR.println("OSC did not start.");
delay(20);
}
......@@ -65,11 +65,11 @@ void loop(void)
adk.RcvData((uint8_t *)&nbread, buf);
if (nbread > 0)
{
Serial5.print("RCV: ");
SERIAL_PORT_MONITOR.print("RCV: ");
for (uint32_t i = 0; i < nbread; ++i)
{
Serial5.print((char)buf[i]);
SERIAL_PORT_MONITOR.print((char)buf[i]);
}
Serial5.print("\r\n");
SERIAL_PORT_MONITOR.print("\r\n");
}
}
......@@ -230,7 +230,7 @@ extern Uart Serial5;
//
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
// pins are NOT connected to anything by default.
#define SERIAL_PORT_MONITOR Serial
#define SERIAL_PORT_MONITOR Serial5
#define SERIAL_PORT_USBVIRTUAL SerialUSB
#define SERIAL_PORT_HARDWARE_OPEN Serial1
#define SERIAL_PORT_HARDWARE_OPEN1 Serial2
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment