@@ -119,6 +119,17 @@ macro_rules! opamps {
119
119
output: Option <$output>,
120
120
}
121
121
122
+ pub enum NonInvertingGain {
123
+ Gain2 = 0 ,
124
+ Gain4 = 1 ,
125
+ Gain8 = 2 ,
126
+ Gain16 = 3 ,
127
+ Gain32 = 4 ,
128
+ Gain64 = 5
129
+ }
130
+
131
+ // TODO: Inverting gain
132
+
122
133
pub struct Config <MODE > {
123
134
mode: MODE ,
124
135
pga_gain: crate :: stm32:: opamp:: [ <$opamp _csr>] :: PGA_GAIN_A ,
@@ -242,7 +253,7 @@ macro_rules! opamps {
242
253
243
254
opamps!{ @follower $opamp, $output, $( $non_inverting_mask, $non_inverting) ,* }
244
255
opamps!{ @open_loop_tt $opamp, $output, $( $non_inverting_mask, $non_inverting) ,* : ( $( $inverting_mask, $inverting) ,* ) }
245
- opamps!{ @pga_tt $opamp, $output, $( $non_inverting_mask, $non_inverting) ,* : ( $( $inverting_mask ) ,* ) }
256
+ opamps!{ @pga_tt $opamp, $output, $( $non_inverting_mask, $non_inverting) ,* : ( $( $inverting ) ,* ) }
246
257
}
247
258
) *
248
259
@@ -417,19 +428,19 @@ macro_rules! opamps {
417
428
,
418
429
$non_inverting: ty
419
430
,
420
- ( $( $inverting_mask : tt , ) ,* )
431
+ ( $( $invertings : ty ) ,* )
421
432
} => {
422
433
paste:: paste!{
423
- $( impl <IntoNonInverting , MODE , IntoOutput > IntoPga
424
- <IntoNonInverting , Config <MODE >, IntoOutput , $non_inverting> for Disabled
434
+ $( impl <IntoNonInverting , $mode , IntoOutput > IntoPga
435
+ <IntoNonInverting , Config <$mode >, IntoOutput , $non_inverting> for Disabled
425
436
where
426
437
IntoNonInverting : Into <$non_inverting>,
427
438
IntoOutput : Into <$output>,
428
439
{
429
440
fn pga(
430
441
self ,
431
442
non_inverting: IntoNonInverting ,
432
- config: Config <MODE >,
443
+ config: Config <$mode >,
433
444
output: Option <IntoOutput >,
434
445
) -> Pga <$non_inverting, $config> {
435
446
let non_inverting = non_inverting. into( ) ;
0 commit comments