added tec modulation

This commit is contained in:
Ayzen
2026-04-27 18:16:39 +03:00
parent d32db245fa
commit d3d48a5255
60 changed files with 13021 additions and 12456 deletions

View File

@ -76,6 +76,9 @@
/** @brief UART header for profile-save data packets. */
#define APP_PACKET_HEADER_PROFILE_SAVE_DATA 0xEEEEu
/** @brief UART header for TEC drive modulation control packets. */
#define APP_PACKET_HEADER_TEC_MODULATION_CONTROL 0xF0F0u
/** @brief Packet size of the host work-configuration message, in bytes. */
#define APP_PACKET_BYTES_WORK_CONFIG 30u
@ -154,6 +157,21 @@
/** @brief STM32 DAC control flag: enable output buffer/channel. */
#define APP_STM32_DAC_FLAG_ENABLE 0x0001u
/** @brief TEC modulation control flag: enable modulation. */
#define APP_TEC_MODULATION_FLAG_ENABLE 0x0001u
/** @brief TEC modulation control flag: select laser/TEC channel 2 instead of channel 1. */
#define APP_TEC_MODULATION_FLAG_CHANNEL_2 0x0002u
/** @brief Lowest accepted TEC modulation frequency in hertz. */
#define APP_TEC_MODULATION_MIN_FREQUENCY_HZ 50u
/** @brief Highest accepted TEC modulation frequency in hertz. */
#define APP_TEC_MODULATION_MAX_FREQUENCY_HZ 2000u
/** @brief Highest accepted peak modulation amplitude in external TEC DAC codes. */
#define APP_TEC_MODULATION_MAX_AMPLITUDE_CODE 4096u
/** @brief Op-code used to begin a custom AD9102 waveform upload. */
#define APP_AD9102_WAVE_OPCODE_BEGIN 0x0001u
@ -224,7 +242,8 @@ typedef enum app_packet_kind_t {
APP_PACKET_KIND_STM32_DAC_CONTROL,
APP_PACKET_KIND_AD9102_WAVE_CONTROL,
APP_PACKET_KIND_AD9102_WAVE_DATA,
APP_PACKET_KIND_PROFILE_SAVE_DATA
APP_PACKET_KIND_PROFILE_SAVE_DATA,
APP_PACKET_KIND_TEC_MODULATION_CONTROL
} app_packet_kind_t;
/**
@ -309,6 +328,16 @@ typedef struct stm32_dac_config_t {
uint16_t code;
} stm32_dac_config_t;
/**
* @brief Fast zero-mean modulation added to one TEC DAC output after PID.
*/
typedef struct tec_modulation_config_t {
uint8_t enabled;
uint8_t channel_index;
uint16_t frequency_hz;
uint16_t amplitude_code;
} tec_modulation_config_t;
/**
* @brief Absolute DS1809 target expressed as a number of steps above the minimum tap.
*/
@ -331,6 +360,7 @@ typedef struct profile_t {
waveform_config_t waveform;
ad9833_config_t ad9833;
stm32_dac_config_t stm32_dac;
tec_modulation_config_t tec_modulation;
ds1809_config_t ds1809;
} profile_t;