<commit_before>
"""
pcDuino v1 board
"""

from pingo.board import Board, DigitalPin, AnalogPin IN, OUT, HIGH, LOW
from pingo.detect import detect

# /sys/class/gpio/gpio40/ --> Arduino pin #13
DIGITAL_PINS_PATH = '/sys/devices/virtual/misc/gpio/'
ADC_PATH = '/proc/'

DIGITAL_PIN_MODES = {IN: '0', OUT: '1'}
DIGITAL_PIN_STATES = {HIGH:1, LOW:0}
LEN_DIGITAL_PINS = 12
LEN_ANALOG_PINS = 6 

class PcDuino(Board):

    def __init__(self):
        self.add_pins([DigitalPin(self, location)
                           for location in range(LEN_DIGITAL_PINS)] + 
                      [AnalogPin(self, 'A%s' % location, bits=10)
                          for location in range(LEN_ANALOG_PINS)])

    def _set_pin_mode(self, pin, mode):
        assert mode in DIGITAL_PIN_MODES, '%r not in %r' % (
            mode, DIGITAL_PIN_MODES)
        with open(DIGITAL_PINS_PATH+'mode/gpio%s' % pin.location, 'w') as fp:
            fp.write(DIGITAL_PIN_MODES[mode])

    def _set_pin_state(self, pin, state):
        with open(DIGITAL_PINS_PATH+'pin/gpio%s' % pin.location, 'w') as fp:
            fp.write(str(state))

   def _get_pin_value(self, pin):
       with open(ADC_PATH+'adc%d' % pin) as fp:
          fp.seek(0)
          return fp.read()
<commit_msg>implemented PcDuino driver level 1<commit_after>
"""
pcDuino v1 board
"""

from pingo.board import Board, DigitalPin, AnalogPin, IN, OUT, HIGH, LOW
from pingo.detect import detect

# /sys/class/gpio/gpio40/ --> Arduino pin #13
DIGITAL_PINS_PATH = '/sys/devices/virtual/misc/gpio/'
ADC_PATH = '/proc/'

DIGITAL_PIN_MODES = {IN: '0', OUT: '1'}
DIGITAL_PIN_STATES = {HIGH:'1', LOW:'0'}
LEN_DIGITAL_PINS = 12
ANALOG_PIN_RESOLUTIONS = [6, 6, 12, 12, 12, 12]


class PcDuino(Board):

    def __init__(self):
        self.add_pins([DigitalPin(self, location)
                       for location in range(LEN_DIGITAL_PINS)] + 
                      [AnalogPin(self, 'A%s' % location, bits=bits)
                       for location, bits in enumerate(ANALOG_PIN_RESOLUTIONS)])

    def _set_pin_mode(self, pin, mode):
        assert mode in DIGITAL_PIN_MODES, '%r not in %r' % (mode, DIGITAL_PIN_MODES)
        with open(DIGITAL_PINS_PATH+'mode/gpio%s' % pin.location, 'w') as fp:
            fp.write(DIGITAL_PIN_MODES[mode])

    def _set_pin_state(self, pin, state):
        with open(DIGITAL_PINS_PATH+'pin/gpio%s' % pin.location, 'w') as fp:
            fp.write(DIGITAL_PIN_STATES[state])

    def _get_pin_value(self, pin):
        adc_id = pin.location[-1]
        with open(ADC_PATH+'adc%s' % adc_id) as fp:
            fp.seek(0)
            return int(fp.read(16).split(':')[1])

{'fraction_non_alphanumeric': 0.13307984790874525, 'fraction_numerical': 0.01596958174904943, 'mean_word_length': 2.8408759124087593, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5685675', 'n_tokens_mistral': 1049, 'n_tokens_neox': 964, 'n_words': 210}