00001 00002 #include <rtt/RTT.hpp> 00003 00004 #if defined (OROPKG_OS_LXRT) 00005 00006 00007 #include "IP_OptoInput_DInInterface.hpp" 00008 #include "drivers/LiAS_lxrt_user.h" 00009 00010 00011 bool IP_OptoInput_DInInterface::isOn( unsigned int bit ) const 00012 { 00013 unsigned int mask = (1 << bit); 00014 mask &= IP_OptoInput_Read_IDR(); 00015 return (mask >> bit); 00016 } 00017 00018 bool IP_OptoInput_DInInterface::isOff( unsigned int bit ) const 00019 { 00020 unsigned int mask = (1 << bit); 00021 mask &= IP_OptoInput_Read_IDR(); 00022 return !(mask >> bit); 00023 } 00024 00025 bool IP_OptoInput_DInInterface::readBit( unsigned int bit ) const 00026 { 00027 unsigned int mask = (1 << bit); 00028 mask &= IP_OptoInput_Read_IDR(); 00029 return (mask >> bit); 00030 } 00031 00032 unsigned int IP_OptoInput_DInInterface::readSequence(unsigned int start_bit, unsigned int stop_bit) const 00033 { 00034 unsigned int mask = 0; 00035 for (unsigned int i = start_bit; i < stop_bit; i++) 00036 { 00037 mask |= ( 1 << i); 00038 } 00039 00040 mask &= IP_OptoInput_Read_IDR(); 00041 00042 return mask; 00043 } 00044 00045 00046 #endif