File tree Expand file tree Collapse file tree 1 file changed +7
-13
lines changed
Expand file tree Collapse file tree 1 file changed +7
-13
lines changed Original file line number Diff line number Diff line change @@ -261,8 +261,7 @@ mod tests {
261261 debug ! ( "temp: {}°C" , temp) ;
262262 assert ! ( ( 20.0 ..30.0 ) . contains( & temp) , "20.0 < {} < 30.0" , temp) ;
263263 }
264-
265- // TODO: This does not seem to work
264+
266265 #[ test]
267266 fn dac ( ) {
268267 use super :: * ;
@@ -274,26 +273,21 @@ mod tests {
274273 let mut delay = cp. SYST . delay ( & rcc. clocks ) ;
275274
276275 let gpioa = dp. GPIOA . split ( & mut rcc) ;
277- let dac1ch1 = dp. DAC1 . constrain ( gpioa. pa4 , & mut rcc) ;
276+ let pa4 = gpioa. pa4 . into_floating_input ( ) ;
277+ let dac1ch1 = dp. DAC1 . constrain ( pa4, & mut rcc) ;
278278
279279 let gpioa = unsafe { & * GPIOA :: PTR } ;
280280
281281 // dac_manual will have its value set manually
282282 let mut dac = dac1ch1. calibrate_buffer ( & mut delay) . enable ( ) ;
283283
284284 dac. set_value ( 0 ) ;
285- delay. delay_ms ( 100 ) ;
285+ delay. delay_ms ( 1 ) ;
286286 assert ! ( is_pax_low( & gpioa, 4 ) ) ;
287287
288- /*for i in (0..=4095).step_by(10) {
289- dac.set_value(i);
290- delay.delay_ms(1);
291- defmt::println!("i: {}, is_pax_low: {}", i, gpioa.idr().read().bits());
292- }
293-
294- delay.delay_ms(100);
295- assert!(!is_pax_low(&gpioa, 4)); // TODO: <---- Why does this not work?
296- */
288+ dac. set_value ( 4095 ) ;
289+ delay. delay_ms ( 1 ) ;
290+ assert ! ( !is_pax_low( & gpioa, 4 ) ) ;
297291 }
298292}
299293
You can’t perform that action at this time.
0 commit comments