Skip to content

Commit 0dad98d

Browse files
committed
update tiny8 (trinket/gemma)
1 parent 8fa96b8 commit 0dad98d

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

platform.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# - https://github.com/arduino/Arduino/wiki/Arduino-Hardware-Cores-migration-guide-from-1.0-to-1.6
66
#
77
name=Adafruit Boards
8-
version=1.4.12
8+
version=1.4.13
99

1010
# AVR Uploader/Programmers tools
1111
# ------------------------------

variants/tiny8/pins_arduino.h

+35-2
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,38 @@
4444
// GND 4| |5 PB0 (D 0) pwm0
4545
// +----+
4646

47+
#define NUM_DIGITAL_PINS 3
48+
#define NUM_ANALOG_INPUTS 1
4749
#define LED_BUILTIN 1
4850

51+
#define PIN_A0 (6)
52+
#define PIN_A1 (7)
53+
#define PIN_A2 (8)
54+
#define PIN_A3 (9)
55+
56+
static const uint8_t A0 = PIN_A0;
57+
static const uint8_t A1 = PIN_A1;
58+
static const uint8_t A2 = PIN_A2;
59+
static const uint8_t A3 = PIN_A3;
60+
4961
#define digitalPinToPCICR(p) ( ((p) >= 0 && (p) <= 4) ? (&GIMSK) : ((uint8_t *)0) )
5062
#define digitalPinToPCICRbit(p) ( PCIE )
5163
#define digitalPinToPCMSK(p) ( ((p) <= 4) ? (&PCMSK) : ((uint8_t *)0) )
5264
#define digitalPinToPCMSKbit(p) ( (p) )
5365

66+
#define digitalPinToInterrupt(p) ((p) == 2 ? 0 : NOT_AN_INTERRUPT)
67+
68+
#define analogPinToChannel(p) ( (p) < 6 ? (p) : (p) - 6 )
69+
70+
#define TCCR1A GTCCR
71+
5472
#ifdef ARDUINO_MAIN
5573

74+
void initVariant()
75+
{
76+
GTCCR |= (1 << PWM1B);
77+
}
78+
5679
// these arrays map port names (e.g. port B) to the
5780
// appropriate addresses for various functions (e.g. reading
5881
// and writing) tiny45 only port B
@@ -81,7 +104,10 @@ const uint8_t PROGMEM digital_pin_to_port_PGM[] = {
81104
PB,
82105
PB,
83106
PB, // 5
84-
107+
PB, // A0
108+
PB,
109+
PB,
110+
PB, // A4
85111
};
86112

87113
const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = {
@@ -91,7 +117,10 @@ const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = {
91117
_BV(3), /* 3 port B */
92118
_BV(4),
93119
_BV(5),
94-
120+
_BV(5),
121+
_BV(2),
122+
_BV(4),
123+
_BV(3),
95124
};
96125

97126
const uint8_t PROGMEM digital_pin_to_timer_PGM[] = {
@@ -101,6 +130,10 @@ const uint8_t PROGMEM digital_pin_to_timer_PGM[] = {
101130
NOT_ON_TIMER,
102131
TIMER1B,
103132
NOT_ON_TIMER,
133+
NOT_ON_TIMER,
134+
NOT_ON_TIMER,
135+
NOT_ON_TIMER,
136+
NOT_ON_TIMER,
104137
};
105138

106139
#endif

0 commit comments

Comments
 (0)