|
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
🟨⬛🟨⬛⬛
⬛⬛🟨🟨🟩
🟩🟩🟩🟩🟩
|
|
|
|
|
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
|
|
|
|
|
|
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.
|
|
|
|
|
|
I find I can bear this disaster with tremendous fortitude.*
* And snigger while I read it ...
"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!
|
|
|
|
|
Quote: "This daunting reality should serve as a sobering check on the euphoria that has often surrounded the NFT space," This daunting reality should serve as a sobering reminder of how stupid people can be.
|
|
|
|
|
Truth.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
Maybe you should explain to others what a NFT is.
Real physical gold doubled it's value in a few years. Basic math.
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Ration keeper has a stake in the company (11)
"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!
|
|
|
|
|
Shareholder
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
|
|
|
|
|
The easy theme continues - you are up Monday as a result!
"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!
|
|
|
|
|
Normal service will resume on Monday
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 825 3/6
⬛🟩⬛⬛⬛
⬛🟩⬛🟨⬛
🟩🟩🟩🟩🟩
|
|
|
|
|
Wordle 825 3/6
⬜⬜⬜⬜🟨
🟨⬜🟩⬜⬜
🟩🟩🟩🟩🟩
|
|
|
|
|
Wordle 825 3/6
🟨⬜⬜⬜⬜
🟩⬜⬜🟨🟨
🟩🟩🟩🟩🟩
|
|
|
|
|
Wordle 825 3/6
⬜🟨⬜⬜⬜
⬜🟨🟩⬜⬜
🟩🟩🟩🟩🟩
|
|
|
|
|
Wordle 825 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!
|
|
|
|