Skip to content

Commit

Permalink
hil: gpio: remove 'static
Browse files Browse the repository at this point in the history
  • Loading branch information
bradjc committed Jun 19, 2020
1 parent 198ff41 commit b019d3b
Show file tree
Hide file tree
Showing 43 changed files with 234 additions and 231 deletions.
6 changes: 3 additions & 3 deletions boards/acd52832/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ pub struct Platform {
nrf52832::ble_radio::Radio,
VirtualMuxAlarm<'static, Rtc<'static>>,
>,
button: &'static capsules::button::Button<'static, nrf52832::gpio::GPIOPin>,
button: &'static capsules::button::Button<'static, nrf52832::gpio::GPIOPin<'static>>,
console: &'static capsules::console::Console<'static>,
gpio: &'static capsules::gpio::GPIO<'static, nrf52832::gpio::GPIOPin>,
led: &'static capsules::led::LED<'static, nrf52832::gpio::GPIOPin>,
gpio: &'static capsules::gpio::GPIO<'static, nrf52832::gpio::GPIOPin<'static>>,
led: &'static capsules::led::LED<'static, nrf52832::gpio::GPIOPin<'static>>,
rng: &'static capsules::rng::RngDriver<'static>,
temp: &'static capsules::temperature::TemperatureSensor<'static>,
ipc: kernel::ipc::IPC,
Expand Down
6 changes: 3 additions & 3 deletions boards/arty_e21/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ pub static mut STACK_MEMORY: [u8; 0x1000] = [0; 0x1000];
/// capsules for this platform.
struct ArtyE21 {
console: &'static capsules::console::Console<'static>,
gpio: &'static capsules::gpio::GPIO<'static, arty_e21_chip::gpio::GpioPin>,
gpio: &'static capsules::gpio::GPIO<'static, arty_e21_chip::gpio::GpioPin<'static>>,
alarm: &'static capsules::alarm::AlarmDriver<
'static,
VirtualMuxAlarm<'static, rv32i::machine_timer::MachineTimer<'static>>,
>,
led: &'static capsules::led::LED<'static, arty_e21_chip::gpio::GpioPin>,
button: &'static capsules::button::Button<'static, arty_e21_chip::gpio::GpioPin>,
led: &'static capsules::led::LED<'static, arty_e21_chip::gpio::GpioPin<'static>>,
button: &'static capsules::button::Button<'static, arty_e21_chip::gpio::GpioPin<'static>>,
// ipc: kernel::ipc::IPC,
}

Expand Down
6 changes: 3 additions & 3 deletions boards/components/src/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ macro_rules! button_component_buf {
};};
}

pub struct ButtonComponent<IP: 'static + gpio::InterruptPin> {
pub struct ButtonComponent<IP: 'static + gpio::InterruptPin<'static>> {
board_kernel: &'static kernel::Kernel,
button_pins: &'static [(
&'static gpio::InterruptValueWrapper<'static, IP>,
Expand All @@ -73,7 +73,7 @@ pub struct ButtonComponent<IP: 'static + gpio::InterruptPin> {
)],
}

impl<IP: 'static + gpio::InterruptPin> ButtonComponent<IP> {
impl<IP: 'static + gpio::InterruptPin<'static>> ButtonComponent<IP> {
pub fn new(
board_kernel: &'static kernel::Kernel,
button_pins: &'static [(
Expand All @@ -89,7 +89,7 @@ impl<IP: 'static + gpio::InterruptPin> ButtonComponent<IP> {
}
}

impl<IP: 'static + gpio::InterruptPin> Component for ButtonComponent<IP> {
impl<IP: 'static + gpio::InterruptPin<'static>> Component for ButtonComponent<IP> {
type StaticInput = &'static mut MaybeUninit<Button<'static, IP>>;
type Output = &'static Button<'static, IP>;

Expand Down
6 changes: 3 additions & 3 deletions boards/components/src/gpio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ macro_rules! gpio_component_buf {
};};
}

pub struct GpioComponent<IP: 'static + gpio::InterruptPin> {
pub struct GpioComponent<IP: 'static + gpio::InterruptPin<'static>> {
board_kernel: &'static kernel::Kernel,
gpio_pins: &'static [Option<&'static gpio::InterruptValueWrapper<'static, IP>>],
}

impl<IP: 'static + gpio::InterruptPin> GpioComponent<IP> {
impl<IP: 'static + gpio::InterruptPin<'static>> GpioComponent<IP> {
pub fn new(
board_kernel: &'static kernel::Kernel,
gpio_pins: &'static [Option<&'static gpio::InterruptValueWrapper<'static, IP>>],
Expand All @@ -116,7 +116,7 @@ impl<IP: 'static + gpio::InterruptPin> GpioComponent<IP> {
}
}

impl<IP: 'static + gpio::InterruptPin> Component for GpioComponent<IP> {
impl<IP: 'static + gpio::InterruptPin<'static>> Component for GpioComponent<IP> {
type StaticInput = &'static mut MaybeUninit<GPIO<'static, IP>>;
type Output = &'static GPIO<'static, IP>;

Expand Down
6 changes: 3 additions & 3 deletions boards/components/src/panic_button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ macro_rules! panic_button_component_buf {
};};
}

pub struct PanicButtonComponent<'a, IP: gpio::InterruptPin> {
pub struct PanicButtonComponent<'a, IP: gpio::InterruptPin<'a>> {
pin: &'a IP,
mode: gpio::ActivationMode,
floating_state: gpio::FloatingState,
}

impl<'a, IP: gpio::InterruptPin> PanicButtonComponent<'a, IP> {
impl<'a, IP: gpio::InterruptPin<'a>> PanicButtonComponent<'a, IP> {
pub fn new(
pin: &'a IP,
mode: gpio::ActivationMode,
Expand All @@ -51,7 +51,7 @@ impl<'a, IP: gpio::InterruptPin> PanicButtonComponent<'a, IP> {
}
}

impl<IP: 'static + gpio::InterruptPin> Component for PanicButtonComponent<'static, IP> {
impl<IP: 'static + gpio::InterruptPin<'static>> Component for PanicButtonComponent<'static, IP> {
type StaticInput = &'static mut MaybeUninit<PanicButton<'static, IP>>;
type Output = ();

Expand Down
6 changes: 3 additions & 3 deletions boards/hail/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub static mut STACK_MEMORY: [u8; 0x1000] = [0; 0x1000];
/// capsules for this platform.
struct Hail {
console: &'static capsules::console::Console<'static>,
gpio: &'static capsules::gpio::GPIO<'static, sam4l::gpio::GPIOPin>,
gpio: &'static capsules::gpio::GPIO<'static, sam4l::gpio::GPIOPin<'static>>,
alarm: &'static capsules::alarm::AlarmDriver<
'static,
VirtualMuxAlarm<'static, sam4l::ast::Ast<'static>>,
Expand All @@ -64,8 +64,8 @@ struct Hail {
spi: &'static capsules::spi::Spi<'static, VirtualSpiMasterDevice<'static, sam4l::spi::SpiHw>>,
nrf51822: &'static capsules::nrf51822_serialization::Nrf51822Serialization<'static>,
adc: &'static capsules::adc::Adc<'static, sam4l::adc::Adc>,
led: &'static capsules::led::LED<'static, sam4l::gpio::GPIOPin>,
button: &'static capsules::button::Button<'static, sam4l::gpio::GPIOPin>,
led: &'static capsules::led::LED<'static, sam4l::gpio::GPIOPin<'static>>,
button: &'static capsules::button::Button<'static, sam4l::gpio::GPIOPin<'static>>,
rng: &'static capsules::rng::RngDriver<'static>,
ipc: kernel::ipc::IPC,
crc: &'static capsules::crc::Crc<'static, sam4l::crccu::Crccu<'static>>,
Expand Down
2 changes: 1 addition & 1 deletion boards/hifive1/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub static mut STACK_MEMORY: [u8; 0x800] = [0; 0x800];
/// A structure representing this platform that holds references to all
/// capsules for this platform. We've included an alarm and console.
struct HiFive1 {
led: &'static capsules::led::LED<'static, sifive::gpio::GpioPin>,
led: &'static capsules::led::LED<'static, sifive::gpio::GpioPin<'static>>,
console: &'static capsules::console::Console<'static>,
lldb: &'static capsules::low_level_debug::LowLevelDebug<
'static,
Expand Down
6 changes: 3 additions & 3 deletions boards/imix/src/imix_components/fxos8700.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ use kernel::Grant;

pub struct Fxos8700Component {
i2c_mux: &'static MuxI2C<'static>,
gpio: &'static sam4l::gpio::GPIOPin,
gpio: &'static sam4l::gpio::GPIOPin<'static>,
}

impl Fxos8700Component {
pub fn new(
i2c: &'static MuxI2C<'static>,
gpio: &'static sam4l::gpio::GPIOPin,
gpio: &'static sam4l::gpio::GPIOPin<'static>,
) -> Fxos8700Component {
Fxos8700Component {
i2c_mux: i2c,
Expand Down Expand Up @@ -68,7 +68,7 @@ impl Component for Fxos8700Component {
pub struct NineDofComponent {
board_kernel: &'static kernel::Kernel,
i2c_mux: &'static MuxI2C<'static>,
gpio: &'static sam4l::gpio::GPIOPin,
gpio: &'static sam4l::gpio::GPIOPin<'static>,
}

impl NineDofComponent {
Expand Down
8 changes: 4 additions & 4 deletions boards/imix/src/imix_components/rf233.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ pub struct RF233Component {
spi: &'static VirtualSpiMasterDevice<'static, sam4l::spi::SpiHw>,
reset: &'static dyn hil::gpio::Pin,
sleep: &'static dyn hil::gpio::Pin,
irq: &'static dyn hil::gpio::InterruptPin,
ctl: &'static sam4l::gpio::GPIOPin,
irq: &'static dyn hil::gpio::InterruptPin<'static>,
ctl: &'static sam4l::gpio::GPIOPin<'static>,
channel: u8,
}

Expand All @@ -35,8 +35,8 @@ impl RF233Component {
spi: &'static VirtualSpiMasterDevice<'static, sam4l::spi::SpiHw>,
reset: &'static dyn hil::gpio::Pin,
sleep: &'static dyn hil::gpio::Pin,
irq: &'static dyn hil::gpio::InterruptPin,
ctl: &'static sam4l::gpio::GPIOPin,
irq: &'static dyn hil::gpio::InterruptPin<'static>,
ctl: &'static sam4l::gpio::GPIOPin<'static>,
channel: u8,
) -> RF233Component {
RF233Component {
Expand Down
6 changes: 3 additions & 3 deletions boards/imix/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ struct Imix {
components::process_console::Capability,
>,
console: &'static capsules::console::Console<'static>,
gpio: &'static capsules::gpio::GPIO<'static, sam4l::gpio::GPIOPin>,
gpio: &'static capsules::gpio::GPIO<'static, sam4l::gpio::GPIOPin<'static>>,
alarm: &'static AlarmDriver<'static, VirtualMuxAlarm<'static, sam4l::ast::Ast<'static>>>,
temp: &'static capsules::temperature::TemperatureSensor<'static>,
humidity: &'static capsules::humidity::HumiditySensor<'static>,
ambient_light: &'static capsules::ambient_light::AmbientLight<'static>,
adc: &'static capsules::adc::Adc<'static, sam4l::adc::Adc>,
led: &'static capsules::led::LED<'static, sam4l::gpio::GPIOPin>,
button: &'static capsules::button::Button<'static, sam4l::gpio::GPIOPin>,
led: &'static capsules::led::LED<'static, sam4l::gpio::GPIOPin<'static>>,
button: &'static capsules::button::Button<'static, sam4l::gpio::GPIOPin<'static>>,
rng: &'static capsules::rng::RngDriver<'static>,
analog_comparator: &'static capsules::analog_comparator::AnalogComparator<
'static,
Expand Down
4 changes: 2 additions & 2 deletions boards/imix/src/power.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use sam4l::gpio::PeripheralFunction::{A, B, E};
use sam4l::gpio::{PA, PB, PC};

struct DetachablePin {
pin: &'static GPIOPin,
pin: &'static GPIOPin<'static>,
function: Option<PeripheralFunction>,
}

Expand All @@ -43,7 +43,7 @@ impl DetachablePin {
}

struct Submodule<'a> {
gate_pin: &'static GPIOPin,
gate_pin: &'static GPIOPin<'static>,
detachable_pins: &'a [DetachablePin],
}

Expand Down
6 changes: 3 additions & 3 deletions boards/launchxl/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ static mut APP_MEMORY: [u8; 0x10000] = [0; 0x10000];
pub static mut STACK_MEMORY: [u8; 0x1000] = [0; 0x1000];

pub struct Platform {
gpio: &'static capsules::gpio::GPIO<'static, cc26x2::gpio::GPIOPin>,
led: &'static capsules::led::LED<'static, cc26x2::gpio::GPIOPin>,
gpio: &'static capsules::gpio::GPIO<'static, cc26x2::gpio::GPIOPin<'static>>,
led: &'static capsules::led::LED<'static, cc26x2::gpio::GPIOPin<'static>>,
console: &'static capsules::console::Console<'static>,
button: &'static capsules::button::Button<'static, cc26x2::gpio::GPIOPin>,
button: &'static capsules::button::Button<'static, cc26x2::gpio::GPIOPin<'static>>,
alarm: &'static capsules::alarm::AlarmDriver<
'static,
capsules::virtual_alarm::VirtualMuxAlarm<'static, cc26x2::rtc::Rtc<'static>>,
Expand Down
6 changes: 3 additions & 3 deletions boards/nordic/nrf52840_dongle/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ pub struct Platform {
VirtualMuxAlarm<'static, nrf52840::rtc::Rtc<'static>>,
>,
ieee802154_radio: &'static capsules::ieee802154::RadioDriver<'static>,
button: &'static capsules::button::Button<'static, nrf52840::gpio::GPIOPin>,
button: &'static capsules::button::Button<'static, nrf52840::gpio::GPIOPin<'static>>,
pconsole: &'static capsules::process_console::ProcessConsole<
'static,
components::process_console::Capability,
>,
console: &'static capsules::console::Console<'static>,
gpio: &'static capsules::gpio::GPIO<'static, nrf52840::gpio::GPIOPin>,
led: &'static capsules::led::LED<'static, nrf52840::gpio::GPIOPin>,
gpio: &'static capsules::gpio::GPIO<'static, nrf52840::gpio::GPIOPin<'static>>,
led: &'static capsules::led::LED<'static, nrf52840::gpio::GPIOPin<'static>>,
rng: &'static capsules::rng::RngDriver<'static>,
temp: &'static capsules::temperature::TemperatureSensor<'static>,
ipc: kernel::ipc::IPC,
Expand Down
6 changes: 3 additions & 3 deletions boards/nordic/nrf52840dk/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,14 @@ pub struct Platform {
VirtualMuxAlarm<'static, nrf52840::rtc::Rtc<'static>>,
>,
ieee802154_radio: &'static capsules::ieee802154::RadioDriver<'static>,
button: &'static capsules::button::Button<'static, nrf52840::gpio::GPIOPin>,
button: &'static capsules::button::Button<'static, nrf52840::gpio::GPIOPin<'static>>,
pconsole: &'static capsules::process_console::ProcessConsole<
'static,
components::process_console::Capability,
>,
console: &'static capsules::console::Console<'static>,
gpio: &'static capsules::gpio::GPIO<'static, nrf52840::gpio::GPIOPin>,
led: &'static capsules::led::LED<'static, nrf52840::gpio::GPIOPin>,
gpio: &'static capsules::gpio::GPIO<'static, nrf52840::gpio::GPIOPin<'static>>,
led: &'static capsules::led::LED<'static, nrf52840::gpio::GPIOPin<'static>>,
rng: &'static capsules::rng::RngDriver<'static>,
temp: &'static capsules::temperature::TemperatureSensor<'static>,
ipc: kernel::ipc::IPC,
Expand Down
6 changes: 3 additions & 3 deletions boards/nordic/nrf52dk/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,14 @@ pub struct Platform {
nrf52832::ble_radio::Radio,
VirtualMuxAlarm<'static, Rtc<'static>>,
>,
button: &'static capsules::button::Button<'static, nrf52832::gpio::GPIOPin>,
button: &'static capsules::button::Button<'static, nrf52832::gpio::GPIOPin<'static>>,
pconsole: &'static capsules::process_console::ProcessConsole<
'static,
components::process_console::Capability,
>,
console: &'static capsules::console::Console<'static>,
gpio: &'static capsules::gpio::GPIO<'static, nrf52832::gpio::GPIOPin>,
led: &'static capsules::led::LED<'static, nrf52832::gpio::GPIOPin>,
gpio: &'static capsules::gpio::GPIO<'static, nrf52832::gpio::GPIOPin<'static>>,
led: &'static capsules::led::LED<'static, nrf52832::gpio::GPIOPin<'static>>,
rng: &'static capsules::rng::RngDriver<'static>,
temp: &'static capsules::temperature::TemperatureSensor<'static>,
ipc: kernel::ipc::IPC,
Expand Down
4 changes: 2 additions & 2 deletions boards/opentitan/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ pub static mut STACK_MEMORY: [u8; 0x1000] = [0; 0x1000];
/// A structure representing this platform that holds references to all
/// capsules for this platform. We've included an alarm and console.
struct OpenTitan {
led: &'static capsules::led::LED<'static, ibex::gpio::GpioPin>,
gpio: &'static capsules::gpio::GPIO<'static, ibex::gpio::GpioPin>,
led: &'static capsules::led::LED<'static, ibex::gpio::GpioPin<'static>>,
gpio: &'static capsules::gpio::GPIO<'static, ibex::gpio::GpioPin<'static>>,
console: &'static capsules::console::Console<'static>,
alarm: &'static capsules::alarm::AlarmDriver<
'static,
Expand Down
4 changes: 2 additions & 2 deletions boards/redboard_artemis_nano/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ struct RedboardArtemisNano {
'static,
VirtualMuxAlarm<'static, apollo3::stimer::STimer<'static>>,
>,
led: &'static capsules::led::LED<'static, apollo3::gpio::GpioPin>,
gpio: &'static capsules::gpio::GPIO<'static, apollo3::gpio::GpioPin>,
led: &'static capsules::led::LED<'static, apollo3::gpio::GpioPin<'static>>,
gpio: &'static capsules::gpio::GPIO<'static, apollo3::gpio::GpioPin<'static>>,
console: &'static capsules::console::Console<'static>,
i2c_master: &'static capsules::i2c_master::I2CMasterDriver<apollo3::iom::Iom<'static>>,
}
Expand Down
8 changes: 4 additions & 4 deletions capsules/src/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub type SubscribeMap = u32;

/// Manages the list of GPIO pins that are connected to buttons and which apps
/// are listening for interrupts from which buttons.
pub struct Button<'a, P: gpio::InterruptPin> {
pub struct Button<'a, P: gpio::InterruptPin<'a>> {
pins: &'a [(
&'a gpio::InterruptValueWrapper<'a, P>,
gpio::ActivationMode,
Expand All @@ -76,7 +76,7 @@ pub struct Button<'a, P: gpio::InterruptPin> {
apps: Grant<(Option<Callback>, SubscribeMap)>,
}

impl<'a, P: gpio::InterruptPin> Button<'a, P> {
impl<'a, P: gpio::InterruptPin<'a>> Button<'a, P> {
pub fn new(
pins: &'a [(
&'a gpio::InterruptValueWrapper<'a, P>,
Expand All @@ -103,7 +103,7 @@ impl<'a, P: gpio::InterruptPin> Button<'a, P> {
}
}

impl<P: gpio::InterruptPin> Driver for Button<'_, P> {
impl<'a, P: gpio::InterruptPin<'a>> Driver for Button<'a, P> {
/// Set callbacks.
///
/// ### `subscribe_num`
Expand Down Expand Up @@ -224,7 +224,7 @@ impl<P: gpio::InterruptPin> Driver for Button<'_, P> {
}
}

impl<P: gpio::InterruptPin> gpio::ClientWithValue for Button<'_, P> {
impl<'a, P: gpio::InterruptPin<'a>> gpio::ClientWithValue for Button<'a, P> {
fn fired(&self, pin_num: u32) {
// Read the value of the pin and get the button state.
let button_state = self.get_button_state(pin_num);
Expand Down
4 changes: 2 additions & 2 deletions capsules/src/debug_process_restart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ use kernel::Kernel;
pub struct DebugProcessRestart<'a, C: ProcessManagementCapability> {
kernel: &'static Kernel,
capability: C,
pin: &'a dyn gpio::InterruptPin,
pin: &'a dyn gpio::InterruptPin<'a>,
mode: gpio::ActivationMode,
}

impl<'a, C: ProcessManagementCapability> DebugProcessRestart<'a, C> {
pub fn new(
kernel: &'static Kernel,
cap: C,
pin: &'a dyn gpio::InterruptPin,
pin: &'a dyn gpio::InterruptPin<'a>,
mode: gpio::ActivationMode,
floating_state: gpio::FloatingState,
) -> Self {
Expand Down
4 changes: 2 additions & 2 deletions capsules/src/fxos8700cq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ enum State {

pub struct Fxos8700cq<'a> {
i2c: &'a dyn I2CDevice,
interrupt_pin1: &'a dyn gpio::InterruptPin,
interrupt_pin1: &'a dyn gpio::InterruptPin<'a>,
state: Cell<State>,
buffer: TakeCell<'static, [u8]>,
callback: OptionalCell<&'a dyn hil::sensors::NineDofClient>,
Expand All @@ -187,7 +187,7 @@ pub struct Fxos8700cq<'a> {
impl<'a> Fxos8700cq<'a> {
pub fn new(
i2c: &'a dyn I2CDevice,
interrupt_pin1: &'a dyn gpio::InterruptPin,
interrupt_pin1: &'a dyn gpio::InterruptPin<'a>,
buffer: &'static mut [u8],
) -> Fxos8700cq<'a> {
Fxos8700cq {
Expand Down

0 comments on commit b019d3b

Please sign in to comment.