added isValidAddress()

This commit is contained in:
john30
2014-11-20 22:06:27 +01:00
parent fa568f9568
commit 0283b0e121
2 changed files with 12 additions and 0 deletions
+4
View File
@@ -187,3 +187,7 @@ bool isMaster(unsigned char addr) {
&& ((addrLo == 0x0) || (addrLo == 0x1) || (addrLo == 0x3) || (addrLo == 0x7) || (addrLo == 0xF));
}
bool isValidAddress(unsigned char addr, bool allowBroadcast) {
return addr != SYN && addr != ESC && (allowBroadcast == true || addr != BROADCAST);
}
+8
View File
@@ -135,4 +135,12 @@ private:
*/
bool isMaster(unsigned char addr);
/**
* Returns whether the address is a valid bus address.
* @param addr the address to check.
* @param allowBroadcast whether to also allow @a addr to be the broadcast address (default true).
* @return <code>true</code> if the specified address is a valid bus address.
*/
bool isValidAddress(unsigned char addr, bool allowBroadcast=true);
#endif // LIBEBUS_SYMBOL_H_