Skip to content

Commit b7e942d

Browse files
committed
DM: fix stuff from rebase
1 parent 0e9c85f commit b7e942d

File tree

4 files changed

+13
-28
lines changed

4 files changed

+13
-28
lines changed

cores/arduino/USB/CDC.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,10 @@ int Serial_::peek(void)
176176

177177
int Serial_::read(void)
178178
{
179-
ring_buffer *buffer = &cdc_rx_buffer;
180-
181-
// if the head isn't ahead of the tail, we don't have any characters
182-
if (buffer->head == buffer->tail && !buffer->full)
183-
{
184-
if (usb.available(CDC_ENDPOINT_OUT))
185-
accept();
179+
if (_serialPeek != -1) {
180+
int res = _serialPeek;
181+
_serialPeek = -1;
182+
return res;
186183
}
187184
return usb.recv(CDC_ENDPOINT_OUT);
188185
}

cores/arduino/USB/USBCore.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -292,15 +292,6 @@ void USBDeviceClass::standby() {
292292
void USBDeviceClass::handleEndpoint(uint8_t ep)
293293
{
294294
#if defined(CDC_ENABLED)
295-
if (ep == CDC_ENDPOINT_OUT)
296-
{
297-
// The RAM Buffer is empty: we can receive data
298-
//usbd.epBank0ResetReady(CDC_ENDPOINT_OUT);
299-
300-
// Handle received bytes
301-
if (available(CDC_ENDPOINT_OUT))
302-
Serial.accept();
303-
}
304295
if (ep == CDC_ENDPOINT_IN)
305296
{
306297
// NAK on endpoint IN, the bank is not yet filled in.

cores/arduino/WInterrupts.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode)
102102
// Store interrupts to service in order of when they were attached
103103
// to allow for first come first serve handler
104104
uint32_t current = 0;
105+
uint32_t inMask = (1UL << in);
105106

106107
// Check if we already have this interrupt
107108
for (current=0; current<nints; current++) {
@@ -128,10 +129,6 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode)
128129
EIC->NMICTRL.bit.NMISENSE = EIC_NMICTRL_NMISENSE_HIGH;
129130
break;
130131

131-
case CHANGE:
132-
EIC->CONFIG[config].reg |= EIC_CONFIG_SENSE0_BOTH_Val << pos;
133-
break;
134-
135132
case CHANGE:
136133
EIC->NMICTRL.bit.NMISENSE = EIC_NMICTRL_NMISENSE_BOTH;
137134
break;
@@ -146,7 +143,7 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode)
146143
}
147144

148145
// Assign callback to interrupt
149-
callbacksInt[EXTERNAL_INT_NMI] = callback;
146+
ISRcallback[EXTERNAL_INT_NMI] = callback;
150147

151148
} else { // Not NMI, is external interrupt
152149

@@ -161,7 +158,7 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode)
161158
pinPeripheral(pin, PIO_EXTINT);
162159

163160
// Assign callback to interrupt
164-
callbacksInt[in] = callback;
161+
ISRcallback[in] = callback;
165162

166163
// Look for right CONFIG register to be addressed
167164
if (in > EXTERNAL_INT_7) {
@@ -208,7 +205,6 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode)
208205
EIC->CTRLA.bit.ENABLE = 1;
209206
while (EIC->SYNCBUSY.bit.ENABLE == 1) { }
210207
#endif
211-
}
212208
}
213209

214210
/*
@@ -240,7 +236,7 @@ void detachInterrupt(uint32_t pin)
240236
// Remove callback from the ISR list
241237
uint32_t current;
242238
for (current=0; current<nints; current++) {
243-
if (ISRlist[current] == inMask) {
239+
if (ISRlist[current] == (1UL << in)) {
244240
break;
245241
}
246242
}
@@ -263,8 +259,8 @@ void InterruptHandler(uint32_t i)
263259
if ((EIC->INTFLAG.reg & (1 << i)) != 0)
264260
{
265261
// Call the callback function if assigned
266-
if (callbacksInt[i]) {
267-
callbacksInt[i]();
262+
if (ISRcallback[i]) {
263+
ISRcallback[i]();
268264
}
269265

270266
// Clear the interrupt
@@ -376,6 +372,7 @@ void EIC_Handler(void)
376372
*/
377373
void NMI_Handler(void)
378374
{
379-
if (callbacksInt[EXTERNAL_INT_NMI]) callbacksInt[EXTERNAL_INT_NMI]();
375+
if (ISRcallback[EXTERNAL_INT_NMI]) ISRcallback[EXTERNAL_INT_NMI]();
380376
EIC->NMIFLAG.bit.NMI = 1; // Clear interrupt
381377
}
378+
#endif

platform.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,4 +185,4 @@ tools.openocd-withbootsize.erase.pattern=
185185

186186
tools.openocd-withbootsize.bootloader.params.verbose=-d2
187187
tools.openocd-withbootsize.bootloader.params.quiet=-d0
188-
tools.openocd-withbootsize.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; init; halt; at91samd bootloader 0; program {{{runtime.platform.path}/bootloaders/{bootloader.file}}} verify reset; shutdown"
188+
tools.openocd-withbootsize.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; init; halt; at91samd bootloader 0; program {{{runtime.platform.path}/bootloaders/{bootloader.file}}} verify reset; shutdown"

0 commit comments

Comments
 (0)