From 3cb0c26e93ede24cd31cca0d99e4e55041ca1d71 Mon Sep 17 00:00:00 2001 From: GetPsyched Date: Mon, 15 Jan 2024 14:20:46 +0530 Subject: [PATCH] feat: get_chordmaps --- charachorder/device.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/charachorder/device.py b/charachorder/device.py index be6210d..41d84df 100644 --- a/charachorder/device.py +++ b/charachorder/device.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Literal, NamedTuple +from typing import TYPE_CHECKING, Generator, Literal, NamedTuple from serial import Serial from serial.tools import list_ports @@ -216,6 +216,12 @@ def get_available_ram(self) -> int: def sim(self, subcommand: str, value: str) -> str: return self.execute("SIM", subcommand, value)[0] + # Misc. custom abstractions + + def get_chordmaps(self) -> Generator[tuple[Chord, ChordPhrase], None, None]: + chordmap_count = self.get_chordmap_count() + return (self.get_chordmap(i) for i in range(chordmap_count)) + @allowed_product_ids(0x800F) # M0 class CharaChorderOne(CharaChorder):