Has anyone of you tried to port this to another microcontroller? For example an ESP8266?
In this case the direct PORT handling of PORTB would not work. I’m struggling to convert the core of the code to equivalent digitalWrite operations:
PORTB &=~(3<<(data_R1-8)); // data_R2 is LOW; data_R1 is LOW;
PORTB &=~(1<<(clockPin-8)); // digitalWrite(clockPin,LOW);
PORTB |= !((buffer[index]>>(7-i)) & 0x01) << (data_R1-8); // top set of rows
if (HEIGHT == 32) PORTB |= !((buffer[index+128]>>(7-i)) & 0x01) << (data_R2-8); // bottom set of rows
PORTB |= 1<<(clockPin-8); // digitalWrite(clockPin,HIGH);
I converted it to:
byte value = buffer[index];
digitalWrite(data_R1, !((value>>(7-i)) & 0x01));
but it is not working. Does anyone know if a special timing is needed for this clock thing to work well and maybe an arduino direct port handling is faster or slower in the right way compared to a 32 bit microcontroller like the esp? When I added delayMicroseconds(10) in between it only got worse.
Regards, Marcus from Heidelberg