1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-27 13:56:24 +00:00

Clean up softspi.h

This commit is contained in:
Scott Lahteine 2018-10-01 01:29:48 -05:00
parent e78bdd654d
commit 389376c40e

View File

@ -19,11 +19,10 @@ bool fastDigitalRead(uint8_t pin) {
*/ */
static inline __attribute__((always_inline)) static inline __attribute__((always_inline))
void fastDigitalWrite(uint8_t pin, bool value) { void fastDigitalWrite(uint8_t pin, bool value) {
if (value) { if (value)
*portSetRegister(pin) = 1; *portSetRegister(pin) = 1;
} else { else
*portClearRegister(pin) = 1; *portClearRegister(pin) = 1;
}
} }
#else // CORE_TEENSY #else // CORE_TEENSY
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -42,17 +41,16 @@ bool fastDigitalRead(uint8_t pin){
*/ */
static inline __attribute__((always_inline)) static inline __attribute__((always_inline))
void fastDigitalWrite(uint8_t pin, bool value){ void fastDigitalWrite(uint8_t pin, bool value){
if(value) { if (value)
g_APinDescription[pin].pPort->PIO_SODR = g_APinDescription[pin].ulPin; g_APinDescription[pin].pPort->PIO_SODR = g_APinDescription[pin].ulPin;
} else { else
g_APinDescription[pin].pPort->PIO_CODR = g_APinDescription[pin].ulPin; g_APinDescription[pin].pPort->PIO_CODR = g_APinDescription[pin].ulPin;
}
} }
#endif // CORE_TEENSY #endif // CORE_TEENSY
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
inline void fastDigitalToggle(uint8_t pin) { inline void fastDigitalToggle(uint8_t pin) {
fastDigitalWrite(pin, !fastDigitalRead(pin)); fastDigitalWrite(pin, !fastDigitalRead(pin));
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
inline void fastPinMode(uint8_t pin, bool mode) {pinMode(pin, mode);} inline void fastPinMode(uint8_t pin, bool mode) {pinMode(pin, mode);}
#else // __arm__ #else // __arm__