├── README.md └── attiny ├── variants ├── tiny8 │ └── pins_arduino.h └── tiny14 │ └── pins_arduino.h └── boards.txt /README.md: -------------------------------------------------------------------------------- 1 | # attiny 2 | ATtiny microcontroller support for the Arduino software (http://arduino.cc). Includes the ATtiny45/85 and the ATtiny44/84. 3 | 4 | For Arduino 1.0.x, use the ide-1.0.x branch: https://github.com/damellis/attiny/tree/ide-1.0.x 5 | 6 | For Arduino 1.6.x, use the ide-1.6.x branch: https://github.com/damellis/attiny/tree/ide-1.6.x 7 | 8 | Tutorial here: http://highlowtech.org/?p=1695 9 | -------------------------------------------------------------------------------- /attiny/variants/tiny8/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | pins_arduino.c - pin definitions for the Arduino board 3 | Part of Arduino / Wiring Lite 4 | 5 | Copyright (c) 2005 David A. Mellis 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public 9 | License as published by the Free Software Foundation; either 10 | version 2.1 of the License, or (at your option) any later version. 11 | 12 | This library is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General 18 | Public License along with this library; if not, write to the 19 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, 20 | Boston, MA 02111-1307 USA 21 | 22 | $Id: pins_arduino.c 565 2009-03-25 10:50:00Z dmellis $ 23 | 24 | Modified 28-08-2009 for attiny84 R.Wiersma 25 | Modified 09-10-2009 for attiny45 A.Saporetti 26 | */ 27 | 28 | #ifndef Pins_Arduino_h 29 | #define Pins_Arduino_h 30 | 31 | #include 32 | 33 | // ATMEL ATTINY45 / ARDUINO 34 | // 35 | // +-\/-+ 36 | // Ain0 (D 5) PB5 1| |8 Vcc 37 | // Ain3 (D 3) PB3 2| |7 PB2 (D 2) Ain1 38 | // Ain2 (D 4) PB4 3| |6 PB1 (D 1) pwm1 39 | // GND 4| |5 PB0 (D 0) pwm0 40 | // +----+ 41 | 42 | static const uint8_t A0 = 6; 43 | static const uint8_t A1 = 7; 44 | static const uint8_t A2 = 8; 45 | static const uint8_t A3 = 9; 46 | 47 | #define digitalPinToPCICR(p) ( ((p) >= 0 && (p) <= 4) ? (&GIMSK) : ((uint8_t *)0) ) 48 | #define digitalPinToPCICRbit(p) ( PCIE ) 49 | #define digitalPinToPCMSK(p) ( ((p) <= 4) ? (&PCMSK) : ((uint8_t *)0) ) 50 | #define digitalPinToPCMSKbit(p) ( (p) ) 51 | 52 | #define analogPinToChannel(p) ( (p) < 6 ? (p) : (p) - 6 ) 53 | 54 | #define TCCR1A GTCCR 55 | 56 | #ifdef ARDUINO_MAIN 57 | 58 | void initVariant() 59 | { 60 | GTCCR |= (1 << PWM1B); 61 | } 62 | 63 | // these arrays map port names (e.g. port B) to the 64 | // appropriate addresses for various functions (e.g. reading 65 | // and writing) tiny45 only port B 66 | const uint16_t PROGMEM port_to_mode_PGM[] = { 67 | NOT_A_PORT, 68 | NOT_A_PORT, 69 | (uint16_t) &DDRB, 70 | }; 71 | 72 | const uint16_t PROGMEM port_to_output_PGM[] = { 73 | NOT_A_PORT, 74 | NOT_A_PORT, 75 | (uint16_t) &PORTB, 76 | }; 77 | 78 | const uint16_t PROGMEM port_to_input_PGM[] = { 79 | NOT_A_PIN, 80 | NOT_A_PIN, 81 | (uint16_t) &PINB, 82 | }; 83 | 84 | const uint8_t PROGMEM digital_pin_to_port_PGM[] = { 85 | PB, /* 0 */ 86 | PB, 87 | PB, 88 | PB, 89 | PB, 90 | PB, // 5 91 | PB, // A0 92 | PB, 93 | PB, 94 | PB, // A4 95 | 96 | }; 97 | 98 | const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = { 99 | _BV(0), /* 0, port B */ 100 | _BV(1), 101 | _BV(2), 102 | _BV(3), /* 3 port B */ 103 | _BV(4), 104 | _BV(5), 105 | _BV(5), 106 | _BV(2), 107 | _BV(4), 108 | _BV(3), 109 | }; 110 | 111 | const uint8_t PROGMEM digital_pin_to_timer_PGM[] = { 112 | TIMER0A, /* OC0A */ 113 | TIMER0B, 114 | NOT_ON_TIMER, 115 | NOT_ON_TIMER, 116 | TIMER1B, 117 | NOT_ON_TIMER, 118 | NOT_ON_TIMER, 119 | NOT_ON_TIMER, 120 | NOT_ON_TIMER, 121 | NOT_ON_TIMER, 122 | }; 123 | 124 | #endif 125 | 126 | #endif -------------------------------------------------------------------------------- /attiny/variants/tiny14/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | pins_arduino.c - pin definitions for the Arduino board 3 | Part of Arduino / Wiring Lite 4 | 5 | Copyright (c) 2005 David A. Mellis 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public 9 | License as published by the Free Software Foundation; either 10 | version 2.1 of the License, or (at your option) any later version. 11 | 12 | This library is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General 18 | Public License along with this library; if not, write to the 19 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, 20 | Boston, MA 02111-1307 USA 21 | 22 | $Id: pins_arduino.c 565 2009-03-25 10:50:00Z dmellis $ 23 | 24 | Modified 28-08-2009 for attiny84 R.Wiersma 25 | Modified 09-10-2009 for attiny45 A.Saporetti 26 | */ 27 | 28 | #ifndef Pins_Arduino_h 29 | #define Pins_Arduino_h 30 | 31 | #include 32 | 33 | // ATMEL ATTINY84 / ARDUINO 34 | // 35 | // +-\/-+ 36 | // VCC 1| |14 GND 37 | // (D 10) PB0 2| |13 AREF (D 0) 38 | // (D 9) PB1 3| |12 PA1 (D 1) 39 | // PB3 4| |11 PA2 (D 2) 40 | // PWM INT0 (D 8) PB2 5| |10 PA3 (D 3) 41 | // PWM (D 7) PA7 6| |9 PA4 (D 4) 42 | // PWM (D 6) PA6 7| |8 PA5 (D 5) PWM 43 | // +----+ 44 | 45 | const static uint8_t A0 = 0; 46 | const static uint8_t A1 = 1; 47 | const static uint8_t A2 = 2; 48 | const static uint8_t A3 = 3; 49 | const static uint8_t A4 = 4; 50 | const static uint8_t A5 = 5; 51 | const static uint8_t A6 = 6; 52 | const static uint8_t A7 = 7; 53 | 54 | #define digitalPinToPCICR(p) ( ((p) >= 0 && (p) <= 10) ? (&GIMSK) : ((uint8_t *)0) ) 55 | #define digitalPinToPCICRbit(p) ( ((p) <= 7) ? PCIE0 : PCIE1 ) 56 | #define digitalPinToPCMSK(p) ( ((p) <= 7) ? (&PCMSK0) : (((p) <= 10) ? (&PCMSK1) : ((uint8_t *)0)) ) 57 | #define digitalPinToPCMSKbit(p) ( ((p) <= 7) ? (p) : (10 - (p)) ) 58 | 59 | #ifdef ARDUINO_MAIN 60 | 61 | // these arrays map port names (e.g. port B) to the 62 | // appropriate addresses for various functions (e.g. reading 63 | // and writing) 64 | const uint16_t PROGMEM port_to_mode_PGM[] = 65 | { 66 | NOT_A_PORT, 67 | (uint16_t)&DDRA, 68 | (uint16_t)&DDRB, 69 | }; 70 | 71 | const uint16_t PROGMEM port_to_output_PGM[] = 72 | { 73 | NOT_A_PORT, 74 | (uint16_t)&PORTA, 75 | (uint16_t)&PORTB, 76 | }; 77 | 78 | const uint16_t PROGMEM port_to_input_PGM[] = 79 | { 80 | NOT_A_PORT, 81 | (uint16_t)&PINA, 82 | (uint16_t)&PINB, 83 | }; 84 | 85 | const uint8_t PROGMEM digital_pin_to_port_PGM[] = 86 | { 87 | PA, /* 0 */ 88 | PA, 89 | PA, 90 | PA, 91 | PA, 92 | PA, 93 | PA, 94 | PA, 95 | PB, /* 8 */ 96 | PB, 97 | PB, 98 | }; 99 | 100 | const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = 101 | { 102 | _BV(0), /* port A */ 103 | _BV(1), 104 | _BV(2), 105 | _BV(3), 106 | _BV(4), 107 | _BV(5), 108 | _BV(6), 109 | _BV(7), 110 | _BV(2), /* port B */ 111 | _BV(1), 112 | _BV(0), 113 | }; 114 | 115 | const uint8_t PROGMEM digital_pin_to_timer_PGM[] = 116 | { 117 | NOT_ON_TIMER, 118 | NOT_ON_TIMER, 119 | NOT_ON_TIMER, 120 | NOT_ON_TIMER, 121 | NOT_ON_TIMER, 122 | TIMER1B, /* OC1B */ 123 | TIMER1A, /* OC1A */ 124 | TIMER0B, /* OC0B */ 125 | TIMER0A, /* OC0A */ 126 | NOT_ON_TIMER, 127 | NOT_ON_TIMER, 128 | }; 129 | 130 | #endif 131 | 132 | #endif 133 | -------------------------------------------------------------------------------- /attiny/boards.txt: -------------------------------------------------------------------------------- 1 | attiny45.name=ATtiny45 (internal 1 MHz clock) 2 | attiny45.bootloader.low_fuses=0x62 3 | attiny45.bootloader.high_fuses=0xdf 4 | attiny45.bootloader.extended_fuses=0xff 5 | attiny45.upload.maximum_size=4096 6 | attiny45.build.mcu=attiny45 7 | attiny45.build.f_cpu=1000000L 8 | attiny45.build.core=arduino:arduino 9 | attiny45.build.variant=tiny8 10 | 11 | attiny45-8.name=ATtiny45 (internal 8 MHz clock) 12 | attiny45-8.bootloader.low_fuses=0xe2 13 | attiny45-8.bootloader.high_fuses=0xdf 14 | attiny45-8.bootloader.extended_fuses=0xff 15 | attiny45-8.upload.maximum_size=4096 16 | attiny45-8.build.mcu=attiny45 17 | attiny45-8.build.f_cpu=8000000L 18 | attiny45-8.build.core=arduino:arduino 19 | attiny45-8.build.variant=tiny8 20 | 21 | attiny45-20.name=ATtiny45 (external 20 MHz clock) 22 | attiny45-20.bootloader.low_fuses=0xfe 23 | attiny45-20.bootloader.high_fuses=0xdf 24 | attiny45-20.bootloader.extended_fuses=0xff 25 | attiny45-20.upload.maximum_size=4096 26 | attiny45-20.build.mcu=attiny45 27 | attiny45-20.build.f_cpu=20000000L 28 | attiny45-20.build.core=arduino:arduino 29 | attiny45-20.build.variant=tiny8 30 | 31 | attiny85.name=ATtiny85 (internal 1 MHz clock) 32 | attiny85.bootloader.low_fuses=0x62 33 | attiny85.bootloader.high_fuses=0xdf 34 | attiny85.bootloader.extended_fuses=0xff 35 | attiny85.upload.maximum_size=8192 36 | attiny85.build.mcu=attiny85 37 | attiny85.build.f_cpu=1000000L 38 | attiny85.build.core=arduino:arduino 39 | attiny85.build.variant=tiny8 40 | 41 | attiny85-8.name=ATtiny85 (internal 8 MHz clock) 42 | attiny85-8.bootloader.low_fuses=0xe2 43 | attiny85-8.bootloader.high_fuses=0xdf 44 | attiny85-8.bootloader.extended_fuses=0xff 45 | attiny85-8.upload.maximum_size=8192 46 | attiny85-8.build.mcu=attiny85 47 | attiny85-8.build.f_cpu=8000000L 48 | attiny85-8.build.core=arduino:arduino 49 | attiny85-8.build.variant=tiny8 50 | 51 | attiny85-20.name=ATtiny85 (external 20 MHz clock) 52 | attiny85-20.bootloader.low_fuses=0xfe 53 | attiny85-20.bootloader.high_fuses=0xdf 54 | attiny85-20.bootloader.extended_fuses=0xff 55 | attiny85-20.upload.maximum_size=8192 56 | attiny85-20.build.mcu=attiny85 57 | attiny85-20.build.f_cpu=20000000L 58 | attiny85-20.build.core=arduino:arduino 59 | attiny85-20.build.variant=tiny8 60 | 61 | attiny44.name=ATtiny44 (internal 1 MHz clock) 62 | attiny44.bootloader.low_fuses=0x62 63 | attiny44.bootloader.high_fuses=0xdf 64 | attiny44.bootloader.extended_fuses=0xff 65 | attiny44.upload.maximum_size=4096 66 | attiny44.build.mcu=attiny44 67 | attiny44.build.f_cpu=1000000L 68 | attiny44.build.core=arduino:arduino 69 | attiny44.build.variant=tiny14 70 | 71 | attiny44-8.name=ATtiny44 (internal 8 MHz clock) 72 | attiny44-8.bootloader.low_fuses=0xe2 73 | attiny44-8.bootloader.high_fuses=0xdf 74 | attiny44-8.bootloader.extended_fuses=0xff 75 | attiny44-8.upload.maximum_size=4096 76 | attiny44-8.build.mcu=attiny44 77 | attiny44-8.build.f_cpu=8000000L 78 | attiny44-8.build.core=arduino:arduino 79 | attiny44-8.build.variant=tiny14 80 | 81 | attiny44-20.name=ATtiny44 (external 20 MHz clock) 82 | attiny44-20.bootloader.low_fuses=0xfe 83 | attiny44-20.bootloader.high_fuses=0xdf 84 | attiny44-20.bootloader.extended_fuses=0xff 85 | attiny44-20.upload.maximum_size=4096 86 | attiny44-20.build.mcu=attiny44 87 | attiny44-20.build.f_cpu=20000000L 88 | attiny44-20.build.core=arduino:arduino 89 | attiny44-20.build.variant=tiny14 90 | 91 | attiny84.name=ATtiny84 (internal 1 MHz clock) 92 | attiny84.bootloader.low_fuses=0x62 93 | attiny84.bootloader.high_fuses=0xdf 94 | attiny84.bootloader.extended_fuses=0xff 95 | attiny84.upload.maximum_size=8192 96 | attiny84.build.mcu=attiny84 97 | attiny84.build.f_cpu=1000000L 98 | attiny84.build.core=arduino:arduino 99 | attiny84.build.variant=tiny14 100 | 101 | attiny84-8.name=ATtiny84 (internal 8 MHz clock) 102 | attiny84-8.bootloader.low_fuses=0xe2 103 | attiny84-8.bootloader.high_fuses=0xdf 104 | attiny84-8.bootloader.extended_fuses=0xff 105 | attiny84-8.upload.maximum_size=8192 106 | attiny84-8.build.mcu=attiny84 107 | attiny84-8.build.f_cpu=8000000L 108 | attiny84-8.build.core=arduino:arduino 109 | attiny84-8.build.variant=tiny14 110 | 111 | attiny84-20.name=ATtiny84 (external 20 MHz clock) 112 | attiny84-20.bootloader.low_fuses=0xfe 113 | attiny84-20.bootloader.high_fuses=0xdf 114 | attiny84-20.bootloader.extended_fuses=0xff 115 | attiny84-20.upload.maximum_size=8192 116 | attiny84-20.build.mcu=attiny84 117 | attiny84-20.build.f_cpu=20000000L 118 | attiny84-20.build.core=arduino:arduino 119 | attiny84-20.build.variant=tiny14 120 | --------------------------------------------------------------------------------