<commit_before>/*
kthxbyetv (play) firmware
coded by kthxbyetv team

based on the code of :
* <NAME>
* <NAME>
* <NAME>
* <NAME>
* Furrtek

distributed under Creative Commons 2.5 -- Attib & Share Alike
*/

#include <avr/io.h>
#include <avr/wdt.h>
#include <util/delay.h>
#include "hardware.h"
#include "utils.h"

void blinkLED(uint8_t count) {
	while(count--) {
		delay_ten_us(15000);
		PORTB |= _BV(LED);
		delay_ten_us(1000);
		PORTB &=~ _BV(LED);
		wdt_reset();
	}
}

void delay_ten_us(uint16_t us) {
	uint8_t timer;
	while (us != 0) {
		for (timer=0; timer <= DELAY_CNT; timer++) {
			NOP;
			NOP;
		}
		NOP;
		us--;
	}
}

void xmitCodeElement(uint16_t on_time, uint16_t off_time, uint8_t is_pwm) {
	// Reset the timers so they are aligned + clean timer flags
	TCNT0 = 0;
	TIFR = 0;

	if(is_pwm) {
		// Turn on PWM timer
		TCCR0A =_BV(COM0A0) | _BV(WGM01);
		TCCR0B = _BV(CS00);
	} else {
		PORTB |= _BV(IRLED);
	}
	
	delay_ten_us(on_time);

	// Turn off PWM timer
	TCCR0A = 0;
	TCCR0B = 0;
	
	PORTB &= ~_BV(IRLED);

	delay_ten_us(off_time);
}<commit_msg>aeoaeoaeo<commit_after>/*
kthxbyetv (play) firmware
coded by kthxbyetv team

based on the code of :
* <NAME>
* <NAME>
* <NAME>
* <NAME>
* Furrtek

distributed under Creative Commons 2.5 -- Attib & Share Alike
*/

#include <avr/io.h>
#include <avr/wdt.h>
#include <util/delay.h>
#include "hardware.h"
#include "utils.h"

void blinkLED(uint8_t count) {
	while(count--) {
		delay_ten_us(15000);
		PORTB |= _BV(LED);
		delay_ten_us(1000);
		PORTB &=~ _BV(LED);
		wdt_reset();
	}
}

void delay_ten_us(uint16_t us) {
	uint8_t timer;
	while (us != 0) {
		for (timer = 0; timer <= DELAY_CNT; timer++) {
			NOP;
			NOP;
		}
		NOP;
		us--;
	}
}

void xmitCodeElement(uint16_t on_time, uint16_t off_time, uint8_t is_pwm) {
	// Reset the timers so they are aligned + clean timer flags
	TCNT0 = 0;
	TIFR = 0;

	if(is_pwm) {
		// Turn on PWM timer
		TCCR0A =_BV(COM0A0) | _BV(WGM01);
		TCCR0B = _BV(CS00);
	} else {
		PORTB |= _BV(IRLED);
	}

	delay_ten_us(on_time);

	// Turn off PWM timer
	TCCR0A = 0;
	TCCR0B = 0;

	PORTB &= ~_BV(IRLED);

	delay_ten_us(off_time);
}
{'fraction_non_alphanumeric': 0.1543560606060606, 'fraction_numerical': 0.035037878787878785, 'mean_word_length': 3.48619957537155, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 17, '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': '6463194', 'n_tokens_mistral': 1083, 'n_tokens_neox': 976, 'n_words': 221}