So I was wrong again on the implementation of the functions for scanning flip for horizontal and vertical, and the text Rotate. I was ^= for both the true and false statements, which didn't work out well with the logic. Here's the logic needed, if 0 and false, remain false, if 0 and true, change to 1, if 1 and true, remain 1, if 1 and false change to 0. With my implementation it was just a switch statement, whether you used true or false, whatever is there will get a XOR of 1 or 0 depending on whether you said true or false, thereby switching no matter what. In the end the result I currently have and seems to be working with no bugs, for true use temp |=, which flips 0 to 1, but leaves 1 if true is used elsewhere, and for false, temp &= ~ which checks if 1 flip to 0, if 0 leave 0, where the ~ means to flip or NOT. Here is an example of the scanV_flip function
if (V_scan) {
writeCommand(0x20);
uint8_t temp = readData();
temp |= 4;
writeData(temp);
}
else {
writeCommand(0x20);
uint8_t temp = readData();
temp &= ~4;
writeData(temp);
}
Currently all the functions are working as intended, but if you find otherwise just let me know and I'll do some debugging. Hopefully this is the last revision of this particular code.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.