|
|
I started creating a way to connect devices to Winduino. You literally load up the hardware, which is a dll, and then you can set some arbitrary configuration properties if necessary, then you can connect the wires together - literally pin to pin connections from your virtual Arduino board to your virtual sensor, display, or other module.
Implementing an SPI slave and master setup by virtually bit-banging (both master/host and slave/device) at both ends is weird, fun, and challenging. It's basically emulating the hardware enough that you can then build the HAL code on top of that.
Here's code in the slave for processing incoming data as the SPI CLK line changes, looking for particular commands in the stream, and updating the framebuffer as SPI data comes in, much like the actual hardware would do. It's neat.
static void process_byte(uint8_t val) {
if (can_configure) return;
if (dc.value()) {
switch (st) {
case STATE_WRITE:
switch (offset) {
case 0:
write_col = val << 8;
++offset;
++bytes_written;
break;
case 1:
write_col |= val;
uint8_t r = ((float)((write_col >> 11) & 31) / 31.0f) * 255;
uint8_t g = ((float)((write_col >> 5) & 63) / 63.0f) * 255;
uint8_t b = ((float)((write_col >> 0) & 31) / 31.0f) * 255;
if (WAIT_OBJECT_0 == WaitForSingleObject(
render_mutex, INFINITE)) { uint8_t* p = &frame_buffer[column + screen_size.width * row * 4];
*p++ = b;
*p++ = g;
*p++ = r;
*p = 0xFF;
}
++column;
if (column > col_end) {
++row;
if (row > row_end) {
st = STATE_IGNORING;
break;
}
}
++bytes_written;
offset = 0;
break;
}
break;
default:
if (cmd_args_cap == 0) {
cmd_args_cap = 16;
cmd_args_size = 0;
cmd_args = (uint8_t*)malloc(cmd_args_cap);
if (cmd_args == nullptr) {
return;
}
} else if (cmd_args == nullptr) {
return;
}
if (cmd_args_size >= cmd_args_cap) {
cmd_args_cap += (cmd_args_cap * .8);
cmd_args = (uint8_t*)realloc(cmd_args, cmd_args_cap);
if (cmd_args == nullptr) {
return;
}
}
cmd_args[cmd_args_size++] = val;
switch (st) {
case STATE_COLSET:
if (cmd_args_size == 4) {
uint16_t r = cmd_args[0] << 8;
r |= cmd_args[1];
col_start = r;
r = cmd_args[2] << 8;
r |= cmd_args[3];
col_end = r;
cmd_args_size = 0;
column = col_start;
st = STATE_IGNORING;
}
break;
case STATE_ROWSET:
if (cmd_args_size == 4) {
uint16_t r = cmd_args[0] << 8;
r |= cmd_args[1];
row_start = r;
row = row_start;
r = cmd_args[2] << 8;
r |= cmd_args[3];
row_end = r;
cmd_args_size = 0;
st = STATE_IGNORING;
}
case STATE_WRITE:
if (bytes_written == sizeof(uint16_t) * (row_end - row_start + 1) * (col_start - col_end + 1)) {
st = STATE_IGNORING;
}
break;
}
break;
}
} else {
bytes_written = 0;
bytes_read = 0;
cmd = val;
if (cmd == colset) {
st = STATE_COLSET;
} else if (cmd == rowset) {
st = STATE_ROWSET;
} else if (cmd == write) {
st = STATE_WRITE;
} else if (cmd == read) {
st = STATE_READ;
} else {
st = STATE_IGNORING;
cmd_args_size = 0;
}
}
}
static void on_clk_changed(void* state) {
if (cs.value()) return;
if (clk.value()) {
if (bit_count == 8) {
process_byte(in_byte);
bit_count = 0;
in_byte = 0;
}
in_byte |= mosi.value();
++bit_count;
} else {
in_byte << 1;
}
}
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
#Worldle #609 3/6 (100%)
π©π©π©π©π¨β‘οΈ
π©π©π©π©β¬β¬
οΈ
π©π©π©π©π©π
https://worldle.teuteuf.fr
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
Wordle 826 3/6
π¨β¬π¨β¬β¬
β¬β¬π¨π¨π©
π©π©π©π©π©
|
|
|
|
|
Wordle 826 4/6
β¬π¨π¨β¬β¬
β¬π©β¬π¨β¬
π©π©β¬β¬π©
π©π©π©π©π©
|
|
|
|
|
π©π¨π¨β¬β¬
π©π©π©β¬β¬
π©π©π©β¬π¨
π©π©π©π©π©
In a closed society where everybody's guilty, the only crime is getting caught. In a world of thieves, the only final sin is stupidity. - Hunter S Thompson - RIP
|
|
|
|
|
Wordle 826 3/6*
π¨π¨π¨β¬β¬
β¬π¨π¨π¨π¨
π©π©π©π©π©
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Wordle 826 3/6
π©π¨π¨β¬β¬
π©β¬β¬π¨π¨
π©π©π©π©π©
|
|
|
|
|
Wordle 826 4/6
π¨π¨π¨β¬β¬
β¬π¨π¨π¨π¨
β¬π©π©π©π©
π©π©π©π©π©
Ok, I have had my coffee, so you can all come out now!
|
|
|
|
|
Wordle 826 4/6
π¨β¬β¬β¬β¬
π©β¬β¬β¬π¨
π©π¨π©π¨π©
π©π©π©π©π©
That third guess
|
|
|
|
|
Wordle 826 5/6
π¨β¬β¬β¬β¬
β¬π¨β¬π¨π¨
π¨π¨π¨β¬β¬
π©π©π©β¬π¨
π©π©π©π©π©
|
|
|
|
|
Wordle 826 5/6
β¬π¨β¬β¬β¬
β¬π¨β¬π©β¬
β¬β¬β¬π©π¨
π¨π©β¬π©β¬
π©π©π©π©π©
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
Wordle 826 4/6
β¬β¬π¨π¨β¬
π¨π©β¬β¬β¬
β¬π©β¬π©π¨
π©π©π©π©π©
Jeremy Falcon
|
|
|
|
|
Edge, that is. I just received the pdf for the preliminary design of a 35 mile 69kV power line and tried to print. Edge declared itself the default pdf viewer/printer application and attempted to open the file. After about 10 minutes it finally showed a preview to me, but when I tried to print the document (33 C-size pages) it froze for 15 minutes, then declared it couldn't calculate the size of the job, then stopped completely, showing me a black screen.
Silly Microsoft; you're d$%^ed invasive browser can't do everything, nor should it!
How do I get it off my computer? Grrr... Even if I could, that would probably break something else.
PS - Installed Acrobat and it printed immediately without a hitch.
Will Rogers never met me.
|
|
|
|
|
Your "Microsoft QA Engineer" badge is in the mail.
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
I have a memory from a dew decades ago where MS was working very hard at integrating the operating system into their browser and claiming that the browser was integral to the entire system, etc. Funny how things go around again and the same old crap is starting. I suspect some enterprising Microsoft haters out there have come up with ways to turn off Edge, but I also think most of the "mandatory updates" just turn it all back on.
Charlie Gilley
βThey who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.β BF, 1759
Has never been more appropriate.
|
|
|
|
|
I don't know if this is still the case, but I found the graphics rendering in PDFs was way better when they used their own rendering engine in Edge vs the chromium version. Much sharper, cleaner. I noticed this when I was doing some SW development for a company in the printing industry, and previewing what a print job would look like.
I guess I can understand the reason for moving to chromium, but that doesn't mean MS didn't do some things better...
|
|
|
|
|
Andreas Mertens wrote: but that doesn't mean MS didn't do some things better... Shhh. That's not P.C.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I remember stress testing about 8 programs to print PDF. We had a 2000 page report.
I tried to print 10 copies in parallel on a βpausedβ printer so that it would get stuck in the spooler. (So I could just delete the paused jobs)
That one file eliminated 6 candidates.
The 2 remaining products had totally different licensing models which brought us down to one product very quickly. We had a great relationship with that vendor until we eliminated all printing from the product. Reasonable price and easy to work with.
|
|
|
|
|
|
That's OK, "BitCoin will go to $500,000 in 2024", says so and so ... so you can get all your money back.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
Please remember that a lot of youth who was claiming NFT to be greatest thing ever which will change the world, has attention span small enough to already forget that NFTs exist.
"It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[ ^]
|
|
|
|
|
I wouldn't count myself a youth but I had already forgotten NFTs existed. 
|
|
|
|
|
I sold some of my "comic art" in grade school for a dime ... I think it's value kept pace!
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
As opposed to 100% last year? Seems to be an improvement.
|
|
|
|