laurencebarker / Andromeda_front_panel

front panel for Orion based Andromeda radio
10 stars 2 forks source link

Thanks for this interesting Project #4

Open hb9trt opened 3 years ago

hb9trt commented 3 years ago

I would like to test if the Andromeda frontpanel works together with my former built Odyssey-2. I think it will work.

So I tried to compile the Sketch for Arduino Nano Every and got some errors:

'class PORTCClass' has no member named 'IN'

the whole error output of the compiler is here:

sketch\opticalencoder.cpp: In function 'void InitOpticalEncoder()': opticalencoder.cpp:68:22: error: 'class PORTCClass' has no member named 'IN' GPinState = (PORTC.IN & VENCODERPINS) >> 2; // bits 3:2 ^~ opticalencoder.cpp:76:9: error: 'class PORTCClass' has no member named 'PIN4CTRL' PORTC.PIN4CTRL = (PORT_PULLUPEN_bm | PORT_ISC_BOTHEDGES_gc); // pullup, both edges interrupt ^~~~ opticalencoder.cpp:77:9: error: 'class PORTCClass' has no member named 'PIN5CTRL' PORTC.PIN5CTRL = (PORT_PULLUPEN_bm | PORT_ISC_BOTHEDGES_gc); // pullup, both edges interrupt ^~~~ sketch\opticalencoder.cpp: In function 'void __vector_24()': opticalencoder.cpp:102:23: error: 'class PORTCClass' has no member named 'IN' InputValue = (PORTC.IN & VENCODERPINS) >> 2; // bits 3:2 ^~ opticalencoder.cpp:103:9: error: 'class PORTCClass' has no member named 'INTFLAGS' PORTC.INTFLAGS = 0b00110000; // clear interrupt flags ^~~~ sketch\tiger.cpp:48:1: warning: narrowing conversion of '10000000000' from 'long long int' to 'long int' inside { } [-Wnarrowing] }; ^ sketch\tiger.cpp:48:1: warning: overflow in implicit constant conversion [-Woverflow] sketch\tiger.cpp:48:1: warning: narrowing conversion of '100000000000' from 'long long int' to 'long int' inside { } [-Wnarrowing] sketch\tiger.cpp:48:1: warning: overflow in implicit constant conversion [-Woverflow] sketch\tiger.cpp:48:1: warning: narrowing conversion of '1000000000000' from 'long long int' to 'long int' inside { } [-Wnarrowing] sketch\tiger.cpp:48:1: warning: overflow in implicit constant conversion [-Woverflow] sketch\tiger.cpp:48:1: warning: narrowing conversion of '10000000000000' from 'long long int' to 'long int' inside { } [-Wnarrowing] sketch\tiger.cpp:48:1: warning: overflow in implicit constant conversion [-Woverflow] sketch\tiger.cpp:67:1: warning: ISO C++ forbids converting a string constant to 'char' [-Wwrite-strings] }; ^ sketch\tiger.cpp:67:1: warning: ISO C++ forbids converting a string constant to 'char' [-Wwrite-strings] sketch\tiger.cpp:67:1: warning: ISO C++ forbids converting a string constant to 'char' [-Wwrite-strings] sketch\tiger.cpp:67:1: warning: ISO C++ forbids converting a string constant to 'char' [-Wwrite-strings] sketch\tiger.cpp:67:1: warning: ISO C++ forbids converting a string constant to 'char' [-Wwrite-strings] sketch\tiger.cpp:67:1: warning: ISO C++ forbids converting a string constant to 'char' [-Wwrite-strings] sketch\tiger.cpp:67:1: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] exit status 1 'class PORTCClass' has no member named 'IN'

there are also some other errors. I think I did something wrong, but I don' know what. I added the Libraries 'DueFlashStorage', Encoder, DueTimer.

But I'm not sure if this is only for Arduiono Due. Also the standard library wire.h isn't installed, which should be installed if the board (here the Arduino Nano Every) is installed.

vy 73 Reto

hb9trt commented 3 years ago

If I coment out some parts of the code in opticalencoder.cpp the project can be compiled.

ifdef HIRESOPTICALENCODER

PORTC.PIN4CTRL = (PORT_PULLUPEN_bm | PORT_ISC_RISING_gc); // pullup, rising edge interrupt

else

// for low res (Broadcom type) encoders, get an interrupt on every edge // PORTC.PIN4CTRL = (PORT_PULLUPEN_bm | PORT_ISC_BOTHEDGES_gc); // pullup, both edges interrupt // PORTC.PIN5CTRL = (PORT_PULLUPEN_bm | PORT_ISC_BOTHEDGES_gc); // pullup, both edges interrupt

endif

}

// // VFO encoder pin interrupt handler // this works one of two ways depending on the attached encoder // for a broadcom type encoder - use both edges; find 4 bits from 2 bits current state and 2 bits previous state, and look up // for a high res encoder at just one interrupt per pulse - use int on one edge and use the sense of the other to set direction. // ISR(PORTC_PORT_vect) { byte InputValue; signed char Increment;

ifdef HIRESOPTICALENCODER // on interrupt - read the non interrupting pin to set direction

InputValue = PORTC.IN & VENCODERDIRPIN; PORTC.INTFLAGS = 0b00010000; // clear interrupt flags if (InputValue) Increment = 1; else Increment = -1;

else

// InputValue = (PORTC.IN & VENCODERPIN) >> 2; // bits 3:2 // PORTC.IN = 0b00110000; // clear interrupt flags GPinState = (GPinState >> 2) | InputValue; // now have new bits in 3:2, old bits in 1:0 Increment = StepsLookup[GPinState];

endif

If I'm a better programmer... I could find the reason.

vy 73 Reto