Remove redundant variable in pico uart examples

This removes the hard-coded XTAL_FREQ_HZ variable from the rp-pico UART
examples as it's already defined in this library as XOSC_CRYSTAL_FREQ.

I noticed this as I was looking thru the examples and it seems like most of
them use the rp_pico::XOSC_CRYSTAL_FREQ value instead. I'm new to embedded so
please let me know if I got something wrong here. Thanks!
This commit is contained in:
Nathan Marley 2023-05-01 11:33:34 -03:00
parent 2f8d0f4404
commit 8b7c67ee47
2 changed files with 2 additions and 10 deletions

View file

@ -73,10 +73,6 @@ struct UartQueue {
interrupt: pac::Interrupt,
}
/// External high-speed crystal on the Raspberry Pi Pico board is 12 MHz. Adjust
/// if your board has a different frequency
const XTAL_FREQ_HZ: u32 = 12_000_000u32;
/// This how we transfer the UART into the Interrupt Handler
static GLOBAL_UART: Mutex<RefCell<Option<Uart>>> = Mutex::new(RefCell::new(None));
@ -105,7 +101,7 @@ fn main() -> ! {
// Configure the clocks
let clocks = hal::clocks::init_clocks_and_plls(
XTAL_FREQ_HZ,
rp_pico::XOSC_CRYSTAL_FREQ,
pac.XOSC,
pac.CLOCKS,
pac.PLL_SYS,

View file

@ -64,10 +64,6 @@ type UartPins = (
/// Alias the type for our UART to make things clearer.
type Uart = hal::uart::UartPeripheral<hal::uart::Enabled, pac::UART0, UartPins>;
/// External high-speed crystal on the Raspberry Pi Pico board is 12 MHz. Adjust
/// if your board has a different frequency
const XTAL_FREQ_HZ: u32 = 12_000_000u32;
/// This how we transfer the UART into the Interrupt Handler
static GLOBAL_UART: Mutex<RefCell<Option<Uart>>> = Mutex::new(RefCell::new(None));
@ -89,7 +85,7 @@ fn main() -> ! {
// Configure the clocks
let clocks = hal::clocks::init_clocks_and_plls(
XTAL_FREQ_HZ,
rp_pico::XOSC_CRYSTAL_FREQ,
pac.XOSC,
pac.CLOCKS,
pac.PLL_SYS,