Renamed getPin function to clearly differentiate it from getPIN
This commit is contained in:
parent
25bd873f94
commit
4f40aa70dc
14
io.hpp
14
io.hpp
@ -172,7 +172,7 @@ static constexpr auto getBus(const P pin)
|
||||
return static_cast<Bus>(port);
|
||||
}
|
||||
|
||||
static constexpr auto getPin(const P pin)
|
||||
static constexpr auto getPinBit(const P pin)
|
||||
{
|
||||
// Lower 4 bits of pin encode which pin bit it is
|
||||
uint8_t pinBit = static_cast<uint8_t>(pin) & 0x0F;
|
||||
@ -242,7 +242,7 @@ class Pin {
|
||||
{
|
||||
constexpr auto bus = detail::getBus(pin);
|
||||
constexpr auto dirReg = detail::getDDR(bus);
|
||||
constexpr auto pinBit = detail::getPin(pin);
|
||||
constexpr auto pinBit = detail::getPinBit(pin);
|
||||
|
||||
if (dir == Dir::IN)
|
||||
*dirReg &= ~(1 << pinBit);
|
||||
@ -254,7 +254,7 @@ class Pin {
|
||||
{
|
||||
constexpr auto bus = detail::getBus(pin);
|
||||
constexpr auto portReg = detail::getPORT(bus);
|
||||
constexpr auto pinBit = detail::getPin(pin);
|
||||
constexpr auto pinBit = detail::getPinBit(pin);
|
||||
|
||||
if (enable)
|
||||
*portReg |= (1 << pinBit);
|
||||
@ -266,7 +266,7 @@ class Pin {
|
||||
{
|
||||
constexpr auto bus = detail::getBus(pin);
|
||||
constexpr auto portReg = detail::getPORT(bus);
|
||||
constexpr auto pinBit = detail::getPin(pin);
|
||||
constexpr auto pinBit = detail::getPinBit(pin);
|
||||
|
||||
if (value)
|
||||
*portReg |= (1 << pinBit);
|
||||
@ -279,13 +279,13 @@ class Pin {
|
||||
#ifdef HARDWARE_TOGGLE
|
||||
constexpr auto bus = detail::getBus(pin);
|
||||
constexpr auto pinReg = detail::getPIN(bus);
|
||||
constexpr auto pinBit = detail::getPin(pin);
|
||||
constexpr auto pinBit = detail::getPinBit(pin);
|
||||
|
||||
*pinReg |= (1 << pinBit);
|
||||
#else
|
||||
constexpr auto bus = detail::getBus(pin);
|
||||
constexpr auto portReg = detail::getPORT(bus);
|
||||
constexpr auto pinBit = detail::getPin(pin);
|
||||
constexpr auto pinBit = detail::getPinBit(pin);
|
||||
|
||||
*portReg ^= (1 << pinBit);
|
||||
#endif
|
||||
@ -295,7 +295,7 @@ class Pin {
|
||||
{
|
||||
constexpr auto bus = detail::getBus(pin);
|
||||
constexpr auto pinReg = detail::getPIN(bus);
|
||||
constexpr auto pinBit = detail::getPin(pin);
|
||||
constexpr auto pinBit = detail::getPinBit(pin);
|
||||
|
||||
if (*pinReg >> pinBit & 1)
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user