I'm working on lcd128x64 spi library. And was working with my Arduino Atmega328p chip.
Now I want to run the code with my maple mini board too. So I have to specify the name on the pins for each chip board. But I want to learn the basics of how to write these statements.
Could you tell me where to find the attributions for each board ?
For now I want to define the pin names for the Atmega328p and maple mini. This is my intention:
#if defined(__AVR_ATmega328P__)
#define CS_PIN 10
#define MOSI_PIN 11
#define CLK_PIN 13
#elif defined(STM32_SERIES_F1)
#define CS_PIN PB12
#define MOSI_PIN PB15
#define CLK_PIN PB13
#endif
I don't think that's %100 correct, but I'm pretty sure that it's not the correct names of boards.
void lcd128x64_init(void){ pinMode(CS_PIN, OUTPUT); pinMode(CLK_PIN, OUTPUT); pinMode(MOSI_PIN, OUTPUT); digitalWrite(CS_PIN, LOW); // disable CS_PIN SPI.begin(); _delay_ms(100); // initial delay digitalWrite(CS_PIN, HIGH); // enable CS_PIN ... }
the pins names are different, so I want to unify them in the header file. – R1S8K Mar 10 '20 at 12:51SPI_2.begin(); //Initialize the SPI_2 port. SPI_2.setBitOrder(MSBFIRST); // Set the SPI_2 bit order SPI_2.setDataMode(SPI_MODE0); //Set the SPI_2 data mode 0 SPI_2.setClockDivider(SPI_CLOCK_DIV16); // Use a different speed to SPI 1 pinMode(SPI2_NSS_PIN, OUTPUT);
so I have put that in my lcd128x64 lib – R1S8K Mar 10 '20 at 12:52Arduino: 1.8.12 (Windows 10), Board: "Maple Mini, Original (17k RAM,108k Flash), 72MHz (Normal), Smallest (default)" H:\Programming\Program_Files\Arduino\libraries\lcd128x64_spi\lcd128x64_spi.cpp:14:20: fatal error: avr/io.h: No such file or directory #include <avr/io.h> ^ compilation terminated. exit status 1 Error compiling for board Maple Mini. This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.
– R1S8K Mar 10 '20 at 13:51