rcmolina / MaxDuino

Unified firmware for tzxduino and casduino
https://www.va-de-retro.com/foros/viewtopic.php?t=5541&start=9999
88 stars 21 forks source link

Mega2560 Pro Embed #5

Closed merlinkv closed 4 years ago

merlinkv commented 4 years ago

Hi,

Not sure if here is the correct place to write ...

Maybe a little tutorial to setup with Mega2560 Pro Embed?

Looking the new code and my MegaDuino project design ... my pins are:

#define btnUp         A0            //Up button
#define btnDown       A1            //Down button
#define btnPlay       A2            //Play Button
#define btnStop       A3            //Stop Button
#define btnRoot       A4            //Return to SD card root
#define btnDelete     A5            //Optional Function
#define btnMotor      6             //Motor Sense (connect pin to gnd to play, NC for pause)
#define scrollSpeed   250           //text scroll delay
#define scrollWait    2500          //Delay before scrolling starts
 // pinMode(btnUp,INPUT_PULLUP);  // Not needed, default is INPUT (0)
// digitalWrite(btnUp,HIGH);
// Analog pin A0
PORTF |= _BV(0);

// pinMode(btnDown,INPUT_PULLUP);  // Not needed, default is INPUT (0)
// digitalWrite(btnDown,HIGH);
// Analog pin A1
PORTF |= _BV(1);

// pinMode(btnPlay,INPUT_PULLUP);  // Not needed, default is INPUT (0)
// digitalWrite(btnPlay,HIGH);
// Analog pin A2
PORTF |= _BV(2);

// pinMode(btnStop,INPUT_PULLUP);  // Not needed, default is INPUT (0)
// digitalWrite(btnStop,HIGH);
// Analog pin A3
PORTF |= _BV(3);

// pinMode(btnRoot, INPUT_PULLUP);  // Not needed, default is INPUT (0)
// digitalWrite(btnRoot, HIGH); 
// Analog pin A4
PORTF |= _BV(4);

// pinMode(btnDelete, INPUT_PULLUP);  // Not needed, default is INPUT (0)
// digitalWrite(btnDelete,HIGH);
//Analog pin A5
PORTF |= _BV(5);

// pinMode(btnMotor, INPUT_PULLUP);  // Not needed, default is INPUT (0)
// digitalWrite(btnMotor,HIGH);
// Digital pin 6
PORTH |= _BV(3);

#define outputPin 23

Thanks a lot for your work!!!!!!!

rcmolina commented 4 years ago

Hi Pablo,

You can switch to spanish o better email me, I consider you as my codeveloper so no need for this thread. If you agree, email me at rcmolina@gmail.com and I'll close the thread.

Yes, never moved this from original Duncan's code although Maxduino.h should be the right place to write pin definitions (in my humble opinion). before line 243, to mix codes in the same place.

I think the right way to go fronm now on is using conditionals to define buttons according to hardware specs, i.e.

ifdef __AVR_ATmega2560__ // for Mega2560 Pro Embed

/ your pin defs /

else // for AVR_ATmega4809 and AVR_ATmega328P

/old pin defs */

endif

Hope this help :)

- Rafa

merlinkv commented 4 years ago

Hola Rafa,

Perfecto. Entonces te escribo mejor por email.

Un cordial saludo.

rcmolina commented 4 years ago

Genial.

El dom., 16 feb. 2020 21:04, merlinkv notifications@github.com escribió:

Hola Rafa,

Perfecto. Entonces te escribo mejor por email.

Un cordial saludo.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rcmolina/MaxDuino_v1.54/issues/5?email_source=notifications&email_token=ADKNPFD2XKAQLEVGKXD6CLDRDGL6JA5CNFSM4KWFUPRKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEL4QWRY#issuecomment-586746695, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADKNPFE2T3U2AG4XDYQXGR3RDGL6JANCNFSM4KWFUPRA .

rcmolina commented 4 years ago

Hola Pablo,

Una cosa, por probar... Me cargué la librería TimerOne, haz esta prueba por si estuviera afectando: (descomenta en Maxduino_v1.54M.ino la línea que te marco en negrita):

// V1.53 Some rework for Arduino nano every and timers TCA / TCB0 and using last SDFat for better speed. // V1.54 Maintenance release. Final byte patched again for Dragon and Coco, got switched when testing in v1.51. //

ifdef __AVR_ATmega4809__

                      // In

C:\Users\Rafael\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.4 // change .\variants\nona4809\timers.h , .\variants\nona4809\variant.c , .\cores\arduino\wiring.c //

define SDFat // Needs 2 patches, check your version:

                      //
                      // SDFat 20150201 (old and very slow):
                      // 1. In SdFatConfig.h change line 84 #define

SD_SPI_CONFIGURATION 0 // with: #define SD_SPI_CONFIGURATION 1 // 2. In SdSpi.h change line 292 #ifdef AVR // with: #if defined(AVR) && not defined(AVR_ATmega4809) // // SDFat 1.1.0 (faster and recommended): // 1. In SdFatConfig.h change line 216 #elif defined(AVR)\ // with: #elif defined(AVR) && not defined(AVR_ATmega4809)\ // // 2. In SpiDriver/SdSpiDriver.h change line 374

ifdef AVR

                      //    with: #if defined(__AVR__) && not

defined(__AVR_ATmega4809__)

//#define TimerOne

else //__AVR_ATmega328P__

define SDFat

ifdef TimerOne

include

else

include "TimerCounter.h"

TimerCounter Timer1; // preinstatiate

El dom., 16 feb. 2020 a las 21:08, Rafael Molina Chasserot (< rcmolina@gmail.com>) escribió:

Genial.

El dom., 16 feb. 2020 21:04, merlinkv notifications@github.com escribió:

Hola Rafa,

Perfecto. Entonces te escribo mejor por email.

Un cordial saludo.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rcmolina/MaxDuino_v1.54/issues/5?email_source=notifications&email_token=ADKNPFD2XKAQLEVGKXD6CLDRDGL6JA5CNFSM4KWFUPRKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEL4QWRY#issuecomment-586746695, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADKNPFE2T3U2AG4XDYQXGR3RDGL6JANCNFSM4KWFUPRA .

merlinkv commented 4 years ago

Hola Rafa ….

Me lo mandas como un adjunto? …. No veo nada en negrita ….

From: rcmolina notifications@github.com Sent: Wednesday, February 19, 2020 22:19 To: rcmolina/MaxDuino_v1.54 MaxDuino_v1.54@noreply.github.com Cc: merlinkv merlinkv@hotmail.com; Author author@noreply.github.com Subject: Re: [rcmolina/MaxDuino_v1.54] Mega2560 Pro Embed (#5)

Hola Pablo,

Una cosa, por probar... Me cargué la librería TimerOne, haz esta prueba por si estuviera afectando: (descomenta en Maxduino_v1.54M.ino la línea que te marco en negrita):

// V1.53 Some rework for Arduino nano every and timers TCA / TCB0 and using last SDFat for better speed. // V1.54 Maintenance release. Final byte patched again for Dragon and Coco, got switched when testing in v1.51. //

ifdef __AVR_ATmega4809__

// In C:\Users\Rafael\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.4 // change .\variants\nona4809\timers.h , .\variants\nona4809\variant.c , .\cores\arduino\wiring.c //

define SDFat // Needs 2 patches, check your version:

// // SDFat 20150201 (old and very slow): // 1. In SdFatConfig.h change line 84 #define SD_SPI_CONFIGURATION 0 // with: #define SD_SPI_CONFIGURATION 1 // 2. In SdSpi.h change line 292 #ifdef AVR // with: #if defined(AVR) && not defined(AVR_ATmega4809) // // SDFat 1.1.0 (faster and recommended): // 1. In SdFatConfig.h change line 216 #elif defined(AVR)\ // with: #elif defined(AVR) && not defined(AVR_ATmega4809)\ // // 2. In SpiDriver/SdSpiDriver.h change line 374

ifdef AVR

// with: #if defined(AVR) && not defined(__AVR_ATmega4809__)

//#define TimerOne

else //__AVR_ATmega328P__

define SDFat

ifdef TimerOne

include

else

include "TimerCounter.h"

TimerCounter Timer1; // preinstatiate

El dom., 16 feb. 2020 a las 21:08, Rafael Molina Chasserot (< rcmolina@gmail.commailto:rcmolina@gmail.com>) escribió:

Genial.

El dom., 16 feb. 2020 21:04, merlinkv notifications@github.com<mailto:notifications@github.com> escribió:

Hola Rafa,

Perfecto. Entonces te escribo mejor por email.

Un cordial saludo.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rcmolina/MaxDuino_v1.54/issues/5?email_source=notifications&email_token=ADKNPFD2XKAQLEVGKXD6CLDRDGL6JA5CNFSM4KWFUPRKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEL4QWRY#issuecomment-586746695, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADKNPFE2T3U2AG4XDYQXGR3RDGL6JANCNFSM4KWFUPRA .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/rcmolina/MaxDuino_v1.54/issues/5?email_source=notifications&email_token=AIOB5XBUKRPCV4P2B5HGTM3RDWH2JA5CNFSM4KWFUPRKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMJLL5A#issuecomment-588428788, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AIOB5XASPNWRDMH44FELUIDRDWH2JANCNFSM4KWFUPRA.

rcmolina commented 4 years ago

Hola Pablo,

Le he he puesto un comentario en mayúsculas // ESTO ES LO QUE HE DESCOMENTADO

El mié., 19 feb. 2020 a las 21:25, merlinkv (notifications@github.com) escribió:

Hola Rafa ….

Me lo mandas como un adjunto? …. No veo nada en negrita ….

From: rcmolina notifications@github.com Sent: Wednesday, February 19, 2020 22:19 To: rcmolina/MaxDuino_v1.54 MaxDuino_v1.54@noreply.github.com Cc: merlinkv merlinkv@hotmail.com; Author author@noreply.github.com Subject: Re: [rcmolina/MaxDuino_v1.54] Mega2560 Pro Embed (#5)

Hola Pablo,

Una cosa, por probar... Me cargué la librería TimerOne, haz esta prueba por si estuviera afectando: (descomenta en Maxduino_v1.54M.ino la línea que te marco en negrita):

// V1.53 Some rework for Arduino nano every and timers TCA / TCB0 and using last SDFat for better speed. // V1.54 Maintenance release. Final byte patched again for Dragon and Coco, got switched when testing in v1.51. //

ifdef __AVR_ATmega4809__

// In C:\Users\Rafael\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.4

// change .\variants\nona4809\timers.h , .\variants\nona4809\variant.c , .\cores\arduino\wiring.c //

define SDFat // Needs 2 patches, check your version:

// // SDFat 20150201 (old and very slow): // 1. In SdFatConfig.h change line 84 #define SD_SPI_CONFIGURATION 0 // with: #define SD_SPI_CONFIGURATION 1 // 2. In SdSpi.h change line 292 #ifdef AVR // with: #if defined(AVR) && not defined(AVR_ATmega4809) // // SDFat 1.1.0 (faster and recommended): // 1. In SdFatConfig.h change line 216 #elif defined(AVR)\ // with: #elif defined(AVR) && not defined(AVR_ATmega4809)\ // // 2. In SpiDriver/SdSpiDriver.h change line 374

ifdef AVR

// with: #if defined(AVR) && not defined(__AVR_ATmega4809__)

//#define TimerOne

else //__AVR_ATmega328P__

define SDFat

  • define TimerOne*

    endif

ifdef TimerOne

include

else

include "TimerCounter.h"

TimerCounter Timer1; // preinstatiate

El dom., 16 feb. 2020 a las 21:08, Rafael Molina Chasserot (< rcmolina@gmail.commailto:rcmolina@gmail.com>) escribió:

Genial.

El dom., 16 feb. 2020 21:04, merlinkv <notifications@github.com<mailto: notifications@github.com>> escribió:

Hola Rafa,

Perfecto. Entonces te escribo mejor por email.

Un cordial saludo.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/rcmolina/MaxDuino_v1.54/issues/5?email_source=notifications&email_token=ADKNPFD2XKAQLEVGKXD6CLDRDGL6JA5CNFSM4KWFUPRKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEL4QWRY#issuecomment-586746695>,

or unsubscribe < https://github.com/notifications/unsubscribe-auth/ADKNPFE2T3U2AG4XDYQXGR3RDGL6JANCNFSM4KWFUPRA>

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub< https://github.com/rcmolina/MaxDuino_v1.54/issues/5?email_source=notifications&email_token=AIOB5XBUKRPCV4P2B5HGTM3RDWH2JA5CNFSM4KWFUPRKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMJLL5A#issuecomment-588428788>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/AIOB5XASPNWRDMH44FELUIDRDWH2JANCNFSM4KWFUPRA>.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/rcmolina/MaxDuino_v1.54/issues/5?email_source=notifications&email_token=ADKNPFCVIZ457472X7VPWH3RDWIR5A5CNFSM4KWFUPRKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMJMDXY#issuecomment-588431839, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADKNPFCSY7A6ZTRODBPCC5TRDWIR5ANCNFSM4KWFUPRA .

// V1.53 Some rework for Arduino nano every and timers TCA / TCB0 and using last SDFat for better speed. // V1.54 Maintenance release. Final byte patched again for Dragon and Coco, got switched when testing in v1.51. //

ifdef __AVR_ATmega4809__

                      // In C:\Users\Rafael\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.4
                      // change .\variants\nona4809\timers.h , .\variants\nona4809\variant.c , .\cores\arduino\wiring.c
                      //

define SDFat // Needs 2 patches, check your version:

                      //
                      // SDFat 20150201 (old and very slow):
                      // 1. In SdFatConfig.h change line 84 #define SD_SPI_CONFIGURATION 0
                      //    with: #define SD_SPI_CONFIGURATION 1
                      // 2. In SdSpi.h change line 292 #ifdef __AVR__
                      //    with: #if defined(__AVR__) && not defined(__AVR_ATmega4809__)
                      //
                      // SDFat 1.1.0 (faster and recommended):
                      // 1. In SdFatConfig.h change line 216 #elif defined(__AVR__)\
                      //    with: #elif defined(__AVR__) && not defined(__AVR_ATmega4809__)\
                      //
                      // 2. In SpiDriver/SdSpiDriver.h change line 374 #ifdef __AVR__
                      //    with: #if defined(__AVR__) && not defined(__AVR_ATmega4809__)

//#define TimerOne

else //__AVR_ATmega328P__

define SDFat

define TimerOne // ESTE ES EL QUE HE DESCOMENTADO

endif

ifdef TimerOne

include

else

include "TimerCounter.h"

TimerCounter Timer1; // preinstatiate