mirror of
https://github.com/arduino/Arduino.git
synced 2024-12-01 12:24:14 +01:00
[SAM] HID and CDC verified okay on Linux/Mac by Cristian. Fixed OTG clock
init issue. CDC is not working correctly under Windows (possible inf issue).
This commit is contained in:
parent
84e887003d
commit
d6d23c530a
@ -51,9 +51,7 @@ static volatile LineInfo _usbLineInfo = { 57600, 0x00, 0x00, 0x00, 0x00 };
|
||||
_Pragma("pack(1)")
|
||||
static const CDCDescriptor _cdcInterface =
|
||||
{
|
||||
#ifdef HID_ENABLED
|
||||
D_IAD(0,2,CDC_COMMUNICATION_INTERFACE_CLASS,CDC_ABSTRACT_CONTROL_MODEL,1),
|
||||
#endif
|
||||
|
||||
// CDC communication interface
|
||||
D_INTERFACE(CDC_ACM_INTERFACE,1,CDC_COMMUNICATION_INTERFACE_CLASS,CDC_ABSTRACT_CONTROL_MODEL,0),
|
||||
|
@ -234,10 +234,8 @@ typedef struct
|
||||
|
||||
typedef struct
|
||||
{
|
||||
#ifdef HID_ENABLED
|
||||
// IAD
|
||||
IADDescriptor iad; // Only needed on compound device
|
||||
#endif
|
||||
|
||||
// Control
|
||||
InterfaceDescriptor cif; //
|
||||
|
Binary file not shown.
@ -29,62 +29,20 @@ const int mouseButton = 6;
|
||||
int range = 5; // output range of X or Y movement; affects movement speed
|
||||
int responseDelay = 10; // response delay of the mouse, in ms
|
||||
|
||||
/*
|
||||
void setup() {
|
||||
Mouse.begin();
|
||||
}
|
||||
|
||||
//void setup() {
|
||||
// initialize the buttons' inputs:
|
||||
/* pinMode(upButton, INPUT);
|
||||
pinMode(downButton, INPUT);
|
||||
pinMode(leftButton, INPUT);
|
||||
pinMode(rightButton, INPUT);
|
||||
pinMode(mouseButton, INPUT);*/
|
||||
// initialize mouse control:
|
||||
// Mouse.begin();
|
||||
//}
|
||||
|
||||
//void loop() {
|
||||
// read the buttons:
|
||||
/* int upState = digitalRead(upButton);
|
||||
int downState = digitalRead(downButton);
|
||||
int rightState = digitalRead(rightButton);
|
||||
int leftState = digitalRead(leftButton);
|
||||
int clickState = digitalRead(mouseButton);
|
||||
|
||||
// calculate the movement distance based on the button states:
|
||||
int xDistance = (leftState - rightState)*range;
|
||||
int yDistance = (upState - downState)*range;
|
||||
|
||||
// if X or Y is non-zero, move:
|
||||
if ((xDistance != 0) || (yDistance != 0)) {
|
||||
Mouse.move(xDistance, yDistance, 0);
|
||||
}
|
||||
|
||||
// if the mouse button is pressed:
|
||||
if (clickState == HIGH) {
|
||||
// if the mouse is not pressed, press it:
|
||||
if (!Mouse.isPressed(MOUSE_LEFT)) {
|
||||
Mouse.press(MOUSE_LEFT);
|
||||
}
|
||||
}
|
||||
// else the mouse button is not pressed:
|
||||
else {
|
||||
// if the mouse is pressed, release it:
|
||||
if (Mouse.isPressed(MOUSE_LEFT)) {
|
||||
Mouse.release(MOUSE_LEFT);
|
||||
}
|
||||
}*/
|
||||
/*Mouse.move(10, 0, 0);
|
||||
// a delay so the mouse doesn't move too fast:
|
||||
delay(1000);
|
||||
}*/
|
||||
void loop() {
|
||||
Mouse.move(10, 0, 0);
|
||||
delay(1000);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
//#include "USBAPI.h"
|
||||
|
||||
|
||||
|
||||
// Cet exemple fonctionne !!! ;-)
|
||||
/*void setup() {
|
||||
/*
|
||||
void setup() {
|
||||
// initialize the digital pin as an output.
|
||||
// Pin 13 has an LED connected on most Arduino boards:
|
||||
//pinMode(13, OUTPUT);
|
||||
@ -98,34 +56,21 @@ void loop() {
|
||||
//digitalWrite(13, LOW); // set the LED off
|
||||
delay(1000); // wait for a second
|
||||
printf("loop...\r\n");
|
||||
}*/
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
void setup() {
|
||||
// open the serial port:
|
||||
Serial.begin(57600);
|
||||
// initialize control over the keyboard:
|
||||
// Keyboard.begin();
|
||||
Serial.begin(57600);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// check for incoming serial data:
|
||||
//if (Serial.available() > 0) {
|
||||
// read incoming serial data:
|
||||
//char inChar = Serial.read();
|
||||
// Type the next ASCII value from what you received:
|
||||
// Keyboard.write(inChar+1);
|
||||
//Serial.print("toto\r\n");
|
||||
// check for incoming serial data:
|
||||
|
||||
if (Serial.available() > 0) {
|
||||
// read incoming serial data:
|
||||
if (Serial.available() > 0)
|
||||
{
|
||||
char inChar = Serial.read();
|
||||
// Type the next ASCII value from what you received:
|
||||
Serial.print(inChar);
|
||||
Serial1.print(inChar);
|
||||
}
|
||||
delay(10);
|
||||
}
|
||||
|
||||
|
||||
|
@ -75,8 +75,8 @@ uint32_t UDD_Init(void)
|
||||
otg_unfreeze_clock();
|
||||
|
||||
// Check USB clock
|
||||
while (!Is_otg_clock_usable())
|
||||
;
|
||||
//while (!Is_otg_clock_usable())
|
||||
// ;
|
||||
|
||||
udd_low_speed_disable();
|
||||
udd_high_speed_disable();
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user