@@ -100,6 +100,117 @@ tests:
100100 expect_true : true
101101 mode : [hardware]
102102
103+ - name : " Set IODIR register"
104+ action : script
105+ script : |
106+ dev.set_iodir(0xF0)
107+ result = dev.get_iodir() == 0xF0
108+ expect_true : true
109+ mode : [mock]
110+
111+ - name : " Set and read full GPIO port"
112+ action : script
113+ script : |
114+ dev.set_iodir(0x00)
115+ dev.set_gpio(0x5A)
116+ result = dev.get_gpio() == 0x5A
117+ expect_true : true
118+ mode : [mock]
119+
120+ - name : " Setup configures pin as input with pull-up"
121+ action : script
122+ script : |
123+ dev.set_iodir(0x00)
124+ dev.set_gppu(0x00)
125+ dev.set_ipol(0x00)
126+ dev.setup(2, 1, pullup=1, polarity=0)
127+ result = (
128+ dev.get_iodir() == 0x04 and
129+ dev.get_gppu() == 0x04 and
130+ dev.get_ipol() == 0x00
131+ )
132+ expect_true : true
133+ mode : [mock]
134+
135+ - name : " Setup configures pin as output without pull-up"
136+ action : script
137+ script : |
138+ dev.set_iodir(0xFF)
139+ dev.set_gppu(0xFF)
140+ dev.set_ipol(0x00)
141+ dev.setup(3, 0, pullup=0, polarity=0)
142+ result = (
143+ dev.get_iodir() == 0xF7 and
144+ dev.get_gppu() == 0xF7 and
145+ dev.get_ipol() == 0x00
146+ )
147+ expect_true : true
148+ mode : [mock]
149+
150+ - name : " Setup configures polarity inversion"
151+ action : script
152+ script : |
153+ dev.set_iodir(0x00)
154+ dev.set_gppu(0x00)
155+ dev.set_ipol(0x00)
156+ dev.setup(1, 1, pullup=1, polarity=1)
157+ result = (
158+ dev.get_iodir() == 0x02 and
159+ dev.get_gppu() == 0x02 and
160+ dev.get_ipol() == 0x02
161+ )
162+ expect_true : true
163+ mode : [mock]
164+
165+ - name : " Set and get individual output level high"
166+ action : script
167+ script : |
168+ dev.set_iodir(0xFE)
169+ dev.set_gpio(0x00)
170+ dev.set_level(0, 1)
171+ result = dev.get_level(0) == 1 and dev.get_gpio() == 0x01
172+ expect_true : true
173+ mode : [mock]
174+
175+ - name : " Set and get individual output level low"
176+ action : script
177+ script : |
178+ dev.set_iodir(0xFE)
179+ dev.set_gpio(0x01)
180+ dev.set_level(0, 0)
181+ result = dev.get_level(0) == 0 and dev.get_gpio() == 0x00
182+ expect_true : true
183+ mode : [mock]
184+
185+ - name : " Set level does not modify input pin"
186+ action : script
187+ script : |
188+ dev.set_iodir(0xFF)
189+ dev.set_gpio(0xF0)
190+ dev.set_level(4, 0)
191+ result = dev.get_gpio() == 0xF0 and dev.get_level(4) == 1
192+ expect_true : true
193+ mode : [mock]
194+
195+ - name : " Get GPPU register after write"
196+ action : script
197+ script : |
198+ dev.set_gppu(0xA5)
199+ result = dev.get_gppu() == 0xA5
200+ expect_true : true
201+ mode : [mock]
202+
203+ - name : " Power cycle toggles reset pin"
204+ action : script
205+ script : |
206+ dev.power_off()
207+ off_state = dev.reset_pin.value()
208+ dev.power_on()
209+ on_state = dev.reset_pin.value()
210+ result = off_state == 0 and on_state == 1
211+ expect_true : true
212+ mode : [mock]
213+
103214 # --- Polling tests (one per D-PAD button) ---
104215 # LED_GREEN signals when the board is ready to read the button.
105216
0 commit comments