thank you for your reply. I am happy to share the full code. It is lengthy, however.
It just looked to me, that the error message has nothing to do with the implementation.
Here are both the header file and the cpp file:
RD_40.h
// =========================================================================================================================================
// Rotating Display RD40
// © Ludwin Monz
// License: Creative Commons Attribution - Non-Commercial - Share Alike (CC BY-NC-SA)
// you may use, adapt, share. If you share, "share alike".
// you may not use this software for commercial purposes
// =========================================================================================================================================
// ******************************************************************************************************************************************
//
// This class provides the rotating display object. It consists of the display data (one bit per LED) and of methods for manipulating
// the data and for transferring it to the display controller.
//
// ******************************************************************************************************************************************
#ifndef RD_40_H
#define RD_40_H
#include <Arduino.h>
#include "FS.h"
#include "SD.h"
#include <SPI.h>
class RD_40 {
private:
struct pixel {
uint8_t R;
uint8_t G;
uint8_t B;
};
SPIClass _SPI1 = SPIClass(FSPI);
unsigned char _line[1960][5][3]; // 1960 lines, 5 bytes x 8 bits = 40 LEDs, 3 colors
pixel _readBmpPix(unsigned char bmp[][165], int x, int y); // read pixel values of bitmap
void _writeBmpPix(unsigned char bmp[][165], int x, int y, const pixel& Pixel); // write pixel values of bitmap
void _writeLinePix(int r, int a, const pixel& Pixel); // write line values
public:
int brightness; // brightness level in %
RD_40(); // constructor
void begin(); // begin function initiates VSPI
void upload(int _brightness); // uploads display image data and brightness setting to display controller
void displayBMP(unsigned char bmp[][165]); // displays a bitmap
void startPattern(int angle);
};
#endif
and here the implementation RD40.cpp
// =========================================================================================================================================
// Rotating Display RD40
// © Ludwin Monz
// License: Creative Commons Attribution - Non-Commercial - Share Alike (CC BY-NC-SA)
// you may use, adapt, share. If you share, "share alike".
// you may not use this software for commercial purposes
// =========================================================================================================================================
#include "RD_40.h"
#include "RD_40trafo.h"
#include <Arduino.h>
#include "FS.h"
#include "SD.h"
#include <SPI.h>
#define FSPI_MOSI 1
#define FSPI_SCLK 3
#define FSPI_MISO 2
#define FSPI_CS 4
// =========================================================================================================================================
// Constructor
// =========================================================================================================================================
RD_40::RD_40() {
// brightness = 50;
}
// =========================================================================================================================================
// begin()
// =========================================================================================================================================
void RD_40::begin() {
_SPI1.begin(FSPI_SCLK, FSPI_MISO, FSPI_MOSI, FSPI_CS);
pinMode(FSPI_CS, OUTPUT);
SPISettings settings1(8000000, MSBFIRST, SPI_MODE0);
_SPI1.beginTransaction(settings1);
startPattern(0);
}
// =========================================================================================================================================
// upload() method
// =========================================================================================================================================
void RD_40::upload(int _brightness) { // formerly send_lines()
brightness=_brightness;
for (int k=0; k<3; k++ ) {
for (int j=0; j<5; j++) {
for (int i=0; i<1920; i++) {
digitalWrite(FSPI_CS, LOW);
_SPI1.transfer(_line[i][j][k]);
digitalWrite(FSPI_CS, HIGH);
}
}
}
}
// =========================================================================================================================================
// displayBMP(unsigned char bmp[][14]) method
// =========================================================================================================================================
void RD_40::displayBMP(unsigned char bmp[][165]) {
int r,a;
for (r=0; r<40; r++) {
for (a=0; a<240; a++) {
unsigned char x, y;
x = pgm_read_byte(&trafo_x[r][a]);
y = pgm_read_byte(&trafo_y[r][a]);
_writeLinePix(r, a, _readBmpPix(bmp, x, y));
}
}
}
// =========================================================================================================================================
// methods for testing and manipulating bitmap bits
// =========================================================================================================================================
pixel RD_40::_readBmpPix(unsigned char bmp[][165], int x, int y) {
int y_byte, y_start;
pixel Pixel;
y_byte=3*y/2;
y_start=3*y%2; // if this value is 0, R is in the lower 4 bits of the byte, otherwise it is in the hogher 4 bits
if (y_start==0) {
Pixel.R = bmp[x][y_byte] & 0x0F;
Pixel.G = bmp[x][y_byte]>>4;
Pixel.B = bmp[x][y_byte+1] & 0x0F;
}
else {
Pixel.R = bmp[x][y_byte]>>4;
Pixel.G = bmp[x][y_byte+1] & 0x0F;
Pixel.B = bmp[x][y_byte+1]>>4;
}
return Pixel
}
void RD_40::_writeBmpPix(unsigned char bmp[][165], int x, int y, const pixel& Pixel){
int y_byte, y_start;
y_byte=3*y/2;
y_start=3*y%2; // if this value is 0, R is in the lower 4 bits of the byte, otherwise it is in the hogher 4 bits
if (y_start==0) {
bmp[x][y_byte] = (Pixel.G<<4) | (Pixel.R & 0x0F);
bmp[x][y_byte+1] &= 0xF0; // delete lower 4 bits
bmp[x][y_byte+1] |= (Pixel.B & 0X0F); // replace upper 4 bits with B
}
else {
bmp[x][y_byte] &= 0x0F; // delete the upper 4 bits
bmp[x][y_byte] |= (Pixel.R << 4); // replace upper 4 bits with R
bmp[x][y_byte+1] = (Pixel.B << 4) | (Pixel.G & 0x0F);
}
}
// =========================================================================================================================================
// methods for manipulating line bits (=LEDs)
// =========================================================================================================================================
void RD_40::_writeLinePix(int r, int a, const pixel& Pixel) {
// LED# 00 01 02 03 04 05 06 07 | 08 09 10 11 12 13 14 15 | 16 17 18 19 20 21 22 23 | 24 25 26 27 28 29 30 31 | 32 33 34 35 36 37 38 39
// byte# 0 3 0 3 0 3 0 3 | 0 3 0 3 0 3 0 3 | 1 4 1 4 1 4 1 4 | 1 4 1 4 1 4 1 4 | 2 2 2 2 2 2 2 2
// bit# 0 0 1 1 2 2 3 3 | 4 4 5 5 6 6 7 7 | 0 0 1 1 2 2 3 3 | 4 4 5 5 6 6 7 7 | 0 4 1 5 2 6 3 7
// bank# 0 1 0 1 0 1 0 1 | 0 1 0 1 0 1 0 1 | 0 1 0 1 0 1 0 1 | 0 1 0 1 0 1 0 1 | 0 1 0 1 0 1 0 1
unsigned char lineByte[40]={0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02};
unsigned char lineBit[40] ={0x01, 0x01, 0x02, 0x02, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80, 0x01, 0x01, 0x02, 0x02, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80, 0x01, 0x10, 0x02, 0x20, 0x04, 0x40, 0x08, 0x80};
unsigned char pattern[8][8] = { // parameters are "value" and "bit#"
{0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 0, 0, 0},
{0, 0, 0, 1, 1, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 1, 1}
};
int bank = r%2;
a = a*8 + bank * 960;
for (int as=0; as<8; as++) {
if (pattern[Pixel.R][as]==0) _line[a+as][lineByte[r]][0] &= ~lineBit[r]; // R
else _line[a+as][lineByte[r]][0] |= lineBit[r];
if (pattern[Pixel.G][as]==0) _line[a+as][lineByte[r]][1] &= ~lineBit[r]; // G
else _line[a+as][lineByte[r]][0] |= lineBit[r];
if (pattern[Pixel.B][as]==0) _line[a+as][lineByte[r]][2] &= ~lineBit[r]; // B
else _line[a+as][lineByte[r]][0] |= lineBit[r];
}
}
void RD_40::startPattern(int angle) {
int i, j;
for (i=0; i<(1920); i++) {
for (j=0; j<5; j++) {
int test = i + angle;
unsigned char R, G, B;
if (test > 1920) test = test-1920;
if (test<640) {
R=0xFF;
G=0;
B=0;
}
if ((test>=640)&(test<1280)) {
R=0;
G=0xFF;
B=0;
}
if (test>=1280) {
R=0;
G=0;
B=0xFF;
}
_line[i][j][0] = R; // R
_line[i][j][1] = G; // G
_line[i][j][2] = B; // B
}
}
}
The error message reads:
'pixel' does not name a type; did you mean 'pipe2'?
reference is to line 82, which is
pixel RD_40::_readBmpPix(unsigned char bmp[][165], int x, int y) {
any thoughts are appreciated.