diff options
author | Fabien Poussin <fabien.poussin@gmail.com> | 2017-02-07 15:20:28 +0100 |
---|---|---|
committer | Fabien Poussin <fabien.poussin@gmail.com> | 2017-02-07 15:20:28 +0100 |
commit | f4687bd298290f54574f213406c21b6d7c38511c (patch) | |
tree | 784baa9adce8d283c2fe6f39d820e5234f24226a /testhal | |
parent | 7059c87ab4f237187bab6db709280de3a6b8ea6b (diff) | |
download | ChibiOS-Contrib-f4687bd298290f54574f213406c21b6d7c38511c.tar.gz ChibiOS-Contrib-f4687bd298290f54574f213406c21b6d7c38511c.tar.bz2 ChibiOS-Contrib-f4687bd298290f54574f213406c21b6d7c38511c.zip |
[Comp] Cleaning example, removing dependencies and adding checks.
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 |