-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsample_ping.py
executable file
·31 lines (27 loc) · 1.02 KB
/
sample_ping.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python3
import argparse
import logging
import sys
sys.path.append('./common_lib/libraries')
from If820Board import If820Board
"""
Hardware Setup
This sample requires the following hardware:
-IF820 connected to PC via USB
-Jumpers on PUART_TXD, PUART_RXD must be installed.
"""
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('-d', '--debug', action='store_true',
help="Enable verbose debug messages")
logging.basicConfig(
format='%(asctime)s [%(module)s] %(levelname)s: %(message)s', level=logging.INFO)
args, unknown = parser.parse_known_args()
if args.debug:
logging.info("Debugging mode enabled")
logging.getLogger().setLevel(logging.DEBUG)
if820_board_p = If820Board.get_board()
if820_board_p.open_and_init_board()
logging.info('Sending ping command...')
res = if820_board_p.p_uart.send_and_wait(if820_board_p.p_uart.CMD_PING)
If820Board.check_if820_response(if820_board_p.p_uart.CMD_PING, res)