[FL-873] Add F5 target, lp5562 driver and api-hal-light (#347)

* Add F5 target, lp5562 driver and api-hal-light. Update api-usage, switch to F5 by default.
* API HAL: add i2c and hardware version api. Dolphin: show hardware version.
* OTP version generator and flashing utility.
* Assets script: fix code formatting
* Backport F5 changes to F4
* F4: disable insomnia, prevent damage to BLE RX path
* F5 HAL API Light: remove magic delay to fix magic BLE
* Dolphin: HW target validation on start
* invert RSSI indication in sub-1
* API HAL: rename board to body in version api
* Gpio tester: detach and release viewport on exit

Co-authored-by: aanper <mail@s3f.ru>
This commit is contained in:
あく
2021-02-18 15:49:32 +03:00
committed by GitHub
parent da91482b7d
commit 68a3f6b4b7
214 changed files with 25577 additions and 184 deletions

View File

@@ -6,6 +6,8 @@ import subprocess
import io
import os
import sys
import struct
import datetime
ICONS_SUPPORTED_FORMATS = ["png"]
@@ -64,6 +66,21 @@ class Assets:
"-o", "--output-directory", help="Output directory"
)
self.parser_icons.set_defaults(func=self.icons)
self.parser_otp = self.subparsers.add_parser(
"otp", help="OTP HW version generator"
)
self.parser_otp.add_argument(
"--version", type=int, help="Version", required=True
)
self.parser_otp.add_argument(
"--firmware", type=int, help="Firmware", required=True
)
self.parser_otp.add_argument("--body", type=int, help="Body", required=True)
self.parser_otp.add_argument(
"--connect", type=int, help="Connect", required=True
)
self.parser_otp.add_argument("file", help="Output file")
self.parser_otp.set_defaults(func=self.otp)
# logging
self.logger = logging.getLogger()
@@ -82,6 +99,18 @@ class Assets:
# execute requested function
self.args.func()
def otp(self):
self.logger.debug(f"Generating OTP")
data = struct.pack(
"<BBBBL",
self.args.version,
self.args.firmware,
self.args.body,
self.args.connect,
int(datetime.datetime.now().timestamp()),
)
open(self.args.file, "wb").write(data)
def icons(self):
self.logger.debug(f"Converting icons")
icons_c = open(os.path.join(self.args.output_directory, "assets_icons.c"), "w")