DM: fix stuff from rebase
This commit is contained in:
parent
0e9c85f8a1
commit
b7e942d924
4 changed files with 13 additions and 28 deletions
|
|
@ -176,13 +176,10 @@ int Serial_::peek(void)
|
|||
|
||||
int Serial_::read(void)
|
||||
{
|
||||
ring_buffer *buffer = &cdc_rx_buffer;
|
||||
|
||||
// if the head isn't ahead of the tail, we don't have any characters
|
||||
if (buffer->head == buffer->tail && !buffer->full)
|
||||
{
|
||||
if (usb.available(CDC_ENDPOINT_OUT))
|
||||
accept();
|
||||
if (_serialPeek != -1) {
|
||||
int res = _serialPeek;
|
||||
_serialPeek = -1;
|
||||
return res;
|
||||
}
|
||||
return usb.recv(CDC_ENDPOINT_OUT);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -292,15 +292,6 @@ void USBDeviceClass::standby() {
|
|||
void USBDeviceClass::handleEndpoint(uint8_t ep)
|
||||
{
|
||||
#if defined(CDC_ENABLED)
|
||||
if (ep == CDC_ENDPOINT_OUT)
|
||||
{
|
||||
// The RAM Buffer is empty: we can receive data
|
||||
//usbd.epBank0ResetReady(CDC_ENDPOINT_OUT);
|
||||
|
||||
// Handle received bytes
|
||||
if (available(CDC_ENDPOINT_OUT))
|
||||
Serial.accept();
|
||||
}
|
||||
if (ep == CDC_ENDPOINT_IN)
|
||||
{
|
||||
// NAK on endpoint IN, the bank is not yet filled in.
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode)
|
|||
// Store interrupts to service in order of when they were attached
|
||||
// to allow for first come first serve handler
|
||||
uint32_t current = 0;
|
||||
uint32_t inMask = (1UL << in);
|
||||
|
||||
// Check if we already have this interrupt
|
||||
for (current=0; current<nints; current++) {
|
||||
|
|
@ -128,10 +129,6 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode)
|
|||
EIC->NMICTRL.bit.NMISENSE = EIC_NMICTRL_NMISENSE_HIGH;
|
||||
break;
|
||||
|
||||
case CHANGE:
|
||||
EIC->CONFIG[config].reg |= EIC_CONFIG_SENSE0_BOTH_Val << pos;
|
||||
break;
|
||||
|
||||
case CHANGE:
|
||||
EIC->NMICTRL.bit.NMISENSE = EIC_NMICTRL_NMISENSE_BOTH;
|
||||
break;
|
||||
|
|
@ -146,7 +143,7 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode)
|
|||
}
|
||||
|
||||
// Assign callback to interrupt
|
||||
callbacksInt[EXTERNAL_INT_NMI] = callback;
|
||||
ISRcallback[EXTERNAL_INT_NMI] = callback;
|
||||
|
||||
} else { // Not NMI, is external interrupt
|
||||
|
||||
|
|
@ -161,7 +158,7 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode)
|
|||
pinPeripheral(pin, PIO_EXTINT);
|
||||
|
||||
// Assign callback to interrupt
|
||||
callbacksInt[in] = callback;
|
||||
ISRcallback[in] = callback;
|
||||
|
||||
// Look for right CONFIG register to be addressed
|
||||
if (in > EXTERNAL_INT_7) {
|
||||
|
|
@ -208,7 +205,6 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode)
|
|||
EIC->CTRLA.bit.ENABLE = 1;
|
||||
while (EIC->SYNCBUSY.bit.ENABLE == 1) { }
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -240,7 +236,7 @@ void detachInterrupt(uint32_t pin)
|
|||
// Remove callback from the ISR list
|
||||
uint32_t current;
|
||||
for (current=0; current<nints; current++) {
|
||||
if (ISRlist[current] == inMask) {
|
||||
if (ISRlist[current] == (1UL << in)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -263,8 +259,8 @@ void InterruptHandler(uint32_t i)
|
|||
if ((EIC->INTFLAG.reg & (1 << i)) != 0)
|
||||
{
|
||||
// Call the callback function if assigned
|
||||
if (callbacksInt[i]) {
|
||||
callbacksInt[i]();
|
||||
if (ISRcallback[i]) {
|
||||
ISRcallback[i]();
|
||||
}
|
||||
|
||||
// Clear the interrupt
|
||||
|
|
@ -376,6 +372,7 @@ void EIC_Handler(void)
|
|||
*/
|
||||
void NMI_Handler(void)
|
||||
{
|
||||
if (callbacksInt[EXTERNAL_INT_NMI]) callbacksInt[EXTERNAL_INT_NMI]();
|
||||
if (ISRcallback[EXTERNAL_INT_NMI]) ISRcallback[EXTERNAL_INT_NMI]();
|
||||
EIC->NMIFLAG.bit.NMI = 1; // Clear interrupt
|
||||
}
|
||||
#endif
|
||||
|
|
@ -185,4 +185,4 @@ tools.openocd-withbootsize.erase.pattern=
|
|||
|
||||
tools.openocd-withbootsize.bootloader.params.verbose=-d2
|
||||
tools.openocd-withbootsize.bootloader.params.quiet=-d0
|
||||
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"
|
||||
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"
|
||||
Loading…
Reference in a new issue