Keyboard firmwares for Atmel AVR and Cortex-M
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

hello_auto.py 1.1KB

12345678910111213141516171819202122232425262728293031323334
  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. class HelloTest():
  15. HELLO_WORLD = "Hello World"
  16. def test(self, selftest):
  17. c = selftest.mbed.serial_readline()
  18. if c is None:
  19. return selftest.RESULT_IO_SERIAL
  20. selftest.notify("Read %d bytes:"% len(c))
  21. selftest.notify(c.strip())
  22. result = True
  23. # Because we can have targetID here let's try to decode
  24. if len(c) < len(self.HELLO_WORLD):
  25. result = False
  26. else:
  27. result = self.HELLO_WORLD in c
  28. return selftest.RESULT_SUCCESS if result else selftest.RESULT_FAILURE