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
52
53
54
55
56
57
58
59
60
61
/* nc.rs
 *
 * Developed by Tim Walls <tim.walls@snowgoons.com>
 * Copyright (c) All Rights Reserved, Tim Walls
 */
//! A dummy 'not connected' Pin implementation


// Imports ===================================================================
use avr_oxide::alloc::boxed::Box;
use avr_oxide::hal::generic::port::{InterruptMode, Pin, PinIsrCallback, PinMode};
use avr_oxide::util::OwnOrBorrow;

// Declarations ==============================================================
pub struct NC {
  _dummy: u8
}

// Code ======================================================================

// Tests =====================================================================
impl Into<OwnOrBorrow<'static, dyn Pin + 'static>> for NC {
  fn into(self) -> OwnOrBorrow<'static, dyn Pin> {
    OwnOrBorrow::Own(Box::new(self))
  }
}

impl NC {
  pub fn new() -> Self {
    NC {
      _dummy: 0x00u8
    }
  }
}

impl Pin for NC {
  fn set_mode(&self, _mode: PinMode) {
  }

  fn toggle(&self) {
  }

  fn set_high(&self) {
  }

  fn set_low(&self) {
  }

  fn set(&self, _high: bool) {
  }

  fn get(&self) -> bool {
    false
  }

  fn set_interrupt_mode(&self, _mode: InterruptMode) {
  }

  fn listen(&'static self, _handler: PinIsrCallback) {
  }
}