added tec modulation
This commit is contained in:
@ -29,6 +29,7 @@ from .constants import (
|
||||
CMD_DS1809_CONTROL,
|
||||
CMD_STATE,
|
||||
CMD_STM32_DAC_CONTROL,
|
||||
CMD_TEC_MODULATION_CONTROL,
|
||||
CMD_TRANS_ENABLE,
|
||||
DEFAULT_SETUP_WORD,
|
||||
DS1809_FLAG_DECREMENT,
|
||||
@ -46,6 +47,8 @@ from .constants import (
|
||||
SEND_PARAMS_TOTAL_LENGTH,
|
||||
SHORT_CONTROL_TOTAL_LENGTH,
|
||||
STM32_DAC_FLAG_ENABLE,
|
||||
TEC_MODULATION_FLAG_CHANNEL_2,
|
||||
TEC_MODULATION_FLAG_ENABLE,
|
||||
STATUS_DESCRIPTIONS,
|
||||
STATUS_RESPONSE_LENGTH,
|
||||
WAVE_DATA_TOTAL_LENGTH,
|
||||
@ -270,6 +273,25 @@ class Protocol:
|
||||
0,
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def encode_tec_modulation_control(
|
||||
*,
|
||||
enabled: bool,
|
||||
laser: int,
|
||||
frequency_hz: int,
|
||||
amplitude_code: int,
|
||||
) -> bytes:
|
||||
"""Build a TEC drive-modulation control packet."""
|
||||
flags = TEC_MODULATION_FLAG_ENABLE if enabled else 0
|
||||
if laser == 2:
|
||||
flags |= TEC_MODULATION_FLAG_CHANNEL_2
|
||||
return Protocol._encode_short_control(
|
||||
CMD_TEC_MODULATION_CONTROL,
|
||||
flags,
|
||||
_ensure_uint(frequency_hz, "frequency_hz", 0, 0xFFFF),
|
||||
_ensure_uint(amplitude_code, "amplitude_code", 0, 0xFFFF),
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def encode_ad9102_wave_begin(sample_count: int) -> bytes:
|
||||
"""Build an AD9102 custom-wave upload BEGIN packet."""
|
||||
|
||||
Reference in New Issue
Block a user