Skip to content

Commit

Permalink
disambiguate pins and sets
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobrosenthal committed Dec 8, 2020
1 parent 0da09cf commit 10493bf
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 35 deletions.
6 changes: 3 additions & 3 deletions boards/pygamer/examples/button_rtic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const APP: () = {
&mut device.NVMCTRL,
);

let mut pins = Pins::new(device.PORT).split();
let mut sets = Pins::new(device.PORT).split();

let gclk0 = clocks.gclk0();
let timer_clock = clocks.tc2_tc3(&gclk0).unwrap();
Expand All @@ -61,8 +61,8 @@ const APP: () = {
tc3.enable_interrupt();

init::LateResources {
buttons: pins.buttons.init(&mut pins.port),
red_led: pins.led_pin.into_open_drain_output(&mut pins.port),
buttons: sets.buttons.init(&mut sets.port),
red_led: sets.led_pin.into_open_drain_output(&mut sets.port),
timer: tc3,
}
}
Expand Down
6 changes: 3 additions & 3 deletions boards/pygamer/examples/ferris_img.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@ fn main() -> ! {
&mut peripherals.OSCCTRL,
&mut peripherals.NVMCTRL,
);
let mut pins = Pins::new(peripherals.PORT).split();
let mut sets = Pins::new(peripherals.PORT).split();
let mut delay = hal::delay::Delay::new(core.SYST, &mut clocks);

let (mut display, _backlight) = pins
let (mut display, _backlight) = sets
.display
.init(
&mut clocks,
peripherals.SERCOM4,
&mut peripherals.MCLK,
peripherals.TC2,
&mut delay,
&mut pins.port,
&mut sets.port,
)
.unwrap();

Expand Down
6 changes: 3 additions & 3 deletions boards/pygamer/examples/neopixel_adc_battery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ fn main() -> ! {
&mut peripherals.OSCCTRL,
&mut peripherals.NVMCTRL,
);
let mut pins = Pins::new(peripherals.PORT).split();
let mut sets = Pins::new(peripherals.PORT).split();

let mut adc0 = Adc::adc0(peripherals.ADC0, &mut peripherals.MCLK, &mut clocks, GCLK11);
let mut battery = pins.battery.init(&mut pins.port);
let mut battery = sets.battery.init(&mut sets.port);

// neopixels
let timer = SpinTimer::new(4);
let mut neopixel = pins.neopixel.init(timer, &mut pins.port);
let mut neopixel = sets.neopixel.init(timer, &mut sets.port);

let mut delay = Delay::new(core.SYST, &mut clocks);

Expand Down
8 changes: 4 additions & 4 deletions boards/pygamer/examples/neopixel_button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ fn main() -> ! {
);

let mut delay = Delay::new(core_peripherals.SYST, &mut clocks);
let mut pins = Pins::new(peripherals.PORT).split();
let mut sets = Pins::new(peripherals.PORT).split();

let mut buttons = pins.buttons.init(&mut pins.port);
let mut buttons = sets.buttons.init(&mut sets.port);

let mut adc1 = Adc::adc1(peripherals.ADC1, &mut peripherals.MCLK, &mut clocks, GCLK11);
let mut joystick = pins.joystick.init(&mut pins.port);
let mut joystick = sets.joystick.init(&mut sets.port);

// neopixels
let timer = SpinTimer::new(4);

let mut neopixel = pins.neopixel.init(timer, &mut pins.port);
let mut neopixel = sets.neopixel.init(timer, &mut sets.port);

const NUM_LEDS: usize = 5;
let mut pos_button: usize = 2;
Expand Down
4 changes: 2 additions & 2 deletions boards/pygamer/examples/neopixel_easing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ fn main() -> ! {
&mut peripherals.NVMCTRL,
);

let mut pins = Pins::new(peripherals.PORT).split();
let mut sets = Pins::new(peripherals.PORT).split();
let timer = SpinTimer::new(4);

let mut neopixel = pins.neopixel.init(timer, &mut pins.port);
let mut neopixel = sets.neopixel.init(timer, &mut sets.port);
let mut delay = Delay::new(core.SYST, &mut clocks);

let trng = Trng::new(&mut peripherals.MCLK, peripherals.TRNG);
Expand Down
4 changes: 2 additions & 2 deletions boards/pygamer/examples/neopixel_rainbow_timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ fn main() -> ! {
&mut peripherals.OSCCTRL,
&mut peripherals.NVMCTRL,
);
let mut pins = Pins::new(peripherals.PORT).split();
let mut sets = Pins::new(peripherals.PORT).split();

let gclk0 = clocks.gclk0();
let timer_clock = clocks.tc2_tc3(&gclk0).unwrap();
let mut timer = TimerCounter::tc3_(&timer_clock, peripherals.TC3, &mut peripherals.MCLK);
timer.start(3.mhz());

let mut neopixel = pins.neopixel.init(timer, &mut pins.port);
let mut neopixel = sets.neopixel.init(timer, &mut sets.port);
let mut delay = Delay::new(core.SYST, &mut clocks);

loop {
Expand Down
8 changes: 4 additions & 4 deletions boards/pygamer/examples/neopixel_tilt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@ fn main() -> ! {
);

let mut delay = Delay::new(core_peripherals.SYST, &mut clocks);
let mut pins = Pins::new(peripherals.PORT).split();
let mut sets = Pins::new(peripherals.PORT).split();

// neopixels
let timer = SpinTimer::new(4);
let mut neopixel = pins.neopixel.init(timer, &mut pins.port);
let mut neopixel = sets.neopixel.init(timer, &mut sets.port);

// i2c
let i2c = pins.i2c.init(
let i2c = sets.i2c.init(
&mut clocks,
KiloHertz(400),
peripherals.SERCOM2,
&mut peripherals.MCLK,
&mut pins.port,
&mut sets.port,
);

let mut lis3dh = Lis3dh::new(i2c, 0x19).unwrap();
Expand Down
12 changes: 6 additions & 6 deletions boards/pygamer/examples/sd_card.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,22 @@ fn main() -> ! {
);
let mut delay = Delay::new(core.SYST, &mut clocks);

let mut pins = Pins::new(peripherals.PORT).split();
let mut sets = Pins::new(peripherals.PORT).split();

let mut red_led = pins.led_pin.into_open_drain_output(&mut pins.port);
let mut red_led = sets.led_pin.into_open_drain_output(&mut sets.port);

let sdmmc_cs: OldOutputPin<_> = pins.sd_cs_pin.into_push_pull_output(&mut pins.port).into();
let sdmmc_spi = pins.spi.init(
let sdmmc_cs: OldOutputPin<_> = sets.sd_cs_pin.into_push_pull_output(&mut sets.port).into();
let sdmmc_spi = sets.spi.init(
&mut clocks,
MegaHertz(3),
peripherals.SERCOM1,
&mut peripherals.MCLK,
&mut pins.port,
&mut sets.port,
);
let mut cont =
embedded_sdmmc::Controller::new(embedded_sdmmc::SdMmcSpi::new(sdmmc_spi, sdmmc_cs), Clock);

let (mut display, _backlight) = pins
let (mut display, _backlight) = sets
.display
.init(
&mut clocks,
Expand Down
8 changes: 4 additions & 4 deletions boards/pygamer/examples/usb_poll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ fn main() -> ! {
&mut peripherals.NVMCTRL,
);

let mut pins = Pins::new(peripherals.PORT).split();
let mut sets = Pins::new(peripherals.PORT).split();

let usb_bus = pins.usb.init(
let usb_bus = sets.usb.init(
peripherals.USB,
&mut clocks,
&mut peripherals.MCLK,
&mut pins.port,
&mut sets.port,
);

let mut serial = SerialPort::new(&usb_bus);
let mut led = pins.led_pin.into_open_drain_output(&mut pins.port);
let mut led = sets.led_pin.into_open_drain_output(&mut sets.port);

let mut usb_dev = UsbDeviceBuilder::new(&usb_bus, UsbVidPid(0x16c0, 0x27dd))
.manufacturer("Fake company")
Expand Down
8 changes: 4 additions & 4 deletions boards/pygamer/examples/usb_serial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@ fn main() -> ! {
&mut peripherals.OSCCTRL,
&mut peripherals.NVMCTRL,
);
let mut pins = Pins::new(peripherals.PORT).split();
let mut sets = Pins::new(peripherals.PORT).split();

let timer = SpinTimer::new(4);
let mut neopixel = pins.neopixel.init(timer, &mut pins.port);
let mut neopixel = sets.neopixel.init(timer, &mut sets.port);

let _ = neopixel.write((0..5).map(|_| RGB8::default()));

let bus_allocator = unsafe {
USB_ALLOCATOR = Some(pins.usb.init(
USB_ALLOCATOR = Some(sets.usb.init(
peripherals.USB,
&mut clocks,
&mut peripherals.MCLK,
&mut pins.port,
&mut sets.port,
));
USB_ALLOCATOR.as_ref().unwrap()
};
Expand Down

0 comments on commit 10493bf

Please sign in to comment.