34 static const uint8_t TEST_PIN_NUM = 12;
51 TEST(Constructor_ShouldSetNullPin) {
59 TEST(Constructor_ShouldSetMask) {
62 ASSERT_EQ(TEST_MASK, testable->get_mask());
67 TEST(Constructor_ShouldSetMaskAndDir) {
70 ASSERT_EQ(TEST_MASK, testable->get_mask());
80 ASSERT_EQ(TEST_MASK, testable->get_mask());
89 ASSERT_EQ(TEST_MASK, testable->get_mask());
125 ASSERT_EQ(TEST_MASK, OUTA & TEST_MASK);
134 ASSERT_EQ(TEST_MASK, OUTA & TEST_MASK);
143 ASSERT_EQ(TEST_MASK, OUTA & TEST_MASK);
152 ASSERT_EQ(0, OUTA & TEST_MASK);
161 ASSERT_EQ(0, OUTA & TEST_MASK);
170 ASSERT_EQ(0, OUTA & TEST_MASK);
179 ASSERT_EQ(0, OUTA & TEST_MASK);
181 ASSERT_EQ(TEST_MASK, OUTA & TEST_MASK);
183 ASSERT_EQ(0, OUTA & TEST_MASK);
191 testable->
write(
true);
192 ASSERT_EQ(TEST_MASK, OUTA & TEST_MASK);
193 testable->
write(
false);
194 ASSERT_EQ(0, OUTA & TEST_MASK);
196 ASSERT_EQ(TEST_MASK, OUTA & TEST_MASK);
205 ASSERT_TRUE(testable->
read());
207 ASSERT_FALSE(testable->
read());
215 RUN_TEST(Constructor_ShouldSetNullPin);
216 RUN_TEST(Constructor_ShouldSetMask);
217 RUN_TEST(Constructor_ShouldSetMaskAndDir);
void set_mask(const PropWare::Port::Mask mask)
Utility class to handle general purpose I/O pins.
void set_dir(const PropWare::Port::Dir direction) const
Set port as either input or output.
void set_dir_in() const
Set the port for input.
void clear() const
Clear selected output port (set it to 0)
void set_dir_out() const
Set the port for output.
void write(const bool value) const
Set or clear the pin programmatically.
PropWare::Port::Dir get_dir() const
Determine the direction this port is currently set to.
void toggle() const
Toggle the output value of a port.
void set() const
Set selected output port high (set all pins to 1)
bool read() const
Read the value from a single pin and return its state.
void set_pin_num(const uint8_t pinNum)
Set a Pin's mask based on the pin number (an integer, 0 through 31)