pulse modulation added

This commit is contained in:
Ayzen
2026-09-01 18:08:35 +03:00
parent 42795eb899
commit fd95fe3c56
6 changed files with 179 additions and 13 deletions
+8 -5
View File
@@ -195,7 +195,7 @@ static bool app_activate_profile(const profile_t *profile, uint16_t index, bool
static bool app_handle_profile_boot(void);
static bool app_apply_waveform_config(const waveform_config_t *waveform);
static void app_apply_profile_auxiliary_outputs(const profile_t *profile);
static bool app_load_custom_waveform_from_file(const char *path);
static bool app_load_custom_waveform_from_file(const char *path, uint16_t pat_period_us);
static void app_handle_packet(const app_packet_t *packet);
static void app_handle_work_config_packet(const app_packet_t *packet);
static void app_handle_profile_save_control_packet(const app_packet_t *packet);
@@ -724,7 +724,7 @@ static void app_decode_work_packet(const uint16_t *packet_words)
g_app.laser_config[1].current_raw = packet_words[12];
}
static bool app_load_custom_waveform_from_file(const char *path)
static bool app_load_custom_waveform_from_file(const char *path, uint16_t pat_period_us)
{
char buffer[APP_CUSTOM_WAVE_BUFFER_SIZE];
UINT bytes_read = 0u;
@@ -769,7 +769,7 @@ static bool app_load_custom_waveform_from_file(const char *path)
cursor = end_ptr;
}
if ((sample_count < 2u) || !ad9102_begin_custom_upload(sample_count))
if ((sample_count < 2u) || !ad9102_begin_custom_upload(sample_count, pat_period_us))
{
return false;
}
@@ -858,7 +858,8 @@ static bool app_apply_waveform_config(const waveform_config_t *waveform)
ad9102_stop_output();
return true;
}
return app_load_custom_waveform_from_file(waveform->source_path);
return app_load_custom_waveform_from_file(waveform->source_path,
waveform->custom_pat_period_us);
default:
return false;
@@ -1352,7 +1353,9 @@ static void app_handle_ad9102_wave_control_packet(const app_packet_t *packet)
switch (opcode)
{
case APP_AD9102_WAVE_OPCODE_BEGIN:
if ((param1 != 0u) || !ad9102_begin_custom_upload(param0))
/* param1 = pattern repetition period in microseconds; 0 keeps
* the legacy back-to-back playback. */
if (!ad9102_begin_custom_upload(param0, param1))
{
ad9102_cancel_custom_upload();
app_set_error(APP_STATUS_FLAG_AD9102_ERROR);