added defines and functions to check and clear bits. updated device
checking