| 37 | namespace platforms { |
| 38 | |
| 39 | inline void pinMode(int pin, fl::PinMode mode) FL_NOEXCEPT { |
| 40 | // Translate PinMode to Teensy core constants |
| 41 | // PinMode::Input=0, Output=1, InputPullup=2, InputPulldown=3 |
| 42 | // Teensy: INPUT=0, OUTPUT=1, INPUT_PULLUP=2, INPUT_PULLDOWN (Teensy-specific) |
| 43 | int teensy_mode = INPUT; // Initialize to safe default |
| 44 | switch (mode) { |
| 45 | case fl::PinMode::Input: |
| 46 | teensy_mode = INPUT; // 0 |
| 47 | break; |
| 48 | case fl::PinMode::Output: |
| 49 | teensy_mode = OUTPUT; // 1 |
| 50 | break; |
| 51 | case fl::PinMode::InputPullup: |
| 52 | teensy_mode = INPUT_PULLUP; // 2 |
| 53 | break; |
| 54 | case fl::PinMode::InputPulldown: |
| 55 | #ifdef INPUT_PULLDOWN |
| 56 | teensy_mode = INPUT_PULLDOWN; // Teensy-specific |
| 57 | #else |
| 58 | teensy_mode = INPUT_PULLUP; // Fallback to INPUT_PULLUP |
| 59 | #endif |
| 60 | break; |
| 61 | } |
| 62 | ::pinMode(pin, teensy_mode); |
| 63 | } |
| 64 | |
| 65 | inline void digitalWrite(int pin, fl::PinValue val) FL_NOEXCEPT { |
| 66 | ::digitalWrite(pin, static_cast<int>(val)); // PinValue::Low=0, High=1 |
no outgoing calls
no test coverage detected