<commit_before>//   Copyright 2016-2017 <NAME>
//
//   Licensed under the Apache License, Version 2.0 (the "License");
//   you may not use this file except in compliance with the License.
//   You may obtain a copy of the License at
//
//       http://www.apache.org/licenses/LICENSE-2.0
//
//   Unless required by applicable law or agreed to in writing, software
//   distributed under the License is distributed on an "AS IS" BASIS,
//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//   See the License for the specific language governing permissions and
//   limitations under the License.

#ifndef BOARDS_LEONARDO_HH
#define BOARDS_LEONARDO_HH

#include <avr/io.h>
#include <avr/sleep.h>

/* This board is based on ATmega32u4 */
#define BOARD_ATMEGA32U4

#ifndef INLINE
#define INLINE __attribute__((always_inline))
#endif

// Arduino Leonardo pinout: http://duino4projects.com/wp-content/uploads/2013/04/Ardunio_leonardo_pinout.jpg
namespace board
{
	//=====================
	// Initialization code
	//=====================
	inline static void init() INLINE;
	inline static void init()
	{
		// Disable USB controller by default
		USBCON = 0;
		UDCON = 0;
		// Disable all interrupts
		UDINT = 0;
		UDIEN = 0;
	}
	
	//====
	// IO
	//====
	enum class Port: uint8_t
	{
		PORT_B = 0,
		PORT_C,
		PORT_D,
		PORT_E,
		PORT_F,
		NONE = 0xFF
	};
	
	/**
	 * Digital pin symbols: 
	 * XX_YYY
	 *	XX pin id on LEONARDO board
	 *	YYY port/pin number on ATmega32u4 MCU
	 */
	enum class DigitalPin: uint8_t
	{
		D0_PD2 = 0,
		D1_PD3,
		D2_PD1,
		D3_PD0,
		D4_PD4,
		D5_PC6,
		D6_PD7,
		D7_PE6,
		D8_PB4,
		D9_PB5,
		D10_PB6,
		D11_PB7,
		D12_PD6,
		D13_PC7,
		
		A0_PF7,
		A1_PF6,
		A2_PF5,
		A3_PF4,
		A4_PF1,
		A5_PF0,
		
		SCK_PB1,
		MOSI_PB2,
		MISO_PB3,
		
		RXLED_PB0,
		TXLED_PD5,
		
		LED = DigitalPin::D13_PC7,
		NONE = 0xFF
	};

	//==============
	// Analog Input
	//==============
	enum class AnalogClock: uint8_t
	{
		MAX_FREQ_50KHz = 0,
		MAX_FREQ_100KHz,
		MAX_FREQ_200KHz,
		MAX_FREQ_500KHz,
		MAX_FREQ_1MHz
	};
	enum class AnalogReference: uint8_t
	{
		AREF = 0,
		AVCC,
		INTERNAL_2_56V
	};
	
	enum class AnalogPin: uint8_t
	{
		A0_ADC7 = 0,
		A1_ADC6,
		A2_ADC5,
		A3_ADC4,
		A4_ADC1,
		A5_ADC0,
		
		A6_D4_ADC8,
		A7_D6_ADC10,
		A8_D8_ADC11,
		A9_D9_ADC12,
		A10_D10_ADC13,
		A11_D12_ADC9,
		
		TEMP,
		BANDGAP,
		NONE = 0xFF
	};
	
	//============
	// PWM output
	//============
	/**
	 * PWM-enabled pin symbols; sub-set of digital pins
	 * to allow compile time checking.
	 */
	namespace PWMPin
	{
		constexpr const DigitalPin D11_PB7_OC0A = DigitalPin::D11_PB7;
		constexpr const DigitalPin D3_PD0_OC0B = DigitalPin::D3_PD0;
		constexpr const DigitalPin D9_PB5_OC1A = DigitalPin::D9_PB5;
		constexpr const DigitalPin D10_PB6_OC1B = DigitalPin::D10_PB6;
		constexpr const DigitalPin D5_PC6_OC3A = DigitalPin::D5_PC6;
		//TODO High-speed timer (Timer4) related PWM pins are not listed here because Timer4 is not supported yer
	};
	<commit_msg>Improve LEONARDO support by adding alias names for Analog inputs.<commit_after>//   Copyright 2016-2017 <NAME>
//
//   Licensed under the Apache License, Version 2.0 (the "License");
//   you may not use this file except in compliance with the License.
//   You may obtain a copy of the License at
//
//       http://www.apache.org/licenses/LICENSE-2.0
//
//   Unless required by applicable law or agreed to in writing, software
//   distributed under the License is distributed on an "AS IS" BASIS,
//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//   See the License for the specific language governing permissions and
//   limitations under the License.

#ifndef BOARDS_LEONARDO_HH
#define BOARDS_LEONARDO_HH

#include <avr/io.h>
#include <avr/sleep.h>

/* This board is based on ATmega32u4 */
#define BOARD_ATMEGA32U4

#ifndef INLINE
#define INLINE __attribute__((always_inline))
#endif

// Arduino Leonardo pinout: http://duino4projects.com/wp-content/uploads/2013/04/Ardunio_leonardo_pinout.jpg
namespace board
{
	//=====================
	// Initialization code
	//=====================
	inline static void init() INLINE;
	inline static void init()
	{
		// Disable USB controller by default
		USBCON = 0;
		UDCON = 0;
		// Disable all interrupts
		UDINT = 0;
		UDIEN = 0;
	}
	
	//====
	// IO
	//====
	enum class Port: uint8_t
	{
		PORT_B = 0,
		PORT_C,
		PORT_D,
		PORT_E,
		PORT_F,
		NONE = 0xFF
	};
	
	/**
	 * Digital pin symbols: 
	 * XX_YYY
	 *	XX pin id on LEONARDO board
	 *	YYY port/pin number on ATmega32u4 MCU
	 */
	enum class DigitalPin: uint8_t
	{
		D0_PD2 = 0,
		D1_PD3,
		D2_PD1,
		D3_PD0,
		D4_PD4,
		D5_PC6,
		D6_PD7,
		D7_PE6,
		D8_PB4,
		D9_PB5,
		D10_PB6,
		D11_PB7,
		D12_PD6,
		D13_PC7,
		
		A0_PF7,
		A1_PF6,
		A2_PF5,
		A3_PF4,
		A4_PF1,
		A5_PF0,
		
		SCK_PB1,
		MOSI_PB2,
		MISO_PB3,
		
		RXLED_PB0,
		TXLED_PD5,
		
		LED = DigitalPin::D13_PC7,
		NONE = 0xFF
	};

	//==============
	// Analog Input
	//==============
	enum class AnalogClock: uint8_t
	{
		MAX_FREQ_50KHz = 0,
		MAX_FREQ_100KHz,
		MAX_FREQ_200KHz,
		MAX_FREQ_500KHz,
		MAX_FREQ_1MHz
	};
	enum class AnalogReference: uint8_t
	{
		AREF = 0,
		AVCC,
		INTERNAL_2_56V
	};
	
	enum class AnalogPin: uint8_t
	{
		A0_ADC7 = 0,
		A0 = A0_ADC7,
		A1_ADC6,
		A1 = A1_ADC6,
		A2_ADC5,
		A2 = A2_ADC5,
		A3_ADC4,
		A3 = A3_ADC4,
		A4_ADC1,
		A4 = A4_ADC1,
		A5_ADC0,
		A5 = A5_ADC0,
		
		A6_D4_ADC8,
		A7_D6_ADC10,
		A8_D8_ADC11,
		A9_D9_ADC12,
		A10_D10_ADC13,
		A11_D12_ADC9,
		
		TEMP,
		BANDGAP,
		NONE = 0xFF
	};
	
	//============
	// PWM output
	//============
	/**
	 * PWM-enabled pin symbols; sub-set of digital pins
	 * to allow compile time checking.
	 */
	namespace PWMPin
	{
		constexpr const DigitalPin D11_PB7_OC0A = DigitalPin::D11_PB7;
		constexpr const DigitalPin D3_PD0_OC0B = DigitalPin::D3_PD0;
		constexpr const DigitalPin D9_PB5_OC1A = DigitalPin::D9_PB5;
		constexpr const DigitalPin D10_PB6_OC1B = DigitalPin::D10_PB6;
		constexpr const DigitalPin D5_PC6_OC3A = DigitalPin::D5_PC6;
		//TODO High-speed timer (Timer4) related PWM pins are not listed here because Timer4 is not supported yer
	};
	
{'fraction_non_alphanumeric': 0.12381419692508996, 'fraction_numerical': 0.06215243702976775, 'mean_word_length': 3.1683708248125426, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '911210', 'n_tokens_mistral': 2882, 'n_tokens_neox': 2530, 'n_words': 619}