Is it possible to have two independent ICU from channel 1 and 2 on one timer? If I run ICU on one channel, it is working properly, but I am not able to run ICU on two channels on one timer. I thought that this implementation will not work, but just for illustration to be clear what I want to achieve:
Code: Select all
icucnt_t last_width, last_period;
static void icuwidthcb(ICUDriver *icup) {
last_width = icuGetWidthX(icup);
}
static void icuperiodcb(ICUDriver *icup) {
last_period = icuGetPeriodX(icup);
}
static void icuoverflowcb(ICUDriver *icup) {
(void)icup;
}
icucnt_t last_width2, last_period2;
static void icuwidthcb2(ICUDriver *icup) {
last_width2 = icuGetWidthX(icup);
}
static void icuperiodcb2(ICUDriver *icup) {
last_period2 = icuGetPeriodX(icup);
}
static void icuoverflowcb2(ICUDriver *icup) {
(void)icup;
}
static ICUConfig icucfg = {
ICU_INPUT_ACTIVE_HIGH,
100000, /* 10kHz ICU clock frequency. */
icuwidthcb,
icuperiodcb,
icuoverflowcb,
ICU_CHANNEL_1,
0
};
static ICUConfig icucfg2 = {
ICU_INPUT_ACTIVE_HIGH,
100000, /* 10kHz ICU clock frequency. */
icuwidthcb2,
icuperiodcb2,
icuoverflowcb2,
ICU_CHANNEL_2,
0
};
.
.
.
icuStart(&ICUD2, &icucfg);
icuStart(&ICUD2, &icucfg2);
icuStartCapture(&ICUD2);
icuEnableNotifications(&ICUD2);
Is there some way how to do something like this?
Thanks,
halba