added isValidAddress()
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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_
|
||||
|
||||
Reference in New Issue
Block a user