diff options
Diffstat (limited to 'testhal')
-rw-r--r-- | testhal/STM32/STM32F3xx/COMP/main.c | 48 | ||||
-rw-r--r-- | testhal/STM32/STM32F3xx/COMP/mcuconf_community.h | 21 |
2 files changed, 30 insertions, 39 deletions
diff --git a/testhal/STM32/STM32F3xx/COMP/main.c b/testhal/STM32/STM32F3xx/COMP/main.c index 5b377aa..83a00ff 100644 --- a/testhal/STM32/STM32F3xx/COMP/main.c +++ b/testhal/STM32/STM32F3xx/COMP/main.c @@ -17,44 +17,30 @@ #include "ch.h"
#include "hal.h"
-static const EXTConfig extcfg = {
- {
- {EXT_CH_MODE_DISABLED, NULL},
- {EXT_CH_MODE_DISABLED, NULL},
- {EXT_CH_MODE_DISABLED, NULL},
- {EXT_CH_MODE_DISABLED, NULL},
- {EXT_CH_MODE_DISABLED, NULL},
- {EXT_CH_MODE_DISABLED, NULL},
- {EXT_CH_MODE_DISABLED, NULL},
- {EXT_CH_MODE_DISABLED, NULL},
- {EXT_CH_MODE_DISABLED, NULL},
- {EXT_CH_MODE_DISABLED, NULL},
- {EXT_CH_MODE_DISABLED, NULL},
- {EXT_CH_MODE_DISABLED, NULL},
- {EXT_CH_MODE_DISABLED, NULL},
- {EXT_CH_MODE_DISABLED, NULL},
- {EXT_CH_MODE_DISABLED, NULL},
- {EXT_CH_MODE_DISABLED, NULL},
- {EXT_CH_MODE_DISABLED, NULL},
- {EXT_CH_MODE_DISABLED, NULL},
- {EXT_CH_MODE_DISABLED, NULL},
- {EXT_CH_MODE_DISABLED, NULL},
- {EXT_CH_MODE_DISABLED, NULL},
- {EXT_CH_MODE_DISABLED, NULL},
- {EXT_CH_MODE_DISABLED, NULL}
+void comp2_cb(COMPDriver *comp) {
+
+ if (comp->reg->CSR & COMP_CSR_COMPxOUT) {
+
+
}
-};
+
+}
+
+void comp4_cb(COMPDriver *comp) {
+ (void) comp;
+
+}
static const COMPConfig comp2_conf = {
COMP_OUTPUT_NORMAL,
- NULL,
- 0
+ comp2_cb,
+ COMP_CSR_COMPxINSEL_0 | COMP_CSR_COMPxOUTSEL_0 // CSR
};
static const COMPConfig comp4_conf = {
COMP_OUTPUT_INVERTED,
- NULL,
- 0
+ comp4_cb,
+ COMP_CSR_COMPxINSEL_0 | COMP_CSR_COMPxOUTSEL_1 // CSR
};
@@ -66,7 +52,6 @@ int main(void) { halInit();
chSysInit();
- extStart(&EXTD1, &extcfg);
compStart(&COMPD2, &comp2_conf);
compStart(&COMPD4, &comp4_conf);
@@ -74,7 +59,6 @@ int main(void) { * Normal main() thread activity, it resets the watchdog.
*/
while (true) {
- palToggleLine(LINE_LED4_BLUE);
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32F3xx/COMP/mcuconf_community.h b/testhal/STM32/STM32F3xx/COMP/mcuconf_community.h index dad1b6d..1f89e54 100644 --- a/testhal/STM32/STM32F3xx/COMP/mcuconf_community.h +++ b/testhal/STM32/STM32F3xx/COMP/mcuconf_community.h @@ -64,15 +64,22 @@ /* * COMP driver system settings. - * IRQ priority is set with the EXT driver (lines 21-22, 29-33) */ -#define STM32_COMP_USE_COMP1 FALSE +#define STM32_COMP_USE_COMP1 TRUE #define STM32_COMP_USE_COMP2 TRUE -#define STM32_COMP_USE_COMP3 FALSE +#define STM32_COMP_USE_COMP3 TRUE #define STM32_COMP_USE_COMP4 TRUE -#define STM32_COMP_USE_COMP5 FALSE -#define STM32_COMP_USE_COMP6 FALSE -#define STM32_COMP_USE_COMP7 FALSE +#define STM32_COMP_USE_COMP5 TRUE +#define STM32_COMP_USE_COMP6 TRUE +#define STM32_COMP_USE_COMP7 TRUE + #define STM32_COMP_USE_INTERRUPTS TRUE +#define STM32_COMP_1_2_3_IRQ_PRIORITY 5 +#define STM32_COMP_4_5_6_IRQ_PRIORITY 5 +#define STM32_COMP_7_IRQ_PRIORITY 5 - +#if STM32_COMP_USE_INTERRUPTS +#define STM32_DISABLE_EXTI21_22_29_HANDLER +#define STM32_DISABLE_EXTI30_32_HANDLER +#define STM32_DISABLE_EXTI33_HANDLER +#endif |