@@ -38,9 +38,11 @@ fn main() -> ! {
38
38
// setup opamps
39
39
let ( opamp1, opamp2, opamp3, opamp4, ..) = dp. OPAMP . split ( & mut rcc) ;
40
40
41
+ // Set up opamp1 and opamp2 in follower mode
41
42
let opamp1 = opamp1. follower ( gpioa. pa1 , Some ( gpioa. pa2 ) ) ;
42
43
let opamp2 = opamp2. follower ( gpioa. pa7 , Option :: < PA6 < Analog > > :: None ) ;
43
44
45
+ // Set up opamp1 and opamp2 in open loop mode
44
46
let opamp3 = opamp3. open_loop ( gpiob. pb0 , gpiob. pb2 , Some ( gpiob. pb1 ) ) ;
45
47
let opamp4 = opamp4. open_loop ( gpiob. pb11 , gpiob. pb10 , Option :: < PB12 < Analog > > :: None ) ;
46
48
@@ -51,16 +53,19 @@ fn main() -> ! {
51
53
let ( _opamp3, _pb0, _pb2, _some_pb1) = opamp3. disable ( ) ;
52
54
let ( _opamp4, _pb11, _pb10, _none) = opamp4. disable ( ) ;
53
55
56
+ // Configure opamp1 with pa1 as non-inverting input and set gain to x2
54
57
let _opamp1 = opamp1. pga (
55
58
pa1,
56
59
PgaModeInternal :: gain ( NonInvertingGain :: Gain2 ) ,
57
- some_pa2,
60
+ some_pa2, // Route output to pin pa2
58
61
) ;
62
+
63
+ // Configure op with pa7 as non-inverting input and set gain to x4
59
64
let mut opamp2 = opamp2. pga (
60
65
pa7,
61
66
PgaModeInternal :: gain ( NonInvertingGain :: Gain4 ) ,
62
67
//Some(gpioa.pa6),
63
- Option :: < PA6 < Analog > > :: None ,
68
+ Option :: < PA6 < Analog > > :: None , // Do not route output to any external pin, use internal AD instead
64
69
) ;
65
70
66
71
let mut delay = cp. SYST . delay ( & rcc. clocks ) ;
@@ -80,7 +85,7 @@ fn main() -> ! {
80
85
81
86
#[ allow( unreachable_code) ]
82
87
{
83
- // let (_opamp1, _pa1, _mode, _some_pa2) = _opamp1.disable();
88
+ let ( _opamp1, _pa1, _mode, _some_pa2) = _opamp1. disable ( ) ;
84
89
let ( _opamp2, _pa7, _mode, _none) = opamp2. disable ( ) ;
85
90
86
91
loop { }
0 commit comments