File tree Expand file tree Collapse file tree 3 files changed +7
-6
lines changed
system/libmaple/include/libmaple
variants/generic_stm32f103t/wirish Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -193,7 +193,8 @@ size_t HardwareSerial::write(unsigned char ch) {
193193 return 1 ;
194194}
195195
196+ /* edogaldo: Waits for the transmission of outgoing serial data to complete (Arduino 1.0 api specs) */
196197void HardwareSerial::flush (void ) {
197- usart_reset_rx ( this ->usart_device );
198- usart_reset_tx ( this ->usart_device );
198+ while (! rb_is_empty ( this ->usart_device -> wb )); // wait for TX buffer empty
199+ while (!(( this ->usart_device -> regs -> SR ) & ( 1 <<USART_SR_TC_BIT))); // wait for TC (Transmission Complete) flag set
199200}
Original file line number Diff line number Diff line change @@ -52,9 +52,9 @@ extern "C"{
5252 * One byte is left free to distinguish empty from full. */
5353typedef struct ring_buffer {
5454 volatile uint8 * buf ; /**< Buffer items are stored into */
55- uint16 head ; /**< Index of the next item to remove */
56- uint16 tail ; /**< Index where the next item will get inserted */
57- uint16 size ; /**< Buffer capacity minus one */
55+ volatile uint16 head ; /**< Index of the next item to remove */
56+ volatile uint16 tail ; /**< Index where the next item will get inserted */
57+ volatile uint16 size ; /**< Buffer capacity minus one */
5858} ring_buffer ;
5959
6060/**
Original file line number Diff line number Diff line change @@ -179,7 +179,7 @@ nvic_init((uint32)VECT_TAB_ADDR, 0);
179179*/
180180}
181181
182- static void adc_default_config (const adc_dev *dev) {
182+ static void adc_default_config (adc_dev *dev) {
183183 adc_enable_single_swstart (dev);
184184 adc_set_sample_rate (dev, wirish::priv::w_adc_smp);
185185}
You can’t perform that action at this time.
0 commit comments