Keyboard firmwares for Atmel AVR and Cortex-M
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

default_auto.py 1.2KB

123456789101112131415161718192021222324252627282930313233343536
  1. """
  2. mbed SDK
  3. Copyright (c) 2011-2013 ARM Limited
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.apache.org/licenses/LICENSE-2.0
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. """
  14. from sys import stdout
  15. class DefaultAuto():
  16. """ Simple, basic host test's test runner waiting for serial port
  17. output from MUT, no supervision over test running in MUT is executed.
  18. """
  19. def test(self, selftest):
  20. result = selftest.RESULT_SUCCESS
  21. try:
  22. while True:
  23. c = selftest.mbed.serial_read(512)
  24. if c is None:
  25. return selftest.RESULT_IO_SERIAL
  26. stdout.write(c)
  27. stdout.flush()
  28. except KeyboardInterrupt, _:
  29. selftest.notify("\r\n[CTRL+C] exit")
  30. result = selftest.RESULT_ERROR
  31. return result