This commit is contained in:
Roger Clark 2017-05-25 20:07:48 +10:00
commit ccddc1f354
3 changed files with 7 additions and 6 deletions

View File

@ -193,7 +193,8 @@ size_t HardwareSerial::write(unsigned char ch) {
return 1;
}
/* edogaldo: Waits for the transmission of outgoing serial data to complete (Arduino 1.0 api specs) */
void HardwareSerial::flush(void) {
usart_reset_rx(this->usart_device);
usart_reset_tx(this->usart_device);
while(!rb_is_empty(this->usart_device->wb)); // wait for TX buffer empty
while(!((this->usart_device->regs->SR) & (1<<USART_SR_TC_BIT))); // wait for TC (Transmission Complete) flag set
}

View File

@ -52,9 +52,9 @@ extern "C"{
* One byte is left free to distinguish empty from full. */
typedef struct ring_buffer {
volatile uint8 *buf; /**< Buffer items are stored into */
uint16 head; /**< Index of the next item to remove */
uint16 tail; /**< Index where the next item will get inserted */
uint16 size; /**< Buffer capacity minus one */
volatile uint16 head; /**< Index of the next item to remove */
volatile uint16 tail; /**< Index where the next item will get inserted */
volatile uint16 size; /**< Buffer capacity minus one */
} ring_buffer;
/**

View File

@ -179,7 +179,7 @@ nvic_init((uint32)VECT_TAB_ADDR, 0);
*/
}
static void adc_default_config(const adc_dev *dev) {
static void adc_default_config(adc_dev *dev) {
adc_enable_single_swstart(dev);
adc_set_sample_rate(dev, wirish::priv::w_adc_smp);
}