8000 Merge branch 'master' into atsamr · freaklabs/ArduinoCore-samd@b86cc80 · GitHub
[go: up one dir, main page]

Skip to content
Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b86cc80

Browse files
committed
Merge branch 'master' into atsamr
2 parents b923678 + 71c6f9d commit b86cc80

File tree

6 files changed

+19
-56
lines changed

6 files changed

+19
-56
lines changed

cores/arduino/USB/CDC.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
#include <stdio.h>
2424
#include <stdint.h>
2525

26-
uint8_t USB_TXLEDticks = 0, USB_RXLEDticks = 0;
27-
2826
#ifdef CDC_ENABLED
2927

3028
#define CDC_SERIAL_BUFFER_SIZE 256
@@ -102,12 +100,6 @@ bool CDC_Setup(USBSetup& setup)
102100
uint8_t requestType = setup.bmRequestType;
103101
uint8_t r = setup.bRequest;
104102

105-
digitalWrite(PIN_LED_RXL, HIGH);
106-
digitalWrite(PIN_LED_TXL, HIGH);
107-
pinMode(PIN_LED_RXL, OUTPUT);
108-
pinMode(PIN_LED_TXL, OUTPUT);
109-
USB_TXLEDticks = USB_RXLEDticks = 0;
110-
111103
if (requestType == REQUEST_DEVICETOHOST_CLASS_INTERFACE)
112104
{
113105
if (r == CDC_GET_LINE_CODING)
@@ -229,9 +221,6 @@ int Serial_::read(void)
229221
{
230222
ring_buffer *buffer = &cdc_rx_buffer;
231223

232-
digitalWrite(PIN_LED_RXL, LOW);
233-
USB_RXLEDticks = 10; // how many ms to keep LED on
234-
235224
// if the head isn't ahead of the tail, we don't have any characters
236225
if (buffer->head == buffer->tail && !buffer->full)
237226
{
@@ -266,9 +255,6 @@ size_t Serial_::write(const uint8_t *buffer, size_t size)
266255
bytes sent before the user opens the connection or after
267256
the connection is closed are lost - just like with a UART. */
268257

269-
digitalWrite(PIN_LED_TXL, LOW);
270-
USB_TXLEDticks = 10; // how many ms to keep LED on
271-
272258
// TODO - ZE - check behavior on different OSes and test what happens if an
273259
// open connection isn't broken cleanly (cable is yanked out, host dies
274260
// or locks up, or host virtual serial port hangs)

cores/arduino/delay.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
#include "delay.h"
2020
#include "Arduino.h"
2121

22-
extern uint8_t USB_TXLEDticks, USB_RXLEDticks;
23-
24-
2522
#ifdef __cplusplus
2623
extern "C" {
2724
#endif
@@ -86,21 +83,6 @@ void SysTick_DefaultHandler(void)
8683
// Increment tick count each ms
8784
_ulTickCount++;
8885
tickReset();
89-
90-
// turn off CDC LEDs if time
91-
if (USB_RXLEDticks) {
92-
USB_RXLEDticks--;
93-
if (USB_RXLEDticks == 0) {
94-
digitalWrite(PIN_LED_RXL, HIGH);
95-
}
96-
}
97-
98-
if (USB_TXLEDticks) {
99-
USB_TXLEDticks--;
100-
if (USB_TXLEDticks == 0) {
101-
digitalWrite(PIN_LED_TXL, HIGH);
102-
}
103-
}
10486
}
10587

10688
#ifdef __cplusplus

libraries/USBHost/src/Usb.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ uint32_t USBHost::SetPipeAddress(uint32_t addr, uint32_t ep, EpInfo **ppep, uint
123123
/* 01-0f = non-zero HRSLT */
124124
uint32_t USBHost::ctrlReq(uint32_t addr, uint32_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi,
125125
uint16_t wInd, uint16_t total, uint32_t nbytes, uint8_t* dataptr, USBReadParser *p) {
126-
126+
127127
uint32_t direction = 0; // Request direction, IN or OUT
128128
uint32_t rcode;
129129
SETUP_PKT setup_pkt;
@@ -194,14 +194,14 @@ uint32_t USBHost::ctrlReq(uint32_t addr, uint32_t ep, uint8_t bmReqType, uint8_t
194194
((USBReadParser*)p)->Parse(read, dataptr, total - left);
195195
}
196196
else // OUT transfer
197-
{
197+
{
198198
pep->bmSndToggle = 1; //bmSNDTOG1;
199199
rcode = OutTransfer(pep, nak_limit, nbytes, dataptr);
200200
}
201201
if(rcode) //return error
202202
return (rcode);
203203
}
204-
204+
205205
// Status stage
206206
UHD_Pipe_CountZero(pep->epAddr);
207207
USB->HOST.HostPipe[pep->epAddr].PSTATUSSET.reg = USB_HOST_PSTATUSSET_DTGL;
@@ -263,17 +263,16 @@ uint32_t USBHost::InTransfer(EpInfo *pep, uint32_t nak_limit, uint8_t *nbytesptr
263263
}
264264
if(rcode) {
265265
uhd_freeze_pipe(pep->epAddr);
266-
267266
//printf(">>>>>>>> Problem! dispatchPkt %2.2x\r\n", rcode);
268267
return(rcode);// break; //should be 0, indicating ACK. Else return error code.
269268
}
270269
/* check for RCVDAVIRQ and generate error if not present */
271270
/* the only case when absence of RCVDAVIRQ makes sense is when toggle error occurred. Need to add handling for that */
272-
271+
273272
pktsize = uhd_byte_count(pep->epAddr); // Number of received bytes
274-
273+
275274
USB->HOST.HostPipe[pep->epAddr].PSTATUSCLR.reg = USB_HOST_PSTATUSCLR_BK0RDY;
276-
275+
277276
//printf("Got %i bytes \r\n", pktsize);
278277
// This would be OK, but...
279278
//assert(pktsize <= nbytes);
@@ -298,7 +297,7 @@ uint32_t USBHost::InTransfer(EpInfo *pep, uint32_t nak_limit, uint8_t *nbytesptr
298297
/* 1. The device sent a short packet (L.T. maxPacketSize) */
299298
/* 2. 'nbytes' have been transferred. */
300299
if((pktsize < maxpktsize) || (*nbytesptr >= nbytes)) // have we transferred 'nbytes' bytes?
301-
{
300+
{
302301
// Save toggle value
303302
pep->bmRcvToggle = USB_HOST_DTGL(pep->epAddr);
304303
//printf("\r\n");
@@ -506,7 +505,7 @@ void USBHost::Task(void) //USB state machine
506505
TRACE_USBHOST(printf(" + USB_DETACHED_SUBSTATE_INITIALIZE\r\n");)
507506

508507
// Init USB stack and driver
509-
Init();
508+
UHD_Init();
510509

511510
// Free all USB resources
512511
for (uint32_t i = 0; i < USB_NUMDEVICES; ++i)

libraries/USBHost/src/Usb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ e-mail : support@circuitsathome.com
2727
// None of these should ever be included by a driver, or a user's sketch.
2828

2929
#include "variant.h"
30-
#define USB_HOST_SERIAL Serial1
30+
#define USB_HOST_SERIAL SERIAL_PORT_MONITOR
3131
#include "Print.h"
3232
#include "printhex.h"
3333
#include "message.h"

variants/arduino_zero/variant.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ const PinDescription g_APinDescription[]=
127127
{ PORTA, 21, PIO_DIGITAL, (PIN_ATTR_DIGITAL), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_5 },
128128

129129
// Digital High
130-
{ PORTA, 6, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_ANALOG), ADC_Channel6, PWM1_CH0, TCC1_CH0, EXTERNAL_INT_6 }, // TCC1/WO[0]
131-
{ PORTA, 7, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_ANALOG), ADC_Channel7, PWM1_CH1, TCC1_CH1, EXTERNAL_INT_7 }, // TCC1/WO[1]
130+
{ PORTA, 6, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM1_CH0, TCC1_CH0, EXTERNAL_INT_6 }, // TCC1/WO[0]
131+
{ PORTA, 7, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM1_CH1, TCC1_CH1, EXTERNAL_INT_7 }, // TCC1/WO[1]
132132
{ PORTA, 18, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM3_CH0, TC3_CH0, EXTERNAL_INT_2 }, // TC3/WO[0]
133133
{ PORTA, 16, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM2_CH0, TCC2_CH0, EXTERNAL_INT_0 }, // TCC2/WO[0]
134134
{ PORTA, 19, PIO_TIMER_ALT, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER_ALT), No_ADC_Channel, PWM0_CH3, TCC0_CH3, EXTERNAL_INT_3 }, // TCC0/WO[3]
@@ -208,18 +208,14 @@ SERCOM sercom4( SERCOM4 ) ;
208208
SERCOM sercom5( SERCOM5 ) ;
209209

210210
Uart Serial1( &sercom0, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ;
211+
Uart Serial5( &sercom5, PIN_SERIAL_RX, PIN_SERIAL_TX, PAD_SERIAL_RX, PAD_SERIAL_TX ) ;
211212
void SERCOM0_Handler()
212213
{
213214
Serial1.IrqHandler();
214215
}
215216

216-
217-
// Serial5 not available on Feather so ditch it
218-
219-
//Uart Serial5( &sercom5, PIN_SERIAL_RX, PIN_SERIAL_TX, PAD_SERIAL_RX, PAD_SERIAL_TX ) ;
220-
/*
221217
void SERCOM5_Handler()
222218
{
223219
Serial5.IrqHandler();
224220
}
225-
*/
221+

variants/arduino_zero/variant.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,12 @@ extern "C"
9898
#define PIN_A7 (9ul)
9999
#define PIN_DAC0 (14ul)
100100

101-
static const uint8_t A0 = PIN_A0 ;
102-
static const uint8_t A1 = PIN_A1 ;
103-
static const uint8_t A2 = PIN_A2 ;
104-
static const uint8_t A3 = PIN_A3 ;
105-
static const uint8_t A4 = PIN_A4 ;
106-
static const uint8_t A5 = PIN_A5 ;
101+
static const uint8_t A0 = PIN_A0;
102+
static const uint8_t A1 = PIN_A1;
103+
static const uint8_t A2 = PIN_A2;
104+
static const uint8_t A3 = PIN_A3;
105+
static const uint8_t A4 = PIN_A4;
106+
static const uint8_t A5 = PIN_A5;
107107
static const uint8_t A6 = PIN_A6 ;
108108
static const uint8_t A7 = PIN_A7 ;
109109
static const uint8_t DAC0 = PIN_DAC0;

0 commit comments

Comments
 (0)
0