<commit_before>
require 'libusb'


module URIx

	class URIx

		attr_accessor :usb, :device, :handle
		attr_reader :pin_states
		
		def initialize
			@usb = LIBUSB::Context.new
			@pin_states = 0x0
		end

		def init_interface
			@device = usb.devices(:idVendor => VENDOR_ID, :idProduct => PRODUCT_ID).first
			@handle = @device.open
			
			@handle.detach_kernel_driver(HID_INTERFACE)
		end

		def set_output pin, state
			if ( @pin_states >> ( pin - 1 )).odd? && ( state == false ) or
			   ( @pin_states >> ( pin - 1 )).even? && ( state == true ) then

				mask = 0 + ( 1 << ( pin - 1 ))
				@pin_states ^= mask
			end
		end

			



	end

end
<commit_msg>now with more pin modes<commit_after>
require 'libusb'


module URIx

	class URIx

		attr_accessor :usb, :device, :handle
		attr_reader :pin_states, :pin_modes
		
		def initialize
			@usb = LIBUSB::Context.new
			@pin_states = 0x0
			@pin_modes = 0x0

			set_pin_mode( PTT_PIN, :output )
		end

		def init_interface
			@device = usb.devices(:idVendor => VENDOR_ID, :idProduct => PRODUCT_ID).first
			@handle = @device.open
			
			@handle.detach_kernel_driver(HID_INTERFACE)
		end

		def set_output pin, state
			if ( @pin_states >> ( pin - 1 )).odd? && ( state == false ) or
			   ( @pin_states >> ( pin - 1 )).even? && ( state == true ) then

				mask = 0 + ( 1 << ( pin - 1 ))
				@pin_states ^= mask
			end
		end

		def set_pin_mode pin, mode
			if ( @pin_modes >> ( pin - 1 )).odd? && ( mode == :input ) or
			   ( @pin_modes >> ( pin - 1 )).even? && ( mode == :output ) then

				mask = 0 + ( 1 << ( pin - 1 ))
				@pin_modes ^= mask
			end
		end
			
	end

end

{'fraction_non_alphanumeric': 0.13756940160394818, 'fraction_numerical': 0.012954966070326958, 'mean_word_length': 2.5805739514348787, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3660593', 'n_tokens_mistral': 734, 'n_tokens_neox': 592, 'n_words': 160}