From d26c82bec0b244fbff06a6b9a6004a67d48d47a4 Mon Sep 17 00:00:00 2001 From: Andrea Manni Date: Thu, 3 Mar 2016 17:51:04 +0100 Subject: [PATCH] Lunedi': blinks --- advanced_projects/blinkAVR/blinkLED.c | 40 ++ basic/blinks/blink_0/blink_0.ino | 8 +- .../blink_1_variabili/blink_1_variabili.ino | 2 +- .../blink_2_funzioni/blink_2_funzioni.ino | 12 +- .../blink_3_funzioni_argomenti.ino | 3 +- .../pwm_1_soluzione_doppio_while_byte.ino | 4 +- breadboard/avr/boards.txt | 24 + .../ATmegaBOOT_168_atmega328_pro_8MHz.hex | 124 ++++ hardware/breadboard/avr/boards.txt | 24 + .../ATmegaBOOT_168_atmega328_pro_8MHz.hex | 124 ++++ libraries/AVR-Programming-Library/.gitignore | 2 + libraries/AVR-Programming-Library/README.md | 30 + .../AVR-Programming-Library/binaryMacro.h | 45 ++ libraries/AVR-Programming-Library/macros.h | 26 + .../AVR-Programming-Library/pinDefines.h | 91 +++ libraries/AVR-Programming-Library/portpins.h | 549 ++++++++++++++++++ 16 files changed, 1094 insertions(+), 14 deletions(-) create mode 100644 advanced_projects/blinkAVR/blinkLED.c create mode 100644 breadboard/avr/boards.txt create mode 100644 breadboard/avr/bootloaders/atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex create mode 100644 hardware/breadboard/avr/boards.txt create mode 100644 hardware/breadboard/avr/bootloaders/atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex create mode 100644 libraries/AVR-Programming-Library/.gitignore create mode 100644 libraries/AVR-Programming-Library/README.md create mode 100644 libraries/AVR-Programming-Library/binaryMacro.h create mode 100644 libraries/AVR-Programming-Library/macros.h create mode 100644 libraries/AVR-Programming-Library/pinDefines.h create mode 100644 libraries/AVR-Programming-Library/portpins.h diff --git a/advanced_projects/blinkAVR/blinkLED.c b/advanced_projects/blinkAVR/blinkLED.c new file mode 100644 index 0000000..5751286 --- /dev/null +++ b/advanced_projects/blinkAVR/blinkLED.c @@ -0,0 +1,40 @@ +/* Blinker Demo */ + +// Includes +#include // Mappatura dei PIN +#include // Funzione equivalente a delay() + + +int main(void) { + +/* Blink AVR + * + * Blink senza utilizzare il framework di Arduino. + * + * Il pin 13 di Arduino corrisponde a PB5, il 6' PIN sulla porta PORTB + * Invece il primo PIN sulla porta PORTB corrisponde a D8 di Arduino + */ + + // Setup + DDRB |= 0b00100000; /* Data Direction Register B: + - il pin e' il 6' della porta: + 00100000 , 0b indica un numero binario + - Utilizziamo una maschera binaria + con l'operatore logico OR per cambiare + solo il 6' BIT a 1 */ + + + // Ciclo infinito + while (1) { + + PORTB = 0b00100000; // Accendiamo il LED impostando tutti i PIN + _delay_ms(1000); // della porta + + PORTB = 0b00000000; // Spegnamo il LED + _delay_ms(1000); + + } // Fine del ciclo while (loop di arduino) + return (0); // Un programma in C deve sempre avere una valore di ritorno + // Per quanto questo non venga mai raggiunto dal uC +} + diff --git a/basic/blinks/blink_0/blink_0.ino b/basic/blinks/blink_0/blink_0.ino index 9253d58..09efff8 100644 --- a/basic/blinks/blink_0/blink_0.ino +++ b/basic/blinks/blink_0/blink_0.ino @@ -1,4 +1,4 @@ -// //////////// +// 1. //////////// // Commento iniziale multi linea /* Blink @@ -8,20 +8,20 @@ */ -// ////////////// +// 2. ////////////// // Dichiarazione variabili // int led = 13; // Il LED onboard corrisponde al PIN 13 // Ha una resistenza premontata -// ///////////////// +// 3. ///////////////// // Setup: eseguita una volta sola all'accensione della scheda void setup() { pinMode(led, OUTPUT); // Abilita il PIN del LED come OUTPUT in modo che // possa essere acceso } -// /////////////// +// 4. /////////////// // loop: Le istruzioni vengono eseguite all'infinito void loop() { digitalWrite(led, HIGH); // Mette il PIN del LED in stato acceso diff --git a/basic/blinks/blink_1_variabili/blink_1_variabili.ino b/basic/blinks/blink_1_variabili/blink_1_variabili.ino index dc03e53..ec6c3c0 100644 --- a/basic/blinks/blink_1_variabili/blink_1_variabili.ino +++ b/basic/blinks/blink_1_variabili/blink_1_variabili.ino @@ -13,7 +13,7 @@ // Pin 13 has an LED connected on most Arduino boards. // give it a name: -int led = 12; +int led = 13; int breve = 200; // Variabile richiambile nel corso dell'esecuzione int lunga = 1000; diff --git a/basic/blinks/blink_2_funzioni/blink_2_funzioni.ino b/basic/blinks/blink_2_funzioni/blink_2_funzioni.ino index d01b759..92db22b 100644 --- a/basic/blinks/blink_2_funzioni/blink_2_funzioni.ino +++ b/basic/blinks/blink_2_funzioni/blink_2_funzioni.ino @@ -55,9 +55,11 @@ void lento() { } /* Domande: - * 1. I valori delle variabili led, breve, lunga cambiano durante - * l'esecuzione del programma? Sono variabili? - * - * 2. Le dichiarazioni delle variabili breve e lunga possono essere - * accorpate nelle rispettive funzioni? + 1. I valori delle variabili led, breve, lunga cambiano durante + l'esecuzione del programma? Sono variabili? + + 2. Le dichiarazioni delle variabili breve e lunga possono essere + accorpate nelle rispettive funzioni? + + 3. Esercizio: creare una funzione per effettuare un S.O.S. : ...---... */ diff --git a/basic/blinks/blink_3_funzioni_argomenti/blink_3_funzioni_argomenti.ino b/basic/blinks/blink_3_funzioni_argomenti/blink_3_funzioni_argomenti.ino index efad97e..cfa0210 100644 --- a/basic/blinks/blink_3_funzioni_argomenti/blink_3_funzioni_argomenti.ino +++ b/basic/blinks/blink_3_funzioni_argomenti/blink_3_funzioni_argomenti.ino @@ -7,6 +7,7 @@ This example code is in the public domain. */ + // Dichiarazione variabili // Pin 13 has an LED connected on most Arduino boards. @@ -47,8 +48,6 @@ void brilla(int velocita) { * 1. Come si potrebbe fare per poter utilizzare la funzione brilla * con PIN diversi rispetto a LED? * - * 2. Le dichiarazioni delle variabili breve e lunga possono essere - * accorpate nelle rispettive funzioni? * * Esercizi sucessivi sulle funzioni: blink_5 e 6 */ diff --git a/basic/pwm/pwm_1_soluzione_doppio_while_byte/pwm_1_soluzione_doppio_while_byte.ino b/basic/pwm/pwm_1_soluzione_doppio_while_byte/pwm_1_soluzione_doppio_while_byte.ino index 062f1ac..eb6cca7 100644 --- a/basic/pwm/pwm_1_soluzione_doppio_while_byte/pwm_1_soluzione_doppio_while_byte.ino +++ b/basic/pwm/pwm_1_soluzione_doppio_while_byte/pwm_1_soluzione_doppio_while_byte.ino @@ -14,7 +14,7 @@ void setup() { } void loop() { - while (brigtness < 255) { + while (brightness < 255) { analogWrite(led, brightness); // La funziona analogWrite utilizza il PWM // a 8 bit integrato nel MCU: simula un serie di valori intermedi // nell'intervallo discreto con minimo 0 (spento) e massimo 255 (acceso). @@ -22,7 +22,7 @@ void loop() { brightness = brightness + 1; // Incrementiamo la luminosita' } - while (brigtness > 0) { + while (brightness > 0) { analogWrite(led, brightness); // La funziona analogWrite utilizza il PWM delay(10); brightness = brightness - 1; // Decrementiamo la luminosita' diff --git a/breadboard/avr/boards.txt b/breadboard/avr/boards.txt new file mode 100644 index 0000000..abaf2b4 --- /dev/null +++ b/breadboard/avr/boards.txt @@ -0,0 +1,24 @@ +############################################################## + +atmega328bb.name=ATmega328 on a breadboard (8 MHz internal clock) + +atmega328bb.upload.protocol=arduino +atmega328bb.upload.maximum_size=30720 +atmega328bb.upload.speed=57600 + +atmega328bb.bootloader.low_fuses=0xE2 +atmega328bb.bootloader.high_fuses=0xDA +atmega328bb.bootloader.extended_fuses=0x05 + +atmega328bb.bootloader.file=atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex +atmega328bb.bootloader.unlock_bits=0x3F +atmega328bb.bootloader.lock_bits=0x0F + +atmega328bb.build.mcu=atmega328p +atmega328bb.build.f_cpu=8000000L +atmega328bb.build.core=arduino:arduino +atmega328bb.build.variant=arduino:standard + + +atmega328bb.bootloader.tool=arduino:avrdude +atmega328bb.upload.tool=arduino:avrdude diff --git a/breadboard/avr/bootloaders/atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex b/breadboard/avr/bootloaders/atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex new file mode 100644 index 0000000..9753e2e --- /dev/null +++ b/breadboard/avr/bootloaders/atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex @@ -0,0 +1,124 @@ +:107800000C94343C0C94513C0C94513C0C94513CE1 +:107810000C94513C0C94513C0C94513C0C94513CB4 +:107820000C94513C0C94513C0C94513C0C94513CA4 +:107830000C94513C0C94513C0C94513C0C94513C94 +:107840000C94513C0C94513C0C94513C0C94513C84 +:107850000C94513C0C94513C0C94513C0C94513C74 +:107860000C94513C0C94513C11241FBECFEFD8E036 +:10787000DEBFCDBF11E0A0E0B1E0EAE8FFE702C063 +:1078800005900D92A230B107D9F712E0A2E0B1E065 +:1078900001C01D92AD30B107E1F70E942D3D0C945F +:1078A000C33F0C94003C982F95959595959595958B +:1078B000905D8F708A307CF0282F295A8091C0000B +:1078C00085FFFCCF9093C6008091C00085FFFCCF60 +:1078D0002093C6000895282F205DF0CF982F809127 +:1078E000C00085FFFCCF9093C6000895EF92FF92F1 +:1078F0000F931F93EE24FF2487018091C00087FD22 +:1079000017C00894E11CF11C011D111D81E2E8164D +:1079100081EAF80687E0080780E0180770F3E09135 +:107920000401F091050109958091C00087FFE9CF1E +:107930008091C6001F910F91FF90EF9008950E94D3 +:10794000763C982F8091C00085FFFCCF9093C600B5 +:1079500091362CF490330CF09053892F089597555D +:10796000892F08951F930E949F3C182F0E949F3CCF +:107970001295107F810F1F9108951F93182F882350 +:1079800021F00E94763C1150E1F71F9108951F935A +:10799000182F0E94763C803249F0809103018F5F5E +:1079A000809303018530C1F01F9108958091C0003C +:1079B00085FFFCCF84E18093C6008091C00085FFE5 +:1079C000FCCF1093C6008091C00085FFFCCF80E102 +:1079D0008093C6001F910895E0910401F091050184 +:1079E00009951F9108950E94763C803241F0809164 +:1079F00003018F5F80930301853081F008958091AA +:107A0000C00085FFFCCF84E18093C6008091C00058 +:107A100085FFFCCF80E18093C6000895E0910401CA +:107A2000F09105010995089548EC50E08823A1F0F4 +:107A30002D9A28EE33E0FA013197F1F721503040CA +:107A4000D1F72D9828EE33E0FA013197F1F7215064 +:107A50003040D1F7815061F708953F924F925F9285 +:107A60006F927F928F929F92AF92BF92CF92DF924E +:107A7000EF92FF920F931F93CF93DF93000082E06A +:107A80008093C00080E18093C4001092C50088E11B +:107A90008093C10086E08093C2005098589A259A3E +:107AA00081E00E94143D24E1F22E9EE1E92E85E959 +:107AB000D82E0FE0C02E10E1B12EAA24A394B1E479 +:107AC0009B2EA6E58A2EF2E57F2EE0E26E2E79E46B +:107AD000572E63E5462E50E5352E0E94763C8033C6 +:107AE000B1F18133B9F1803409F46FC0813409F404 +:107AF00076C0823409F485C0853409F488C08035A5 +:107B000031F1823521F1813511F1853509F485C0D6 +:107B1000863509F48DC0843609F496C0843709F49B +:107B200003C1853709F472C1863709F466C08091B4 +:107B300003018F5F80930301853079F6E0910401A2 +:107B4000F091050109950E94763C803351F60E9420 +:107B5000F33CC3CF0E94763C803249F78091C0004D +:107B600085FFFCCFF092C6008091C00085FFFCCF5E +:107B70009092C6008091C00085FFFCCF8092C60025 +:107B80008091C00085FFFCCF7092C6008091C0003C +:107B900085FFFCCF6092C6008091C00085FFFCCFBE +:107BA0005092C6008091C00085FFFCCF4092C60075 +:107BB0008091C00085FFFCCF3092C6008091C0004C +:107BC00085FFFCCFB092C60088CF0E94763C8638F5 +:107BD00008F4BDCF0E94763C0E94F33C7ECF0E9409 +:107BE000763C803809F49CC0813809F40BC1823896 +:107BF00009F430C1883909F48FC080E00E94C73C85 +:107C00006CCF84E10E94BD3C0E94F33C66CF85E0CE +:107C10000E94BD3C0E94F33C60CF0E94763C809362 +:107C200006010E94763C809307010E94F33C55CFE9 +:107C30000E94763C803309F411C183E00E94BD3C70 +:107C400080E00E94C73C49CF0E94763C80930902A5 +:107C50000E94763C8093080280910C028E7F809374 +:107C60000C020E94763C853409F409C18091080217 +:107C700090910902892B89F000E010E00E94763C87 +:107C8000F801E85FFE4F80830F5F1F4F809108026D +:107C9000909109020817190788F30E94763C8032F8 +:107CA00009F045CF80910C0280FFF5C0609106017C +:107CB00070910701660F771F7093070160930601AB +:107CC000A0910802B09109021097C9F0E8E0F1E034 +:107CD0009B01AD014E0F5F1FF999FECF32BD21BD53 +:107CE000819180BDFA9AF99A2F5F3F4FE417F5070B +:107CF00099F76A0F7B1F70930701609306018091CB +:107D0000C00085FFFCCFF092C6008091C00085FFC7 +:107D1000FCCFB092C600E1CE83E00E94C73CDDCE2E +:107D200082E00E94C73CD9CE0E94763C8093090233 +:107D30000E94763C80930802809106019091070191 +:107D4000880F991F90930701809306010E94763C4B +:107D5000853409F49AC080910C028E7F80930C02C6 +:107D60000E94763C803209F0B8CE8091C00085FF39 +:107D7000FCCFF092C600A0910802B09109021097C2 +:107D8000C1F180910C02082F0170182F1695117007 +:107D9000E0910601F0910701AF014F5F5F4FBA011B +:107DA00020E030E00023B1F4112339F49491809164 +:107DB000C00085FFFCCF9093C6002F5F3F4FCB01E3 +:107DC0000196FA012A173B0780F4BC014F5F5F4F11 +:107DD000002351F3F999FECFF2BDE1BDF89A90B5B9 +:107DE0008091C00085FFFCCFE6CF709307016093C0 +:107DF00006018091C00085FDE5CE8091C00085FF21 +:107E0000F8CFE0CE81E00E94C73C67CE0E94763C6E +:107E1000803209F08CCE8091C00085FFFCCFF092BB +:107E2000C6008091C00085FFFCCFE092C600809123 +:107E3000C00085FFFCCFD092C6008091C00085FFB6 +:107E4000FCCFC092C6008091C00085FFFCCFB092ED +:107E5000C60043CE80E10E94C73C3FCE0E94763CE4 +:107E60000E94763C182F0E94763C112309F483C0AF +:107E7000113009F484C08FE00E94C73C2ECE80915F +:107E80000C02816080930C02F1CE80910C02816023 +:107E900080930C0265CF809107018823880F880B9F +:107EA0008A2180930B028091060190910701880F2F +:107EB000991F90930701809306018091080280FF2B +:107EC00009C08091080290910902019690930902DD +:107ED00080930802F894F999FECF1127E0910601EA +:107EE000F0910701C8E0D1E0809108029091090269 +:107EF000103091F40091570001700130D9F303E084 +:107F000000935700E8950091570001700130D9F3B4 +:107F100001E100935700E8950990199000915700EE +:107F200001700130D9F301E000935700E8951395F3 +:107F3000103498F011270091570001700130D9F3E7 +:107F400005E000935700E89500915700017001305B +:107F5000D9F301E100935700E8953296029709F0B2 +:107F6000C7CF103011F00296E5CF11248091C000E8 +:107F700085FFC5CEC8CE8EE10E94C73CAECD85E957 +:0A7F80000E94C73CAACDF894FFCF81 +:027F8A00800075 +:040000030000780081 +:00000001FF diff --git a/hardware/breadboard/avr/boards.txt b/hardware/breadboard/avr/boards.txt new file mode 100644 index 0000000..abaf2b4 --- /dev/null +++ b/hardware/breadboard/avr/boards.txt @@ -0,0 +1,24 @@ +############################################################## + +atmega328bb.name=ATmega328 on a breadboard (8 MHz internal clock) + +atmega328bb.upload.protocol=arduino +atmega328bb.upload.maximum_size=30720 +atmega328bb.upload.speed=57600 + +atmega328bb.bootloader.low_fuses=0xE2 +atmega328bb.bootloader.high_fuses=0xDA +atmega328bb.bootloader.extended_fuses=0x05 + +atmega328bb.bootloader.file=atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex +atmega328bb.bootloader.unlock_bits=0x3F +atmega328bb.bootloader.lock_bits=0x0F + +atmega328bb.build.mcu=atmega328p +atmega328bb.build.f_cpu=8000000L +atmega328bb.build.core=arduino:arduino +atmega328bb.build.variant=arduino:standard + + +atmega328bb.bootloader.tool=arduino:avrdude +atmega328bb.upload.tool=arduino:avrdude diff --git a/hardware/breadboard/avr/bootloaders/atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex b/hardware/breadboard/avr/bootloaders/atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex new file mode 100644 index 0000000..9753e2e --- /dev/null +++ b/hardware/breadboard/avr/bootloaders/atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex @@ -0,0 +1,124 @@ +:107800000C94343C0C94513C0C94513C0C94513CE1 +:107810000C94513C0C94513C0C94513C0C94513CB4 +:107820000C94513C0C94513C0C94513C0C94513CA4 +:107830000C94513C0C94513C0C94513C0C94513C94 +:107840000C94513C0C94513C0C94513C0C94513C84 +:107850000C94513C0C94513C0C94513C0C94513C74 +:107860000C94513C0C94513C11241FBECFEFD8E036 +:10787000DEBFCDBF11E0A0E0B1E0EAE8FFE702C063 +:1078800005900D92A230B107D9F712E0A2E0B1E065 +:1078900001C01D92AD30B107E1F70E942D3D0C945F +:1078A000C33F0C94003C982F95959595959595958B +:1078B000905D8F708A307CF0282F295A8091C0000B +:1078C00085FFFCCF9093C6008091C00085FFFCCF60 +:1078D0002093C6000895282F205DF0CF982F809127 +:1078E000C00085FFFCCF9093C6000895EF92FF92F1 +:1078F0000F931F93EE24FF2487018091C00087FD22 +:1079000017C00894E11CF11C011D111D81E2E8164D +:1079100081EAF80687E0080780E0180770F3E09135 +:107920000401F091050109958091C00087FFE9CF1E +:107930008091C6001F910F91FF90EF9008950E94D3 +:10794000763C982F8091C00085FFFCCF9093C600B5 +:1079500091362CF490330CF09053892F089597555D +:10796000892F08951F930E949F3C182F0E949F3CCF +:107970001295107F810F1F9108951F93182F882350 +:1079800021F00E94763C1150E1F71F9108951F935A +:10799000182F0E94763C803249F0809103018F5F5E +:1079A000809303018530C1F01F9108958091C0003C +:1079B00085FFFCCF84E18093C6008091C00085FFE5 +:1079C000FCCF1093C6008091C00085FFFCCF80E102 +:1079D0008093C6001F910895E0910401F091050184 +:1079E00009951F9108950E94763C803241F0809164 +:1079F00003018F5F80930301853081F008958091AA +:107A0000C00085FFFCCF84E18093C6008091C00058 +:107A100085FFFCCF80E18093C6000895E0910401CA +:107A2000F09105010995089548EC50E08823A1F0F4 +:107A30002D9A28EE33E0FA013197F1F721503040CA +:107A4000D1F72D9828EE33E0FA013197F1F7215064 +:107A50003040D1F7815061F708953F924F925F9285 +:107A60006F927F928F929F92AF92BF92CF92DF924E +:107A7000EF92FF920F931F93CF93DF93000082E06A +:107A80008093C00080E18093C4001092C50088E11B +:107A90008093C10086E08093C2005098589A259A3E +:107AA00081E00E94143D24E1F22E9EE1E92E85E959 +:107AB000D82E0FE0C02E10E1B12EAA24A394B1E479 +:107AC0009B2EA6E58A2EF2E57F2EE0E26E2E79E46B +:107AD000572E63E5462E50E5352E0E94763C8033C6 +:107AE000B1F18133B9F1803409F46FC0813409F404 +:107AF00076C0823409F485C0853409F488C08035A5 +:107B000031F1823521F1813511F1853509F485C0D6 +:107B1000863509F48DC0843609F496C0843709F49B +:107B200003C1853709F472C1863709F466C08091B4 +:107B300003018F5F80930301853079F6E0910401A2 +:107B4000F091050109950E94763C803351F60E9420 +:107B5000F33CC3CF0E94763C803249F78091C0004D +:107B600085FFFCCFF092C6008091C00085FFFCCF5E +:107B70009092C6008091C00085FFFCCF8092C60025 +:107B80008091C00085FFFCCF7092C6008091C0003C +:107B900085FFFCCF6092C6008091C00085FFFCCFBE +:107BA0005092C6008091C00085FFFCCF4092C60075 +:107BB0008091C00085FFFCCF3092C6008091C0004C +:107BC00085FFFCCFB092C60088CF0E94763C8638F5 +:107BD00008F4BDCF0E94763C0E94F33C7ECF0E9409 +:107BE000763C803809F49CC0813809F40BC1823896 +:107BF00009F430C1883909F48FC080E00E94C73C85 +:107C00006CCF84E10E94BD3C0E94F33C66CF85E0CE +:107C10000E94BD3C0E94F33C60CF0E94763C809362 +:107C200006010E94763C809307010E94F33C55CFE9 +:107C30000E94763C803309F411C183E00E94BD3C70 +:107C400080E00E94C73C49CF0E94763C80930902A5 +:107C50000E94763C8093080280910C028E7F809374 +:107C60000C020E94763C853409F409C18091080217 +:107C700090910902892B89F000E010E00E94763C87 +:107C8000F801E85FFE4F80830F5F1F4F809108026D +:107C9000909109020817190788F30E94763C8032F8 +:107CA00009F045CF80910C0280FFF5C0609106017C +:107CB00070910701660F771F7093070160930601AB +:107CC000A0910802B09109021097C9F0E8E0F1E034 +:107CD0009B01AD014E0F5F1FF999FECF32BD21BD53 +:107CE000819180BDFA9AF99A2F5F3F4FE417F5070B +:107CF00099F76A0F7B1F70930701609306018091CB +:107D0000C00085FFFCCFF092C6008091C00085FFC7 +:107D1000FCCFB092C600E1CE83E00E94C73CDDCE2E +:107D200082E00E94C73CD9CE0E94763C8093090233 +:107D30000E94763C80930802809106019091070191 +:107D4000880F991F90930701809306010E94763C4B +:107D5000853409F49AC080910C028E7F80930C02C6 +:107D60000E94763C803209F0B8CE8091C00085FF39 +:107D7000FCCFF092C600A0910802B09109021097C2 +:107D8000C1F180910C02082F0170182F1695117007 +:107D9000E0910601F0910701AF014F5F5F4FBA011B +:107DA00020E030E00023B1F4112339F49491809164 +:107DB000C00085FFFCCF9093C6002F5F3F4FCB01E3 +:107DC0000196FA012A173B0780F4BC014F5F5F4F11 +:107DD000002351F3F999FECFF2BDE1BDF89A90B5B9 +:107DE0008091C00085FFFCCFE6CF709307016093C0 +:107DF00006018091C00085FDE5CE8091C00085FF21 +:107E0000F8CFE0CE81E00E94C73C67CE0E94763C6E +:107E1000803209F08CCE8091C00085FFFCCFF092BB +:107E2000C6008091C00085FFFCCFE092C600809123 +:107E3000C00085FFFCCFD092C6008091C00085FFB6 +:107E4000FCCFC092C6008091C00085FFFCCFB092ED +:107E5000C60043CE80E10E94C73C3FCE0E94763CE4 +:107E60000E94763C182F0E94763C112309F483C0AF +:107E7000113009F484C08FE00E94C73C2ECE80915F +:107E80000C02816080930C02F1CE80910C02816023 +:107E900080930C0265CF809107018823880F880B9F +:107EA0008A2180930B028091060190910701880F2F +:107EB000991F90930701809306018091080280FF2B +:107EC00009C08091080290910902019690930902DD +:107ED00080930802F894F999FECF1127E0910601EA +:107EE000F0910701C8E0D1E0809108029091090269 +:107EF000103091F40091570001700130D9F303E084 +:107F000000935700E8950091570001700130D9F3B4 +:107F100001E100935700E8950990199000915700EE +:107F200001700130D9F301E000935700E8951395F3 +:107F3000103498F011270091570001700130D9F3E7 +:107F400005E000935700E89500915700017001305B +:107F5000D9F301E100935700E8953296029709F0B2 +:107F6000C7CF103011F00296E5CF11248091C000E8 +:107F700085FFC5CEC8CE8EE10E94C73CAECD85E957 +:0A7F80000E94C73CAACDF894FFCF81 +:027F8A00800075 +:040000030000780081 +:00000001FF diff --git a/libraries/AVR-Programming-Library/.gitignore b/libraries/AVR-Programming-Library/.gitignore new file mode 100644 index 0000000..df3d5dd --- /dev/null +++ b/libraries/AVR-Programming-Library/.gitignore @@ -0,0 +1,2 @@ +binaryMacroDemo.c + diff --git a/libraries/AVR-Programming-Library/README.md b/libraries/AVR-Programming-Library/README.md new file mode 100644 index 0000000..1bed580 --- /dev/null +++ b/libraries/AVR-Programming-Library/README.md @@ -0,0 +1,30 @@ +AVR-Programming-Library +======================= + +Files that are re-used throughout the book *Make: AVR Programming* + +* **pinDefines.h** + Includes all of the pin definitions for the projects in *Make: AVR Programming*. When you + need to know what to hook up where, have a look here. + +* **USART.c** and **USART.h** + These are the main utility files used for serial input/output in the book. They're not + particularly clever, but they have a tiny memory and resource footprint and get you + up and running very quickly. + +* **binaryMacro.h** + If you're using a compiler other than a recent AVR-GCC, it may not support + native binary digits (e.g. 0b00111010). If so, this include file has a pre-processor + macro that will let you enter them similarly: B8(01010101). + +* **macros.h** + This file includes pre-processor macro definitions for bit-twiddling: + set_bit, clear_bit, and toggle_bit. Useful for those days when you're feeling + lazy, or have forgotten your bit-wise logic operations. + +* **portpins.h** + This is a recent version of the portpins.h file included with the Arduino environment. + It includes the AVR pin definitions of the form PB1 and similar. The version included + with Arduino is very old -- you'll want to replace it with this one if you want to write + in C using the Arduino IDE. Or you can include this file directly in your code. + diff --git a/libraries/AVR-Programming-Library/binaryMacro.h b/libraries/AVR-Programming-Library/binaryMacro.h new file mode 100644 index 0000000..9dff3c1 --- /dev/null +++ b/libraries/AVR-Programming-Library/binaryMacro.h @@ -0,0 +1,45 @@ +/* Binary constant generator macro +By Tom Torfs - donated to the public domain +*/ + +/* All macro's evaluate to compile-time constants */ + +/* *** helper macros *** / + +/* turn a numeric literal into a hex constant +(avoids problems with leading zeroes) +8-bit constants max value 0x11111111, always fits in unsigned long +*/ +#define HEX__(n) 0x##n##LU + +/* 8-bit conversion function */ +#define B8__(x) ((x&0x0000000FLU)?1:0) \ ++((x&0x000000F0LU)?2:0) \ ++((x&0x00000F00LU)?4:0) \ ++((x&0x0000F000LU)?8:0) \ ++((x&0x000F0000LU)?16:0) \ ++((x&0x00F00000LU)?32:0) \ ++((x&0x0F000000LU)?64:0) \ ++((x&0xF0000000LU)?128:0) + +/* *** user macros *** / + +/* for upto 8-bit binary constants */ +#define B8(d) ((unsigned char)B8__(HEX__(d))) + +/* for upto 16-bit binary constants, MSB first */ +#define B16(dmsb,dlsb) (((unsigned short)B8(dmsb)<<8) \ ++ B8(dlsb)) + +/* for upto 32-bit binary constants, MSB first */ +#define B32(dmsb,db2,db3,dlsb) (((unsigned long)B8(dmsb)<<24) \ ++ ((unsigned long)B8(db2)<<16) \ ++ ((unsigned long)B8(db3)<<8) \ ++ B8(dlsb)) + +/* Sample usage: +B8(01010101) = 85 +B16(10101010,01010101) = 43605 +B32(10000000,11111111,10101010,01010101) = 2164238933 +*/ + diff --git a/libraries/AVR-Programming-Library/macros.h b/libraries/AVR-Programming-Library/macros.h new file mode 100644 index 0000000..7987b22 --- /dev/null +++ b/libraries/AVR-Programming-Library/macros.h @@ -0,0 +1,26 @@ + +/* Standard Macros */ +/* You can totally get by without these, but why? */ + +/* Make sure we've already got io / sfr / pindefs loaded */ +#ifndef _AVR_IO_H_ +#include +#endif + +/* Reminder: the following useful bit-twiddling macros are + always included in avr/sfr_defs.h, which is called from + avr/io.h + + bit_is_set(sfr, bit) + bit_is_clear(sfr, bit) + loop_until_bit_is_set(sfr, bit) + loop_until_bit_is_clear(sfr, bit) + +*/ + +/* Define up the full complement of bit-twiddling macros */ +#define BV(bit) (1 << bit) +#define set_bit(sfr, bit) (_SFR_BYTE(sfr) |= BV(bit)) // old sbi() +#define clear_bit(sfr, bit) (_SFR_BYTE(sfr) &= ~BV(bit)) // old cbi() +#define toggle_bit(sfr, bit) (_SFR_BYTE(sfr) ^= BV(bit)) + diff --git a/libraries/AVR-Programming-Library/pinDefines.h b/libraries/AVR-Programming-Library/pinDefines.h new file mode 100644 index 0000000..36cd2f0 --- /dev/null +++ b/libraries/AVR-Programming-Library/pinDefines.h @@ -0,0 +1,91 @@ +// --------------- +// Pin Defines +// --------------- + +#define LED_PORT PORTB +#define LED_PIN PINB +#define LED_DDR DDRB + +#define LED0 PB0 +#define LED1 PB1 +#define LED2 PB2 +#define LED3 PB3 +#define LED4 PB4 +#define LED5 PB5 +#define LED6 PB6 +#define LED7 PB7 + +#define BUTTON_PORT PORTD +#define BUTTON_PIN PIND +#define BUTTON_DDR DDRD + +#define BUTTON PD2 +#define BUTTON2 PD3 +#define BUTTON3 PD4 + +#define SPEAKER PD6 /* OC0A */ +#define SPEAKER_PORT PORTD +#define SPEAKER_PIN PIND +#define SPEAKER_DDR DDRD + +#define ANTENNA PD5 /* OC0B */ +#define ANTENNA_PORT PORTD +#define ANTENNA_PIN PIND +#define ANTENNA_DDR DDRD + +#define MODULATION PD3 /* OC2B */ +#define MODULATION_PORT PORTD +#define MODULATION_PIN PIND +#define MODULATION_DDR DDRD + +#define LIGHT_SENSOR PC0 /* ADC0 */ +#define LIGHT_SENSOR_PORT PORTC +#define LIGHT_SENSOR_PIN PINC +#define LIGHT_SENSOR_DDR DDRC + +#define CAP_SENSOR PC1 /* ADC1 */ +#define CAP_SENSOR_PORT PORTC +#define CAP_SENSOR_PIN PINC +#define CAP_SENSOR_DDR DDRC + +#define PIEZO PC2 /* ADC2 */ +#define PIEZO_PORT PORTC +#define PIEZO_PIN PINC +#define PIEZO_DDR DDRC + +#define POT PC3 /* ADC3 */ +#define POT_PORT PORTC +#define POT_PIN PINC +#define POT_DDR DDRC + +// SPI and I2C serial mode defines + +#define SPI_SS PB2 +#define SPI_SS_PORT PORTB +#define SPI_SS_PIN PINB +#define SPI_SS_DDR DDRB + +#define SPI_MOSI PB3 +#define SPI_MOSI_PORT PORTB +#define SPI_MOSI_PIN PINB +#define SPI_MOSI_DDR DDRB + +#define SPI_MISO PB4 +#define SPI_MISO_PORT PORTB +#define SPI_MISO_PIN PINB +#define SPI_MISO_DDR DDRB + +#define SPI_SCK PB5 +#define SPI_SCK_PORT PORTB +#define SPI_SCK_PIN PINB +#define SPI_SCK_DDR DDRB + +#define I2C_SDA PC4 +#define I2C_SDA_PORT PORTC +#define I2C_SDA_PIN PINC +#define I2C_SDA_DDR DDRC + +#define I2C_SCL PC5 +#define I2C_SCL_PORT PORTC +#define I2C_SCL_PIN PINC +#define I2C_SCL_DDR DDRC diff --git a/libraries/AVR-Programming-Library/portpins.h b/libraries/AVR-Programming-Library/portpins.h new file mode 100644 index 0000000..6a24830 --- /dev/null +++ b/libraries/AVR-Programming-Library/portpins.h @@ -0,0 +1,549 @@ +/* Copyright (c) 2003 Theodore A. Roth + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of the copyright holders nor the names of + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. */ + +/* $Id: portpins.h 1936 2009-03-19 22:19:26Z arcanum $ */ + +#ifndef _AVR_PORTPINS_H_ +#define _AVR_PORTPINS_H_ 1 + +/* This file should only be included from , never directly. */ + +#ifndef _AVR_IO_H_ +# error "Include instead of this file." +#endif + +/* Define Generic PORTn, DDn, and PINn values. */ + +/* Port Data Register (generic) */ +#define PORT7 7 +#define PORT6 6 +#define PORT5 5 +#define PORT4 4 +#define PORT3 3 +#define PORT2 2 +#define PORT1 1 +#define PORT0 0 + +/* Port Data Direction Register (generic) */ +#define DD7 7 +#define DD6 6 +#define DD5 5 +#define DD4 4 +#define DD3 3 +#define DD2 2 +#define DD1 1 +#define DD0 0 + +/* Port Input Pins (generic) */ +#define PIN7 7 +#define PIN6 6 +#define PIN5 5 +#define PIN4 4 +#define PIN3 3 +#define PIN2 2 +#define PIN1 1 +#define PIN0 0 + +/* Define PORTxn an Pxn values for all possible port pins if not defined already by io.h. */ + +/* PORT A */ + +#if defined(PA0) && !defined(PORTA0) +# define PORTA0 PA0 +#elif defined(PORTA0) && !defined(PA0) +# define PA0 PORTA0 +#endif +#if defined(PA1) && !defined(PORTA1) +# define PORTA1 PA1 +#elif defined(PORTA1) && !defined(PA1) +# define PA1 PORTA1 +#endif +#if defined(PA2) && !defined(PORTA2) +# define PORTA2 PA2 +#elif defined(PORTA2) && !defined(PA2) +# define PA2 PORTA2 +#endif +#if defined(PA3) && !defined(PORTA3) +# define PORTA3 PA3 +#elif defined(PORTA3) && !defined(PA3) +# define PA3 PORTA3 +#endif +#if defined(PA4) && !defined(PORTA4) +# define PORTA4 PA4 +#elif defined(PORTA4) && !defined(PA4) +# define PA4 PORTA4 +#endif +#if defined(PA5) && !defined(PORTA5) +# define PORTA5 PA5 +#elif defined(PORTA5) && !defined(PA5) +# define PA5 PORTA5 +#endif +#if defined(PA6) && !defined(PORTA6) +# define PORTA6 PA6 +#elif defined(PORTA6) && !defined(PA6) +# define PA6 PORTA6 +#endif +#if defined(PA7) && !defined(PORTA7) +# define PORTA7 PA7 +#elif defined(PORTA7) && !defined(PA7) +# define PA7 PORTA7 +#endif + +/* PORT B */ + +#if defined(PB0) && !defined(PORTB0) +# define PORTB0 PB0 +#elif defined(PORTB0) && !defined(PB0) +# define PB0 PORTB0 +#endif +#if defined(PB1) && !defined(PORTB1) +# define PORTB1 PB1 +#elif defined(PORTB1) && !defined(PB1) +# define PB1 PORTB1 +#endif +#if defined(PB2) && !defined(PORTB2) +# define PORTB2 PB2 +#elif defined(PORTB2) && !defined(PB2) +# define PB2 PORTB2 +#endif +#if defined(PB3) && !defined(PORTB3) +# define PORTB3 PB3 +#elif defined(PORTB3) && !defined(PB3) +# define PB3 PORTB3 +#endif +#if defined(PB4) && !defined(PORTB4) +# define PORTB4 PB4 +#elif defined(PORTB4) && !defined(PB4) +# define PB4 PORTB4 +#endif +#if defined(PB5) && !defined(PORTB5) +# define PORTB5 PB5 +#elif defined(PORTB5) && !defined(PB5) +# define PB5 PORTB5 +#endif +#if defined(PB6) && !defined(PORTB6) +# define PORTB6 PB6 +#elif defined(PORTB6) && !defined(PB6) +# define PB6 PORTB6 +#endif +#if defined(PB7) && !defined(PORTB7) +# define PORTB7 PB7 +#elif defined(PORTB7) && !defined(PB7) +# define PB7 PORTB7 +#endif + +/* PORT C */ + +#if defined(PC0) && !defined(PORTC0) +# define PORTC0 PC0 +#elif defined(PORTC0) && !defined(PC0) +# define PC0 PORTC0 +#endif +#if defined(PC1) && !defined(PORTC1) +# define PORTC1 PC1 +#elif defined(PORTC1) && !defined(PC1) +# define PC1 PORTC1 +#endif +#if defined(PC2) && !defined(PORTC2) +# define PORTC2 PC2 +#elif defined(PORTC2) && !defined(PC2) +# define PC2 PORTC2 +#endif +#if defined(PC3) && !defined(PORTC3) +# define PORTC3 PC3 +#elif defined(PORTC3) && !defined(PC3) +# define PC3 PORTC3 +#endif +#if defined(PC4) && !defined(PORTC4) +# define PORTC4 PC4 +#elif defined(PORTC4) && !defined(PC4) +# define PC4 PORTC4 +#endif +#if defined(PC5) && !defined(PORTC5) +# define PORTC5 PC5 +#elif defined(PORTC5) && !defined(PC5) +# define PC5 PORTC5 +#endif +#if defined(PC6) && !defined(PORTC6) +# define PORTC6 PC6 +#elif defined(PORTC6) && !defined(PC6) +# define PC6 PORTC6 +#endif +#if defined(PC7) && !defined(PORTC7) +# define PORTC7 PC7 +#elif defined(PORTC7) && !defined(PC7) +# define PC7 PORTC7 +#endif + +/* PORT D */ + +#if defined(PD0) && !defined(PORTD0) +# define PORTD0 PD0 +#elif defined(PORTD0) && !defined(PD0) +# define PD0 PORTD0 +#endif +#if defined(PD1) && !defined(PORTD1) +# define PORTD1 PD1 +#elif defined(PORTD1) && !defined(PD1) +# define PD1 PORTD1 +#endif +#if defined(PD2) && !defined(PORTD2) +# define PORTD2 PD2 +#elif defined(PORTD2) && !defined(PD2) +# define PD2 PORTD2 +#endif +#if defined(PD3) && !defined(PORTD3) +# define PORTD3 PD3 +#elif defined(PORTD3) && !defined(PD3) +# define PD3 PORTD3 +#endif +#if defined(PD4) && !defined(PORTD4) +# define PORTD4 PD4 +#elif defined(PORTD4) && !defined(PD4) +# define PD4 PORTD4 +#endif +#if defined(PD5) && !defined(PORTD5) +# define PORTD5 PD5 +#elif defined(PORTD5) && !defined(PD5) +# define PD5 PORTD5 +#endif +#if defined(PD6) && !defined(PORTD6) +# define PORTD6 PD6 +#elif defined(PORTD6) && !defined(PD6) +# define PD6 PORTD6 +#endif +#if defined(PD7) && !defined(PORTD7) +# define PORTD7 PD7 +#elif defined(PORTD7) && !defined(PD7) +# define PD7 PORTD7 +#endif + +/* PORT E */ + +#if defined(PE0) && !defined(PORTE0) +# define PORTE0 PE0 +#elif defined(PORTE0) && !defined(PE0) +# define PE0 PORTE0 +#endif +#if defined(PE1) && !defined(PORTE1) +# define PORTE1 PE1 +#elif defined(PORTE1) && !defined(PE1) +# define PE1 PORTE1 +#endif +#if defined(PE2) && !defined(PORTE2) +# define PORTE2 PE2 +#elif defined(PORTE2) && !defined(PE2) +# define PE2 PORTE2 +#endif +#if defined(PE3) && !defined(PORTE3) +# define PORTE3 PE3 +#elif defined(PORTE3) && !defined(PE3) +# define PE3 PORTE3 +#endif +#if defined(PE4) && !defined(PORTE4) +# define PORTE4 PE4 +#elif defined(PORTE4) && !defined(PE4) +# define PE4 PORTE4 +#endif +#if defined(PE5) && !defined(PORTE5) +# define PORTE5 PE5 +#elif defined(PORTE5) && !defined(PE5) +# define PE5 PORTE5 +#endif +#if defined(PE6) && !defined(PORTE6) +# define PORTE6 PE6 +#elif defined(PORTE6) && !defined(PE6) +# define PE6 PORTE6 +#endif +#if defined(PE7) && !defined(PORTE7) +# define PORTE7 PE7 +#elif defined(PORTE7) && !defined(PE7) +# define PE7 PORTE7 +#endif + +/* PORT F */ + +#if defined(PF0) && !defined(PORTF0) +# define PORTF0 PF0 +#elif defined(PORTF0) && !defined(PF0) +# define PF0 PORTF0 +#endif +#if defined(PF1) && !defined(PORTF1) +# define PORTF1 PF1 +#elif defined(PORTF1) && !defined(PF1) +# define PF1 PORTF1 +#endif +#if defined(PF2) && !defined(PORTF2) +# define PORTF2 PF2 +#elif defined(PORTF2) && !defined(PF2) +# define PF2 PORTF2 +#endif +#if defined(PF3) && !defined(PORTF3) +# define PORTF3 PF3 +#elif defined(PORTF3) && !defined(PF3) +# define PF3 PORTF3 +#endif +#if defined(PF4) && !defined(PORTF4) +# define PORTF4 PF4 +#elif defined(PORTF4) && !defined(PF4) +# define PF4 PORTF4 +#endif +#if defined(PF5) && !defined(PORTF5) +# define PORTF5 PF5 +#elif defined(PORTF5) && !defined(PF5) +# define PF5 PORTF5 +#endif +#if defined(PF6) && !defined(PORTF6) +# define PORTF6 PF6 +#elif defined(PORTF6) && !defined(PF6) +# define PF6 PORTF6 +#endif +#if defined(PF7) && !defined(PORTF7) +# define PORTF7 PF7 +#elif defined(PORTF7) && !defined(PF7) +# define PF7 PORTF7 +#endif + +/* PORT G */ + +#if defined(PG0) && !defined(PORTG0) +# define PORTG0 PG0 +#elif defined(PORTG0) && !defined(PG0) +# define PG0 PORTG0 +#endif +#if defined(PG1) && !defined(PORTG1) +# define PORTG1 PG1 +#elif defined(PORTG1) && !defined(PG1) +# define PG1 PORTG1 +#endif +#if defined(PG2) && !defined(PORTG2) +# define PORTG2 PG2 +#elif defined(PORTG2) && !defined(PG2) +# define PG2 PORTG2 +#endif +#if defined(PG3) && !defined(PORTG3) +# define PORTG3 PG3 +#elif defined(PORTG3) && !defined(PG3) +# define PG3 PORTG3 +#endif +#if defined(PG4) && !defined(PORTG4) +# define PORTG4 PG4 +#elif defined(PORTG4) && !defined(PG4) +# define PG4 PORTG4 +#endif +#if defined(PG5) && !defined(PORTG5) +# define PORTG5 PG5 +#elif defined(PORTG5) && !defined(PG5) +# define PG5 PORTG5 +#endif +#if defined(PG6) && !defined(PORTG6) +# define PORTG6 PG6 +#elif defined(PORTG6) && !defined(PG6) +# define PG6 PORTG6 +#endif +#if defined(PG7) && !defined(PORTG7) +# define PORTG7 PG7 +#elif defined(PORTG7) && !defined(PG7) +# define PG7 PORTG7 +#endif + +/* PORT H */ + +#if defined(PH0) && !defined(PORTH0) +# define PORTH0 PH0 +#elif defined(PORTH0) && !defined(PH0) +# define PH0 PORTH0 +#endif +#if defined(PH1) && !defined(PORTH1) +# define PORTH1 PH1 +#elif defined(PORTH1) && !defined(PH1) +# define PH1 PORTH1 +#endif +#if defined(PH2) && !defined(PORTH2) +# define PORTH2 PH2 +#elif defined(PORTH2) && !defined(PH2) +# define PH2 PORTH2 +#endif +#if defined(PH3) && !defined(PORTH3) +# define PORTH3 PH3 +#elif defined(PORTH3) && !defined(PH3) +# define PH3 PORTH3 +#endif +#if defined(PH4) && !defined(PORTH4) +# define PORTH4 PH4 +#elif defined(PORTH4) && !defined(PH4) +# define PH4 PORTH4 +#endif +#if defined(PH5) && !defined(PORTH5) +# define PORTH5 PH5 +#elif defined(PORTH5) && !defined(PH5) +# define PH5 PORTH5 +#endif +#if defined(PH6) && !defined(PORTH6) +# define PORTH6 PH6 +#elif defined(PORTH6) && !defined(PH6) +# define PH6 PORTH6 +#endif +#if defined(PH7) && !defined(PORTH7) +# define PORTH7 PH7 +#elif defined(PORTH7) && !defined(PH7) +# define PH7 PORTH7 +#endif + +/* PORT J */ + +#if defined(PJ0) && !defined(PORTJ0) +# define PORTJ0 PJ0 +#elif defined(PORTJ0) && !defined(PJ0) +# define PJ0 PORTJ0 +#endif +#if defined(PJ1) && !defined(PORTJ1) +# define PORTJ1 PJ1 +#elif defined(PORTJ1) && !defined(PJ1) +# define PJ1 PORTJ1 +#endif +#if defined(PJ2) && !defined(PORTJ2) +# define PORTJ2 PJ2 +#elif defined(PORTJ2) && !defined(PJ2) +# define PJ2 PORTJ2 +#endif +#if defined(PJ3) && !defined(PORTJ3) +# define PORTJ3 PJ3 +#elif defined(PORTJ3) && !defined(PJ3) +# define PJ3 PORTJ3 +#endif +#if defined(PJ4) && !defined(PORTJ4) +# define PORTJ4 PJ4 +#elif defined(PORTJ4) && !defined(PJ4) +# define PJ4 PORTJ4 +#endif +#if defined(PJ5) && !defined(PORTJ5) +# define PORTJ5 PJ5 +#elif defined(PORTJ5) && !defined(PJ5) +# define PJ5 PORTJ5 +#endif +#if defined(PJ6) && !defined(PORTJ6) +# define PORTJ6 PJ6 +#elif defined(PORTJ6) && !defined(PJ6) +# define PJ6 PORTJ6 +#endif +#if defined(PJ7) && !defined(PORTJ7) +# define PORTJ7 PJ7 +#elif defined(PORTJ7) && !defined(PJ7) +# define PJ7 PORTJ7 +#endif + +/* PORT K */ + +#if defined(PK0) && !defined(PORTK0) +# define PORTK0 PK0 +#elif defined(PORTK0) && !defined(PK0) +# define PK0 PORTK0 +#endif +#if defined(PK1) && !defined(PORTK1) +# define PORTK1 PK1 +#elif defined(PORTK1) && !defined(PK1) +# define PK1 PORTK1 +#endif +#if defined(PK2) && !defined(PORTK2) +# define PORTK2 PK2 +#elif defined(PORTK2) && !defined(PK2) +# define PK2 PORTK2 +#endif +#if defined(PK3) && !defined(PORTK3) +# define PORTK3 PK3 +#elif defined(PORTK3) && !defined(PK3) +# define PK3 PORTK3 +#endif +#if defined(PK4) && !defined(PORTK4) +# define PORTK4 PK4 +#elif defined(PORTK4) && !defined(PK4) +# define PK4 PORTK4 +#endif +#if defined(PK5) && !defined(PORTK5) +# define PORTK5 PK5 +#elif defined(PORTK5) && !defined(PK5) +# define PK5 PORTK5 +#endif +#if defined(PK6) && !defined(PORTK6) +# define PORTK6 PK6 +#elif defined(PORTK6) && !defined(PK6) +# define PK6 PORTK6 +#endif +#if defined(PK7) && !defined(PORTK7) +# define PORTK7 PK7 +#elif defined(PORTK7) && !defined(PK7) +# define PK7 PORTK7 +#endif + +/* PORT L */ + +#if defined(PL0) && !defined(PORTL0) +# define PORTL0 PL0 +#elif defined(PORTL0) && !defined(PL0) +# define PL0 PORTL0 +#endif +#if defined(PL1) && !defined(PORTL1) +# define PORTL1 PL1 +#elif defined(PORTL1) && !defined(PL1) +# define PL1 PORTL1 +#endif +#if defined(PL2) && !defined(PORTL2) +# define PORTL2 PL2 +#elif defined(PORTL2) && !defined(PL2) +# define PL2 PORTL2 +#endif +#if defined(PL3) && !defined(PORTL3) +# define PORTL3 PL3 +#elif defined(PORTL3) && !defined(PL3) +# define PL3 PORTL3 +#endif +#if defined(PL4) && !defined(PORTL4) +# define PORTL4 PL4 +#elif defined(PORTL4) && !defined(PL4) +# define PL4 PORTL4 +#endif +#if defined(PL5) && !defined(PORTL5) +# define PORTL5 PL5 +#elif defined(PORTL5) && !defined(PL5) +# define PL5 PORTL5 +#endif +#if defined(PL6) && !defined(PORTL6) +# define PORTL6 PL6 +#elif defined(PORTL6) && !defined(PL6) +# define PL6 PORTL6 +#endif +#if defined(PL7) && !defined(PORTL7) +# define PORTL7 PL7 +#elif defined(PORTL7) && !defined(PL7) +# define PL7 PORTL7 +#endif + +#endif /* _AVR_PORTPINS_H_ */ -- 2.39.2