Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Address clippy naming warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mciantyre committed Mar 30, 2021
1 parent 6def511 commit 778cab4
Show file tree
Hide file tree
Showing 15 changed files with 131 additions and 131 deletions.
8 changes: 4 additions & 4 deletions examples/teensy4/src/bin/forgotten.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static DATA: u32 = 0;
/// Prepare to receive UART data from a DMA transfer into stack memory
#[inline(never)]
fn prepare_receive(
uart: &mut hal::UART<hal::iomuxc::consts::U2, P14, P15>,
uart: &mut hal::Uart<hal::iomuxc::consts::U2, P14, P15>,
channel: &mut hal::dma::Channel,
) {
let mut buffer: [u8; 8] = [0; 8];
Expand All @@ -62,7 +62,7 @@ fn prepare_receive(

/// Watch the stack memory, and turn on the LED when its non-zero
#[inline(never)]
fn watch_stack(led: &mut hal::gpio::GPIO<P13, hal::gpio::Output>) -> ! {
fn watch_stack(led: &mut hal::gpio::Gpio<P13, hal::gpio::Output>) -> ! {
let buffer: [u8; 256] = [0; 256];
loop {
for elem in &buffer {
Expand All @@ -80,7 +80,7 @@ fn watch_stack(led: &mut hal::gpio::GPIO<P13, hal::gpio::Output>) -> ! {
fn main() -> ! {
let pads = hal::iomuxc::new(hal::ral::iomuxc::IOMUXC::take().unwrap());
let pins = teensy4_pins::t40::into_pins(pads);
let mut led = hal::gpio::GPIO::new(pins.p13).output();
let mut led = hal::gpio::Gpio::new(pins.p13).output();

let ccm = hal::ral::ccm::CCM::take().unwrap();
ral::modify_reg!(ral::ccm, ccm, CSCDR1, UART_CLK_SEL: 1 /* XTAL */, UART_CLK_PODF: 0);
Expand All @@ -95,7 +95,7 @@ fn main() -> ! {
);

let uart2 = hal::ral::lpuart::LPUART2::take().unwrap();
let mut uart = hal::UART::new(uart2, pins.p14, pins.p15);
let mut uart = hal::Uart::new(uart2, pins.p14, pins.p15);
let mut channel = channels[7].take().unwrap();
uart.set_baud(BAUD, 24_000_000 /* XTAL Hz */).unwrap();

Expand Down
18 changes: 9 additions & 9 deletions examples/teensy4/src/bin/gpio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ use hal::gpio;
use imxrt_async_hal as hal;

async fn connect<P, Q>(
mut input: gpio::GPIO<P, gpio::Input>,
mut output: gpio::GPIO<Q, gpio::Output>,
mut input: gpio::Gpio<P, gpio::Input>,
mut output: gpio::Gpio<Q, gpio::Output>,
) -> !
where
P: hal::iomuxc::gpio::Pin,
Expand All @@ -40,7 +40,7 @@ where
fn main() -> ! {
let pads = hal::iomuxc::new(hal::ral::iomuxc::IOMUXC::take().unwrap());
let pins = teensy4_pins::t40::into_pins(pads);
let mut p13 = hal::gpio::GPIO::new(pins.p13).output();
let mut p13 = hal::gpio::Gpio::new(pins.p13).output();

let ccm = hal::ral::ccm::CCM::take().unwrap();
let (_, _, mut timer) = t4_startup::new_gpt(hal::ral::gpt::GPT2::take().unwrap(), &ccm);
Expand All @@ -51,16 +51,16 @@ fn main() -> ! {
}
};

let p12 = hal::gpio::GPIO::new(pins.p12);
let p14 = hal::gpio::GPIO::new(pins.p14).output();
let p12 = hal::gpio::Gpio::new(pins.p12);
let p14 = hal::gpio::Gpio::new(pins.p14).output();
let twos = connect(p12, p14);

let p11 = hal::gpio::GPIO::new(pins.p11);
let p15 = hal::gpio::GPIO::new(pins.p15).output();
let p11 = hal::gpio::Gpio::new(pins.p11);
let p15 = hal::gpio::Gpio::new(pins.p15).output();
let fours = connect(p11, p15);

let p10 = hal::gpio::GPIO::new(pins.p10);
let p16 = hal::gpio::GPIO::new(pins.p16).output();
let p10 = hal::gpio::Gpio::new(pins.p10);
let p16 = hal::gpio::Gpio::new(pins.p16).output();
let eights = connect(p10, p16);

async_embedded::task::block_on(future::join4(ones, twos, fours, eights));
Expand Down
6 changes: 3 additions & 3 deletions examples/teensy4/src/bin/gpt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ use imxrt_async_hal as hal;
fn main() -> ! {
let pads = hal::iomuxc::new(hal::ral::iomuxc::IOMUXC::take().unwrap());
let pins = teensy4_pins::t40::into_pins(pads);
let mut led = hal::gpio::GPIO::new(pins.p13).output();
let mut pin14 = hal::gpio::GPIO::new(pins.p14).output();
let mut led = hal::gpio::Gpio::new(pins.p13).output();
let mut pin14 = hal::gpio::Gpio::new(pins.p14).output();

let ccm = ral::ccm::CCM::take().unwrap();
// Select 24MHz crystal oscillator, divide by 24 == 1MHz clock
Expand All @@ -34,7 +34,7 @@ fn main() -> ! {
);
ral::write_reg!(ral::gpt, gpt, PR, PRESCALER24M: 4); // 1MHz / 5 == 200KHz

let (mut blink_timer, mut gpio_timer, _) = hal::GPT::new(gpt);
let (mut blink_timer, mut gpio_timer, _) = hal::Gpt::new(gpt);
let blink_loop = async {
loop {
blink_timer.delay(250_000u32 / 5).await;
Expand Down
10 changes: 5 additions & 5 deletions examples/teensy4/src/bin/i2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ extern crate panic_halt;
extern crate t4_startup;

use hal::{
gpio::GPIO,
gpio::Gpio,
iomuxc,
ral::{self, ccm::CCM, gpt::GPT1, iomuxc::IOMUXC, lpi2c::LPI2C3},
I2C,
I2c,
};
use imxrt_async_hal as hal;

const MPU9250_ADDRESS: u8 = 0x68;
const WHO_AM_I: u8 = 0x75;
const ACCEL_XOUT_H: u8 = 0x3B;
const CLOCK_SPEED: hal::I2CClockSpeed = hal::I2CClockSpeed::KHz400;
const CLOCK_SPEED: hal::I2cClockSpeed = hal::I2cClockSpeed::KHz400;

const SOURCE_CLOCK_HZ: u32 = 24_000_000;
const SOURCE_CLOCK_DIVIDER: u32 = 3;
Expand Down Expand Up @@ -61,10 +61,10 @@ fn main() -> ! {
ral::modify_reg!(ral::ccm, ccm, CCGR2, CG5: 0b11);
let (mut timer, _, _) = t4_startup::new_gpt(GPT1::take().unwrap(), &ccm);

let mut led = GPIO::new(pins.p13).output();
let mut led = Gpio::new(pins.p13).output();

let i2c3 = LPI2C3::take().unwrap();
let mut i2c = I2C::new(i2c3, pins.p16, pins.p17);
let mut i2c = I2c::new(i2c3, pins.p16, pins.p17);
i2c.set_clock_speed(CLOCK_SPEED, SOURCE_CLOCK_HZ / SOURCE_CLOCK_DIVIDER)
.unwrap();

Expand Down
4 changes: 2 additions & 2 deletions examples/teensy4/src/bin/pit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use imxrt_async_hal as hal;
fn main() -> ! {
let pads = hal::iomuxc::new(hal::ral::iomuxc::IOMUXC::take().unwrap());
let pins = teensy4_pins::t40::into_pins(pads);
let mut led = hal::gpio::GPIO::new(pins.p13).output();
let mut led = hal::gpio::Gpio::new(pins.p13).output();

let ccm = ral::ccm::CCM::take().unwrap();
// Select 24MHz crystal oscillator, divide by 24 == 1MHz clock
Expand All @@ -24,7 +24,7 @@ fn main() -> ! {
ral::modify_reg!(ral::ccm, ccm, CCGR1, CG6: 0b11);
ral::ccm::CCM::release(ccm);

let (mut pit, _, _, _) = ral::pit::PIT::take().map(hal::PIT::new).unwrap();
let (mut pit, _, _, _) = ral::pit::PIT::take().map(hal::Pit::new).unwrap();
let blink_loop = async {
loop {
const DELAY_MS: u32 = 250_000; // 1MHz clock, 1us period
Expand Down
6 changes: 3 additions & 3 deletions examples/teensy4/src/bin/spi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const SOURCE_CLOCK_DIVIDER: u32 = 5;
fn main() -> ! {
let pads = hal::iomuxc::new(hal::ral::iomuxc::IOMUXC::take().unwrap());
let pins = teensy4_pins::t40::into_pins(pads);
let mut hardware_flag = hal::gpio::GPIO::new(pins.p14).output();
let mut hardware_flag = hal::gpio::Gpio::new(pins.p14).output();
hardware_flag.clear();

let ccm = hal::ral::ccm::CCM::take().unwrap();
Expand All @@ -57,13 +57,13 @@ fn main() -> ! {
);

let spi4 = hal::ral::lpspi::LPSPI4::take().unwrap();
let pins = hal::SPIPins {
let pins = hal::SpiPins {
sdo: pins.p11,
sdi: pins.p12,
sck: pins.p13,
pcs0: pins.p10,
};
let mut spi = hal::SPI::new(pins, spi4);
let mut spi = hal::Spi::new(pins, spi4);
let mut tx_channel = channels[8].take().unwrap();
let mut rx_channel = channels[9].take().unwrap();
tx_channel.set_interrupt_on_completion(true);
Expand Down
4 changes: 2 additions & 2 deletions examples/teensy4/src/bin/uart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const CLOCK_DIVIDER: u32 = 1;
fn main() -> ! {
let pads = hal::iomuxc::new(hal::ral::iomuxc::IOMUXC::take().unwrap());
let pins = teensy4_pins::t40::into_pins(pads);
let mut led = hal::gpio::GPIO::new(pins.p13).output();
let mut led = hal::gpio::Gpio::new(pins.p13).output();
let gpt = hal::ral::gpt::GPT2::take().unwrap();

let ccm = hal::ral::ccm::CCM::take().unwrap();
Expand All @@ -47,7 +47,7 @@ fn main() -> ! {
);

let uart2 = hal::ral::lpuart::LPUART2::take().unwrap();
let mut uart = hal::UART::new(uart2, pins.p14, pins.p15);
let mut uart = hal::Uart::new(uart2, pins.p14, pins.p15);
let mut channel = channels[7].take().unwrap();
channel.set_interrupt_on_completion(true);
uart.set_baud(BAUD, CLOCK_FREQUENCY_HZ / CLOCK_DIVIDER)
Expand Down
8 changes: 4 additions & 4 deletions examples/teensy4/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ unsafe fn pre_init() {
pub fn new_gpt<N>(
gpt: ral::gpt::Instance<N>,
ccm: &ral::ccm::Instance,
) -> (hal::GPT, hal::GPT, hal::GPT) {
) -> (hal::Gpt, hal::Gpt, hal::Gpt) {
// Select 24MHz crystal oscillator, divide by 24 == 1MHz clock
ral::modify_reg!(ral::ccm, ccm, CSCMR1, PERCLK_PODF: DIVIDE_24, PERCLK_CLK_SEL: 1);

Expand All @@ -54,15 +54,15 @@ pub fn new_gpt<N>(
);
ral::write_reg!(ral::gpt, gpt, PR, PRESCALER24M: 4); // 1MHz / 5 == 200KHz

hal::GPT::new(gpt)
hal::Gpt::new(gpt)
}

/// Use a GPT to delay `ms` milliseconds
pub async fn gpt_delay_ms(gpt: &mut hal::GPT, ms: u32) {
pub async fn gpt_delay_ms(gpt: &mut hal::Gpt, ms: u32) {
gpt.delay(ms * 1_000 / 5).await
}

/// Use a GPT to delay `us` microseconds
pub async fn gpt_delay_us(gpt: &mut hal::GPT, us: u32) {
pub async fn gpt_delay_us(gpt: &mut hal::Gpt, us: u32) {
gpt.delay(us / 5).await
}
Loading

0 comments on commit 778cab4

Please sign in to comment.