[NUCLEO_xxx] Change code optimization for us_ticker_read()

Fix issue when the hal is compiled with -O3 -Otime