minor: Change pulse_data print to const

This commit is contained in:
Christian W. Zuckschwerdt 2023-03-09 21:48:55 +01:00
parent 964f6eba74
commit 376f1b02f3
4 changed files with 24 additions and 23 deletions

View file

@ -73,9 +73,9 @@ void pulse_data_load(FILE *file, pulse_data_t *data, uint32_t sample_rate);
void pulse_data_print_pulse_header(FILE *file);
/// Print the content of a pulse_data_t structure as OOK text.
void pulse_data_dump(FILE *file, pulse_data_t *data);
void pulse_data_dump(FILE *file, pulse_data_t const *data);
/// Print the content of a pulse_data_t structure as OOK json.
data_t *pulse_data_print_data(pulse_data_t *data);
data_t *pulse_data_print_data(pulse_data_t const *data);
#endif /* INCLUDE_PULSE_DATA_H_ */

View file

@ -35,7 +35,7 @@
/// - reset_limit: Maximum gap size before End Of Message [us].
/// - tolerance: Maximum deviation from nominal widths (optional, default 25%) [us]
/// @return number of events processed
int pulse_slicer_pcm(const pulse_data_t *pulses, r_device *device);
int pulse_slicer_pcm(pulse_data_t const *pulses, r_device *device);
/// Demodulate a Pulse Position Modulation signal.
///
@ -53,7 +53,7 @@ int pulse_slicer_pcm(const pulse_data_t *pulses, r_device *device);
/// - gap_limit: Maximum gap size before new row of bits [us]
/// - tolerance: Maximum deviation from nominal widths (optional, raw if 0) [us]
/// @return number of events processed
int pulse_slicer_ppm(const pulse_data_t *pulses, r_device *device);
int pulse_slicer_ppm(pulse_data_t const *pulses, r_device *device);
/// Demodulate a Pulse Width Modulation signal.
///
@ -72,7 +72,7 @@ int pulse_slicer_ppm(const pulse_data_t *pulses, r_device *device);
/// - sync_width: Nominal width of sync pulse (optional) [us]
/// - tolerance: Maximum deviation from nominal widths (optional, raw if 0) [us]
/// @return number of events processed
int pulse_slicer_pwm(const pulse_data_t *pulses, r_device *device);
int pulse_slicer_pwm(pulse_data_t const *pulses, r_device *device);
/// Demodulate a Manchester encoded signal with a hardcoded zerobit in front.
///
@ -90,7 +90,7 @@ int pulse_slicer_pwm(const pulse_data_t *pulses, r_device *device);
/// - long_width: Not used
/// - reset_limit: Maximum gap size before End Of Message [us].
/// @return number of events processed
int pulse_slicer_manchester_zerobit(const pulse_data_t *pulses, r_device *device);
int pulse_slicer_manchester_zerobit(pulse_data_t const *pulses, r_device *device);
/// Demodulate a Differential Manchester Coded signal.
///
@ -113,7 +113,7 @@ int pulse_slicer_manchester_zerobit(const pulse_data_t *pulses, r_device *device
/// - reset_limit: Maximum gap size before End Of Message [us].
/// - tolerance: Maximum deviation from nominal widths [us]
/// @return number of events processed
int pulse_slicer_dmc(const pulse_data_t *pulses, r_device *device);
int pulse_slicer_dmc(pulse_data_t const *pulses, r_device *device);
/// Demodulate a raw Pulse Interval and Width Modulation signal.
///
@ -127,7 +127,7 @@ int pulse_slicer_dmc(const pulse_data_t *pulses, r_device *device);
/// - reset_limit: Maximum gap size before End Of Message [us].
/// - tolerance: Maximum deviation from nominal widths [us]
/// @return number of events processed
int pulse_slicer_piwm_raw(const pulse_data_t *pulses, r_device *device);
int pulse_slicer_piwm_raw(pulse_data_t const *pulses, r_device *device);
/// Demodulate a differential Pulse Interval and Width Modulation signal.
///
@ -141,11 +141,11 @@ int pulse_slicer_piwm_raw(const pulse_data_t *pulses, r_device *device);
/// - reset_limit: Maximum gap size before End Of Message [us].
/// - tolerance: Maximum deviation from nominal widths [us]
/// @return number of events processed
int pulse_slicer_piwm_dc(const pulse_data_t *pulses, r_device *device);
int pulse_slicer_piwm_dc(pulse_data_t const *pulses, r_device *device);
int pulse_slicer_nrzs(const pulse_data_t *pulses, r_device *device);
int pulse_slicer_nrzs(pulse_data_t const *pulses, r_device *device);
int pulse_slicer_osv1(const pulse_data_t *pulses, r_device *device);
int pulse_slicer_osv1(pulse_data_t const *pulses, r_device *device);
/// Simulate demodulation using a given signal code string.
///

View file

@ -170,7 +170,7 @@ void pulse_data_print_pulse_header(FILE *file)
chk_ret(fprintf(file, ";created %s\n", format_time_str(time_str, NULL, 1, 0)));
}
void pulse_data_dump(FILE *file, pulse_data_t *data)
void pulse_data_dump(FILE *file, pulse_data_t const *data)
{
char time_str[LOCAL_TIME_BUFLEN];
@ -199,7 +199,7 @@ void pulse_data_dump(FILE *file, pulse_data_t *data)
chk_ret(fprintf(file, ";end\n"));
}
data_t *pulse_data_print_data(pulse_data_t *data)
data_t *pulse_data_print_data(pulse_data_t const *data)
{
int pulses[2 * PD_MAX_PULSES];
double to_us = 1e6 / data->sample_rate;

View file

@ -12,6 +12,7 @@
*/
#include "pulse_slicer.h"
#include "pulse_data.h"
#include "bitbuffer.h"
#include "util.h"
#include "logger.h"
@ -61,7 +62,7 @@ static int account_event(r_device *device, bitbuffer_t *bits, char const *demod_
return ret;
}
int pulse_slicer_pcm(const pulse_data_t *pulses, r_device *device)
int pulse_slicer_pcm(pulse_data_t const *pulses, r_device *device)
{
float samples_per_us = pulses->sample_rate / 1.0e6;
int s_short = device->short_width * samples_per_us;
@ -255,7 +256,7 @@ int pulse_slicer_pcm(const pulse_data_t *pulses, r_device *device)
return events;
}
int pulse_slicer_ppm(const pulse_data_t *pulses, r_device *device)
int pulse_slicer_ppm(pulse_data_t const *pulses, r_device *device)
{
float samples_per_us = pulses->sample_rate / 1.0e6;
@ -334,7 +335,7 @@ int pulse_slicer_ppm(const pulse_data_t *pulses, r_device *device)
return events;
}
int pulse_slicer_pwm(const pulse_data_t *pulses, r_device *device)
int pulse_slicer_pwm(pulse_data_t const *pulses, r_device *device)
{
float samples_per_us = pulses->sample_rate / 1.0e6;
@ -447,7 +448,7 @@ int pulse_slicer_pwm(const pulse_data_t *pulses, r_device *device)
return events;
}
int pulse_slicer_manchester_zerobit(const pulse_data_t *pulses, r_device *device)
int pulse_slicer_manchester_zerobit(pulse_data_t const *pulses, r_device *device)
{
float samples_per_us = pulses->sample_rate / 1.0e6;
@ -526,7 +527,7 @@ int pulse_slicer_manchester_zerobit(const pulse_data_t *pulses, r_device *device
return events;
}
static inline int pulse_slicer_get_symbol(const pulse_data_t *pulses, unsigned int n)
static inline int pulse_slicer_get_symbol(pulse_data_t const *pulses, unsigned int n)
{
if (n % 2 == 0)
return pulses->pulse[n / 2];
@ -534,7 +535,7 @@ static inline int pulse_slicer_get_symbol(const pulse_data_t *pulses, unsigned i
return pulses->gap[n / 2];
}
int pulse_slicer_dmc(const pulse_data_t *pulses, r_device *device)
int pulse_slicer_dmc(pulse_data_t const *pulses, r_device *device)
{
float samples_per_us = pulses->sample_rate / 1.0e6;
@ -594,7 +595,7 @@ int pulse_slicer_dmc(const pulse_data_t *pulses, r_device *device)
return events;
}
int pulse_slicer_piwm_raw(const pulse_data_t *pulses, r_device *device)
int pulse_slicer_piwm_raw(pulse_data_t const *pulses, r_device *device)
{
float samples_per_us = pulses->sample_rate / 1.0e6;
@ -656,7 +657,7 @@ int pulse_slicer_piwm_raw(const pulse_data_t *pulses, r_device *device)
return events;
}
int pulse_slicer_piwm_dc(const pulse_data_t *pulses, r_device *device)
int pulse_slicer_piwm_dc(pulse_data_t const *pulses, r_device *device)
{
float samples_per_us = pulses->sample_rate / 1.0e6;
@ -712,7 +713,7 @@ int pulse_slicer_piwm_dc(const pulse_data_t *pulses, r_device *device)
return events;
}
int pulse_slicer_nrzs(const pulse_data_t *pulses, r_device *device)
int pulse_slicer_nrzs(pulse_data_t const *pulses, r_device *device)
{
float samples_per_us = pulses->sample_rate / 1.0e6;
@ -772,7 +773,7 @@ int pulse_slicer_nrzs(const pulse_data_t *pulses, r_device *device)
* bit is discarded.
*/
int pulse_slicer_osv1(const pulse_data_t *pulses, r_device *device)
int pulse_slicer_osv1(pulse_data_t const *pulses, r_device *device)
{
float samples_per_us = pulses->sample_rate / 1.0e6;