From f265d1725f27581069addbc75a1a323616dd147f Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Wed, 6 Aug 2014 17:39:52 -0400 Subject: [PATCH 1/2] PWM on pin 4 (TIMER1B). This fixes issue #36 (for Arduino 1.5.x at least). It uses initVariant() to put Timer1 into PWM mode and a hacky #define alias (TCCR1A for GTCCR) so that analogWrite() will set the right bit in the right register to connect the timer PWM output to the pin. Also, the pre-scale factor and PWM frequency are probably wrong (or, at least, not the same as on other AVRs). --- attiny/variants/tiny8/pins_arduino.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/attiny/variants/tiny8/pins_arduino.h b/attiny/variants/tiny8/pins_arduino.h index e64b887..09fd0aa 100755 --- a/attiny/variants/tiny8/pins_arduino.h +++ b/attiny/variants/tiny8/pins_arduino.h @@ -51,8 +51,15 @@ static const uint8_t A3 = 9; #define analogPinToChannel(p) ( (p) < 6 ? (p) : (p) - 6 ) +#define TCCR1A GTCCR + #ifdef ARDUINO_MAIN +void initVariant() +{ + GTCCR |= (1 << PWM1B); +} + // these arrays map port names (e.g. port B) to the // appropriate addresses for various functions (e.g. reading // and writing) tiny45 only port B @@ -106,7 +113,7 @@ const uint8_t PROGMEM digital_pin_to_timer_PGM[] = { TIMER0B, NOT_ON_TIMER, NOT_ON_TIMER, - NOT_ON_TIMER, + TIMER1B, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, From 8695269a0ca503566b794fd356da30c337c2b204 Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Mon, 16 Feb 2015 12:21:26 -0500 Subject: [PATCH 2/2] Create README.md --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..e0da101 --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +# attiny +ATtiny microcontroller support for the Arduino software (http://arduino.cc). Includes the ATtiny45/85 and the ATtiny44/84. + +For Arduino 1.0.x, use the ide-1.0.x branch: https://github.com/damellis/attiny/tree/ide-1.0.x + +For Arduino 1.6.x, use the ide-1.6.x branch: https://github.com/damellis/attiny/tree/ide-1.6.x + +Tutorial here: http://highlowtech.org/?p=1695