1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//! Exti trait definition
/// Embedded-hal does not expose any generic interface for
/// working with EXTI interrupts.
/// This trait allows the driver to take control
/// over the EXTI pin and manage the interrupt status.
///
/// Implement it as per following in the app
///
/// pub struct MyIrq<const C: char, const N: u8>(Pin<C, N>);
///
/// impl Xpt2046Exti for MyIrq<'A', 2> {
/// type Exti = EXTI;
/// fn clear_interrupt(&mut self) {
/// self.0.clear_interrupt_pending_bit();
/// }
///
/// fn disable_interrupt(&mut self, exti: &mut Self::Exti) {
/// self.0.disable_interrupt(exti);
/// }
///
/// fn enable_interrupt(&mut self, exti: &mut Self::Exti) {
/// self.0.enable_interrupt(exti);
/// }
///
/// fn is_high(&self) -> bool {
/// self.0.is_high()
/// }
///
/// fn is_low(&self) -> bool {
/// self.0.is_low()
/// }
/// }
///
/// The use it as such in the driver
///
/// let mut xpt_drv = Xpt2046::new(
/// touch_spi,
/// touch_cs,
/// MyIrq(touch_irq),
/// xpt2046::Orientation::PortraitFlipped,
/// );
///