God help me Image
Structy generates code by reading a schema written using Python syntax:

In vs Out (c): Image
Note that I said "Python syntax" not Python. I'm just using Python's parser to generate an AST and just reading that to generate the code.
To pack and unpack the struct, the generated code uses a lightweight library based on Python's "struct" library. It uses format specifiers to pack stuff in. Think printf for binary data: ImageImage
Since it knows about types, it can also generate a nice debug print function for the struct. It even handles the custom "fix16_t" type. Image
Oh yeah I got Python generation kind of working too. Image
I still got a bit to do before I release this to the world. But you might be asking why I'm doing this instead of using .... anything else.

The reason is that I like to keep my firmware super small and super simple. Protobuf & friends just... are too much.
Structy is made to replace some C code in my firmware that looks like this: Image
Everytime I added or updated a field for that struct I'd have to update this function, the matching serialization function, and the Python & JavaScript versions! That's like... 6 places I have to update! Ugh. (python code pictured) Image
It's fragile and annoying, but protobuf & friends are *overkill*. I just need to pass some dumb structs with scalar fields.

Hence, structy.

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Stargirl🌠

Stargirl🌠 Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @theavalkyrie

9 Jan
Lmfao how am I ever supposed to get well enough to return to my job?
I know y'all see me posting stuff and are probably confused as to why I'm not able to work right now. It's because I'm mentally ill. The creative stuff I do outside of work- like electronics and neat blog posts- are mechanisms for me to regain my abilities.
But they're hard. Focusing is all or nothing for me- I either can not focus at all or I laser focus on something to the point where I don't eat, sleep, or anything. Starting and finishing creative tasks is incredibly difficult and inconsistent for me.
Read 10 tweets
9 Jan
You stupid motherfuckers are about 4 years late. Y'all are complicit. You gave him a platform- a megaphone. You encouraged him. You made money from him.

You only give a fuck now because he can't retaliate anymore.
Don't even pretend otherwise. Your Safety team routinely suspends the accounts of trans people for no god damn reason. Trump should've been banned ages ago but your leadership has protected him for FOUR YEARS.

Fuck you, Twitter Safety & Leadership. I don't feel any more safe.
"After close review". Your review took four years? Four years?! Hundreds of thousands of people dead because of this demagogue and you let it happen for *years*.

I hope to high hell that that the new administration seeks to heavily regulate Twitter & Facebook.
Read 6 tweets
8 Jan
I've been throwing myself at making a tiny c library a beautiful polished rock because I've been outright avoiding processing anything that's happening in my life.
Why would I try to deal with my crushing loneliness and anxiety when I could enable another esoteric compiler warning and make sure my 300 lines of code doesn't upset software daddy?
Why try to figure out how the hell I'm supposed to go back to work when I could read through the disassembly of switch statement?
Read 5 tweets
17 Nov 20
I'm taking apart my KeyStep for $REASONS, so here's a thread of interesting things I've found!

🧵
First up is the brains of the operation: an STM32F103. Not a lightweight chip: It's a Cortex M3 @ 72MHz. It's got 256kB of flash and 48kB of RAM and that's a 100-pin TQFP package!

st.com/en/microcontro…
The KeyStep has a 9V power input so I wanted to see what voltage regulator it uses - no surprises here, it's the tried and true LD1117. Nice heatsink design.
Read 14 tweets
15 Nov 20
I once raised an issue with a SVP of marketing for only highlighting a single cis male drag queen instead of the incredible accomplishments of a multitude of LGBTQ women.

Nothing fucking happened. He got the whole spotlight, we got the bullshit excuses.
If you're a trans woman reading this: It's complicated and nuanced and my take wasn't so much about people in the trans community but just cis people in general thinking that it's this universally affirming thing for trans women.
Read 4 tweets
5 Aug 20
Mark's a nice guy and has great advice, but I'm about to challenge this piece of advice:

"um", "like", "you know", etc. are *FINE* and *NATURAL* when giving talks.

You are better off spending your time practicing other aspects of public speaking than trying to eliminate these.
There's a reason we tend to use these filler words - it's a natural partner of human speech. They appear in every natural language. The serve an important linguistic purpose.
The biggest is that in conversations they indicate that the current speaker isn't done with a thought, so that other people int he conversation don't interrupt. Of course, when on stage it's a one side conversation. But- this isn't the only purpose.
Read 10 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!