1*** Variables ***
2${UART}                       sysbus.uart0
3${URI}                        @https://dl.antmicro.com/projects/renode
4
5${LSM303DLHC}=     SEPARATOR=
6...  """                                                        ${\n}
7...  using "platforms/cpus/nrf52840.repl"                       ${\n}
8...                                                             ${\n}
9...  lsm303dlhc_a: Sensors.LSM303DLHC_Accelerometer @ twi1 0x19 ${\n}
10...  ${SPACE*4}\[IRQ0,IRQ1\] -> gpio0@\[26,27\]                 ${\n}
11...                                                             ${\n}
12...  lsm303dlhc_g: Sensors.LSM303DLHC_Gyroscope @ twi1 0x1e     ${\n}
13...  """
14
15@{MAGNETICFIELD}=
16...  Magnetometer data:
17...  ( x y z ) = ( 20.000000${SPACE*2}5.000000${SPACE*2}-5.000000 )
18
19@{ACCELERATION}=
20...  Accelerometer data:
21...  ( x y z ) = ( 11.998728${SPACE*2}3.993192${SPACE*2}-2.001384 )
22
23
24*** Keywords ***
25Create Machine
26	Execute Command          mach create
27	Execute Command          machine LoadPlatformDescriptionFromString ${LSM303DLHC}
28	Execute Command          sysbus LoadELF ${URI}/nrf52840--zephyr_lsm303dlhc.elf-s_740272-51b2a14ca50e54790a80d65ed347f04d7d36c373
29
30*** Test Cases ***
31Should Read MagneticField
32	Create Machine
33	Create Terminal Tester    ${UART}
34
35	Execute Command           sysbus.twi1.lsm303dlhc_g MagneticFieldX 20
36	Execute Command           sysbus.twi1.lsm303dlhc_g MagneticFieldY 5
37	Execute Command           sysbus.twi1.lsm303dlhc_g MagneticFieldZ -5
38
39	Start Emulation
40	Wait For Lines On Uart    ${MAGNETICFIELD}
41
42Should Read Acceleration
43	Create Machine
44	Create Terminal Tester    ${UART}
45
46	Execute Command           sysbus.twi1.lsm303dlhc_a AccelerationX 12
47	Execute Command           sysbus.twi1.lsm303dlhc_a AccelerationY 4
48	Execute Command           sysbus.twi1.lsm303dlhc_a AccelerationZ -2
49
50	Start Emulation
51	Wait For Lines On Uart    ${ACCELERATION}
52