Code: Select all
rccEnableAPB1(RCC_APB1ENR_COMPEN, TRUE);
palSetPadMode(GPIOB, 4, PAL_MODE_INPUT_ANALOG);
RI->ASCR2 = RI_ASCR2_GR6_1; /* Non-inv input is connected to PB4 */
COMP->CSR =
COMP_CSR_SPEED | /* Fast comparator */
COMP_CSR_OUTSEL_2 | COMP_CSR_OUTSEL_1 | COMP_CSR_OUTSEL_0 | /* Output not redirected */
COMP_CSR_INSEL_2 | COMP_CSR_INSEL_1; /* Inverted input connected to DAC_OUT_1 */
I can read COMP->CSR and see that COMP_CSR_CMP2IN changes state when PB4 value changes voltage. I'm stuck figuring out the interrupt part. From the RM, the COMP output is connected to EXTI line 21. The EXT driver is marked as obsolete, so what's the way forward?