Browse Source

Fix SET_OUTPUT glitch - LPC1768 & DUE

pull/1/head
Bob-the-Kuhn 7 years ago
committed by Scott Lahteine
parent
commit
1a948cbd93
  1. 18
      Marlin/src/HAL/HAL_DUE/fastio_Due.h
  2. 4
      Marlin/src/HAL/HAL_LPC1768/fastio.h

18
Marlin/src/HAL/HAL_DUE/fastio_Due.h

@ -78,14 +78,17 @@
#define _TOGGLE(IO) _WRITE(IO, !READ(IO))
/// set pin as input
#define _SET_INPUT(IO) pmc_enable_periph_clk(g_APinDescription[IO].ulPeripheralId); \
PIO_Configure(g_APinDescription[IO].pPort, PIO_INPUT, g_APinDescription[IO].ulPin, 0)
#define _SET_INPUT(IO) do{ pmc_enable_periph_clk(g_APinDescription[IO].ulPeripheralId); \
PIO_Configure(g_APinDescription[IO].pPort, PIO_INPUT, g_APinDescription[IO].ulPin, 0); \
}while(0)
/// set pin as output
#define _SET_OUTPUT(IO) PIO_Configure(g_APinDescription[IO].pPort, PIO_OUTPUT_1, \
g_APinDescription[IO].ulPin, g_APinDescription[IO].ulPinConfiguration)
#define _SET_OUTPUT(IO) do{ pmc_enable_periph_clk(g_APinDescription[IO].ulPeripheralId); \
PIO_Configure(g_APinDescription[IO].pPort, _READ(IO) ? PIO_OUTPUT_1 : PIO_OUTPUT_0, \
g_APinDescription[IO].ulPin, g_APinDescription[IO].ulPinConfiguration); \
}while(0)
/// set pin as input with pullup mode
#define _PULLUP(IO, v) { pinMode(IO, (v!=LOW ? INPUT_PULLUP : INPUT)); }
#define _PULLUP(IO, v) { pinMode(IO, v != LOW ? INPUT_PULLUP : INPUT); }
/// check if pin is an input
#define _GET_INPUT(IO)
@ -109,9 +112,8 @@
#define SET_INPUT(IO) _SET_INPUT(IO)
/// set pin as input with pullup wrapper
#define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0)
/// set pin as output wrapper
#define SET_OUTPUT(IO) do{ _SET_OUTPUT(IO); _WRITE(IO, LOW); }while(0)
/// set pin as output wrapper - reads the pin and sets the output to that value
#define SET_OUTPUT(IO) _SET_OUTPUT(IO)
/// check if pin is an input wrapper
#define GET_INPUT(IO) _GET_INPUT(IO)
/// check if pin is an output wrapper

4
Marlin/src/HAL/HAL_LPC1768/fastio.h

@ -119,8 +119,8 @@ bool useable_hardware_PWM(pin_t pin);
#define SET_INPUT(IO) _SET_INPUT(IO)
/// set pin as input with pullup wrapper
#define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0)
/// set pin as output wrapper
#define SET_OUTPUT(IO) do{ _SET_OUTPUT(IO); _WRITE(IO, LOW); }while(0)
/// set pin as output wrapper - reads the pin and sets the output to that value
#define SET_OUTPUT(IO) do{ _WRITE(IO, _READ(IO)); _SET_OUTPUT(IO); }while(0)
/// check if pin is an input wrapper
#define GET_INPUT(IO) _GET_INPUT(IO)

Loading…
Cancel
Save