File tree Expand file tree Collapse file tree 3 files changed +11
-7
lines changed Expand file tree Collapse file tree 3 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 14
14
//#define COMP_PA4 0b1000101
15
15
//#define COMP_PA5 0b1010101
16
16
17
- //// High speed comparator
17
+ // High speed comparator
18
18
#define COMP_PA0 0b1100001
19
19
#define COMP_PA4 0b1000001
20
20
#define COMP_PA5 0b1010001
Original file line number Diff line number Diff line change 12
12
COMP_TypeDef * active_COMP = COMP1 ;
13
13
14
14
uint8_t getCompOutputLevel () { return LL_COMP_ReadOutputLevel (active_COMP ); }
15
- uint8_t medium_speed_set ;
16
15
17
16
void maskPhaseInterrupts ()
18
17
{
@@ -36,12 +35,9 @@ void changeCompInput()
36
35
}
37
36
if ((average_interval < 400 )){
38
37
COMP -> CSR = COMP -> CSR & ~(1 <<2 );
39
-
40
- medium_speed_set = 0 ;
41
38
}
42
39
if ((average_interval > 600 )){
43
40
COMP -> CSR = COMP -> CSR | 1 <<2 ;
44
- medium_speed_set = 1 ;
45
41
}
46
42
if (rising ) {
47
43
EXTI -> RTSR = 0x0 ;
Original file line number Diff line number Diff line change 6
6
*/
7
7
8
8
#include "comparator.h"
9
-
10
9
#include "targets.h"
10
+ #include "common.h"
11
11
12
12
uint8_t getCompOutputLevel () { return CMP -> ctrlsts_bit .cmpvalue ; }
13
13
@@ -39,6 +39,14 @@ void changeCompInput()
39
39
// EXINT->polcfg1 |= (uint32_t)EXTI_LINE;
40
40
// EXINT->polcfg2 = 0;
41
41
// }
42
- EXINT -> polcfg1 = !rising << 21 ;
42
+ if ((average_interval < 150 )){
43
+ //set comp to high speed mode
44
+ CMP -> ctrlsts = CMP -> ctrlsts & ~(1 <<2 );
45
+ }
46
+ if ((average_interval > 250 )){
47
+ //set comp to medium speed mode
48
+ CMP -> ctrlsts = CMP -> ctrlsts | 1 <<2 ;
49
+ }
50
+ EXINT -> polcfg1 = !rising << 21 ;
43
51
EXINT -> polcfg2 = rising << 21 ;
44
52
}
You can’t perform that action at this time.
0 commit comments