Skip to content

Commit e8522c4

Browse files
committed
WIP2
1 parent 91e6ceb commit e8522c4

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

src/opamp.rs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,17 @@ macro_rules! opamps {
119119
output: Option<$output>,
120120
}
121121

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+
122133
pub struct Config<MODE> {
123134
mode: MODE,
124135
pga_gain: crate::stm32::opamp::[<$opamp _csr>]::PGA_GAIN_A,
@@ -242,7 +253,7 @@ macro_rules! opamps {
242253

243254
opamps!{ @follower $opamp, $output, $($non_inverting_mask, $non_inverting),* }
244255
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),*) }
246257
}
247258
)*
248259

@@ -417,19 +428,19 @@ macro_rules! opamps {
417428
,
418429
$non_inverting:ty
419430
,
420-
($($inverting_mask:tt,),*)
431+
($($invertings:ty),*)
421432
} => {
422433
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
425436
where
426437
IntoNonInverting: Into<$non_inverting>,
427438
IntoOutput: Into<$output>,
428439
{
429440
fn pga(
430441
self,
431442
non_inverting: IntoNonInverting,
432-
config: Config<MODE>,
443+
config: Config<$mode>,
433444
output: Option<IntoOutput>,
434445
) -> Pga<$non_inverting, $config> {
435446
let non_inverting = non_inverting.into();

0 commit comments

Comments
 (0)