Skip to content

Commit

Permalink
Update flash docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
kg583 committed Jan 13, 2024
1 parent 76ca3da commit ad2a916
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tivars/flash.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class BCDDate(Converter):
"""
Converter for dates stored in four byte BCD
A date (dd, mm, yyyy) is stored in BCD as ddmmyyyy
A date (dd, mm, yyyy) is stored in BCD as ``ddmmyyyy``.
"""

_T = tuple[int, int, int]
Expand Down Expand Up @@ -63,7 +63,7 @@ class BCDRevision(Converter):
"""
Converter for revision numbers stored in two byte BCD
A revision xx.yy is stored in BCD as xxyy
A revision xx.yy is stored in BCD as ``xxyy``.
"""

_T = str
Expand Down Expand Up @@ -93,6 +93,14 @@ def set(cls, value: _T, **kwargs) -> bytes:


class FlashDevices(Converter):
"""
Converter for the device field of a flash header
The device field contains at least one device type and type ID pair (xx, yy), stored as ``xxyy`.
A flash header usually contains only has one pair in this field; the remainder of the field is null-padded.
The exception is a `TILicense`, which can hold licenses for multiple devices.
"""

_T = list[tuple[int, int]]

@classmethod
Expand Down
25 changes: 25 additions & 0 deletions tivars/types/flash.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
"""
Flash types
"""


from tivars.data import *
from tivars.flash import TIFlashHeader
from tivars.models import *


class TIOperatingSystem(TIFlashHeader, register=True):
"""
Parser for operating systems (OSes)
"""

extensions = {
None: "8eu",
TI_82A: "82u",
Expand All @@ -17,6 +26,10 @@ class TIOperatingSystem(TIFlashHeader, register=True):


class TIApp(TIFlashHeader, register=True):
"""
Parser for apps
"""

extensions = {
None: "8ek",
TI_83P: "8xk",
Expand All @@ -28,6 +41,12 @@ class TIApp(TIFlashHeader, register=True):


class TICertificate(TIFlashHeader, register=True):
"""
Parser for certificate files
To date, no external certificate files have been found in the wild.
"""

extensions = {
None: "8eq",
TI_83P: "8xq",
Expand All @@ -39,6 +58,12 @@ class TICertificate(TIFlashHeader, register=True):


class TILicense(TIFlashHeader, register=True):
"""
Parser for licenses
A license is simply a string containing the TI license agreement, possibly spanning multiple devices and languages.
"""

extensions = {
None: "8eu",
TI_82A: "82u",
Expand Down

0 comments on commit ad2a916

Please sign in to comment.