Expand description
§External Interrupt Controller
This module provides typesafe APIs for interacting with the EIC peripheral, which is used to generate interrupts based on the state of a GPIO.
Each chip has a number of EXTINT channels:
- SAMD11: 8 channels
 - SAMD21/SAMx5x: 16 channels
 
Each channel can operate independently, and sense state changes for a single
GPIO pin at a time. Refer to the datasheet for GPIO pin/EXTINT channel
compatibility. In this module, an ExtInt represents an EXTINT channel
which is tied to a GPIO Pin, and is capable of sensing state changes.
§Steps to create an ExtInt
- 
Start by creating an
Eicstruct, by callingEic::new. This initializes the EIC peripheral and sets up the correct clocking. - 
Turn the
Eicinto a tuple ofChannels by callingEic::split. Each channel represents a single EXTINT channel. - 
Assign a pin to a channel by calling
Channel::with_pin. This returns a fully configured and ready to useExtInt. APincan also be directly converted into anExtIntby calling one of the methods provided by theEicPintrait. 
§Example setup
let eic_clock = clocks.eic(&gclk0).unwrap();
// Initialize the EIC peripheral
let eic = Eic::new(&mut peripherals.pm, eic_clock, peripherals.eic);
// Split into channels
let eic_channels = eic.split();
// Take the pin that we want to use
let button: Pin<_, PullUpInterrupt> = pins.d10.into();
// Turn the EXTINT[2] channel into an ExtInt struct
let mut extint = eic_channels.2.with_pin(button);§async operation async
ExtInts can be used for async operations. Configuring the Eic in
async mode is relatively simple:
- 
Bind the corresponding
EICinterrupt source to the SPIInterruptHandler(refer to the module-levelasync_haldocumentation for more information). - 
SAMD11/SAMD21: Turn an
Eicinto an async-enabledEicby callingEic::into_future. Since there is only a single interrupt handler for the EIC peripheral, all EXTINT channels must be turned into async channels at once. - 
SAMx5x: Turn an individuel
ExtIntinto an async-enabledExtIntby callingExtInt::into_future. Each channel has a dedicated interrupt source, therefore you must individually choose which channels to turn into async channels. - 
Use the provided
waitmethod. async-enabledExtInts also implementembedded_hal_async::digital::Wait. 
Structs§
- Channel
 - EIC channel.
 - Channels
 - Struct generating individual handles to each EXTINT channel
 - Eic
 - External Interrupt Controller.
 - ExtInt
 - A numbered external interrupt, which can be used to sense state changes on its pin.
 - Future
Channels  - Struct generating individual handles to each EXTINT channel for 
asyncoperation - Interrupt
Handler  - Interrupt handler used for 
asyncoperations. 
Enums§
- Ch0
 - Type alias for a channel number
 - Ch1
 - Type alias for a channel number
 - Ch2
 - Type alias for a channel number
 - Ch3
 - Type alias for a channel number
 - Ch4
 - Type alias for a channel number
 - Ch5
 - Type alias for a channel number
 - Ch6
 - Type alias for a channel number
 - Ch7
 - Type alias for a channel number
 - Ch8
 - Type alias for a channel number
 - Ch9
 - Type alias for a channel number
 - Ch10
 - Type alias for a channel number
 - Ch11
 - Type alias for a channel number
 - Ch12
 - Type alias for a channel number
 - Ch13
 - Type alias for a channel number
 - Ch14
 - Type alias for a channel number
 - Ch15
 - Type alias for a channel number
 - EicFuture
 - Marker type that represents an EXTINT channel capable of doing async operations.
 
Constants§
- NUM_
CHANNELS  - The number of EXTINT channels on this chip.
 
Traits§
- ChId
 - Trait representing an EXTINT channel ID.
 - EicPin
 - Trait representing a GPIO pin which can be used as an external interrupt.