#define DEFAULT_NUM_LOGIC_CHANNELS 8
#define DEFAULT_LOGIC_PATTERN PATTERN_SIGROK
-#define DEFAULT_NUM_ANALOG_CHANNELS 4
+#define DEFAULT_NUM_ANALOG_CHANNELS 5
/* Note: No spaces allowed because of sigrok-cli. */
static const char *logic_pattern_str[] = {
if (num_logic_channels > 0) {
/* Logic channels, all in one channel group. */
- cg = g_malloc0(sizeof(struct sr_channel_group));
- cg->name = g_strdup("Logic");
+ cg = sr_channel_group_new(sdi, "Logic", NULL);
for (i = 0; i < num_logic_channels; i++) {
sprintf(channel_name, "D%d", i);
ch = sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE, channel_name);
cg->channels = g_slist_append(cg->channels, ch);
}
- sdi->channel_groups = g_slist_append(NULL, cg);
}
/* Analog channels, channel groups and pattern generators. */
pattern = 0;
/* An "Analog" channel group with all analog channels in it. */
- acg = g_malloc0(sizeof(struct sr_channel_group));
- acg->name = g_strdup("Analog");
- sdi->channel_groups = g_slist_append(sdi->channel_groups, acg);
+ acg = sr_channel_group_new(sdi, "Analog", NULL);
for (i = 0; i < num_analog_channels; i++) {
snprintf(channel_name, 16, "A%d", i);
acg->channels = g_slist_append(acg->channels, ch);
/* Every analog channel gets its own channel group as well. */
- cg = g_malloc0(sizeof(struct sr_channel_group));
- cg->name = g_strdup(channel_name);
+ cg = sr_channel_group_new(sdi, channel_name, NULL);
cg->channels = g_slist_append(NULL, ch);
- sdi->channel_groups = g_slist_append(sdi->channel_groups, cg);
/* Every channel gets a generator struct. */
ag = g_malloc(sizeof(struct analog_gen));
GHashTableIter iter;
void *value;
+ demo_free_analog_pattern(devc);
+
/* Analog generators. */
g_hash_table_iter_init(&iter, devc->ch_ag);
while (g_hash_table_iter_next(&iter, NULL, &value))
std_session_send_df_header(sdi);
if (devc->limit_frames > 0)
- std_session_send_frame_begin(sdi);
+ std_session_send_df_frame_begin(sdi);
/* We use this timestamp to decide how many more samples to send. */
devc->start_us = g_get_monotonic_time();
devc = sdi->priv;
if (devc->limit_frames > 0)
- std_session_send_frame_end(sdi);
+ std_session_send_df_frame_end(sdi);
std_session_send_df_end(sdi);