<s> """<STR_LIT>""" <EOL> from bbio import * <EOL> class ADS786x ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , data_pin , clk_pin , cs_pin , vref = <NUM_LIT> ) : <EOL> self . _data = data_pin <EOL> self . _clk = clk_pin <EOL> self . _cs = cs_pin <EOL> pinMode ( self . _data , INPUT ) <EOL> for i in ( self . _cs , self . _clk ) : pinMode ( i , OUTPUT ) <EOL> for i in ( self . _cs , self . _clk ) : digitalWrite ( i , HIGH ) <EOL> self . dv = float ( vref ) / <NUM_LIT:2> ** self . n_bits <EOL> def read ( self ) : <EOL> """<STR_LIT>""" <EOL> digitalWrite ( self . _cs , LOW ) <EOL> value = shiftIn ( self . _data , self . _clk , MSBFIRST , n_bits = self . n_bits + <NUM_LIT:3> ) <EOL> digitalWrite ( self . _cs , HIGH ) <EOL> return value <EOL> def readVolts ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . read ( ) * self . dv <EOL> class ADS7866 ( ADS786x ) : <EOL> n_bits = <NUM_LIT:12> <EOL> class ADS7867 ( ADS786x ) : <EOL> n_bits = <NUM_LIT:10> <EOL> class ADS7868 ( ADS786x ) : <EOL> n_bits = <NUM_LIT:8> </s>
