Add comment for navswitch delay

main
Michael Hayes 12 years ago
parent a21b31950b
commit efd77c9fd7

@ -118,19 +118,16 @@ navswitch_update (void)
MOSFET otherwise will always read logic low and think the MOSFET otherwise will always read logic low and think the
switch is pushed. Alternatively, we need to wait 10 us or switch is pushed. Alternatively, we need to wait 10 us or
more so that the gate capacitance of the MOSFET charges via more so that the gate capacitance of the MOSFET charges via
the pullup resistor. */ the internal pullup resistor. */
pio_config_set (navswitch_cfg[i].pio, PIO_OUTPUT_HIGH); pio_config_set (navswitch_cfg[i].pio, PIO_OUTPUT_HIGH);
/* Switch PIO to an input to read switch. */ /* Switch PIO to an input to read switch. */
pio_config_set (navswitch_cfg[i].pio, PIO_PULLUP); pio_config_set (navswitch_cfg[i].pio, PIO_PULLUP);
/* I'm unsure why this is needed. It wasn't required for the /* Wait long enough for MOSFET gate capacitance to discharge
slightly slower PIO implementation. There may be a minimum through 2.2 kohm resistor when switch is pushed (connected
number of CPU clock cycles for the synchronising flip flops to ground). */
to propagate the input state? For some reason the boards DELAY_US (2.5);
made in 2013 need a longer delay. Increasing the charge
time before switching to an input does not help.*/
DELAY_US (2.0);
navswitch_state[i].current = pio_input_get (navswitch_cfg[i].pio) == 0; navswitch_state[i].current = pio_input_get (navswitch_cfg[i].pio) == 0;

Loading…
Cancel
Save