energia / tivac-core

7 stars 17 forks source link

Initialize HardwareSerial buffers before interrupts are enabled #17

Closed MarSik closed 7 years ago

MarSik commented 7 years ago

There is a slight chance (when connected device is slow) that an interrupt event will be generated immediately after interrups are enabled for the serial peripheral.

This will run the interrupt routine that already expects all buffers to be initialized.

Also make sure the compiler knows that buffer counters cannot be optimized, because they are accessed from interrupt handlers.

Signed-off-by: Martin Sivak mars@montik.net

robertinant commented 7 years ago

Thanks for the pull request!