1*** Test Cases ***
2Should Respect PullUp Configuration
3    # this is necessary to handle buttons on a paused simulation
4    Execute Command             emulation Mode SynchronizedTimers
5    Execute Command             include @scripts/single-node/nrf52840.resc
6
7    # read IN, by default it should return 0
8    ${x}=  Execute Command      gpio0 ReadDoubleWord 0x10
9    Should Be Equal As Numbers  ${x}   0x0
10
11    # setting pin#5 as pull-up
12    Execute Command             gpio0 WriteDoubleWord 0x214 0xC
13
14    # read IN, now expecting pull-up for pin#5
15    ${x}=  Execute Command      gpio0 ReadDoubleWord 0x10
16    Should Be Equal As Numbers  ${x}   0x20
17
18    # attaching a button, now pull-up should not matter anymore
19    Execute Command             machine LoadPlatformDescriptionFromString "button: Miscellaneous.Button @ gpio0 5 { -> gpio0@5 }"
20
21    # read IN, now expect to read the button state - false
22    ${x}=  Execute Command      gpio0 ReadDoubleWord 0x10
23    Should Be Equal As Numbers  ${x}   0x0
24
25    # press the button
26    Execute Command             gpio0.button Press
27
28    # read IN, expect to read the button state - true
29    ${x}=  Execute Command      gpio0 ReadDoubleWord 0x10
30    Should Be Equal As Numbers  ${x}   0x20
31
32    # release the button
33    Execute Command             gpio0.button Release
34
35    # read IN, now expect to read the button state - false
36    ${x}=  Execute Command      gpio0 ReadDoubleWord 0x10
37    Should Be Equal As Numbers  ${x}   0x0
38