Skip to content

Commit

Permalink
edgebadge: change imports to fix docs BREAKING
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobrosenthal committed Dec 3, 2020
1 parent f5ca7fb commit c39e6d4
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 33 deletions.
2 changes: 1 addition & 1 deletion boards/edgebadge/examples/blinky_basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![no_std]
#![no_main]

use edgebadge::{self as hal, entry, pac, Pins};
use edgebadge::{entry, hal, pac, Pins};
use panic_halt as _;

use hal::clock::GenericClockController;
Expand Down
4 changes: 2 additions & 2 deletions boards/edgebadge/examples/button_rtic.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#![no_std]
#![no_main]

use edgebadge::{self as hal, pins::ButtonReader, pins::Keys, Pins};
use edgebadge::{hal, ButtonReader, Keys, Pins};
use panic_halt as _;

use hal::clock::GenericClockController;
use hal::gpio::{OpenDrain, Output, Pa23};
use hal::prelude::*;
use rtic::app;

#[app(device = crate::hal::pac, peripherals = true)]
#[app(device = edgebadge::pac, peripherals = true)]
const APP: () = {
struct Resources {
red_led: Pa23<Output<OpenDrain>>,
Expand Down
2 changes: 1 addition & 1 deletion boards/edgebadge/examples/ferris_img.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#![no_std]
#![no_main]

use edgebadge::{self as hal, entry, pac, Pins};
use edgebadge::{entry, hal, pac, Pins};
use panic_halt as _;

use embedded_graphics::pixelcolor::{Rgb565, RgbColor};
Expand Down
2 changes: 1 addition & 1 deletion boards/edgebadge/examples/neopixel_adc_battery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#![no_std]
#![no_main]

use edgebadge::{self as hal, entry, pac, Pins};
use edgebadge::{entry, hal, pac, Pins};
use panic_halt as _;

use hal::adc::Adc;
Expand Down
2 changes: 1 addition & 1 deletion boards/edgebadge/examples/neopixel_adc_light.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#![no_std]
#![no_main]

use edgebadge::{self as hal, entry, pac, Pins};
use edgebadge::{entry, hal, pac, Pins};
use panic_halt as _;

use embedded_hal::digital::v1_compat::OldOutputPin;
Expand Down
2 changes: 1 addition & 1 deletion boards/edgebadge/examples/neopixel_button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#![no_std]
#![no_main]

use edgebadge::{self as hal, entry, pac, pins::Keys, Pins};
use edgebadge::{entry, hal, pac, Keys, Pins};
use panic_halt as _;

use hal::prelude::*;
Expand Down
2 changes: 1 addition & 1 deletion boards/edgebadge/examples/neopixel_easing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#![no_std]
#![no_main]

use edgebadge::{self as hal, entry, pac, Pins};
use edgebadge::{entry, hal, pac, Pins};
use panic_halt as _;

use core::f32::consts::FRAC_PI_2;
Expand Down
2 changes: 1 addition & 1 deletion boards/edgebadge/examples/neopixel_rainbow_timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#![no_std]
#![no_main]

use edgebadge::{self as hal, entry, pac, Pins};
use edgebadge::{entry, hal, pac, Pins};
use panic_halt as _;

use hal::prelude::*;
Expand Down
2 changes: 1 addition & 1 deletion boards/edgebadge/examples/neopixel_tilt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#![no_std]
#![no_main]

use edgebadge::{self as hal, entry, pac, Pins};
use edgebadge::{entry, hal, pac, Pins};
use panic_halt as _;

use hal::prelude::*;
Expand Down
2 changes: 1 addition & 1 deletion boards/edgebadge/examples/usb_poll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#![no_std]
#![no_main]

use edgebadge::{self as hal, entry, pac, Pins};
use edgebadge::{entry, hal, pac, Pins};
use panic_halt as _;

use hal::clock::GenericClockController;
Expand Down
2 changes: 1 addition & 1 deletion boards/edgebadge/examples/usb_serial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
//! Note leds may appear white during debug. Either build for release or add
//! opt-level = 2 to profile.dev in Cargo.toml
use edgebadge::{self as hal, entry, pac, Pins};
use edgebadge::{entry, hal, pac, Pins};
use panic_halt as _;

use cortex_m::interrupt::free as disable_interrupts;
Expand Down
18 changes: 9 additions & 9 deletions boards/edgebadge/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
#![recursion_limit = "1024"]

#[cfg(feature = "unproven")]
pub mod buttons;
mod buttons;

pub mod pins;
use atsamd_hal as hal;
// Re-export the HAL and the PAC to give the user lower-level access to the
// device should they need it.
pub use atsamd_hal::{self as hal, target_device as pac};

#[cfg(feature = "rt")]
pub use cortex_m_rt::entry;

pub use pins::Pins;
mod pins;
pub use pins::*;

use hal::*;

pub use hal::common::*;
pub use hal::samd51::*;
pub use hal::target_device as pac;
pub mod prelude {
pub use atsamd_hal::prelude::*;
}
25 changes: 13 additions & 12 deletions boards/edgebadge/src/pins.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
//! EdgeBadge pins
use super::{hal, pac, target_device};
use super::hal;

use atsamd_hal::target_device::{self, MCLK};
use embedded_hal::{digital::v1_compat::OldOutputPin, timer::CountDown, timer::Periodic};
use gpio::{Floating, Input, Output, Port, PushPull};
use hal::clock::GenericClockController;
Expand All @@ -11,16 +12,14 @@ use hal::hal::spi;
use hal::prelude::*;
use hal::sercom::{I2CMaster2, PadPin, SPIMaster1, SPIMaster4, UART5};
use hal::time::Hertz;
use pac::MCLK;
use st7735_lcd::{Orientation, ST7735};
use ws2812_timer_delay as ws2812;

#[cfg(feature = "usb")]
use hal::usb::usb_device::bus::UsbBusAllocator;
#[cfg(feature = "usb")]
pub use hal::usb::UsbBus;
#[cfg(feature = "usb")]
use pac::gclk::{genctrl::SRC_A, pchctrl::GEN_A};
use target_device::gclk::{genctrl::SRC_A, pchctrl::GEN_A};

#[cfg(feature = "unproven")]
pub use crate::buttons::ButtonReader;
Expand All @@ -29,7 +28,9 @@ pub use crate::buttons::Keys;
#[cfg(feature = "unproven")]
use hal::pwm::Pwm2;
#[cfg(feature = "unproven")]
use pac::ADC0;
use st7735_lcd::{Orientation, ST7735};
#[cfg(feature = "unproven")]
use target_device::ADC0;

define_pins!(
/// Maps the pins to their arduino names and
Expand Down Expand Up @@ -310,9 +311,9 @@ impl Display {
pub fn init(
self,
clocks: &mut GenericClockController,
sercom4: pac::SERCOM4,
mclk: &mut pac::MCLK,
timer2: pac::TC2,
sercom4: target_device::SERCOM4,
mclk: &mut target_device::MCLK,
timer2: target_device::TC2,
delay: &mut hal::delay::Delay,
port: &mut Port,
) -> Result<
Expand Down Expand Up @@ -406,7 +407,7 @@ impl SPI {
self,
clocks: &mut GenericClockController,
bus_speed: F,
sercom1: pac::SERCOM1,
sercom1: target_device::SERCOM1,
mclk: &mut MCLK,
port: &mut Port,
) -> SPIMaster1<
Expand Down Expand Up @@ -446,7 +447,7 @@ impl I2C {
self,
clocks: &mut GenericClockController,
bus_speed: F,
sercom2: pac::SERCOM2,
sercom2: target_device::SERCOM2,
mclk: &mut MCLK,
port: &mut Port,
) -> I2CMaster2<hal::sercom::Sercom2Pad0<Pa12<PfC>>, hal::sercom::Sercom2Pad1<Pa13<PfC>>> {
Expand Down Expand Up @@ -480,7 +481,7 @@ impl USB {
/// as a USB device.
pub fn init(
self,
usb: pac::USB,
usb: target_device::USB,
clocks: &mut GenericClockController,
mclk: &mut MCLK,
port: &mut Port,
Expand Down Expand Up @@ -512,7 +513,7 @@ impl UART {
self,
clocks: &mut GenericClockController,
baud: F,
sercom5: pac::SERCOM5,
sercom5: target_device::SERCOM5,
mclk: &mut MCLK,
port: &mut Port,
) -> UART5<hal::sercom::Sercom5Pad1<Pb17<PfC>>, hal::sercom::Sercom5Pad0<Pb16<PfC>>, (), ()>
Expand Down

0 comments on commit c39e6d4

Please sign in to comment.