Click here to Skip to main content
15,886,513 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Wordle Theory Pin
RickZeeland28-Mar-22 7:42
mveRickZeeland28-Mar-22 7:42 
GeneralRe: Wordle Theory Pin
TNCaver28-Mar-22 7:48
TNCaver28-Mar-22 7:48 
GeneralRe: Wordle Theory Pin
0x01AA28-Mar-22 7:47
mve0x01AA28-Mar-22 7:47 
GeneralRe: Wordle Theory Pin
oofalladeez34328-Mar-22 9:04
professionaloofalladeez34328-Mar-22 9:04 
GeneralRe: Wordle Theory Pin
Vivi Chellappa28-Mar-22 16:43
professionalVivi Chellappa28-Mar-22 16:43 
GeneralRe: Wordle Theory Pin
Amarnath S28-Mar-22 16:57
professionalAmarnath S28-Mar-22 16:57 
GeneralRe: Wordle Theory Pin
Vivi Chellappa28-Mar-22 18:05
professionalVivi Chellappa28-Mar-22 18:05 
GeneralI love when this happens Pin
honey the codewitch28-Mar-22 7:01
mvahoney the codewitch28-Mar-22 7:01 
So years ago, I was playing Ninja Gaidan on the PS3 and I got stuck at the boss of level 4.

He just ruined me. RUINED me every time, until I finally put the game down for months.

I fired it up one time to show a friend just how difficult the game was. I had saved it at the boss fight.

So this time, months later I had fired the game up and I proceeded to make it look easy. I destroyed that poor boss.

It made me look silly to my friend. I had just gotten finished telling him how difficult this was, and then here I am, like Bruce Muhammed Lee Ali just kicking the snot out of the game.

Anyway, I'm getting to a point.

I had about given up on getting the cantankerous RA8875 driver to work using my new decoupled SPI bus framework under Arduino.

Finally, I hacked it. I basically scraped the bus for the information I needed to do the bus code's job for it, because could not get the RA8875 to work with my new optimized bus code. It failed on the first register read. It did what I needed to do so I called it good and shelved it for quite awhile as one of the many things "i'd get to".

Today, after finishing the documentation reboot for GFX and getting my DNS records propagated for honeythecodewitch.com I was resting on my laurels. But I needed something to do, and I had stuck a pin in this problem from before.

I fired up my IDE. Wrote this code, which compiled almost the first time (forgot a semicolon), and then ran successfully the first time.

It spits 117 to the serial port, which is code for victory - a successful read of register zero. I am elated. Now I can crank out the code for the new rendition of this driver, cleaner, hopefully faster, and less buggy.

C++
#include <Arduino.h>

#include <tft_io.hpp>
using namespace arduino;

using bus_t = tft_spi_ex<VSPI, 5, 23, 19, 18, SPI_MODE0>;

void sendx(uint8_t x, uint8_t value) {
    bus_t::cs_low();
    bus_t::begin_transaction();
    bus_t::begin_write();
    bus_t::write_raw8(x);
    bus_t::write_raw8(value);
    bus_t::end_transaction();
    bus_t::end_write();
    bus_t::cs_high();
}
uint8_t recvx(uint8_t x) {
    bus_t::cs_low();
    bus_t::begin_transaction();
    bus_t::begin_write();
    bus_t::write_raw8(x);
    bus_t::end_write();
    bus_t::begin_read();
    uint8_t result = bus_t::read_raw8();
    bus_t::end_read();
    bus_t::end_transaction();
    bus_t::cs_high();
    return result;
}
inline void send_command(uint8_t value) {
    static const uint8_t RA8875_CMDWRITE = 0x80;
    sendx(RA8875_CMDWRITE, value);
}
inline void send_data(uint8_t value) {
    static const uint8_t RA8875_DATAWRITE = 0x00;
    sendx(RA8875_DATAWRITE, value);
}
inline uint8_t recv_data() {
    static const uint8_t RA8875_DATAREAD = 0x40;
    return recvx(RA8875_DATAREAD);
}
inline uint8_t recv_command() {
    static const uint8_t RA8875_CMDREAD = 0xC0;
    return recvx(RA8875_CMDREAD);
}
uint8_t reg(uint8_t reg) {
    send_command(reg);
    return recv_data();
}
void setup() {
    Serial.begin(115200);
    pinMode(4, OUTPUT);
    digitalWrite(15, LOW);
    delay(100);
    digitalWrite(15, HIGH);
    delay(100);
    bus_t::initialize();
    bus_t::set_speed_multiplier(1/20.0);
    bus_t::begin_initialization();
    uint8_t result = reg(0);
    Serial.println(result);
    bus_t::end_initialization();
    bus_t::set_speed_multiplier(1);
}

To err is human. Fortune favors the monsters.

JokeI do tend to go on about tech subjects Pin
raddevus28-Mar-22 3:49
mvaraddevus28-Mar-22 3:49 
GeneralRe: I do tend to go on about tech subjects Pin
Slacker00728-Mar-22 3:55
professionalSlacker00728-Mar-22 3:55 
GeneralRe: I do tend to go on about tech subjects Pin
Amarnath S28-Mar-22 4:07
professionalAmarnath S28-Mar-22 4:07 
GeneralRe: I do tend to go on about tech subjects Pin
Johnny J.28-Mar-22 4:43
professionalJohnny J.28-Mar-22 4:43 
JokeRe: I do tend to go on about tech subjects Pin
Daniel Pfeffer28-Mar-22 10:26
professionalDaniel Pfeffer28-Mar-22 10:26 
GeneralRe: I do tend to go on about tech subjects Pin
Craig Robbins28-Mar-22 4:49
Craig Robbins28-Mar-22 4:49 
GeneralRe: I do tend to go on about tech subjects Pin
Mike Hankey28-Mar-22 4:55
mveMike Hankey28-Mar-22 4:55 
GeneralRe: I do tend to go on about tech subjects Pin
Alan Pengelly30-Mar-22 11:42
Alan Pengelly30-Mar-22 11:42 
GeneralRe: I do tend to go on about tech subjects Pin
kmoorevs28-Mar-22 5:47
kmoorevs28-Mar-22 5:47 
GeneralRe: I do tend to go on about tech subjects Pin
oofalladeez34328-Mar-22 9:06
professionaloofalladeez34328-Mar-22 9:06 
GeneralWSO CCC OTD - 2022-03-28 Pin
FreedMalloc27-Mar-22 22:04
FreedMalloc27-Mar-22 22:04 
GeneralRe: WSO CCC OTD - 2022-03-28 Pin
Greg Utas28-Mar-22 0:39
professionalGreg Utas28-Mar-22 0:39 
GeneralRe: WSO CCC OTD - 2022-03-28 Pin
FreedMalloc28-Mar-22 0:42
FreedMalloc28-Mar-22 0:42 
GeneralRe: WSO CCC OTD - 2022-03-28 - you win! Pin
OriginalGriff28-Mar-22 2:12
mveOriginalGriff28-Mar-22 2:12 
GeneralRe: WSO CCC OTD - 2022-03-28 Solution Pin
FreedMalloc28-Mar-22 2:28
FreedMalloc28-Mar-22 2:28 
GeneralRe: WSO CCC OTD - 2022-03-28 Solution Pin
Greg Utas28-Mar-22 3:06
professionalGreg Utas28-Mar-22 3:06 
GeneralRe: WSO CCC OTD - 2022-03-28 Solution Pin
pkfox28-Mar-22 5:27
professionalpkfox28-Mar-22 5:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.