mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-17 06:52:18 +01:00
Assigned Serial to UART and SerialUSB to USB-CDC-ACM
This commit is contained in:
parent
cfa77a2436
commit
2071c00ba0
@ -163,10 +163,10 @@ shiftOut KEYWORD2 ShiftOut
|
|||||||
tone KEYWORD2 Tone
|
tone KEYWORD2 Tone
|
||||||
|
|
||||||
Serial KEYWORD3 Serial
|
Serial KEYWORD3 Serial
|
||||||
Serial1 KEYWORD3 Serial
|
|
||||||
Serial2 KEYWORD3 Serial
|
Serial2 KEYWORD3 Serial
|
||||||
Serial3 KEYWORD3 Serial
|
Serial3 KEYWORD3 Serial
|
||||||
Serial4 KEYWORD3 Serial
|
Serial4 KEYWORD3 Serial
|
||||||
|
SerialUSB KEYWORD3 Serial
|
||||||
begin KEYWORD2 Serial_Begin
|
begin KEYWORD2 Serial_Begin
|
||||||
end KEYWORD2 Serial_End
|
end KEYWORD2 Serial_End
|
||||||
peek KEYWORD2 Serial_Peek
|
peek KEYWORD2 Serial_Peek
|
||||||
|
@ -34,7 +34,7 @@ class HardwareSerial : public Stream
|
|||||||
virtual void flush(void) = 0;
|
virtual void flush(void) = 0;
|
||||||
virtual size_t write(uint8_t) = 0;
|
virtual size_t write(uint8_t) = 0;
|
||||||
using Print::write; // pull in write(str) and write(buf, size) from Print
|
using Print::write; // pull in write(str) and write(buf, size) from Print
|
||||||
operator bool();
|
virtual operator bool() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern void serialEventRun(void) __attribute__((weak));
|
extern void serialEventRun(void) __attribute__((weak));
|
||||||
|
@ -54,6 +54,8 @@ class UARTClass : public HardwareSerial
|
|||||||
// virtual void write( const char *str ) ;
|
// virtual void write( const char *str ) ;
|
||||||
// virtual void write( const uint8_t *buffer, size_t size ) ;
|
// virtual void write( const uint8_t *buffer, size_t size ) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
operator bool() { return true; }; // UART always active
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _UART_CLASS_
|
#endif // _UART_CLASS_
|
||||||
|
@ -54,6 +54,8 @@ class USARTClass : public HardwareSerial
|
|||||||
// virtual void write( const char *str ) ;
|
// virtual void write( const char *str ) ;
|
||||||
// virtual void write( const uint8_t *buffer, size_t size ) ;
|
// virtual void write( const uint8_t *buffer, size_t size ) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
operator bool() { return true; }; // USART always active
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _USART_CLASS_
|
#endif // _USART_CLASS_
|
||||||
|
@ -267,6 +267,6 @@ Serial_::operator bool()
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Serial_ Serial;
|
Serial_ SerialUSB;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -61,7 +61,7 @@ public:
|
|||||||
using Print::write; // pull in write(str) from Print
|
using Print::write; // pull in write(str) from Print
|
||||||
operator bool();
|
operator bool();
|
||||||
};
|
};
|
||||||
extern Serial_ Serial;
|
extern Serial_ SerialUSB;
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
//================================================================================
|
//================================================================================
|
||||||
|
@ -598,7 +598,7 @@ static void USB_ISR(void)
|
|||||||
|
|
||||||
// Handle received bytes
|
// Handle received bytes
|
||||||
while (USBD_Available(CDC_RX))
|
while (USBD_Available(CDC_RX))
|
||||||
Serial.accept();
|
SerialUSB.accept();
|
||||||
|
|
||||||
udd_ack_fifocon(CDC_RX);
|
udd_ack_fifocon(CDC_RX);
|
||||||
}
|
}
|
||||||
|
@ -296,12 +296,12 @@ extern const PinDescription g_APinDescription[]=
|
|||||||
*/
|
*/
|
||||||
RingBuffer rx_buffer1 ;
|
RingBuffer rx_buffer1 ;
|
||||||
|
|
||||||
UARTClass Serial1( UART, UART_IRQn, ID_UART, &rx_buffer1 ) ;
|
UARTClass Serial( UART, UART_IRQn, ID_UART, &rx_buffer1 ) ;
|
||||||
|
|
||||||
// IT handlers
|
// IT handlers
|
||||||
void UART_Handler(void)
|
void UART_Handler(void)
|
||||||
{
|
{
|
||||||
Serial1.IrqHandler() ;
|
Serial.IrqHandler() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@ -364,7 +364,7 @@ void init( void )
|
|||||||
g_APinDescription[PINS_UART].ulPin,
|
g_APinDescription[PINS_UART].ulPin,
|
||||||
g_APinDescription[PINS_UART].ulPinConfiguration);
|
g_APinDescription[PINS_UART].ulPinConfiguration);
|
||||||
|
|
||||||
Serial1.begin(115200);
|
Serial.begin(115200);
|
||||||
|
|
||||||
// Initialize Serial ports USART
|
// Initialize Serial ports USART
|
||||||
PIO_Configure(
|
PIO_Configure(
|
||||||
|
@ -201,7 +201,7 @@ static const uint8_t CANTX0 = 69;
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
extern UARTClass Serial1 ;
|
extern UARTClass Serial ;
|
||||||
|
|
||||||
extern USARTClass Serial2 ;
|
extern USARTClass Serial2 ;
|
||||||
extern USARTClass Serial3 ;
|
extern USARTClass Serial3 ;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user