[WIP] Flipper Devtool (#113)

* FLPv0.1 on Python; File transfer is working.
* FLPv0.1 on Python; .gitignore fixes.
* Update protocol to latest version; change interface to OOP

Co-authored-by: Daniel Solmann <DanGSun@yandex.ru>
Co-authored-by: coreglitch <mail@s3f.ru>
This commit is contained in:
Daniel Solmann
2020-10-29 11:10:46 +03:00
committed by GitHub
parent 979af6c165
commit 0d7395d05c
7 changed files with 334 additions and 2 deletions

39
flp/flp.py Normal file
View File

@@ -0,0 +1,39 @@
import flipper
import serial
import click
DEFAULT_TTY = "/dev/ttyUSB0"
@click.group()
def cli():
pass
@cli.group()
def fs():
pass
@fs.command()
@click.argument("file_in", type=click.Path(exists=True))
@click.argument("file_out")
@click.option("--port", default=DEFAULT_TTY)
def push(file_in, file_out, port):
with serial.Serial(port, 115200, timeout=10) as p:
flipper.file.push(p, file_in, file_out)
print("OK.")
@fs.command()
@click.argument("file_in")
@click.argument("file_out", type=click.Path())
@click.option("--port", default=DEFAULT_TTY)
def pull(file_in, file_out, port):
with serial.Serial(port, 115200, timeout=10) as p:
flipper.file.pull(p, file_in, file_out)
print("OK.")
if __name__ == "__main__":
cli()