Skip to content

Commit

Permalink
Update ATTiny88 Pin Mapping (Issue #22)
Browse files Browse the repository at this point in the history
Changed the pin mapping of the preliminary ATTiny88 support to include missing pins.
  • Loading branch information
TCWORLD committed Nov 26, 2014
1 parent 566fc57 commit 3605cfd
Showing 1 changed file with 46 additions and 34 deletions.
80 changes: 46 additions & 34 deletions tiny/variants/tinyX8/pins_arduino.h
Expand Up @@ -32,9 +32,9 @@

#define TUNED_OSCCAL_VALUE OSCCAL

#define NUM_DIGITAL_PINS 20
#define NUM_DIGITAL_PINS 28
#define NUM_ANALOG_INPUTS 6
#define analogInputToDigitalPin(p) ((p < 6) ? (p) + 14 : -1)
#define analogInputToDigitalPin(p) ((p < 6) ? (p) + 16 : -1)

#define digitalPinHasPWM(p) ((p) == 9 || (p) == 10)

Expand All @@ -51,17 +51,17 @@ static const uint8_t SDA = 18;
static const uint8_t SCL = 19;
static const uint8_t LED_BUILTIN = 13;

static const uint8_t A0 = 14;
static const uint8_t A1 = 15;
static const uint8_t A2 = 16;
static const uint8_t A3 = 17;
static const uint8_t A4 = 18;
static const uint8_t A5 = 19;
static const uint8_t A0 = 16;
static const uint8_t A1 = 17;
static const uint8_t A2 = 18;
static const uint8_t A3 = 19;
static const uint8_t A4 = 20;
static const uint8_t A5 = 21;

#define digitalPinToPCICR(p) (((p) >= 0 && (p) <= 19) ? (&PCICR) : ((uint8_t *)0))
#define digitalPinToPCICRbit(p) (((p) <= 7) ? 2 : (((p) <= 13) ? 0 : (((p) <= 19) ? 1 : 3)))
#define digitalPinToPCMSK(p) (((p) <= 7) ? (&PCMSK2) : (((p) <= 13) ? (&PCMSK0) : (((p) <= 19) ? (&PCMSK1) : (((p) <= 23) ? (&PCMSK3) : ((uint8_t *)0)))))
#define digitalPinToPCMSKbit(p) (((p) <= 7) ? (p) : (((p) <= 13) ? ((p) - 8) : (((p) <= 19) ? ((p) - 14) : ((p) - 20))))
#define digitalPinToPCICR(p) (((p) >= 0 && (p) <= 21) ? (&PCICR) : ((uint8_t *)0))
#define digitalPinToPCICRbit(p) (((p) <= 7) ? 2 : (((p) <= 15) ? 0 : (((p) <= 23) ? 1 : 3)))
#define digitalPinToPCMSK(p) (((p) <= 7) ? (&PCMSK2) : (((p) <= 15) ? (&PCMSK0) : (((p) <= 23) ? (&PCMSK1) : (((p) <= 27) ? (&PCMSK3) : ((uint8_t *)0)))))
#define digitalPinToPCMSKbit(p) ((p) & 0x7)//(((p) <= 7) ? (p) : (((p) <= 15) ? ((p) - 8) : (((p) <= 23) ? ((p) - 16) : ((p) - 24))))

#ifdef ARDUINO_MAIN

Expand All @@ -71,23 +71,23 @@ static const uint8_t A5 = 19;

// ATMEL ATTINY88
//
// +-\/-+
// PC6 1| |28 PC5 (AI 5)
// (D 0) PD0 2| |27 PC4 (AI 4)
// (D 1) PD1 3| |26 PC3 (AI 3)
// (D 2) PD2 4| |25 PC2 (AI 2)
// (D 3) PD3 5| |24 PC1 (AI 1)
// (D 4) PD4 6| |23 PC0 (AI 0)
// VCC 7| |22 GND
// GND 8| |21 AREF
// PB6 9| |20 AVCC
// PB7 10| |19 PB5 (D 13)
// (D 5) PD5 11| |18 PB4 (D 12)
// (D 6) PD6 12| |17 PB3 (D 11)
// (D 7) PD7 13| |16 PB2 (D 10) PWM
// (D 8) PB0 14| |15 PB1 (D 9) PWM
// +-\/-+
// (D 22) PC6 1| |28 PC5 (AI 5)
// (D 0) PD0 2| |27 PC4 (AI 4)
// (D 1) PD1 3| |26 PC3 (AI 3)
// (D 2) PD2 4| |25 PC2 (AI 2)
// (D 3) PD3 5| |24 PC1 (AI 1)
// (D 4) PD4 6| |23 PC0 (AI 0)
// VCC 7| |22 GND
// GND 8| |21 PC7 (D 23)
// (D 14) PB6 9| |20 AVCC
// (D 15) PB7 10| |19 PB5 (D 13)
// (D 5) PD5 11| |18 PB4 (D 12)
// (D 6) PD6 12| |17 PB3 (D 11)
// (D 7) PD7 13| |16 PB2 (D 10) PWM
// (D 8) PB0 14| |15 PB1 (D 9) PWM
// +----+
// Note: For 32pin Packages, PORTA exists. PA0 = D20, PA1 = D21, PA2 = D22, PA3 = D23
// Note: For 32pin Packages, PORTA exists. PA0 = D24, PA1 = D25, PA2 = D26, PA3 = D27
//


Expand Down Expand Up @@ -133,13 +133,17 @@ const uint8_t PROGMEM digital_pin_to_port_PGM[] = {
PB,
PB,
PB,
PC, /* 14 */
PB,
PB,
PC, /* 16 */
PC,
PC,
PC,
PC,
PC,
PC,
PA, /* 20 */
PC,
PA, /* 24 */
PA,
PA,
PA,
Expand All @@ -160,13 +164,17 @@ const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = {
_BV(3),
_BV(4),
_BV(5),
_BV(0), /* 14, port C */
_BV(6),
_BV(7),
_BV(0), /* 16, port C */
_BV(1),
_BV(2),
_BV(3),
_BV(4),
_BV(5),
_BV(0), /* 20, port A */
_BV(6),
_BV(7),
_BV(0), /* 24, port A */
_BV(1),
_BV(2),
_BV(3),
Expand All @@ -187,13 +195,17 @@ const uint8_t PROGMEM digital_pin_to_timer_PGM[] = {
NOT_ON_TIMER,
NOT_ON_TIMER,
NOT_ON_TIMER,
NOT_ON_TIMER, /* 14 - port C */
NOT_ON_TIMER,
NOT_ON_TIMER,
NOT_ON_TIMER, /* 16 - port C */
NOT_ON_TIMER,
NOT_ON_TIMER,
NOT_ON_TIMER,
NOT_ON_TIMER,
NOT_ON_TIMER,
NOT_ON_TIMER,
NOT_ON_TIMER,
NOT_ON_TIMER, /* 20 - port A */
NOT_ON_TIMER, /* 24 - port A */
NOT_ON_TIMER,
NOT_ON_TIMER,
NOT_ON_TIMER,
Expand Down

0 comments on commit 3605cfd

Please sign in to comment.