<commit_before>// Copyright (c) 2016 The mccdaq developers. All rights reserved.
// Project site: https://github.com/gotmc/mccdaq
// Use of this source code is governed by a MIT-style license that
// can be found in the LICENSE.txt file for the project.

package main

import (
	"bytes"
	"encoding/binary"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"log"
	"time"

	"github.com/gizak/termui"
	"github.com/gotmc/libusb"
	"github.com/gotmc/mccdaq/usb1608fsplus"
)

const (
	millisecondDelay = 100
	termWidth        = 70
)

func main() {

	// Initialize the USB Context
	ctx, err := libusb.Init()
	if err != nil {
		log.Fatal("Couldn't create USB context. Ending now.")
	}
	defer ctx.Exit()

	// Find the first USB fevice with the VendorID and ProductID matching the MCC
	// USB-1608FS-Plus DAQ
	daq, err := usb1608fsplus.GetFirstDevice(ctx)
	if err != nil {
		log.Fatalf("Couldn't find a USB-1608FS-Plus: %s", err)
	}
	defer daq.Close()

	// Read the calibration memory to setup the gain table
	// gainTable, _ := daq.BuildGainTable()

	// Create new analog input and ensure the scan is stopped and buffer cleared<commit_msg>Pull GPIO3 low if running on RPi<commit_after>// Copyright (c) 2016 The mccdaq developers. All rights reserved.
// Project site: https://github.com/gotmc/mccdaq
// Use of this source code is governed by a MIT-style license that
// can be found in the LICENSE.txt file for the project.

package main

import (
	"bytes"
	"encoding/binary"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"log"
	"runtime"
	"time"

	"github.com/gizak/termui"
	"github.com/gotmc/libusb"
	"github.com/gotmc/mccdaq/usb1608fsplus"
	"github.com/nathan-osman/go-rpigpio"
)

const (
	millisecondDelay = 100
	termWidth        = 70
)

func main() {

	// If running from RPi, set GPIO3 low.
	if runtime.GOARCH == "arm" {
		gpio3, err := rpi.OpenPin(3, rpi.OUT)
		if err != nil {
			panic(err)
		}
		defer gpio3.Close()
		gpio3.Write(rpi.LOW)
	}

	// Initialize the USB Context
	ctx, err := libusb.Init()
	if err != nil {
		log.Fatal("Couldn't create USB context. Ending now.")
	}
	defer ctx.Exit()

	// Find the first USB fevice with the VendorID and ProductID matching the MCC
	// USB-1608FS-Plus DAQ
	daq, err := usb1608fsplus.GetFirstDevice(ctx)
	if err != nil {
		log.Fatalf("Couldn't find a USB-1608FS-Plus: %s", err)
	}
	defer daq.Close()

	// Read the calibration memory to setup the gain table
	// gainTable, _ := daq.BuildGainTable()

	// Create new analog input and ensure the scan is stopped and buffer cleared
{'fraction_non_alphanumeric': 0.12214657589106928, 'fraction_numerical': 0.022426912294753704, 'mean_word_length': 3.3292894280762564, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '4237259', 'n_tokens_mistral': 968, 'n_tokens_neox': 907, 'n_words': 280}