Clone of official tools

Committer:
Anders Blomdell
Date:
Thu Feb 04 17:17:13 2021 +0100
Revision:
47:21ae3e5a7128
Parent:
0:66f3b5499f7f
Add a few normpath calls

Who changed what in which revision?

UserRevisionLine numberNew contents of line
screamer 0:66f3b5499f7f 1 """
screamer 0:66f3b5499f7f 2 mbed SDK
screamer 0:66f3b5499f7f 3 Copyright (c) 2011-2013 ARM Limited
screamer 0:66f3b5499f7f 4
screamer 0:66f3b5499f7f 5 Licensed under the Apache License, Version 2.0 (the "License");
screamer 0:66f3b5499f7f 6 you may not use this file except in compliance with the License.
screamer 0:66f3b5499f7f 7 You may obtain a copy of the License at
screamer 0:66f3b5499f7f 8
screamer 0:66f3b5499f7f 9 http://www.apache.org/licenses/LICENSE-2.0
screamer 0:66f3b5499f7f 10
screamer 0:66f3b5499f7f 11 Unless required by applicable law or agreed to in writing, software
screamer 0:66f3b5499f7f 12 distributed under the License is distributed on an "AS IS" BASIS,
screamer 0:66f3b5499f7f 13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
screamer 0:66f3b5499f7f 14 See the License for the specific language governing permissions and
screamer 0:66f3b5499f7f 15 limitations under the License.
screamer 0:66f3b5499f7f 16 """
screamer 0:66f3b5499f7f 17 from host_test import Test
screamer 0:66f3b5499f7f 18 from mbedrpc import SerialRPC, DigitalOut, DigitalIn, pin
screamer 0:66f3b5499f7f 19
screamer 0:66f3b5499f7f 20
screamer 0:66f3b5499f7f 21 class RpcTest(Test):
screamer 0:66f3b5499f7f 22 def test(self):
screamer 0:66f3b5499f7f 23 self.notify("RPC Test")
screamer 0:66f3b5499f7f 24 s = SerialRPC(self.mbed.port, debug=True)
screamer 0:66f3b5499f7f 25
screamer 0:66f3b5499f7f 26 self.notify("Init remote objects")
screamer 0:66f3b5499f7f 27
screamer 0:66f3b5499f7f 28 p_out = pin("p10")
screamer 0:66f3b5499f7f 29 p_in = pin("p11")
screamer 0:66f3b5499f7f 30
screamer 0:66f3b5499f7f 31 if hasattr(self.mbed.options, 'micro'):
screamer 0:66f3b5499f7f 32 if self.mbed.options.micro == 'M0+':
screamer 0:66f3b5499f7f 33 print "Freedom Board: PTA12 <-> PTC4"
screamer 0:66f3b5499f7f 34 p_out = pin("PTA12")
screamer 0:66f3b5499f7f 35 p_in = pin("PTC4")
screamer 0:66f3b5499f7f 36
screamer 0:66f3b5499f7f 37 self.output = DigitalOut(s, p_out);
screamer 0:66f3b5499f7f 38 self.input = DigitalIn(s, p_in);
screamer 0:66f3b5499f7f 39
screamer 0:66f3b5499f7f 40 self.check = True
screamer 0:66f3b5499f7f 41 self.write_read_test(1)
screamer 0:66f3b5499f7f 42 self.write_read_test(0)
screamer 0:66f3b5499f7f 43 return self.check
screamer 0:66f3b5499f7f 44
screamer 0:66f3b5499f7f 45 def write_read_test(self, v):
screamer 0:66f3b5499f7f 46 self.notify("Check %d" % v)
screamer 0:66f3b5499f7f 47 self.output.write(v)
screamer 0:66f3b5499f7f 48 if self.input.read() != v:
screamer 0:66f3b5499f7f 49 self.notify("ERROR")
screamer 0:66f3b5499f7f 50 self.check = False
screamer 0:66f3b5499f7f 51 else:
screamer 0:66f3b5499f7f 52 self.notify("OK")
screamer 0:66f3b5499f7f 53
screamer 0:66f3b5499f7f 54
screamer 0:66f3b5499f7f 55 if __name__ == '__main__':
screamer 0:66f3b5499f7f 56 RpcTest().run()