Updated with commits that had been applied to Leaflabs:libmaple since the original copy of the repo was taken (by BobC) in Nov 2014
This commit is contained in:
parent
58df3f36b4
commit
912098d5b8
|
@ -72,9 +72,17 @@ void USBSerial::begin(void) {
|
||||||
//Roger Clark. Two new begin functions has been added so that normal Arduino Sketches that use Serial.begin(xxx) will compile.
|
//Roger Clark. Two new begin functions has been added so that normal Arduino Sketches that use Serial.begin(xxx) will compile.
|
||||||
void USBSerial::begin(unsigned long ignoreBaud)
|
void USBSerial::begin(unsigned long ignoreBaud)
|
||||||
{
|
{
|
||||||
|
volatile unsigned long removeCompilerWarningsIgnoreBaud=ignoreBaud;
|
||||||
|
|
||||||
|
ignoreBaud=removeCompilerWarningsIgnoreBaud;
|
||||||
}
|
}
|
||||||
void USBSerial::begin(unsigned long ignoreBaud, uint8_t ignore)
|
void USBSerial::begin(unsigned long ignoreBaud, uint8_t ignore)
|
||||||
{
|
{
|
||||||
|
volatile unsigned long removeCompilerWarningsIgnoreBaud=ignoreBaud;
|
||||||
|
volatile uint8_t removeCompilerWarningsIgnore=ignore;
|
||||||
|
|
||||||
|
ignoreBaud=removeCompilerWarningsIgnoreBaud;
|
||||||
|
ignore=removeCompilerWarningsIgnore;
|
||||||
}
|
}
|
||||||
|
|
||||||
void USBSerial::end(void) {
|
void USBSerial::end(void) {
|
||||||
|
|
|
@ -38,10 +38,11 @@
|
||||||
* in the series support files, which need dma_irq_handler().) */
|
* in the series support files, which need dma_irq_handler().) */
|
||||||
#ifdef DMA_GET_HANDLER
|
#ifdef DMA_GET_HANDLER
|
||||||
static __always_inline void dma_irq_handler(dma_dev *dev, dma_tube tube) {
|
static __always_inline void dma_irq_handler(dma_dev *dev, dma_tube tube) {
|
||||||
dma_clear_isr_bits(dev, tube); /* in case handler doesn't */
|
|
||||||
void (*handler)(void) = DMA_GET_HANDLER(dev, tube);
|
void (*handler)(void) = DMA_GET_HANDLER(dev, tube);
|
||||||
if (handler) {
|
if (handler) {
|
||||||
handler();
|
handler();
|
||||||
|
dma_clear_isr_bits(dev, tube); /* in case handler doesn't */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -38,6 +38,12 @@
|
||||||
#include <libmaple/usart.h>
|
#include <libmaple/usart.h>
|
||||||
|
|
||||||
static __always_inline void usart_irq(ring_buffer *rb, usart_reg_map *regs) {
|
static __always_inline void usart_irq(ring_buffer *rb, usart_reg_map *regs) {
|
||||||
|
/* We can get RXNE and ORE interrupts here. Only RXNE signifies
|
||||||
|
* availability of a byte in DR.
|
||||||
|
*
|
||||||
|
* See table 198 (sec 27.4, p809) in STM document RM0008 rev 15.
|
||||||
|
* We enable RXNEIE. */
|
||||||
|
if (regs->SR & USART_SR_RXNE) {
|
||||||
#ifdef USART_SAFE_INSERT
|
#ifdef USART_SAFE_INSERT
|
||||||
/* If the buffer is full and the user defines USART_SAFE_INSERT,
|
/* If the buffer is full and the user defines USART_SAFE_INSERT,
|
||||||
* ignore new bytes. */
|
* ignore new bytes. */
|
||||||
|
@ -46,6 +52,7 @@ static __always_inline void usart_irq(ring_buffer *rb, usart_reg_map *regs) {
|
||||||
/* By default, push bytes around in the ring buffer. */
|
/* By default, push bytes around in the ring buffer. */
|
||||||
rb_push_insert(rb, (uint8)regs->DR);
|
rb_push_insert(rb, (uint8)regs->DR);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 _usart_clock_freq(usart_dev *dev);
|
uint32 _usart_clock_freq(usart_dev *dev);
|
||||||
|
|
Loading…
Reference in New Issue