pinio.h: remove TOGGLE(), GET_INPUT(), GET_OUTPUT() macros.
Nowhere used, which unlikely changes in the forseeable future.
This commit is contained in:
parent
2b52233a2d
commit
c66bf0a8de
|
|
@ -29,38 +29,24 @@
|
||||||
#define _READ(IO) (IO ## _RPORT & MASK(IO ## _PIN))
|
#define _READ(IO) (IO ## _RPORT & MASK(IO ## _PIN))
|
||||||
/// write to a pin
|
/// write to a pin
|
||||||
#define _WRITE(IO, v) do { if (v) { IO ## _WPORT |= MASK(IO ## _PIN); } else { IO ## _WPORT &= ~MASK(IO ## _PIN); }; } while (0)
|
#define _WRITE(IO, v) do { if (v) { IO ## _WPORT |= MASK(IO ## _PIN); } else { IO ## _WPORT &= ~MASK(IO ## _PIN); }; } while (0)
|
||||||
/// toggle a pin
|
|
||||||
#define _TOGGLE(IO) do { IO ## _RPORT = MASK(IO ## _PIN); } while (0)
|
|
||||||
|
|
||||||
/// set pin as input
|
/// set pin as input
|
||||||
#define _SET_INPUT(IO) do { IO ## _DDR &= ~MASK(IO ## _PIN); } while (0)
|
#define _SET_INPUT(IO) do { IO ## _DDR &= ~MASK(IO ## _PIN); } while (0)
|
||||||
/// set pin as output
|
/// set pin as output
|
||||||
#define _SET_OUTPUT(IO) do { IO ## _DDR |= MASK(IO ## _PIN); } while (0)
|
#define _SET_OUTPUT(IO) do { IO ## _DDR |= MASK(IO ## _PIN); } while (0)
|
||||||
|
|
||||||
/// check if pin is an input
|
|
||||||
#define _GET_INPUT(IO) ((IO ## _DDR & MASK(IO ## _PIN)) == 0)
|
|
||||||
/// check if pin is an output
|
|
||||||
#define _GET_OUTPUT(IO) ((IO ## _DDR & MASK(IO ## _PIN)) != 0)
|
|
||||||
|
|
||||||
// why double up on these macros? see http://gcc.gnu.org/onlinedocs/cpp/Stringification.html
|
// why double up on these macros? see http://gcc.gnu.org/onlinedocs/cpp/Stringification.html
|
||||||
|
|
||||||
/// Read a pin wrapper
|
/// Read a pin wrapper
|
||||||
#define READ(IO) _READ(IO)
|
#define READ(IO) _READ(IO)
|
||||||
/// Write to a pin wrapper
|
/// Write to a pin wrapper
|
||||||
#define WRITE(IO, v) _WRITE(IO, v)
|
#define WRITE(IO, v) _WRITE(IO, v)
|
||||||
/// toggle a pin wrapper
|
|
||||||
#define TOGGLE(IO) _TOGGLE(IO)
|
|
||||||
|
|
||||||
/// set pin as input wrapper
|
/// set pin as input wrapper
|
||||||
#define SET_INPUT(IO) _SET_INPUT(IO)
|
#define SET_INPUT(IO) _SET_INPUT(IO)
|
||||||
/// set pin as output wrapper
|
/// set pin as output wrapper
|
||||||
#define SET_OUTPUT(IO) _SET_OUTPUT(IO)
|
#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
|
|
||||||
#define GET_OUTPUT(IO) _GET_OUTPUT(IO)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ports and functions
|
ports and functions
|
||||||
|
|
||||||
|
|
|
||||||
15
pinio.h
15
pinio.h
|
|
@ -36,19 +36,12 @@
|
||||||
if (v) { IO ## _WPORT |= MASK(IO ## _PIN); } \
|
if (v) { IO ## _WPORT |= MASK(IO ## _PIN); } \
|
||||||
else { IO ## _WPORT &= ~MASK(IO ## _PIN); } \
|
else { IO ## _WPORT &= ~MASK(IO ## _PIN); } \
|
||||||
} while (0)
|
} while (0)
|
||||||
/// Toggle a pin.
|
|
||||||
#define _TOGGLE(IO) do { IO ## _RPORT = MASK(IO ## _PIN); } while (0)
|
|
||||||
|
|
||||||
/// Set pin as input.
|
/// Set pin as input.
|
||||||
#define _SET_INPUT(IO) do { IO ## _DDR &= ~MASK(IO ## _PIN); } while (0)
|
#define _SET_INPUT(IO) do { IO ## _DDR &= ~MASK(IO ## _PIN); } while (0)
|
||||||
/// Set pin as output.
|
/// Set pin as output.
|
||||||
#define _SET_OUTPUT(IO) do { IO ## _DDR |= MASK(IO ## _PIN); } while (0)
|
#define _SET_OUTPUT(IO) do { IO ## _DDR |= MASK(IO ## _PIN); } while (0)
|
||||||
|
|
||||||
/// Check if pin is an input.
|
|
||||||
#define _GET_INPUT(IO) ((IO ## _DDR & MASK(IO ## _PIN)) == 0)
|
|
||||||
/// Check if pin is an output.
|
|
||||||
#define _GET_OUTPUT(IO) ((IO ## _DDR & MASK(IO ## _PIN)) != 0)
|
|
||||||
|
|
||||||
#elif defined __ARMEL__
|
#elif defined __ARMEL__
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -75,7 +68,6 @@
|
||||||
|
|
||||||
bool _READ(pin_t pin);
|
bool _READ(pin_t pin);
|
||||||
void _WRITE(pin_t pin, bool on);
|
void _WRITE(pin_t pin, bool on);
|
||||||
void _TOGGLE(pin_t pin);
|
|
||||||
void _SET_OUTPUT(pin_t pin);
|
void _SET_OUTPUT(pin_t pin);
|
||||||
void _SET_INPUT(pin_t pin);
|
void _SET_INPUT(pin_t pin);
|
||||||
|
|
||||||
|
|
@ -89,19 +81,12 @@
|
||||||
#define READ(IO) _READ(IO)
|
#define READ(IO) _READ(IO)
|
||||||
/// Write to a pin wrapper.
|
/// Write to a pin wrapper.
|
||||||
#define WRITE(IO, v) _WRITE(IO, v)
|
#define WRITE(IO, v) _WRITE(IO, v)
|
||||||
/// Toggle a pin wrapper.
|
|
||||||
#define TOGGLE(IO) _TOGGLE(IO)
|
|
||||||
|
|
||||||
/// Set pin as input wrapper.
|
/// Set pin as input wrapper.
|
||||||
#define SET_INPUT(IO) _SET_INPUT(IO)
|
#define SET_INPUT(IO) _SET_INPUT(IO)
|
||||||
/// Set pin as output wrapper.
|
/// Set pin as output wrapper.
|
||||||
#define SET_OUTPUT(IO) _SET_OUTPUT(IO)
|
#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.
|
|
||||||
#define GET_OUTPUT(IO) _GET_OUTPUT(IO)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Power
|
Power
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue