00001 #include <rtt/RTT.hpp> 00002 00003 #if defined (OROPKG_OS_LXRT) 00004 00005 00006 #include "IP_Digital_24_DOutInterface.hpp" 00007 #include "drivers/LiAS_lxrt_user.h" 00008 00009 void IP_Digital_24_DOutInterface::switchOn( unsigned int n ) 00010 { 00011 IP_Digital_24_set_bit_of_channel( n + 1 ); 00012 } 00013 00014 00015 void IP_Digital_24_DOutInterface::switchOff( unsigned int n ) 00016 { 00017 IP_Digital_24_clear_bit_of_channel( n + 1 ); 00018 } 00019 00020 00021 void IP_Digital_24_DOutInterface::setBit( unsigned int bit, bool value ) 00022 { 00023 if (value) IP_Digital_24_set_bit_of_channel( bit + 1 ); 00024 else IP_Digital_24_clear_bit_of_channel( bit + 1 ); 00025 } 00026 00027 00028 void IP_Digital_24_DOutInterface::setSequence(unsigned int start_bit, unsigned int stop_bit, unsigned int value) 00029 { 00030 unsigned int temp; 00031 00032 for(unsigned int i = start_bit; i < stop_bit; i++) 00033 { 00034 temp = (1 << i); 00035 temp &= value; 00036 if ( temp ) IP_Digital_24_set_bit_of_channel( i + 1 ); 00037 else IP_Digital_24_clear_bit_of_channel( i + 1 ); 00038 } 00039 } 00040 00041 00042 bool IP_Digital_24_DOutInterface::checkBit( unsigned int bit ) const 00043 { 00044 return IP_Digital_24_get_bit_of_channel( bit + 1 ); 00045 } 00046 00047 00048 unsigned int IP_Digital_24_DOutInterface::checkSequence( unsigned int start_bit, unsigned int stop_bit ) const 00049 { 00050 unsigned int value = 0; 00051 00052 for (unsigned int i = start_bit; i < stop_bit; i++) 00053 value |= (IP_Digital_24_get_bit_of_channel( i + 1 ) << i ); 00054 00055 return value; 00056 } 00057 00058 #endif