format all files
This commit is contained in:
Родитель
e3ec628e42
Коммит
efa07d8861
16
SECURITY.md
16
SECURITY.md
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
|
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
|
||||||
|
|
||||||
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)), please report it to us as described below.
|
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](<https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)>), please report it to us as described below.
|
||||||
|
|
||||||
## Reporting Security Issues
|
## Reporting Security Issues
|
||||||
|
|
||||||
|
@ -18,13 +18,13 @@ You should receive a response within 24 hours. If for some reason you do not, pl
|
||||||
|
|
||||||
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
|
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
|
||||||
|
|
||||||
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
|
- Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
|
||||||
* Full paths of source file(s) related to the manifestation of the issue
|
- Full paths of source file(s) related to the manifestation of the issue
|
||||||
* The location of the affected source code (tag/branch/commit or direct URL)
|
- The location of the affected source code (tag/branch/commit or direct URL)
|
||||||
* Any special configuration required to reproduce the issue
|
- Any special configuration required to reproduce the issue
|
||||||
* Step-by-step instructions to reproduce the issue
|
- Step-by-step instructions to reproduce the issue
|
||||||
* Proof-of-concept or exploit code (if possible)
|
- Proof-of-concept or exploit code (if possible)
|
||||||
* Impact of the issue, including how an attacker might exploit the issue
|
- Impact of the issue, including how an attacker might exploit the issue
|
||||||
|
|
||||||
This information will help us triage your report more quickly.
|
This information will help us triage your report more quickly.
|
||||||
|
|
||||||
|
|
|
@ -3,14 +3,15 @@ from .constants import *
|
||||||
from typing import Union
|
from typing import Union
|
||||||
from jacdac.events import HandlerFn
|
from jacdac.events import HandlerFn
|
||||||
|
|
||||||
|
|
||||||
class AccelerometerClient(Client):
|
class AccelerometerClient(Client):
|
||||||
"""
|
"""
|
||||||
A 3-axis accelerometer.
|
A 3-axis accelerometer.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, bus: Bus, role: str) -> None:
|
def __init__(self, bus: Bus, role: str) -> None:
|
||||||
super().__init__(bus, JD_SERVICE_CLASS_ACCELEROMETER, JD_ACCELEROMETER_PACK_FORMATS, role)
|
super().__init__(bus, JD_SERVICE_CLASS_ACCELEROMETER,
|
||||||
|
JD_ACCELEROMETER_PACK_FORMATS, role)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def x(self) -> Union[float, None]:
|
def x(self) -> Union[float, None]:
|
||||||
|
@ -58,7 +59,6 @@ class AccelerometerClient(Client):
|
||||||
reg = self.register(JD_ACCELEROMETER_REG_MAX_FORCE)
|
reg = self.register(JD_ACCELEROMETER_REG_MAX_FORCE)
|
||||||
reg.set_value(0, value)
|
reg.set_value(0, value)
|
||||||
|
|
||||||
|
|
||||||
def on_tilt_up(self, handler: HandlerFn) -> None:
|
def on_tilt_up(self, handler: HandlerFn) -> None:
|
||||||
"""
|
"""
|
||||||
Emitted when accelerometer is tilted in the given direction.
|
Emitted when accelerometer is tilted in the given direction.
|
||||||
|
@ -130,5 +130,3 @@ class AccelerometerClient(Client):
|
||||||
Emitted when force in any direction exceeds given threshold.
|
Emitted when force in any direction exceeds given threshold.
|
||||||
"""
|
"""
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@ from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
from jacdac.system.constants import *
|
from jacdac.system.constants import *
|
||||||
JD_SERVICE_CLASS_ARCADE_GAMEPAD = const(0x1deaa06e)
|
JD_SERVICE_CLASS_ARCADE_GAMEPAD = const(0x1deaa06e)
|
||||||
|
|
||||||
|
|
||||||
class ArcadeGamepadButton(Enum):
|
class ArcadeGamepadButton(Enum):
|
||||||
LEFT = const(0x1)
|
LEFT = const(0x1)
|
||||||
UP = const(0x2)
|
UP = const(0x2)
|
||||||
|
@ -17,6 +19,7 @@ class ArcadeGamepadButton(Enum):
|
||||||
RESET = const(0x9)
|
RESET = const(0x9)
|
||||||
EXIT = const(0xa)
|
EXIT = const(0xa)
|
||||||
|
|
||||||
|
|
||||||
JD_ARCADE_GAMEPAD_REG_BUTTONS = const(JD_REG_READING)
|
JD_ARCADE_GAMEPAD_REG_BUTTONS = const(JD_REG_READING)
|
||||||
JD_ARCADE_GAMEPAD_REG_AVAILABLE_BUTTONS = const(0x180)
|
JD_ARCADE_GAMEPAD_REG_AVAILABLE_BUTTONS = const(0x180)
|
||||||
JD_ARCADE_GAMEPAD_EV_DOWN = const(JD_EV_ACTIVE)
|
JD_ARCADE_GAMEPAD_EV_DOWN = const(JD_EV_ACTIVE)
|
||||||
|
|
|
@ -5,12 +5,15 @@ from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
from jacdac.system.constants import *
|
from jacdac.system.constants import *
|
||||||
JD_SERVICE_CLASS_AZURE_IOT_HUB_HEALTH = const(0x1462eefc)
|
JD_SERVICE_CLASS_AZURE_IOT_HUB_HEALTH = const(0x1462eefc)
|
||||||
|
|
||||||
|
|
||||||
class AzureIotHubHealthConnectionStatus(Enum):
|
class AzureIotHubHealthConnectionStatus(Enum):
|
||||||
CONNECTED = const(0x1)
|
CONNECTED = const(0x1)
|
||||||
DISCONNECTED = const(0x2)
|
DISCONNECTED = const(0x2)
|
||||||
CONNECTING = const(0x3)
|
CONNECTING = const(0x3)
|
||||||
DISCONNECTING = const(0x4)
|
DISCONNECTING = const(0x4)
|
||||||
|
|
||||||
|
|
||||||
JD_AZURE_IOT_HUB_HEALTH_REG_HUB_NAME = const(0x180)
|
JD_AZURE_IOT_HUB_HEALTH_REG_HUB_NAME = const(0x180)
|
||||||
JD_AZURE_IOT_HUB_HEALTH_REG_HUB_DEVICE_ID = const(0x181)
|
JD_AZURE_IOT_HUB_HEALTH_REG_HUB_DEVICE_ID = const(0x181)
|
||||||
JD_AZURE_IOT_HUB_HEALTH_REG_CONNECTION_STATUS = const(0x182)
|
JD_AZURE_IOT_HUB_HEALTH_REG_CONNECTION_STATUS = const(0x182)
|
||||||
|
|
|
@ -5,6 +5,8 @@ from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
from jacdac.system.constants import *
|
from jacdac.system.constants import *
|
||||||
JD_SERVICE_CLASS_BARCODE_READER = const(0x1c739e6c)
|
JD_SERVICE_CLASS_BARCODE_READER = const(0x1c739e6c)
|
||||||
|
|
||||||
|
|
||||||
class BarcodeReaderFormat(Enum):
|
class BarcodeReaderFormat(Enum):
|
||||||
AZTEC = const(0x1)
|
AZTEC = const(0x1)
|
||||||
CODE128 = const(0x2)
|
CODE128 = const(0x2)
|
||||||
|
@ -20,6 +22,7 @@ class BarcodeReaderFormat(Enum):
|
||||||
UPC_A = const(0xd)
|
UPC_A = const(0xd)
|
||||||
UPC_E = const(0xe)
|
UPC_E = const(0xe)
|
||||||
|
|
||||||
|
|
||||||
JD_BARCODE_READER_REG_ENABLED = const(JD_REG_INTENSITY)
|
JD_BARCODE_READER_REG_ENABLED = const(JD_REG_INTENSITY)
|
||||||
JD_BARCODE_READER_REG_FORMATS = const(0x180)
|
JD_BARCODE_READER_REG_FORMATS = const(0x180)
|
||||||
JD_BARCODE_READER_EV_DETECT = const(JD_EV_ACTIVE)
|
JD_BARCODE_READER_EV_DETECT = const(JD_EV_ACTIVE)
|
||||||
|
|
|
@ -11,7 +11,6 @@ class BarometerClient(Client):
|
||||||
def __init__(self, bus: Bus, role: str) -> None:
|
def __init__(self, bus: Bus, role: str) -> None:
|
||||||
super().__init__(bus, JD_SERVICE_CLASS_BAROMETER, JD_BAROMETER_PACK_FORMATS, role)
|
super().__init__(bus, JD_SERVICE_CLASS_BAROMETER, JD_BAROMETER_PACK_FORMATS, role)
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def pressure(self) -> Union[float, None]:
|
def pressure(self) -> Union[float, None]:
|
||||||
"""
|
"""
|
||||||
|
@ -27,5 +26,3 @@ class BarometerClient(Client):
|
||||||
"""
|
"""
|
||||||
reg = self.register(JD_BAROMETER_REG_PRESSURE_ERROR)
|
reg = self.register(JD_BAROMETER_REG_PRESSURE_ERROR)
|
||||||
return reg.value(0)
|
return reg.value(0)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,15 +5,19 @@ from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
from jacdac.system.constants import *
|
from jacdac.system.constants import *
|
||||||
JD_SERVICE_CLASS_CHARACTER_SCREEN = const(0x1f37c56a)
|
JD_SERVICE_CLASS_CHARACTER_SCREEN = const(0x1f37c56a)
|
||||||
|
|
||||||
|
|
||||||
class CharacterScreenVariant(Enum):
|
class CharacterScreenVariant(Enum):
|
||||||
LCD = const(0x1)
|
LCD = const(0x1)
|
||||||
OLED = const(0x2)
|
OLED = const(0x2)
|
||||||
BRAILLE = const(0x3)
|
BRAILLE = const(0x3)
|
||||||
|
|
||||||
|
|
||||||
class CharacterScreenTextDirection(Enum):
|
class CharacterScreenTextDirection(Enum):
|
||||||
LEFT_TO_RIGHT = const(0x1)
|
LEFT_TO_RIGHT = const(0x1)
|
||||||
RIGHT_TO_LEFT = const(0x2)
|
RIGHT_TO_LEFT = const(0x2)
|
||||||
|
|
||||||
|
|
||||||
JD_CHARACTER_SCREEN_REG_MESSAGE = const(JD_REG_VALUE)
|
JD_CHARACTER_SCREEN_REG_MESSAGE = const(JD_REG_VALUE)
|
||||||
JD_CHARACTER_SCREEN_REG_BRIGHTNESS = const(JD_REG_INTENSITY)
|
JD_CHARACTER_SCREEN_REG_BRIGHTNESS = const(JD_REG_INTENSITY)
|
||||||
JD_CHARACTER_SCREEN_REG_VARIANT = const(JD_REG_VARIANT)
|
JD_CHARACTER_SCREEN_REG_VARIANT = const(JD_REG_VARIANT)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
def const(v: int): return v
|
def const(v: int): return v
|
||||||
# A shim for the micropython const keyword
|
# A shim for the micropython const keyword
|
||||||
|
|
||||||
|
|
||||||
JD_SERIAL_HEADER_SIZE = const(16)
|
JD_SERIAL_HEADER_SIZE = const(16)
|
||||||
JD_SERIAL_MAX_PAYLOAD_SIZE = const(236)
|
JD_SERIAL_MAX_PAYLOAD_SIZE = const(236)
|
||||||
|
@ -29,10 +30,12 @@ CMD_EVENT_CODE_MASK = const(0xff)
|
||||||
CMD_EVENT_COUNTER_MASK = const(0x7f)
|
CMD_EVENT_COUNTER_MASK = const(0x7f)
|
||||||
CMD_EVENT_COUNTER_POS = const(8)
|
CMD_EVENT_COUNTER_POS = const(8)
|
||||||
|
|
||||||
|
|
||||||
def JD_GET(code: int):
|
def JD_GET(code: int):
|
||||||
assert 0 <= code and code <= 0xfff
|
assert 0 <= code and code <= 0xfff
|
||||||
return CMD_GET_REG | code
|
return CMD_GET_REG | code
|
||||||
|
|
||||||
|
|
||||||
def JD_SET(code: int):
|
def JD_SET(code: int):
|
||||||
assert 0 <= code and code <= 0xfff
|
assert 0 <= code and code <= 0xfff
|
||||||
return CMD_SET_REG | code
|
return CMD_SET_REG | code
|
||||||
|
|
|
@ -5,11 +5,14 @@ from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
from jacdac.system.constants import *
|
from jacdac.system.constants import *
|
||||||
JD_SERVICE_CLASS_DIMMER = const(0x1fb02645)
|
JD_SERVICE_CLASS_DIMMER = const(0x1fb02645)
|
||||||
|
|
||||||
|
|
||||||
class DimmerVariant(Enum):
|
class DimmerVariant(Enum):
|
||||||
LIGHT = const(0x1)
|
LIGHT = const(0x1)
|
||||||
FAN = const(0x2)
|
FAN = const(0x2)
|
||||||
PUMP = const(0x3)
|
PUMP = const(0x3)
|
||||||
|
|
||||||
|
|
||||||
JD_DIMMER_REG_INTENSITY = const(JD_REG_INTENSITY)
|
JD_DIMMER_REG_INTENSITY = const(JD_REG_INTENSITY)
|
||||||
JD_DIMMER_REG_VARIANT = const(JD_REG_VARIANT)
|
JD_DIMMER_REG_VARIANT = const(JD_REG_VARIANT)
|
||||||
JD_DIMMER_PACK_FORMATS = {
|
JD_DIMMER_PACK_FORMATS = {
|
||||||
|
|
|
@ -5,12 +5,15 @@ from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
from jacdac.system.constants import *
|
from jacdac.system.constants import *
|
||||||
JD_SERVICE_CLASS_DISTANCE = const(0x141a6b8a)
|
JD_SERVICE_CLASS_DISTANCE = const(0x141a6b8a)
|
||||||
|
|
||||||
|
|
||||||
class DistanceVariant(Enum):
|
class DistanceVariant(Enum):
|
||||||
ULTRASONIC = const(0x1)
|
ULTRASONIC = const(0x1)
|
||||||
INFRARED = const(0x2)
|
INFRARED = const(0x2)
|
||||||
LI_DAR = const(0x3)
|
LI_DAR = const(0x3)
|
||||||
LASER = const(0x4)
|
LASER = const(0x4)
|
||||||
|
|
||||||
|
|
||||||
JD_DISTANCE_REG_DISTANCE = const(JD_REG_READING)
|
JD_DISTANCE_REG_DISTANCE = const(JD_REG_READING)
|
||||||
JD_DISTANCE_REG_MIN_RANGE = const(JD_REG_MIN_READING)
|
JD_DISTANCE_REG_MIN_RANGE = const(JD_REG_MIN_READING)
|
||||||
JD_DISTANCE_REG_MAX_RANGE = const(JD_REG_MAX_READING)
|
JD_DISTANCE_REG_MAX_RANGE = const(JD_REG_MAX_READING)
|
||||||
|
|
|
@ -5,10 +5,13 @@ from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
from jacdac.system.constants import *
|
from jacdac.system.constants import *
|
||||||
JD_SERVICE_CLASS_DOT_MATRIX = const(0x110d154b)
|
JD_SERVICE_CLASS_DOT_MATRIX = const(0x110d154b)
|
||||||
|
|
||||||
|
|
||||||
class DotMatrixVariant(Enum):
|
class DotMatrixVariant(Enum):
|
||||||
LED = const(0x1)
|
LED = const(0x1)
|
||||||
BRAILLE = const(0x2)
|
BRAILLE = const(0x2)
|
||||||
|
|
||||||
|
|
||||||
JD_DOT_MATRIX_REG_DOTS = const(JD_REG_VALUE)
|
JD_DOT_MATRIX_REG_DOTS = const(JD_REG_VALUE)
|
||||||
JD_DOT_MATRIX_REG_BRIGHTNESS = const(JD_REG_INTENSITY)
|
JD_DOT_MATRIX_REG_BRIGHTNESS = const(JD_REG_INTENSITY)
|
||||||
JD_DOT_MATRIX_REG_ROWS = const(0x181)
|
JD_DOT_MATRIX_REG_ROWS = const(0x181)
|
||||||
|
|
|
@ -5,10 +5,13 @@ from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
from jacdac.system.constants import *
|
from jacdac.system.constants import *
|
||||||
JD_SERVICE_CLASS_E_CO2 = const(0x169c9dc6)
|
JD_SERVICE_CLASS_E_CO2 = const(0x169c9dc6)
|
||||||
|
|
||||||
|
|
||||||
class ECO2Variant(Enum):
|
class ECO2Variant(Enum):
|
||||||
VOC = const(0x1)
|
VOC = const(0x1)
|
||||||
NDIR = const(0x2)
|
NDIR = const(0x2)
|
||||||
|
|
||||||
|
|
||||||
JD_E_CO2_REG_E_CO2 = const(JD_REG_READING)
|
JD_E_CO2_REG_E_CO2 = const(JD_REG_READING)
|
||||||
JD_E_CO2_REG_E_CO2_ERROR = const(JD_REG_READING_ERROR)
|
JD_E_CO2_REG_E_CO2_ERROR = const(JD_REG_READING_ERROR)
|
||||||
JD_E_CO2_REG_MIN_E_CO2 = const(JD_REG_MIN_READING)
|
JD_E_CO2_REG_MIN_E_CO2 = const(JD_REG_MIN_READING)
|
||||||
|
|
|
@ -5,10 +5,13 @@ from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
from jacdac.system.constants import *
|
from jacdac.system.constants import *
|
||||||
JD_SERVICE_CLASS_FLEX = const(0x1f47c6c6)
|
JD_SERVICE_CLASS_FLEX = const(0x1f47c6c6)
|
||||||
|
|
||||||
|
|
||||||
class FlexVariant(Enum):
|
class FlexVariant(Enum):
|
||||||
LINEAR22INCH = const(0x1)
|
LINEAR22INCH = const(0x1)
|
||||||
LINEAR45INCH = const(0x2)
|
LINEAR45INCH = const(0x2)
|
||||||
|
|
||||||
|
|
||||||
JD_FLEX_REG_BENDING = const(JD_REG_READING)
|
JD_FLEX_REG_BENDING = const(JD_REG_READING)
|
||||||
JD_FLEX_REG_VARIANT = const(JD_REG_VARIANT)
|
JD_FLEX_REG_VARIANT = const(JD_REG_VARIANT)
|
||||||
JD_FLEX_PACK_FORMATS = {
|
JD_FLEX_PACK_FORMATS = {
|
||||||
|
|
|
@ -5,6 +5,8 @@ from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
from jacdac.system.constants import *
|
from jacdac.system.constants import *
|
||||||
JD_SERVICE_CLASS_HEART_RATE = const(0x166c6dc4)
|
JD_SERVICE_CLASS_HEART_RATE = const(0x166c6dc4)
|
||||||
|
|
||||||
|
|
||||||
class HeartRateVariant(Enum):
|
class HeartRateVariant(Enum):
|
||||||
FINGER = const(0x1)
|
FINGER = const(0x1)
|
||||||
CHEST = const(0x2)
|
CHEST = const(0x2)
|
||||||
|
@ -12,6 +14,7 @@ class HeartRateVariant(Enum):
|
||||||
PUMP = const(0x4)
|
PUMP = const(0x4)
|
||||||
WEB_CAM = const(0x5)
|
WEB_CAM = const(0x5)
|
||||||
|
|
||||||
|
|
||||||
JD_HEART_RATE_REG_HEART_RATE = const(JD_REG_READING)
|
JD_HEART_RATE_REG_HEART_RATE = const(JD_REG_READING)
|
||||||
JD_HEART_RATE_REG_HEART_RATE_ERROR = const(JD_REG_READING_ERROR)
|
JD_HEART_RATE_REG_HEART_RATE_ERROR = const(JD_REG_READING_ERROR)
|
||||||
JD_HEART_RATE_REG_VARIANT = const(JD_REG_VARIANT)
|
JD_HEART_RATE_REG_VARIANT = const(JD_REG_VARIANT)
|
||||||
|
|
|
@ -4,6 +4,8 @@ Autogenerated constants for HID Keyboard service
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
JD_SERVICE_CLASS_HID_KEYBOARD = const(0x18b05b6a)
|
JD_SERVICE_CLASS_HID_KEYBOARD = const(0x18b05b6a)
|
||||||
|
|
||||||
|
|
||||||
class HidKeyboardModifiers(Enum):
|
class HidKeyboardModifiers(Enum):
|
||||||
NONE = const(0x0)
|
NONE = const(0x0)
|
||||||
LEFT_CONTROL = const(0x1)
|
LEFT_CONTROL = const(0x1)
|
||||||
|
@ -15,11 +17,13 @@ class HidKeyboardModifiers(Enum):
|
||||||
RIGHT_ALT = const(0x40)
|
RIGHT_ALT = const(0x40)
|
||||||
RIGHT_GUI = const(0x80)
|
RIGHT_GUI = const(0x80)
|
||||||
|
|
||||||
|
|
||||||
class HidKeyboardAction(Enum):
|
class HidKeyboardAction(Enum):
|
||||||
PRESS = const(0x0)
|
PRESS = const(0x0)
|
||||||
UP = const(0x1)
|
UP = const(0x1)
|
||||||
DOWN = const(0x2)
|
DOWN = const(0x2)
|
||||||
|
|
||||||
|
|
||||||
JD_HID_KEYBOARD_CMD_KEY = const(0x80)
|
JD_HID_KEYBOARD_CMD_KEY = const(0x80)
|
||||||
JD_HID_KEYBOARD_CMD_CLEAR = const(0x81)
|
JD_HID_KEYBOARD_CMD_CLEAR = const(0x81)
|
||||||
JD_HID_KEYBOARD_PACK_FORMATS = {
|
JD_HID_KEYBOARD_PACK_FORMATS = {
|
||||||
|
|
|
@ -4,17 +4,21 @@ Autogenerated constants for HID Mouse service
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
JD_SERVICE_CLASS_HID_MOUSE = const(0x1885dc1c)
|
JD_SERVICE_CLASS_HID_MOUSE = const(0x1885dc1c)
|
||||||
|
|
||||||
|
|
||||||
class HidMouseButton(Enum):
|
class HidMouseButton(Enum):
|
||||||
LEFT = const(0x1)
|
LEFT = const(0x1)
|
||||||
RIGHT = const(0x2)
|
RIGHT = const(0x2)
|
||||||
MIDDLE = const(0x4)
|
MIDDLE = const(0x4)
|
||||||
|
|
||||||
|
|
||||||
class HidMouseButtonEvent(Enum):
|
class HidMouseButtonEvent(Enum):
|
||||||
UP = const(0x1)
|
UP = const(0x1)
|
||||||
DOWN = const(0x2)
|
DOWN = const(0x2)
|
||||||
CLICK = const(0x3)
|
CLICK = const(0x3)
|
||||||
DOUBLE_CLICK = const(0x4)
|
DOUBLE_CLICK = const(0x4)
|
||||||
|
|
||||||
|
|
||||||
JD_HID_MOUSE_CMD_SET_BUTTON = const(0x80)
|
JD_HID_MOUSE_CMD_SET_BUTTON = const(0x80)
|
||||||
JD_HID_MOUSE_CMD_MOVE = const(0x81)
|
JD_HID_MOUSE_CMD_MOVE = const(0x81)
|
||||||
JD_HID_MOUSE_CMD_WHEEL = const(0x82)
|
JD_HID_MOUSE_CMD_WHEEL = const(0x82)
|
||||||
|
|
|
@ -5,6 +5,8 @@ from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
from jacdac.system.constants import *
|
from jacdac.system.constants import *
|
||||||
JD_SERVICE_CLASS_JOYSTICK = const(0x108f7456)
|
JD_SERVICE_CLASS_JOYSTICK = const(0x108f7456)
|
||||||
|
|
||||||
|
|
||||||
class JoystickButtons(Enum):
|
class JoystickButtons(Enum):
|
||||||
LEFT = const(0x1)
|
LEFT = const(0x1)
|
||||||
UP = const(0x2)
|
UP = const(0x2)
|
||||||
|
@ -19,12 +21,14 @@ class JoystickButtons(Enum):
|
||||||
X = const(0x400)
|
X = const(0x400)
|
||||||
Y = const(0x800)
|
Y = const(0x800)
|
||||||
|
|
||||||
|
|
||||||
class JoystickVariant(Enum):
|
class JoystickVariant(Enum):
|
||||||
THUMB = const(0x1)
|
THUMB = const(0x1)
|
||||||
ARCADE_BALL = const(0x2)
|
ARCADE_BALL = const(0x2)
|
||||||
ARCADE_STICK = const(0x3)
|
ARCADE_STICK = const(0x3)
|
||||||
GAMEPAD = const(0x4)
|
GAMEPAD = const(0x4)
|
||||||
|
|
||||||
|
|
||||||
JD_JOYSTICK_REG_DIRECTION = const(JD_REG_READING)
|
JD_JOYSTICK_REG_DIRECTION = const(JD_REG_READING)
|
||||||
JD_JOYSTICK_REG_VARIANT = const(JD_REG_VARIANT)
|
JD_JOYSTICK_REG_VARIANT = const(JD_REG_VARIANT)
|
||||||
JD_JOYSTICK_REG_BUTTONS_AVAILABLE = const(0x180)
|
JD_JOYSTICK_REG_BUTTONS_AVAILABLE = const(0x180)
|
||||||
|
|
|
@ -5,12 +5,15 @@ from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
from jacdac.system.constants import *
|
from jacdac.system.constants import *
|
||||||
JD_SERVICE_CLASS_LED = const(0x1e3048f8)
|
JD_SERVICE_CLASS_LED = const(0x1e3048f8)
|
||||||
|
|
||||||
|
|
||||||
class LedVariant(Enum):
|
class LedVariant(Enum):
|
||||||
THROUGH_HOLE = const(0x1)
|
THROUGH_HOLE = const(0x1)
|
||||||
SMD = const(0x2)
|
SMD = const(0x2)
|
||||||
POWER = const(0x3)
|
POWER = const(0x3)
|
||||||
BEAD = const(0x4)
|
BEAD = const(0x4)
|
||||||
|
|
||||||
|
|
||||||
JD_LED_CMD_ANIMATE = const(0x80)
|
JD_LED_CMD_ANIMATE = const(0x80)
|
||||||
JD_LED_REG_COLOR = const(0x180)
|
JD_LED_REG_COLOR = const(0x180)
|
||||||
JD_LED_REG_MAX_POWER = const(JD_REG_MAX_POWER)
|
JD_LED_REG_MAX_POWER = const(JD_REG_MAX_POWER)
|
||||||
|
|
|
@ -5,11 +5,14 @@ from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
from jacdac.system.constants import *
|
from jacdac.system.constants import *
|
||||||
JD_SERVICE_CLASS_LED_PIXEL = const(0x126f00e0)
|
JD_SERVICE_CLASS_LED_PIXEL = const(0x126f00e0)
|
||||||
|
|
||||||
|
|
||||||
class LedPixelLightType(Enum):
|
class LedPixelLightType(Enum):
|
||||||
WS2812B_GRB = const(0x0)
|
WS2812B_GRB = const(0x0)
|
||||||
APA102 = const(0x10)
|
APA102 = const(0x10)
|
||||||
SK9822 = const(0x11)
|
SK9822 = const(0x11)
|
||||||
|
|
||||||
|
|
||||||
class LedPixelVariant(Enum):
|
class LedPixelVariant(Enum):
|
||||||
STRIP = const(0x1)
|
STRIP = const(0x1)
|
||||||
RING = const(0x2)
|
RING = const(0x2)
|
||||||
|
@ -17,6 +20,7 @@ class LedPixelVariant(Enum):
|
||||||
JEWEL = const(0x4)
|
JEWEL = const(0x4)
|
||||||
MATRIX = const(0x5)
|
MATRIX = const(0x5)
|
||||||
|
|
||||||
|
|
||||||
JD_LED_PIXEL_REG_BRIGHTNESS = const(JD_REG_INTENSITY)
|
JD_LED_PIXEL_REG_BRIGHTNESS = const(JD_REG_INTENSITY)
|
||||||
JD_LED_PIXEL_REG_ACTUAL_BRIGHTNESS = const(0x180)
|
JD_LED_PIXEL_REG_ACTUAL_BRIGHTNESS = const(0x180)
|
||||||
JD_LED_PIXEL_REG_LIGHT_TYPE = const(0x80)
|
JD_LED_PIXEL_REG_LIGHT_TYPE = const(0x80)
|
||||||
|
|
|
@ -5,11 +5,14 @@ from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
from jacdac.system.constants import *
|
from jacdac.system.constants import *
|
||||||
JD_SERVICE_CLASS_LIGHT_LEVEL = const(0x17dc9a1c)
|
JD_SERVICE_CLASS_LIGHT_LEVEL = const(0x17dc9a1c)
|
||||||
|
|
||||||
|
|
||||||
class LightLevelVariant(Enum):
|
class LightLevelVariant(Enum):
|
||||||
PHOTO_RESISTOR = const(0x1)
|
PHOTO_RESISTOR = const(0x1)
|
||||||
LEDMATRIX = const(0x2)
|
LEDMATRIX = const(0x2)
|
||||||
AMBIENT = const(0x3)
|
AMBIENT = const(0x3)
|
||||||
|
|
||||||
|
|
||||||
JD_LIGHT_LEVEL_REG_LIGHT_LEVEL = const(JD_REG_READING)
|
JD_LIGHT_LEVEL_REG_LIGHT_LEVEL = const(JD_REG_READING)
|
||||||
JD_LIGHT_LEVEL_REG_VARIANT = const(JD_REG_VARIANT)
|
JD_LIGHT_LEVEL_REG_VARIANT = const(JD_REG_VARIANT)
|
||||||
JD_LIGHT_LEVEL_PACK_FORMATS = {
|
JD_LIGHT_LEVEL_PACK_FORMATS = {
|
||||||
|
|
|
@ -5,12 +5,15 @@ from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
from jacdac.system.constants import *
|
from jacdac.system.constants import *
|
||||||
JD_SERVICE_CLASS_MATRIX_KEYPAD = const(0x13062dc8)
|
JD_SERVICE_CLASS_MATRIX_KEYPAD = const(0x13062dc8)
|
||||||
|
|
||||||
|
|
||||||
class MatrixKeypadVariant(Enum):
|
class MatrixKeypadVariant(Enum):
|
||||||
MEMBRANE = const(0x1)
|
MEMBRANE = const(0x1)
|
||||||
KEYBOARD = const(0x2)
|
KEYBOARD = const(0x2)
|
||||||
ELASTOMER = const(0x3)
|
ELASTOMER = const(0x3)
|
||||||
ELASTOMER_LEDPIXEL = const(0x4)
|
ELASTOMER_LEDPIXEL = const(0x4)
|
||||||
|
|
||||||
|
|
||||||
JD_MATRIX_KEYPAD_REG_PRESSED = const(JD_REG_READING)
|
JD_MATRIX_KEYPAD_REG_PRESSED = const(JD_REG_READING)
|
||||||
JD_MATRIX_KEYPAD_REG_ROWS = const(0x180)
|
JD_MATRIX_KEYPAD_REG_ROWS = const(0x180)
|
||||||
JD_MATRIX_KEYPAD_REG_COLUMNS = const(0x181)
|
JD_MATRIX_KEYPAD_REG_COLUMNS = const(0x181)
|
||||||
|
|
|
@ -5,11 +5,14 @@ from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
from jacdac.system.constants import *
|
from jacdac.system.constants import *
|
||||||
JD_SERVICE_CLASS_MODEL_RUNNER = const(0x140f9a78)
|
JD_SERVICE_CLASS_MODEL_RUNNER = const(0x140f9a78)
|
||||||
|
|
||||||
|
|
||||||
class ModelRunnerModelFormat(Enum):
|
class ModelRunnerModelFormat(Enum):
|
||||||
TFLITE = const(0x334c4654)
|
TFLITE = const(0x334c4654)
|
||||||
ML4F = const(0x30470f62)
|
ML4F = const(0x30470f62)
|
||||||
EDGE_IMPULSE_COMPILED = const(0x30564945)
|
EDGE_IMPULSE_COMPILED = const(0x30564945)
|
||||||
|
|
||||||
|
|
||||||
JD_MODEL_RUNNER_CMD_SET_MODEL = const(0x80)
|
JD_MODEL_RUNNER_CMD_SET_MODEL = const(0x80)
|
||||||
JD_MODEL_RUNNER_CMD_PREDICT = const(0x81)
|
JD_MODEL_RUNNER_CMD_PREDICT = const(0x81)
|
||||||
JD_MODEL_RUNNER_REG_AUTO_INVOKE_EVERY = const(0x80)
|
JD_MODEL_RUNNER_REG_AUTO_INVOKE_EVERY = const(0x80)
|
||||||
|
|
|
@ -5,9 +5,12 @@ from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
from jacdac.system.constants import *
|
from jacdac.system.constants import *
|
||||||
JD_SERVICE_CLASS_MOTION = const(0x1179a749)
|
JD_SERVICE_CLASS_MOTION = const(0x1179a749)
|
||||||
|
|
||||||
|
|
||||||
class MotionVariant(Enum):
|
class MotionVariant(Enum):
|
||||||
PIR = const(0x1)
|
PIR = const(0x1)
|
||||||
|
|
||||||
|
|
||||||
JD_MOTION_REG_MOVING = const(JD_REG_READING)
|
JD_MOTION_REG_MOVING = const(JD_REG_READING)
|
||||||
JD_MOTION_REG_MAX_DISTANCE = const(0x180)
|
JD_MOTION_REG_MAX_DISTANCE = const(0x180)
|
||||||
JD_MOTION_REG_ANGLE = const(0x181)
|
JD_MOTION_REG_ANGLE = const(0x181)
|
||||||
|
|
|
@ -9,8 +9,8 @@ class PotentiometerClient(Client):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, bus: Bus, role: str) -> None:
|
def __init__(self, bus: Bus, role: str) -> None:
|
||||||
super().__init__(bus, JD_SERVICE_CLASS_POTENTIOMETER, JD_POTENTIOMETER_PACK_FORMATS, role)
|
super().__init__(bus, JD_SERVICE_CLASS_POTENTIOMETER,
|
||||||
|
JD_POTENTIOMETER_PACK_FORMATS, role)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def position(self) -> Union[float, None]:
|
def position(self) -> Union[float, None]:
|
||||||
|
@ -27,5 +27,3 @@ class PotentiometerClient(Client):
|
||||||
"""
|
"""
|
||||||
reg = self.register(JD_POTENTIOMETER_REG_VARIANT)
|
reg = self.register(JD_POTENTIOMETER_REG_VARIANT)
|
||||||
return reg.value(0)
|
return reg.value(0)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,13 @@ from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
from jacdac.system.constants import *
|
from jacdac.system.constants import *
|
||||||
JD_SERVICE_CLASS_POTENTIOMETER = const(0x1f274746)
|
JD_SERVICE_CLASS_POTENTIOMETER = const(0x1f274746)
|
||||||
|
|
||||||
|
|
||||||
class PotentiometerVariant(Enum):
|
class PotentiometerVariant(Enum):
|
||||||
SLIDER = const(0x1)
|
SLIDER = const(0x1)
|
||||||
ROTARY = const(0x2)
|
ROTARY = const(0x2)
|
||||||
|
|
||||||
|
|
||||||
JD_POTENTIOMETER_REG_POSITION = const(JD_REG_READING)
|
JD_POTENTIOMETER_REG_POSITION = const(JD_REG_READING)
|
||||||
JD_POTENTIOMETER_REG_VARIANT = const(JD_REG_VARIANT)
|
JD_POTENTIOMETER_REG_VARIANT = const(JD_REG_VARIANT)
|
||||||
JD_POTENTIOMETER_PACK_FORMATS = {
|
JD_POTENTIOMETER_PACK_FORMATS = {
|
||||||
|
|
|
@ -5,12 +5,15 @@ from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
from jacdac.system.constants import *
|
from jacdac.system.constants import *
|
||||||
JD_SERVICE_CLASS_POWER = const(0x1fa4c95a)
|
JD_SERVICE_CLASS_POWER = const(0x1fa4c95a)
|
||||||
|
|
||||||
|
|
||||||
class PowerPowerStatus(Enum):
|
class PowerPowerStatus(Enum):
|
||||||
DISALLOWED = const(0x0)
|
DISALLOWED = const(0x0)
|
||||||
POWERING = const(0x1)
|
POWERING = const(0x1)
|
||||||
OVERLOAD = const(0x2)
|
OVERLOAD = const(0x2)
|
||||||
OVERPROVISION = const(0x3)
|
OVERPROVISION = const(0x3)
|
||||||
|
|
||||||
|
|
||||||
JD_POWER_REG_ALLOWED = const(JD_REG_INTENSITY)
|
JD_POWER_REG_ALLOWED = const(JD_REG_INTENSITY)
|
||||||
JD_POWER_REG_MAX_POWER = const(JD_REG_MAX_POWER)
|
JD_POWER_REG_MAX_POWER = const(JD_REG_MAX_POWER)
|
||||||
JD_POWER_REG_POWER_STATUS = const(0x181)
|
JD_POWER_REG_POWER_STATUS = const(0x181)
|
||||||
|
|
|
@ -5,11 +5,14 @@ from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
from jacdac.system.constants import *
|
from jacdac.system.constants import *
|
||||||
JD_SERVICE_CLASS_REAL_TIME_CLOCK = const(0x1a8b1a28)
|
JD_SERVICE_CLASS_REAL_TIME_CLOCK = const(0x1a8b1a28)
|
||||||
|
|
||||||
|
|
||||||
class RealTimeClockVariant(Enum):
|
class RealTimeClockVariant(Enum):
|
||||||
COMPUTER = const(0x1)
|
COMPUTER = const(0x1)
|
||||||
CRYSTAL = const(0x2)
|
CRYSTAL = const(0x2)
|
||||||
CUCKOO = const(0x3)
|
CUCKOO = const(0x3)
|
||||||
|
|
||||||
|
|
||||||
JD_REAL_TIME_CLOCK_REG_LOCAL_TIME = const(JD_REG_READING)
|
JD_REAL_TIME_CLOCK_REG_LOCAL_TIME = const(JD_REG_READING)
|
||||||
JD_REAL_TIME_CLOCK_REG_ERROR = const(0x180)
|
JD_REAL_TIME_CLOCK_REG_ERROR = const(0x180)
|
||||||
JD_REAL_TIME_CLOCK_REG_PRECISION = const(0x181)
|
JD_REAL_TIME_CLOCK_REG_PRECISION = const(0x181)
|
||||||
|
|
|
@ -5,10 +5,13 @@ from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
from jacdac.system.constants import *
|
from jacdac.system.constants import *
|
||||||
JD_SERVICE_CLASS_REFLECTED_LIGHT = const(0x126c4cb2)
|
JD_SERVICE_CLASS_REFLECTED_LIGHT = const(0x126c4cb2)
|
||||||
|
|
||||||
|
|
||||||
class ReflectedLightVariant(Enum):
|
class ReflectedLightVariant(Enum):
|
||||||
INFRARED_DIGITAL = const(0x1)
|
INFRARED_DIGITAL = const(0x1)
|
||||||
INFRARED_ANALOG = const(0x2)
|
INFRARED_ANALOG = const(0x2)
|
||||||
|
|
||||||
|
|
||||||
JD_REFLECTED_LIGHT_REG_BRIGHTNESS = const(JD_REG_READING)
|
JD_REFLECTED_LIGHT_REG_BRIGHTNESS = const(JD_REG_READING)
|
||||||
JD_REFLECTED_LIGHT_REG_VARIANT = const(JD_REG_VARIANT)
|
JD_REFLECTED_LIGHT_REG_VARIANT = const(JD_REG_VARIANT)
|
||||||
JD_REFLECTED_LIGHT_EV_DARK = const(JD_EV_INACTIVE)
|
JD_REFLECTED_LIGHT_EV_DARK = const(JD_EV_INACTIVE)
|
||||||
|
|
|
@ -3,6 +3,7 @@ from .constants import *
|
||||||
from typing import Union
|
from typing import Union
|
||||||
from jacdac.events import HandlerFn
|
from jacdac.events import HandlerFn
|
||||||
|
|
||||||
|
|
||||||
class RelayClient(Client):
|
class RelayClient(Client):
|
||||||
"""
|
"""
|
||||||
A switching relay.
|
A switching relay.
|
||||||
|
@ -11,7 +12,6 @@ class RelayClient(Client):
|
||||||
def __init__(self, bus: Bus, role: str) -> None:
|
def __init__(self, bus: Bus, role: str) -> None:
|
||||||
super().__init__(bus, JD_SERVICE_CLASS_RELAY, JD_RELAY_PACK_FORMATS, role)
|
super().__init__(bus, JD_SERVICE_CLASS_RELAY, JD_RELAY_PACK_FORMATS, role)
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def closed(self) -> Union[bool, None]:
|
def closed(self) -> Union[bool, None]:
|
||||||
"""
|
"""
|
||||||
|
@ -25,7 +25,6 @@ class RelayClient(Client):
|
||||||
reg = self.register(JD_RELAY_REG_CLOSED)
|
reg = self.register(JD_RELAY_REG_CLOSED)
|
||||||
reg.set_value(0, value)
|
reg.set_value(0, value)
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def variant(self) -> Union[RelayVariant, None]:
|
def variant(self) -> Union[RelayVariant, None]:
|
||||||
"""
|
"""
|
||||||
|
@ -55,5 +54,3 @@ class RelayClient(Client):
|
||||||
Normally closed (NC) relays open the circuit when activated.
|
Normally closed (NC) relays open the circuit when activated.
|
||||||
"""
|
"""
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,11 +5,14 @@ from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
from jacdac.system.constants import *
|
from jacdac.system.constants import *
|
||||||
JD_SERVICE_CLASS_RELAY = const(0x183fe656)
|
JD_SERVICE_CLASS_RELAY = const(0x183fe656)
|
||||||
|
|
||||||
|
|
||||||
class RelayVariant(Enum):
|
class RelayVariant(Enum):
|
||||||
ELECTROMECHANICAL = const(0x1)
|
ELECTROMECHANICAL = const(0x1)
|
||||||
SOLID_STATE = const(0x2)
|
SOLID_STATE = const(0x2)
|
||||||
REED = const(0x3)
|
REED = const(0x3)
|
||||||
|
|
||||||
|
|
||||||
JD_RELAY_REG_CLOSED = const(JD_REG_INTENSITY)
|
JD_RELAY_REG_CLOSED = const(JD_REG_INTENSITY)
|
||||||
JD_RELAY_REG_VARIANT = const(JD_REG_VARIANT)
|
JD_RELAY_REG_VARIANT = const(JD_REG_VARIANT)
|
||||||
JD_RELAY_REG_MAX_SWITCHING_CURRENT = const(0x180)
|
JD_RELAY_REG_MAX_SWITCHING_CURRENT = const(0x180)
|
||||||
|
|
|
@ -5,11 +5,14 @@ from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
from jacdac.system.constants import *
|
from jacdac.system.constants import *
|
||||||
JD_SERVICE_CLASS_RNG = const(0x1789f0a2)
|
JD_SERVICE_CLASS_RNG = const(0x1789f0a2)
|
||||||
|
|
||||||
|
|
||||||
class RngVariant(Enum):
|
class RngVariant(Enum):
|
||||||
QUANTUM = const(0x1)
|
QUANTUM = const(0x1)
|
||||||
ADCNOISE = const(0x2)
|
ADCNOISE = const(0x2)
|
||||||
WEB_CRYPTO = const(0x3)
|
WEB_CRYPTO = const(0x3)
|
||||||
|
|
||||||
|
|
||||||
JD_RNG_REG_RANDOM = const(0x180)
|
JD_RNG_REG_RANDOM = const(0x180)
|
||||||
JD_RNG_REG_VARIANT = const(JD_REG_VARIANT)
|
JD_RNG_REG_VARIANT = const(JD_REG_VARIANT)
|
||||||
JD_RNG_PACK_FORMATS = {
|
JD_RNG_PACK_FORMATS = {
|
||||||
|
|
|
@ -9,8 +9,8 @@ class RotaryEncoderClient(Client):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, bus: Bus, role: str) -> None:
|
def __init__(self, bus: Bus, role: str) -> None:
|
||||||
super().__init__(bus, JD_SERVICE_CLASS_ROTARY_ENCODER, JD_ROTARY_ENCODER_PACK_FORMATS, role)
|
super().__init__(bus, JD_SERVICE_CLASS_ROTARY_ENCODER,
|
||||||
|
JD_ROTARY_ENCODER_PACK_FORMATS, role)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def position(self) -> Union[float, None]:
|
def position(self) -> Union[float, None]:
|
||||||
|
@ -28,5 +28,3 @@ class RotaryEncoderClient(Client):
|
||||||
"""
|
"""
|
||||||
reg = self.register(JD_ROTARY_ENCODER_REG_CLICKS_PER_TURN)
|
reg = self.register(JD_ROTARY_ENCODER_REG_CLICKS_PER_TURN)
|
||||||
return reg.value(0)
|
return reg.value(0)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@ from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
from jacdac.system.constants import *
|
from jacdac.system.constants import *
|
||||||
JD_SERVICE_CLASS_SENSOR_AGGREGATOR = const(0x1d90e1c5)
|
JD_SERVICE_CLASS_SENSOR_AGGREGATOR = const(0x1d90e1c5)
|
||||||
|
|
||||||
|
|
||||||
class SensorAggregatorSampleType(Enum):
|
class SensorAggregatorSampleType(Enum):
|
||||||
U8 = const(0x8)
|
U8 = const(0x8)
|
||||||
I8 = const(0x88)
|
I8 = const(0x88)
|
||||||
|
@ -13,6 +15,7 @@ class SensorAggregatorSampleType(Enum):
|
||||||
U32 = const(0x20)
|
U32 = const(0x20)
|
||||||
I32 = const(0xa0)
|
I32 = const(0xa0)
|
||||||
|
|
||||||
|
|
||||||
JD_SENSOR_AGGREGATOR_REG_INPUTS = const(0x80)
|
JD_SENSOR_AGGREGATOR_REG_INPUTS = const(0x80)
|
||||||
JD_SENSOR_AGGREGATOR_REG_NUM_SAMPLES = const(0x180)
|
JD_SENSOR_AGGREGATOR_REG_NUM_SAMPLES = const(0x180)
|
||||||
JD_SENSOR_AGGREGATOR_REG_SAMPLE_SIZE = const(0x181)
|
JD_SENSOR_AGGREGATOR_REG_SAMPLE_SIZE = const(0x181)
|
||||||
|
|
|
@ -5,10 +5,13 @@ from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
from jacdac.system.constants import *
|
from jacdac.system.constants import *
|
||||||
JD_SERVICE_CLASS_SOIL_MOISTURE = const(0x1d4aa3b3)
|
JD_SERVICE_CLASS_SOIL_MOISTURE = const(0x1d4aa3b3)
|
||||||
|
|
||||||
|
|
||||||
class SoilMoistureVariant(Enum):
|
class SoilMoistureVariant(Enum):
|
||||||
RESISTIVE = const(0x1)
|
RESISTIVE = const(0x1)
|
||||||
CAPACITIVE = const(0x2)
|
CAPACITIVE = const(0x2)
|
||||||
|
|
||||||
|
|
||||||
JD_SOIL_MOISTURE_REG_MOISTURE = const(JD_REG_READING)
|
JD_SOIL_MOISTURE_REG_MOISTURE = const(JD_REG_READING)
|
||||||
JD_SOIL_MOISTURE_REG_MOISTURE_ERROR = const(JD_REG_READING_ERROR)
|
JD_SOIL_MOISTURE_REG_MOISTURE_ERROR = const(JD_REG_READING_ERROR)
|
||||||
JD_SOIL_MOISTURE_REG_VARIANT = const(JD_REG_VARIANT)
|
JD_SOIL_MOISTURE_REG_VARIANT = const(JD_REG_VARIANT)
|
||||||
|
|
|
@ -5,11 +5,14 @@ from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
from jacdac.system.constants import *
|
from jacdac.system.constants import *
|
||||||
JD_SERVICE_CLASS_SOLENOID = const(0x171723ca)
|
JD_SERVICE_CLASS_SOLENOID = const(0x171723ca)
|
||||||
|
|
||||||
|
|
||||||
class SolenoidVariant(Enum):
|
class SolenoidVariant(Enum):
|
||||||
PUSH_PULL = const(0x1)
|
PUSH_PULL = const(0x1)
|
||||||
VALVE = const(0x2)
|
VALVE = const(0x2)
|
||||||
LATCH = const(0x3)
|
LATCH = const(0x3)
|
||||||
|
|
||||||
|
|
||||||
JD_SOLENOID_REG_PULLED = const(JD_REG_INTENSITY)
|
JD_SOLENOID_REG_PULLED = const(JD_REG_INTENSITY)
|
||||||
JD_SOLENOID_REG_VARIANT = const(JD_REG_VARIANT)
|
JD_SOLENOID_REG_VARIANT = const(JD_REG_VARIANT)
|
||||||
JD_SOLENOID_PACK_FORMATS = {
|
JD_SOLENOID_PACK_FORMATS = {
|
||||||
|
|
|
@ -5,6 +5,8 @@ from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
from jacdac.system.constants import *
|
from jacdac.system.constants import *
|
||||||
JD_SERVICE_CLASS_SWITCH = const(0x1ad29402)
|
JD_SERVICE_CLASS_SWITCH = const(0x1ad29402)
|
||||||
|
|
||||||
|
|
||||||
class SwitchVariant(Enum):
|
class SwitchVariant(Enum):
|
||||||
SLIDE = const(0x1)
|
SLIDE = const(0x1)
|
||||||
TILT = const(0x2)
|
TILT = const(0x2)
|
||||||
|
@ -15,6 +17,7 @@ class SwitchVariant(Enum):
|
||||||
MAGNETIC = const(0x7)
|
MAGNETIC = const(0x7)
|
||||||
FOOT_PEDAL = const(0x8)
|
FOOT_PEDAL = const(0x8)
|
||||||
|
|
||||||
|
|
||||||
JD_SWITCH_REG_ACTIVE = const(JD_REG_READING)
|
JD_SWITCH_REG_ACTIVE = const(JD_REG_READING)
|
||||||
JD_SWITCH_REG_VARIANT = const(JD_REG_VARIANT)
|
JD_SWITCH_REG_VARIANT = const(JD_REG_VARIANT)
|
||||||
JD_SWITCH_REG_AUTO_OFF_DELAY = const(0x180)
|
JD_SWITCH_REG_AUTO_OFF_DELAY = const(0x180)
|
||||||
|
|
|
@ -4,10 +4,13 @@ Autogenerated constants for TCP service
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
JD_SERVICE_CLASS_TCP = const(0x1b43b70b)
|
JD_SERVICE_CLASS_TCP = const(0x1b43b70b)
|
||||||
|
|
||||||
|
|
||||||
class TcpTcpError(Enum):
|
class TcpTcpError(Enum):
|
||||||
INVALID_COMMAND = const(0x1)
|
INVALID_COMMAND = const(0x1)
|
||||||
INVALID_COMMAND_PAYLOAD = const(0x2)
|
INVALID_COMMAND_PAYLOAD = const(0x2)
|
||||||
|
|
||||||
|
|
||||||
JD_TCP_CMD_OPEN = const(0x80)
|
JD_TCP_CMD_OPEN = const(0x80)
|
||||||
JD_TCP_PIPE_OPEN_SSL = const(0x1)
|
JD_TCP_PIPE_OPEN_SSL = const(0x1)
|
||||||
JD_TCP_PIPE_ERROR = const(0x0)
|
JD_TCP_PIPE_ERROR = const(0x0)
|
||||||
|
|
|
@ -9,8 +9,8 @@ class ThermocoupleClient(Client):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, bus: Bus, role: str) -> None:
|
def __init__(self, bus: Bus, role: str) -> None:
|
||||||
super().__init__(bus, JD_SERVICE_CLASS_THERMOCOUPLE, JD_THERMOCOUPLE_PACK_FORMATS, role)
|
super().__init__(bus, JD_SERVICE_CLASS_THERMOCOUPLE,
|
||||||
|
JD_THERMOCOUPLE_PACK_FORMATS, role)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def temperature(self) -> Union[float, None]:
|
def temperature(self) -> Union[float, None]:
|
||||||
|
@ -51,5 +51,3 @@ class ThermocoupleClient(Client):
|
||||||
"""
|
"""
|
||||||
reg = self.register(JD_THERMOCOUPLE_REG_VARIANT)
|
reg = self.register(JD_THERMOCOUPLE_REG_VARIANT)
|
||||||
return reg.value(0)
|
return reg.value(0)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@ from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
from jacdac.system.constants import *
|
from jacdac.system.constants import *
|
||||||
JD_SERVICE_CLASS_THERMOCOUPLE = const(0x143ac061)
|
JD_SERVICE_CLASS_THERMOCOUPLE = const(0x143ac061)
|
||||||
|
|
||||||
|
|
||||||
class ThermocoupleVariant(Enum):
|
class ThermocoupleVariant(Enum):
|
||||||
TYPE_K = const(0x1)
|
TYPE_K = const(0x1)
|
||||||
TYPE_J = const(0x2)
|
TYPE_J = const(0x2)
|
||||||
|
@ -15,6 +17,7 @@ class ThermocoupleVariant(Enum):
|
||||||
TYPE_R = const(0x7)
|
TYPE_R = const(0x7)
|
||||||
TYPE_B = const(0x8)
|
TYPE_B = const(0x8)
|
||||||
|
|
||||||
|
|
||||||
JD_THERMOCOUPLE_REG_TEMPERATURE = const(JD_REG_READING)
|
JD_THERMOCOUPLE_REG_TEMPERATURE = const(JD_REG_READING)
|
||||||
JD_THERMOCOUPLE_REG_MIN_TEMPERATURE = const(JD_REG_MIN_READING)
|
JD_THERMOCOUPLE_REG_MIN_TEMPERATURE = const(JD_REG_MIN_READING)
|
||||||
JD_THERMOCOUPLE_REG_MAX_TEMPERATURE = const(JD_REG_MAX_READING)
|
JD_THERMOCOUPLE_REG_MAX_TEMPERATURE = const(JD_REG_MAX_READING)
|
||||||
|
|
|
@ -11,7 +11,6 @@ class ThermometerClient(Client):
|
||||||
def __init__(self, bus: Bus, role: str) -> None:
|
def __init__(self, bus: Bus, role: str) -> None:
|
||||||
super().__init__(bus, JD_SERVICE_CLASS_THERMOMETER, JD_THERMOMETER_PACK_FORMATS, role)
|
super().__init__(bus, JD_SERVICE_CLASS_THERMOMETER, JD_THERMOMETER_PACK_FORMATS, role)
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def temperature(self) -> Union[float, None]:
|
def temperature(self) -> Union[float, None]:
|
||||||
"""
|
"""
|
||||||
|
@ -51,5 +50,3 @@ class ThermometerClient(Client):
|
||||||
"""
|
"""
|
||||||
reg = self.register(JD_THERMOMETER_REG_VARIANT)
|
reg = self.register(JD_THERMOMETER_REG_VARIANT)
|
||||||
return reg.value(0)
|
return reg.value(0)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,11 +5,14 @@ from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
from jacdac.system.constants import *
|
from jacdac.system.constants import *
|
||||||
JD_SERVICE_CLASS_THERMOMETER = const(0x1421bac7)
|
JD_SERVICE_CLASS_THERMOMETER = const(0x1421bac7)
|
||||||
|
|
||||||
|
|
||||||
class ThermometerVariant(Enum):
|
class ThermometerVariant(Enum):
|
||||||
OUTDOOR = const(0x1)
|
OUTDOOR = const(0x1)
|
||||||
INDOOR = const(0x2)
|
INDOOR = const(0x2)
|
||||||
BODY = const(0x3)
|
BODY = const(0x3)
|
||||||
|
|
||||||
|
|
||||||
JD_THERMOMETER_REG_TEMPERATURE = const(JD_REG_READING)
|
JD_THERMOMETER_REG_TEMPERATURE = const(JD_REG_READING)
|
||||||
JD_THERMOMETER_REG_MIN_TEMPERATURE = const(JD_REG_MIN_READING)
|
JD_THERMOMETER_REG_MIN_TEMPERATURE = const(JD_REG_MIN_READING)
|
||||||
JD_THERMOMETER_REG_MAX_TEMPERATURE = const(JD_REG_MAX_READING)
|
JD_THERMOMETER_REG_MAX_TEMPERATURE = const(JD_REG_MAX_READING)
|
||||||
|
|
|
@ -29,9 +29,11 @@ HF2_CMD_JDS_CONFIG = 0x0020
|
||||||
HF2_CMD_JDS_SEND = 0x0021
|
HF2_CMD_JDS_SEND = 0x0021
|
||||||
HF2_EV_JDS_PACKET = 0x800020
|
HF2_EV_JDS_PACKET = 0x800020
|
||||||
|
|
||||||
|
|
||||||
class HF2Error(Exception):
|
class HF2Error(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class HF2Transport(Transport):
|
class HF2Transport(Transport):
|
||||||
def _write(self, buf: bytes):
|
def _write(self, buf: bytes):
|
||||||
frame = bytearray(64)
|
frame = bytearray(64)
|
||||||
|
@ -107,11 +109,13 @@ class HF2Transport(Transport):
|
||||||
self._error("timeout for 0x%d" % cmd)
|
self._error("timeout for 0x%d" % cmd)
|
||||||
(seq2, status, info) = struct.unpack("<HBB", resp[0:4])
|
(seq2, status, info) = struct.unpack("<HBB", resp[0:4])
|
||||||
if seq != seq2:
|
if seq != seq2:
|
||||||
self.log("packet out of sync (exp: %d, got: %d)" % (seq, seq2))
|
self.log("packet out of sync (exp: %d, got: %d)" %
|
||||||
|
(seq, seq2))
|
||||||
elif status == 0:
|
elif status == 0:
|
||||||
return resp[4:]
|
return resp[4:]
|
||||||
else:
|
else:
|
||||||
self._error("bad status: %d (info=%d) for 0x%x" % (status, info, cmd))
|
self._error("bad status: %d (info=%d) for 0x%x" %
|
||||||
|
(status, info, cmd))
|
||||||
self._error("desync for 0x%x" % cmd)
|
self._error("desync for 0x%x" % cmd)
|
||||||
|
|
||||||
def _connect(self):
|
def _connect(self):
|
||||||
|
@ -133,6 +137,5 @@ class HF2Transport(Transport):
|
||||||
self._connect()
|
self._connect()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
hf2 = HF2Transport(sys.argv[1])
|
hf2 = HF2Transport(sys.argv[1])
|
||||||
|
|
|
@ -106,6 +106,7 @@ def short_id(longid: Union[bytes, str]):
|
||||||
chr(0x30 + (h // (26 * 26 * 10)) % 10)
|
chr(0x30 + (h // (26 * 26 * 10)) % 10)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def crc16(buf: bytes, start: int = 0, end: int = None):
|
def crc16(buf: bytes, start: int = 0, end: int = None):
|
||||||
if end is None:
|
if end is None:
|
||||||
end = len(buf)
|
end = len(buf)
|
||||||
|
|
|
@ -5,10 +5,13 @@ from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
from jacdac.system.constants import *
|
from jacdac.system.constants import *
|
||||||
JD_SERVICE_CLASS_UV_INDEX = const(0x1f6e0d90)
|
JD_SERVICE_CLASS_UV_INDEX = const(0x1f6e0d90)
|
||||||
|
|
||||||
|
|
||||||
class UvIndexVariant(Enum):
|
class UvIndexVariant(Enum):
|
||||||
UVA_UVB = const(0x1)
|
UVA_UVB = const(0x1)
|
||||||
VISIBLE_IR = const(0x2)
|
VISIBLE_IR = const(0x2)
|
||||||
|
|
||||||
|
|
||||||
JD_UV_INDEX_REG_UV_INDEX = const(JD_REG_READING)
|
JD_UV_INDEX_REG_UV_INDEX = const(JD_REG_READING)
|
||||||
JD_UV_INDEX_REG_UV_INDEX_ERROR = const(JD_REG_READING_ERROR)
|
JD_UV_INDEX_REG_UV_INDEX_ERROR = const(JD_REG_READING_ERROR)
|
||||||
JD_UV_INDEX_REG_VARIANT = const(JD_REG_VARIANT)
|
JD_UV_INDEX_REG_VARIANT = const(JD_REG_VARIANT)
|
||||||
|
|
|
@ -5,16 +5,20 @@ from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
from jacdac.system.constants import *
|
from jacdac.system.constants import *
|
||||||
JD_SERVICE_CLASS_VERIFIED_TELEMETRY = const(0x2194841f)
|
JD_SERVICE_CLASS_VERIFIED_TELEMETRY = const(0x2194841f)
|
||||||
|
|
||||||
|
|
||||||
class VerifiedTelemetryStatus(Enum):
|
class VerifiedTelemetryStatus(Enum):
|
||||||
UNKNOWN = const(0x0)
|
UNKNOWN = const(0x0)
|
||||||
WORKING = const(0x1)
|
WORKING = const(0x1)
|
||||||
FAULTY = const(0x2)
|
FAULTY = const(0x2)
|
||||||
|
|
||||||
|
|
||||||
class VerifiedTelemetryFingerprintType(Enum):
|
class VerifiedTelemetryFingerprintType(Enum):
|
||||||
FALL_CURVE = const(0x1)
|
FALL_CURVE = const(0x1)
|
||||||
CURRENT_SENSE = const(0x2)
|
CURRENT_SENSE = const(0x2)
|
||||||
CUSTOM = const(0x3)
|
CUSTOM = const(0x3)
|
||||||
|
|
||||||
|
|
||||||
JD_VERIFIED_TELEMETRY_REG_TELEMETRY_STATUS = const(0x180)
|
JD_VERIFIED_TELEMETRY_REG_TELEMETRY_STATUS = const(0x180)
|
||||||
JD_VERIFIED_TELEMETRY_REG_TELEMETRY_STATUS_INTERVAL = const(0x80)
|
JD_VERIFIED_TELEMETRY_REG_TELEMETRY_STATUS_INTERVAL = const(0x80)
|
||||||
JD_VERIFIED_TELEMETRY_REG_FINGERPRINT_TYPE = const(0x181)
|
JD_VERIFIED_TELEMETRY_REG_FINGERPRINT_TYPE = const(0x181)
|
||||||
|
|
|
@ -5,11 +5,14 @@ from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
from jacdac.system.constants import *
|
from jacdac.system.constants import *
|
||||||
JD_SERVICE_CLASS_WATER_LEVEL = const(0x147b62ed)
|
JD_SERVICE_CLASS_WATER_LEVEL = const(0x147b62ed)
|
||||||
|
|
||||||
|
|
||||||
class WaterLevelVariant(Enum):
|
class WaterLevelVariant(Enum):
|
||||||
RESISTIVE = const(0x1)
|
RESISTIVE = const(0x1)
|
||||||
CONTACT_PHOTO_ELECTRIC = const(0x2)
|
CONTACT_PHOTO_ELECTRIC = const(0x2)
|
||||||
NON_CONTACT_PHOTO_ELECTRIC = const(0x3)
|
NON_CONTACT_PHOTO_ELECTRIC = const(0x3)
|
||||||
|
|
||||||
|
|
||||||
JD_WATER_LEVEL_REG_LEVEL = const(JD_REG_READING)
|
JD_WATER_LEVEL_REG_LEVEL = const(JD_REG_READING)
|
||||||
JD_WATER_LEVEL_REG_VARIANT = const(JD_REG_VARIANT)
|
JD_WATER_LEVEL_REG_VARIANT = const(JD_REG_VARIANT)
|
||||||
JD_WATER_LEVEL_PACK_FORMATS = {
|
JD_WATER_LEVEL_PACK_FORMATS = {
|
||||||
|
|
|
@ -5,11 +5,14 @@ from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
from jacdac.system.constants import *
|
from jacdac.system.constants import *
|
||||||
JD_SERVICE_CLASS_WEIGHT_SCALE = const(0x1f4d5040)
|
JD_SERVICE_CLASS_WEIGHT_SCALE = const(0x1f4d5040)
|
||||||
|
|
||||||
|
|
||||||
class WeightScaleVariant(Enum):
|
class WeightScaleVariant(Enum):
|
||||||
BODY = const(0x1)
|
BODY = const(0x1)
|
||||||
FOOD = const(0x2)
|
FOOD = const(0x2)
|
||||||
JEWELRY = const(0x3)
|
JEWELRY = const(0x3)
|
||||||
|
|
||||||
|
|
||||||
JD_WEIGHT_SCALE_REG_WEIGHT = const(JD_REG_READING)
|
JD_WEIGHT_SCALE_REG_WEIGHT = const(JD_REG_READING)
|
||||||
JD_WEIGHT_SCALE_REG_WEIGHT_ERROR = const(JD_REG_READING_ERROR)
|
JD_WEIGHT_SCALE_REG_WEIGHT_ERROR = const(JD_REG_READING_ERROR)
|
||||||
JD_WEIGHT_SCALE_REG_ZERO_OFFSET = const(0x80)
|
JD_WEIGHT_SCALE_REG_ZERO_OFFSET = const(0x80)
|
||||||
|
|
|
@ -5,6 +5,8 @@ from enum import Enum
|
||||||
from jacdac.constants import *
|
from jacdac.constants import *
|
||||||
from jacdac.system.constants import *
|
from jacdac.system.constants import *
|
||||||
JD_SERVICE_CLASS_WIFI = const(0x18aae1fa)
|
JD_SERVICE_CLASS_WIFI = const(0x18aae1fa)
|
||||||
|
|
||||||
|
|
||||||
class WifiAPFlags(Enum):
|
class WifiAPFlags(Enum):
|
||||||
HAS_PASSWORD = const(0x1)
|
HAS_PASSWORD = const(0x1)
|
||||||
WPS = const(0x2)
|
WPS = const(0x2)
|
||||||
|
@ -18,6 +20,7 @@ class WifiAPFlags(Enum):
|
||||||
IEEE_802_11AX = const(0x2000)
|
IEEE_802_11AX = const(0x2000)
|
||||||
IEEE_802_LONG_RANGE = const(0x8000)
|
IEEE_802_LONG_RANGE = const(0x8000)
|
||||||
|
|
||||||
|
|
||||||
JD_WIFI_CMD_LAST_SCAN_RESULTS = const(0x80)
|
JD_WIFI_CMD_LAST_SCAN_RESULTS = const(0x80)
|
||||||
JD_WIFI_CMD_ADD_NETWORK = const(0x81)
|
JD_WIFI_CMD_ADD_NETWORK = const(0x81)
|
||||||
JD_WIFI_CMD_RECONNECT = const(0x82)
|
JD_WIFI_CMD_RECONNECT = const(0x82)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче