Skip to content

Commit 67f9141

Browse files
committed
Add getBit function
1 parent 4b312d6 commit 67f9141

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/PF1550/PF1550_IO.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ void PF1550_IO::setBit(Register const reg, uint8_t const bit_pos)
8484
writeRegister(reg, reg_val);
8585
}
8686

87+
uint8_t PF1550_IO::getBit(Register const reg, uint8_t const bit_pos)
88+
{
89+
assert(bit_pos < 8);
90+
uint8_t reg_val;
91+
readRegister(reg, &reg_val);
92+
return (reg_val >> bit_pos) & 1;
93+
}
94+
8795
void PF1550_IO::clrBit(Register const reg, uint8_t const bit_pos)
8896
{
8997
assert(bit_pos < 8);

src/PF1550/PF1550_IO.h

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class PF1550_IO
5656
void writeRegister(Register const reg_addr, uint8_t const data);
5757

5858
void setBit(Register const reg, uint8_t const bit_pos);
59+
uint8_t getBit(Register const reg, uint8_t const bit_pos);
5960
void clrBit(Register const reg, uint8_t const bit_pos);
6061

6162

0 commit comments

Comments
 (0)