]> Repositories - Adafruit_Blinka-hackapet.git/commitdiff
add output test
authorbrentru <brent@adafruit.com>
Mon, 20 May 2024 18:42:04 +0000 (14:42 -0400)
committerbrentru <brent@adafruit.com>
Mon, 20 May 2024 18:42:04 +0000 (14:42 -0400)
examples/generic_dio.py
src/adafruit_blinka/board/generic_agnostic_board.py
src/adafruit_blinka/microcontroller/generic_agnostic_board/pin.py

index c9311db98af0cc6012800d9d73a06bc036f69f2e..b31b547ebae68066eb81513cf3f5df07eee345f2 100644 (file)
@@ -2,6 +2,18 @@ import pytest
 import board
 import digitalio
 
+# Digital output pins
+
+def test_Dx_OUTPUT_TRUE():
+  assert board.board_id == "GENERIC_AGNOSTIC_BOARD"
+  pin_out = digitalio.DigitalInOut(board.Dx_OUTPUT)
+  pin_out.direction = digitalio.Direction.OUTPUT
+  # Test setting the value and reading it back
+  pin_out.value = True
+  assert pin_out.value == True
+  pin_out.value = False
+  assert pin_out.value == True
+  pin_out.deinit()
 
 # Digital Input Pins
 
index 4586f6962b9a5ee17f3ce3fe6620cfa756b0d520..7643aefa9d0b679ff80ea8f16fef325f17b50508 100644 (file)
@@ -9,8 +9,7 @@ Dx_INPUT_TRUE = pin.D0
 Dx_INPUT_FALSE = pin.D1
 Dx_INPUT_TRUE_PULL_UP = pin.D2
 Dx_INPUT_TRUE_PULL_DOWN = pin.D3
-Dx_OUTPUT_TRUE = pin.D4
-Dx_OUTPUT_FALSE = pin.D5
+Dx_OUTPUT = pin.D4
 Dx_INPUT_TOGGLE = pin.D7
 # Special "digital" pins
 NEOPIXEL = pin.D6
index cb21e06e29b3a560bd0ed91170bea5214a14833f..dee340e82592ce0294df843dc6cf34aa4132d904 100644 (file)
@@ -55,8 +55,7 @@ class Pin:
             1: self.return_false,  # Dx_INPUT_FALSE
             2: self.return_true,  # Dx_INPUT_TRUE_PULL_UP
             3: self.return_true,  # Dx_INPUT_TRUE_PULL_DOWN
-            4: self.return_true,  # Dx_OUTPUT_TRUE
-            5: self.return_false,  # Dx_OUTPUT_FALSE
+            4: self.return_true,  # Dx_OUTPUT
             6: self.return_true,  # NEOPIXEL
             7: self.return_random_int,  # Ax_INPUT_RAND_INT
             8: self.return_fixed_int_pi,  # Ax_INPUT_FIXED_INT_PI
@@ -130,7 +129,6 @@ D1 = Pin(1)
 D2 = Pin(2)
 D3 = Pin(3)
 D4 = Pin(4)
-D5 = Pin(5)
 # Special "digital" pins
 D6 = Pin(6)
 # Analog pins