<commit_before>#include <IoAbstraction.h>

#define READ_CLOCK_PIN 28
#define READ_DATA_PIN 26
#define READ_LATCH_PIN 25
#define READ_CLK_ENA_PIN 27

#define WRITE_CLOCK_PIN 22
#define WRITE_DATA_PIN 23
#define WRITE_LATCH_PIN 24

IoAbstractionRef shiftRegister = inputOutputFromShiftRegister(READ_CLOCK_PIN, READ_DATA_PIN, READ_LATCH_PIN, WRITE_CLOCK_PIN, WRITE_DATA_PIN, WRITE_LATCH_PIN);

void setup() {
	// although not technically needed for the shift register we should always call pinDirection
	// as it makes it possible to switch in future to either arduino direct or IO expander.

	// 0-7 are always input and 24 onwards are always output with the shift register abstraction
	// this allows for a future improvement where more than one register could be easily supported.
	for (int i = 24; i < 32; ++i) {
		ioDevicePinMode(shiftRegister, i, OUTPUT);
	}
	for (int i = 0; i < 8; ++i) {
		ioDevicePinMode(shiftRegister, i, INPUT);
	}
}

uint8_t counter = 0;

void loop() {
	delay(1);
	ioDeviceSync(shiftRegister);
	ioDeviceDigitalWrite(shiftRegister, 24, ioDeviceDigitalRead(shiftRegister, 1));
	ioDeviceDigitalWrite(shiftRegister, 25, ioDeviceDigitalRead(shiftRegister, 2));
	ioDeviceDigitalWrite(shiftRegister, 26, ioDeviceDigitalRead(shiftRegister, 3));
	counter++;
	ioDeviceDigitalWrite(shiftRegister, 27, (counter > 128));
}<commit_msg>#18 Support for more than one shift register chained together (up to 4 in, 4 out)<commit_after>#include <IoAbstraction.h>

#define READ_CLOCK_PIN 28
#define READ_DATA_PIN 26
#define READ_LATCH_PIN 25

#define WRITE_CLOCK_PIN 22
#define WRITE_DATA_PIN 23
#define WRITE_LATCH_PIN 24

// here we create a shift register abstraction that has 1 input and 1 output shift register.
IoAbstractionRef shiftRegister = inputOutputFromShiftRegister(READ_CLOCK_PIN, READ_DATA_PIN, READ_LATCH_PIN, 1, WRITE_CLOCK_PIN, WRITE_DATA_PIN, WRITE_LATCH_PIN, 1);

void setup() {
	// although not technically needed for the shift register we should always call pinDirection
	// as it makes it possible to switch in future to either arduino direct or IO expander.

	// 0-7 are always input and 32 onwards are always output with the shift register abstraction
	// this allows for up to 4 input and 4 output devices to be chained together.
	for (int i = 32; i < 40; ++i) {
		ioDevicePinMode(shiftRegister, i, OUTPUT);
	}
	for (int i = 0; i < 8; ++i) {
		ioDevicePinMode(shiftRegister, i, INPUT);
	}
}

uint8_t counter = 0;

void loop() {
	delay(1);
	ioDeviceSync(shiftRegister);
	ioDeviceDigitalWrite(shiftRegister, 32, ioDeviceDigitalRead(shiftRegister, 1));
	ioDeviceDigitalWrite(shiftRegister, 33, ioDeviceDigitalRead(shiftRegister, 2));
	ioDeviceDigitalWrite(shiftRegister, 34, ioDeviceDigitalRead(shiftRegister, 3));
	counter++;
	ioDeviceDigitalWrite(shiftRegister, 35, (counter > 128));
}
{'fraction_non_alphanumeric': 0.08454706927175844, 'fraction_numerical': 0.03197158081705151, 'mean_word_length': 5.720763723150358, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '2225218', 'n_tokens_mistral': 1002, 'n_tokens_neox': 877, 'n_words': 302}