Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
f31c249
Add a package called 'tactile' which provides utilities and classes t…
michaelDCurran Aug 15, 2024
30ed73c
Add a braille display driver for the Dot Pad tactile graphics braille…
michaelDCurran Aug 15, 2024
2879521
Pre-commit auto-fix
pre-commit-ci[bot] Aug 15, 2024
752fe1c
Add translator comments.
michaelDCurran Aug 15, 2024
9b19353
dotPad braille driver: save braille destination in config, and correc…
michaelDCurran Aug 15, 2024
73cca03
Update user guide.
michaelDCurran Aug 15, 2024
bbeb180
Update what's new
michaelDCurran Aug 15, 2024
a719902
Pre-commit auto-fix
pre-commit-ci[bot] Aug 15, 2024
1c320b6
drawBrailleCells: pass in desired cell padding. Update docstrings.
michaelDCurran Aug 15, 2024
470c866
Apply suggestions from code review
michaelDCurran Aug 18, 2024
efb0e29
Remove incorrect comment.
michaelDCurran Aug 18, 2024
cf5a144
Verify bounds when setting dots in drawBrailleCell
michaelDCurran Aug 18, 2024
56d2e46
Correct case of BrailleDestination constants.
michaelDCurran Aug 18, 2024
6fc04e6
Add type information.
michaelDCurran Aug 18, 2024
85b7095
dotPad: move Dot Pad device enums and constants into defs.py, move dr…
michaelDCurran Aug 18, 2024
2042d07
Update source/tactile/braille.py
michaelDCurran Aug 19, 2024
bdea59d
Pre-commit auto-fix
pre-commit-ci[bot] Aug 19, 2024
6928fef
setup.py include dotPad braille display driver package.
michaelDCurran Aug 19, 2024
f9d391f
Update user_docs/en/userGuide.md
seanbudd Aug 19, 2024
fe53dd8
Merge branch 'master' into dotPad
michaelDCurran Aug 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
dotPad: move Dot Pad device enums and constants into defs.py, move dr…
…iver stuff into driver.py.
  • Loading branch information
michaelDCurran committed Aug 18, 2024
commit 85b7095a78ad98c8cd8d6c1427104f9d729033f0
9 changes: 9 additions & 0 deletions source/brailleDisplayDrivers/dotPad/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# A part of NonVisual Desktop Access (NVDA)
# This file is covered by the GNU General Public License.
# See the file COPYING for more details.
# Copyright (C) 2024 NV Access Limited

"""Braille display driver for the Dot Pad Tactile Graphic braille display from Dot Inc."""

# Imported here so that braille._getDisplayDriver can import
from .driver import BrailleDisplayDriver # noqa: F401
Comment thread
seanbudd marked this conversation as resolved.
108 changes: 108 additions & 0 deletions source/brailleDisplayDrivers/dotPad/defs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2024 NV Access Limited
# This file is covered by the GNU General Public License.
# See the file COPYING for more details.


import enum
import ctypes


class DP_Command(enum.IntEnum):
REQ_FIRMWARE_VERSION = 0x0000
RSP_FIRMWARE_VERSION = 0x0001
REQ_DEVICE_NAME = 0x0100
RSP_DEVICE_NAME = 0x0101
REQ_BOARD_INFORMATION = 0x0110
RSP_BOARD_INFORMATION = 0x0111
REQ_DISPLAY_LINE = 0x0200
RSP_DISPLAY_LINE = 0x0201
NTF_DISPLAY_LINE = 0x0202
REQ_DISPLAY_CURSOR = 0x0210
RSP_DISPLAY_CURSOR = 0x0211
NTF_DISPLAY_CURSOR = 0x0212
NTF_KEYS_SCROLL = 0x0302
NTF_KEYS_PERKINS = 0x0312
NTF_KEYS_ROUTING = 0x0322
NTF_KEYS_FUNCTION = 0x0332
NTF_ERROR = 0x9902


class DP_ErrorCode(enum.IntEnum):
LENGTH = 1
COMMAND = 2
CHECKSUM = 3
PARAMETER = 4
TIMEOUT = 5


class DP_DisplayResponse(enum.IntEnum):
ACK = 0
NACK = 1
WAIT = 2
CHECKSUM = 3


class DP_Features(enum.IntFlag):
HAS_GRAPHIC_DISPLAY = 0x80
HAS_TEXT_DISPLAY = 0x40
HAS_PERKINS_KEYS = 0x20
HAS_ROUTING_KEYS = 0x10
HAS_NAVIGATION_KEYS = 0x08
HAS_PANNING_KEYS = 0x04
HAS_FUNCTION_KEYS = 0x02


class DP_DisplayDescriptor(ctypes.Structure):
_fields_ = [
("rowCount", ctypes.c_ubyte),
("columnCount", ctypes.c_ubyte),
("dividedLine", ctypes.c_ubyte),
("refreshTime", ctypes.c_ubyte),
]


class DP_BoardInformation(ctypes.Structure):
_fields_ = [
("features", ctypes.c_ubyte),
("dotsPerCell", ctypes.c_ubyte),
("distanceBetweenPins", ctypes.c_ubyte),
("functionKeyCount", ctypes.c_ubyte),
("text", DP_DisplayDescriptor),
("graphic", DP_DisplayDescriptor),
]


class DP_PacketSeqFlag(enum.IntEnum):
SEQ_TEXT = 0x80


class DP_PacketSyncByte(enum.IntEnum):
SYNC1 = 0xAA
SYNC2 = 0x55


class DP_PerkinsKey(enum.IntEnum):
DOT7 = 0
DOT3 = 1
DOT2 = 2
DOT1 = 3
DOT4 = 4
DOT5 = 5
DOT6 = 6
DOT8 = 7
SPACE = 8
SHIFT_LEFT = 9
CONTROL_LEFT = 10
SHIFT_RIGHT = 11
CONTROL_RIGHT = 12
PAN_LEFT = 13
PAN_RIGHT = 14
NAV_CENTER = 16
NAV_UP = 17
NAV_RIGHT = 18
NAV_DOWN = 19
NAV_LEFT = 20


DP_CHECKSUM_BASE = 0xA5
Original file line number Diff line number Diff line change
Expand Up @@ -19,110 +19,16 @@
from autoSettingsUtils.utils import StringParameterInfo
from tactile import TactileGraphicsBuffer
from tactile.braille import drawBrailleCells


BAUD_RATE = 115200
PARITY = serial.PARITY_NONE


class DP_Command(enum.IntEnum):
REQ_FIRMWARE_VERSION = 0x0000
RSP_FIRMWARE_VERSION = 0x0001
REQ_DEVICE_NAME = 0x0100
RSP_DEVICE_NAME = 0x0101
REQ_BOARD_INFORMATION = 0x0110
RSP_BOARD_INFORMATION = 0x0111
REQ_DISPLAY_LINE = 0x0200
RSP_DISPLAY_LINE = 0x0201
NTF_DISPLAY_LINE = 0x0202
REQ_DISPLAY_CURSOR = 0x0210
RSP_DISPLAY_CURSOR = 0x0211
NTF_DISPLAY_CURSOR = 0x0212
NTF_KEYS_SCROLL = 0x0302
NTF_KEYS_PERKINS = 0x0312
NTF_KEYS_ROUTING = 0x0322
NTF_KEYS_FUNCTION = 0x0332
NTF_ERROR = 0x9902


class DP_ErrorCode(enum.IntEnum):
LENGTH = 1
COMMAND = 2
CHECKSUM = 3
PARAMETER = 4
TIMEOUT = 5


class DP_DisplayResponse(enum.IntEnum):
ACK = 0
NACK = 1
WAIT = 2
CHECKSUM = 3


class DP_Features(enum.IntFlag):
HAS_GRAPHIC_DISPLAY = 0x80
HAS_TEXT_DISPLAY = 0x40
HAS_PERKINS_KEYS = 0x20
HAS_ROUTING_KEYS = 0x10
HAS_NAVIGATION_KEYS = 0x08
HAS_PANNING_KEYS = 0x04
HAS_FUNCTION_KEYS = 0x02


class DP_DisplayDescriptor(ctypes.Structure):
_fields_ = [
("rowCount", ctypes.c_ubyte),
("columnCount", ctypes.c_ubyte),
("dividedLine", ctypes.c_ubyte),
("refreshTime", ctypes.c_ubyte),
]


class DP_BoardInformation(ctypes.Structure):
_fields_ = [
("features", ctypes.c_ubyte),
("dotsPerCell", ctypes.c_ubyte),
("distanceBetweenPins", ctypes.c_ubyte),
("functionKeyCount", ctypes.c_ubyte),
("text", DP_DisplayDescriptor),
("graphic", DP_DisplayDescriptor),
]


class DP_PacketSeqFlag(enum.IntEnum):
SEQ_TEXT = 0x80


class DP_PacketSyncByte(enum.IntEnum):
SYNC1 = 0xAA
SYNC2 = 0x55


class DP_PerkinsKey(enum.IntEnum):
DOT7 = 0
DOT3 = 1
DOT2 = 2
DOT1 = 3
DOT4 = 4
DOT5 = 5
DOT6 = 6
DOT8 = 7
SPACE = 8
SHIFT_LEFT = 9
CONTROL_LEFT = 10
SHIFT_RIGHT = 11
CONTROL_RIGHT = 12
PAN_LEFT = 13
PAN_RIGHT = 14
NAV_CENTER = 16
NAV_UP = 17
NAV_RIGHT = 18
NAV_DOWN = 19
NAV_LEFT = 20


DP_CHECKSUM_BASE = 0xA5
from .defs import (
DP_Command,
DP_DisplayResponse,
DP_Features,
DP_PacketSeqFlag,
DP_PacketSyncByte,
DP_PerkinsKey,
DP_BoardInformation,
DP_CHECKSUM_BASE,
)


class DpTactileGraphicsBuffer(TactileGraphicsBuffer):
Expand Down Expand Up @@ -182,6 +88,8 @@ class BrailleDisplayDriver(braille.BrailleDisplayDriver):
hCellPadding = 1
vCellPadding = 1
_brailleDestination: BrailleDestination
SERIAL_BAUD_RATE = 115200
SERIAL_PARITY = serial.PARITY_NONE

@classmethod
def getManualPorts(cls):
Expand Down Expand Up @@ -308,8 +216,8 @@ def _handleNotification(self, cmd: DP_Command, data: bytes, dest: int = 0, seqNu
def __init__(self, port: str):
self._dev = hwIo.Serial(
port=port,
baudrate=BAUD_RATE,
parity=PARITY,
baudrate=self.SERIAL_BAUD_RATE,
parity=self.SERIAL_PARITY,
timeout=self.timeout,
writeTimeout=self.timeout,
onReceive=self._onReceive,
Expand Down