Click here to Skip to main content
15,890,690 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: Brainstorm on UX for "registering an Application license" Pin
Super Lloyd6-Dec-21 11:57
Super Lloyd6-Dec-21 11:57 
QuestionHalo Infinite Pin
oofalladeez3435-Dec-21 19:48
professionaloofalladeez3435-Dec-21 19:48 
AnswerRe: Halo Infinite Pin
OriginalGriff5-Dec-21 20:09
mveOriginalGriff5-Dec-21 20:09 
JokeThe wine taster at an old vinyard died PinPopular
honey the codewitch5-Dec-21 11:51
mvahoney the codewitch5-Dec-21 11:51 
PraiseRe: The wine taster at an old vinyard died Pin
Eddy Vluggen5-Dec-21 15:31
professionalEddy Vluggen5-Dec-21 15:31 
PraiseRe: The wine taster at an old vinyard died Pin
Jalapeno Bob5-Dec-21 16:51
professionalJalapeno Bob5-Dec-21 16:51 
GeneralRe: The wine taster at an old vinyard died Pin
charlieg5-Dec-21 23:28
charlieg5-Dec-21 23:28 
GeneralIoT bit bashing. It's the most fun nightmare in town Pin
honey the codewitch5-Dec-21 6:41
mvahoney the codewitch5-Dec-21 6:41 
I unboxed my fancy new ESP32-S3 yesterday. I intended to connect it to a parallel display and start banging on it until I realized that no toolchains are really ready for developing against it yet except for the ESP-IDF's which can limp along and do it if you're willing to devote your life to driving python scripts from the command line. So back in the box it goes.

I unboxed my ILI9341 display driver with an 8-bit parallel interface. Usually they come with a serial (SPI) interface.

I need to write a driver for it, and the ESP32 does not have hardware support for a parallel bus, meaning I have to bang the bits myself by controlling the individual pins.

And the trick is getting the timing right.

This is the part where I hate GCC (which I usually adore), because it doesn't respect "inline" very well. That means code like this:
C++
#define HTCW_RS_C GPIO.out_w1tc = (1 << pin_rs)
#define HTCW_RS_D GPIO.out_w1ts = (1 << pin_rs)
#define HTCW_CS_L if(pin_cs>31) { GPIO.out1_w1tc.val = (1 << pin_cs-32); } else { GPIO.out_w1tc.val = (1 << pin_cs); }
#define HTCW_CS_H if(pin_cs>31) { GPIO.out1_w1ts.val = (1 << pin_cs-32); } else { GPIO.out_w1ts.val = (1 << pin_cs); }
#define HTCW_WR_L if(pin_wr>31) { GPIO.out1_w1tc.val = (1 << pin_wr-32); } else { GPIO.out_w1tc.val = (1 << pin_wr); }
#define HTCW_WR_H if(pin_wr>31) { GPIO.out1_w1ts.val = (1 << pin_wr-32); } else { GPIO.out_w1ts.val = (1 << pin_wr); }
#define HTCW_RD_L if(pin_wr>31) { GPIO.out1_w1tc.val = (1 << pin_rd-32); } else { GPIO.out_w1tc.val = (1 << pin_rd); }
#define HTCW_RD_H if(pin_wr>31) { GPIO.out1_w1ts.val = (1 << pin_rd-32); } else { GPIO.out_w1ts.val = (1 << pin_rd); }
#define HTCW_WRITE8(C)  GPIO.out_w1tc = HTCW_CLR_MASK; GPIO.out_w1ts = HTCW_SET_MASK((uint8_t)(C)); HTCW_WR_H
#define HTCW_WRITE16(C) GPIO.out_w1tc = HTCW_CLR_MASK; GPIO.out_w1ts = HTCW_SET_MASK((uint8_t) ((C) >> 0)); HTCW_WR_H
#define HTCW_WRITE32(C) GPIO.out_w1tc = HTCW_CLR_MASK; GPIO.out_w1ts = HTCW_SET_MASK((uint8_t) ((C) >> 24)); HTCW_WR_H; \
                        GPIO.out_w1tc = HTCW_CLR_MASK; GPIO.out_w1ts = HTCW_SET_MASK((uint8_t) ((C) >> 16)); HTCW_WR_H; \
                        GPIO.out_w1tc = HTCW_CLR_MASK; GPIO.out_w1ts = HTCW_SET_MASK((uint8_t) ((C) >>  8)); HTCW_WR_H; \
                        GPIO.out_w1tc = HTCW_CLR_MASK; GPIO.out_w1ts = HTCW_SET_MASK((uint8_t) ((C) >>  0)); HTCW_WR_H


Forgive the formatting. There I'm using a combination of the preprocessor and constexpr charged ifs to get them to resolve at compile time based on the pin assignments. It's a mess that should have been able to be done without the preprocessor at all.

That mess is to get it as fast as possible, so that when I do insert delays, they are minimal and controlled - I'm not blowing overhead on branch prediction misses from function calls and the like.

Anyway, at least the bit banging is fun, even if what I have to do to the C++ language isn't.

I love coding the metal. I love writing hardware interfaces. It dovetails with my love of circuit building, right there where the rubber meets the road. Turn this pin on in software, send that bit to the 8080 parallel interface connected to the display. Woo.

Something about it just feels pure.
Real programmers use butterflies

GeneralRe: IoT bit bashing. It's the most fun nightmare in town Pin
Peter_in_27805-Dec-21 14:30
professionalPeter_in_27805-Dec-21 14:30 
GeneralRe: IoT bit bashing. It's the most fun nightmare in town Pin
honey the codewitch5-Dec-21 14:38
mvahoney the codewitch5-Dec-21 14:38 
GeneralDesktop UI brainstorming Pin
Super Lloyd4-Dec-21 17:36
Super Lloyd4-Dec-21 17:36 
GeneralRe: Desktop UI brainstorming Pin
David O'Neil4-Dec-21 18:51
professionalDavid O'Neil4-Dec-21 18:51 
GeneralRe: Desktop UI brainstorming Pin
Super Lloyd4-Dec-21 23:19
Super Lloyd4-Dec-21 23:19 
GeneralRe: Desktop UI brainstorming Pin
RickZeeland4-Dec-21 19:57
mveRickZeeland4-Dec-21 19:57 
GeneralRe: Desktop UI brainstorming Pin
Super Lloyd4-Dec-21 23:21
Super Lloyd4-Dec-21 23:21 
GeneralRe: Desktop UI brainstorming Pin
RickZeeland4-Dec-21 23:41
mveRickZeeland4-Dec-21 23:41 
GeneralRe: Desktop UI brainstorming Pin
charlieg5-Dec-21 1:15
charlieg5-Dec-21 1:15 
GeneralRe: Desktop UI brainstorming Pin
Super Lloyd5-Dec-21 3:34
Super Lloyd5-Dec-21 3:34 
GeneralRe: Desktop UI brainstorming Pin
Gerry Schmitz5-Dec-21 7:46
mveGerry Schmitz5-Dec-21 7:46 
GeneralRe: Desktop UI brainstorming Pin
RickZeeland5-Dec-21 10:01
mveRickZeeland5-Dec-21 10:01 
GeneralRe: Desktop UI brainstorming Pin
Super Lloyd5-Dec-21 11:45
Super Lloyd5-Dec-21 11:45 
GeneralRe: Desktop UI brainstorming Pin
BillWoodruff5-Dec-21 15:53
professionalBillWoodruff5-Dec-21 15:53 
GeneralRe: Desktop UI brainstorming Pin
Super Lloyd5-Dec-21 16:47
Super Lloyd5-Dec-21 16:47 
GeneralRe: Desktop UI brainstorming Pin
BillWoodruff5-Dec-21 17:49
professionalBillWoodruff5-Dec-21 17:49 
GeneralRe: Desktop UI brainstorming Pin
Super Lloyd5-Dec-21 18:04
Super Lloyd5-Dec-21 18:04 

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.