From c58fcf5554827113680ee16559c36ed21e0ec0e0 Mon Sep 17 00:00:00 2001 From: Zach Eveland Date: Sun, 11 Dec 2011 19:56:50 -0500 Subject: fixed TIMER4 use on Leonardo ATMEGA32U4 has major differences in TIMER4 registers compared to ATMEGA1280 and 2560. turnOffPWM, analogWrite, and initialize routines had wrong registers, bit names, etc. --- variants/leonardo/pins_arduino.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'variants/leonardo') diff --git a/variants/leonardo/pins_arduino.h b/variants/leonardo/pins_arduino.h index 15afb4e..0a0c574 100644 --- a/variants/leonardo/pins_arduino.h +++ b/variants/leonardo/pins_arduino.h @@ -212,7 +212,7 @@ const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[30] = { _BV(6), // D29 / D12 - A11 - PD6 }; -const uint8_t PROGMEM digital_pin_to_timer_PGM[18] = { +const uint8_t PROGMEM digital_pin_to_timer_PGM[16] = { NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, -- cgit v1.2.3-18-g5258 From 3f429a9c61ae953d24f3d19ff1f6d9b332d29b9c Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Mon, 2 Jan 2012 12:38:23 -0500 Subject: Fixing static is not at beginning of declaration warnings (maniacbug). --- variants/leonardo/pins_arduino.h | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'variants/leonardo') diff --git a/variants/leonardo/pins_arduino.h b/variants/leonardo/pins_arduino.h index 15afb4e..5a15146 100644 --- a/variants/leonardo/pins_arduino.h +++ b/variants/leonardo/pins_arduino.h @@ -35,29 +35,29 @@ #define RXLED0 PORTB |= (1<<0) #define RXLED1 PORTB &= ~(1<<0) -const static uint8_t SDA = 2; -const static uint8_t SCL = 3; +static const uint8_t SDA = 2; +static const uint8_t SCL = 3; // Map SPI port to 'new' pins D14..D17 -const static uint8_t SS = 17; -const static uint8_t MOSI = 16; -const static uint8_t MISO = 14; -const static uint8_t SCK = 15; +static const uint8_t SS = 17; +static const uint8_t MOSI = 16; +static const uint8_t MISO = 14; +static const uint8_t SCK = 15; // Mapping of analog pins as digital I/O // A6-A11 share with digital pins -const static uint8_t A0 = 18; -const static uint8_t A1 = 19; -const static uint8_t A2 = 20; -const static uint8_t A3 = 21; -const static uint8_t A4 = 22; -const static uint8_t A5 = 23; -const static uint8_t A6 = 24; // D4 -const static uint8_t A7 = 25; // D6 -const static uint8_t A8 = 26; // D8 -const static uint8_t A9 = 27; // D9 -const static uint8_t A10 = 28; // D10 -const static uint8_t A11 = 29; // D12 +static const uint8_t A0 = 18; +static const uint8_t A1 = 19; +static const uint8_t A2 = 20; +static const uint8_t A3 = 21; +static const uint8_t A4 = 22; +static const uint8_t A5 = 23; +static const uint8_t A6 = 24; // D4 +static const uint8_t A7 = 25; // D6 +static const uint8_t A8 = 26; // D8 +static const uint8_t A9 = 27; // D9 +static const uint8_t A10 = 28; // D10 +static const uint8_t A11 = 29; // D12 // __AVR_ATmega32U4__ has an unusual mapping of pins to channels extern const uint8_t PROGMEM analog_pin_to_channel_PGM[]; -- cgit v1.2.3-18-g5258 From 35bbf80ba955bee9e432d4b2e11d479979599568 Mon Sep 17 00:00:00 2001 From: Zach Eveland Date: Wed, 8 Feb 2012 01:16:56 -0500 Subject: adjusting descriptors - trying to prevent sketch and bootloader from grabbing different COM numbers on Windows --- variants/leonardo/pins_arduino.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'variants/leonardo') diff --git a/variants/leonardo/pins_arduino.h b/variants/leonardo/pins_arduino.h index d8faddb..d4c6a0b 100644 --- a/variants/leonardo/pins_arduino.h +++ b/variants/leonardo/pins_arduino.h @@ -27,7 +27,7 @@ #include -#define ARDUINO_MODEL_USB_PID 0x0034 +#define ARDUINO_MODEL_USB_PID 0x3003 #define TX_RX_LED_INIT DDRD |= (1<<5), DDRB |= (1<<0) #define TXLED0 PORTD |= (1<<5) -- cgit v1.2.3-18-g5258 From ac3aca0acf45f459c2c55e8e0894621aaaa4b4dd Mon Sep 17 00:00:00 2001 From: Zach Eveland Date: Mon, 13 Feb 2012 00:10:16 -0500 Subject: changed Leonardo bootloader and sketch PID values again (now 0x0701 for bootloader, 0x0801 for sketch) --- variants/leonardo/pins_arduino.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'variants/leonardo') diff --git a/variants/leonardo/pins_arduino.h b/variants/leonardo/pins_arduino.h index d4c6a0b..753aa93 100644 --- a/variants/leonardo/pins_arduino.h +++ b/variants/leonardo/pins_arduino.h @@ -27,7 +27,7 @@ #include -#define ARDUINO_MODEL_USB_PID 0x3003 +#define ARDUINO_MODEL_USB_PID 0x0801 #define TX_RX_LED_INIT DDRD |= (1<<5), DDRB |= (1<<0) #define TXLED0 PORTD |= (1<<5) -- cgit v1.2.3-18-g5258 From ec83f55b626f3b9b5da4a0782b8fa81ca72a8933 Mon Sep 17 00:00:00 2001 From: Zach Eveland Date: Mon, 9 Apr 2012 08:06:35 -0400 Subject: sketch USB VID and PID values are passed in from boards.txt at compile time now. changed sketch PIDs to final values. also uncommented Micro section in boards.txt --- variants/leonardo/pins_arduino.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'variants/leonardo') diff --git a/variants/leonardo/pins_arduino.h b/variants/leonardo/pins_arduino.h index 753aa93..ff9e4f9 100644 --- a/variants/leonardo/pins_arduino.h +++ b/variants/leonardo/pins_arduino.h @@ -27,8 +27,6 @@ #include -#define ARDUINO_MODEL_USB_PID 0x0801 - #define TX_RX_LED_INIT DDRD |= (1<<5), DDRB |= (1<<0) #define TXLED0 PORTD |= (1<<5) #define TXLED1 PORTD &= ~(1<<5) -- cgit v1.2.3-18-g5258 From e346d868b92b431507487b0de57b746477a80bec Mon Sep 17 00:00:00 2001 From: Zach Eveland Date: Sat, 19 May 2012 22:05:46 -0400 Subject: added pin change interrupt defines for Leonardo. fix for broken software serial on Leonardo --- variants/leonardo/pins_arduino.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'variants/leonardo') diff --git a/variants/leonardo/pins_arduino.h b/variants/leonardo/pins_arduino.h index ff9e4f9..d5b32d0 100644 --- a/variants/leonardo/pins_arduino.h +++ b/variants/leonardo/pins_arduino.h @@ -57,6 +57,11 @@ static const uint8_t A9 = 27; // D9 static const uint8_t A10 = 28; // D10 static const uint8_t A11 = 29; // D12 +#define digitalPinToPCICR(p) (((p) >= 0 && (p) <= 21) ? (&PCICR) : ((uint8_t *)0)) +#define digitalPinToPCICRbit(p) (((p) <= 7) ? 2 : (((p) <= 13) ? 0 : 1)) +#define digitalPinToPCMSK(p) (((p) <= 7) ? (&PCMSK2) : (((p) <= 13) ? (&PCMSK0) : (((p) <= 21) ? (&PCMSK1) : ((uint8_t *)0)))) +#define digitalPinToPCMSKbit(p) (((p) <= 7) ? (p) : (((p) <= 13) ? ((p) - 8) : ((p) - 14))) + // __AVR_ATmega32U4__ has an unusual mapping of pins to channels extern const uint8_t PROGMEM analog_pin_to_channel_PGM[]; #define analogPinToChannel(P) ( pgm_read_byte( analog_pin_to_channel_PGM + (P) ) ) -- cgit v1.2.3-18-g5258 From 3e68702149cbf938f11bc9410eb7f9a0c811fa28 Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Sun, 20 May 2012 15:56:49 -0700 Subject: Updating SoftwareSerial pin mapping (pin change interrupts) for Leonardo. --- variants/leonardo/pins_arduino.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'variants/leonardo') diff --git a/variants/leonardo/pins_arduino.h b/variants/leonardo/pins_arduino.h index d5b32d0..9f770d6 100644 --- a/variants/leonardo/pins_arduino.h +++ b/variants/leonardo/pins_arduino.h @@ -57,10 +57,10 @@ static const uint8_t A9 = 27; // D9 static const uint8_t A10 = 28; // D10 static const uint8_t A11 = 29; // D12 -#define digitalPinToPCICR(p) (((p) >= 0 && (p) <= 21) ? (&PCICR) : ((uint8_t *)0)) -#define digitalPinToPCICRbit(p) (((p) <= 7) ? 2 : (((p) <= 13) ? 0 : 1)) -#define digitalPinToPCMSK(p) (((p) <= 7) ? (&PCMSK2) : (((p) <= 13) ? (&PCMSK0) : (((p) <= 21) ? (&PCMSK1) : ((uint8_t *)0)))) -#define digitalPinToPCMSKbit(p) (((p) <= 7) ? (p) : (((p) <= 13) ? ((p) - 8) : ((p) - 14))) +#define digitalPinToPCICR(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCICR) : ((uint8_t *)0)) +#define digitalPinToPCICRbit(p) 0 +#define digitalPinToPCMSK(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCMSK0) : ((uint8_t *)0)) +#define digitalPinToPCMSKbit(p) ( ((p) >= 8 && (p) <= 11) ? (p) - 4 : ((p) == 14 ? 3 : ((p) == 15 ? 1 : ((p) == 16 ? 2 : ((p) == 17 ? 0 : (p - A8 + 4)))))) // __AVR_ATmega32U4__ has an unusual mapping of pins to channels extern const uint8_t PROGMEM analog_pin_to_channel_PGM[]; -- cgit v1.2.3-18-g5258