Live data from Hacker News

Open-Sourcing our Firmware

frame.work

361–370 of 382 posts

Re: Open-Sourcing our Firmware

#361

Earlier quoted context omitted.

I can run a Linux vm emulating x64 or aarch64 right now on M1… It’s more flexible that WSL2 in my opinion See https://github.com/lima-vm/lima for a very friendly QEMU wrapper

I can write a program and send it to my friend - and they can actually run it - without me paying $99/year to Apple. Try that on your M1.

You can run unsigned software on an M1 Mac, clicking “run anyway” isn’t that hard lol

Re: Open-Sourcing our Firmware

#362

Earlier quoted context omitted.

IIRC those already exist in the form of optical switches.

Yes, but they are overengineering a simple problem. A mechanical bounce free switch is a no problem at all.

>A mechanical bounce free switch is a no problem at all.

Two questions:

1) do mechanical switches with zero bounce really exist?

2) are they cost effective enough to be used in consumer keyboards?

Re: Open-Sourcing our Firmware

#363
post #342

Earlier quoted context omitted.

Why? Do you feel similar about not having a "real" dedicated key to ctrl+c / ctrl+v ?

It takes two hands to use Fn+Up/Down instead of PageUp/PageDown keys to scroll around. These keys are for some people the most common keys used for fast nevigation in code and documents. Ctrl+C / Ctrl+V are used far less often, and you can type them with one hand.

> It takes two hands to use Fn+Up/Down instead of PageUp/PageDown keys to scroll around

Doesn't seem like a big deal, I'm trying to think of a situation where I need the other hand to be free while paging or moving to end of the line.

> These keys are for some people the most common keys used for fast nevigation in code and documents.

Seems like a personal preference. I have a working trackpad so I almost never use them. Also, home/end on a thinkpad are out of reach anyway. And what's the point of 'insert' ?

> Ctrl+C / Ctrl+V are used far less often,

I use these constantly, I don't remember touching home/end ever, pg up/dwn maybe by accident.

Re: Open-Sourcing our Firmware

#364
post #176

Earlier quoted context omitted.

And I hate the ThinkPad 6-key cluster because of accidentally hitting the pgup and pgdown buttons. I decapped both buttons because of it. Same with the the fn button next to ctrl.

Different strokes for different folks. I'm personally just glad that we were able to collectively hate the Touch Bar enough for Apple to '86 it.

Pedantry incoming, but “86” doesn’t need the apostrophe before it.

The etymology from what I remember comes from the fact that if asking for 86 of anything at once is impossible to provide.

Re: Open-Sourcing our Firmware

#365

Earlier quoted context omitted.

Yes, but they are overengineering a simple problem. A mechanical bounce free switch is a no problem at all.

>A mechanical bounce free switch is a no problem at all. Two questions: 1) do mechanical switches with zero bounce really exist? 2) are they cost effective enough to be used in consumer keyboards?

> 1) do mechanical switches with zero bounce really exist?

You just use a switch with 2 outputs: for on, and off position. Triggering 2 at the same time is impossible.

> 2) are they cost effective enough to be used in consumer keyboards?

Surely less than a percentage of a cent in extra cost.

Re: Open-Sourcing our Firmware

#366

Earlier quoted context omitted.

>A mechanical bounce free switch is a no problem at all. Two questions: 1) do mechanical switches with zero bounce really exist? 2) are they cost effective enough to be used in consumer keyboards?

> 1) do mechanical switches with zero bounce really exist? You just use a switch with 2 outputs: for on, and off position. Triggering 2 at the same time is impossible. > 2) are they cost effective enough to be used in consumer keyboards? Surely less than a percentage of a cent in extra cost.

>You just use a switch with 2 outputs: for on, and off position. Triggering 2 at the same time is impossible.

But then the switch will still bounce except now it bounces with an extra state and you need extra logic to read an extra output per switch and debounce both outputs, which also makes PCB's more complex further increasing the cost.

>Surely less than a percentage of a cent in extra cost.

With the extra PCB and custom logic complexity you just added with the extra output per switch, you're looking at way more than that, which I guess is why the industry went optical instead of following your idea.

Re: Open-Sourcing our Firmware

#367

Earlier quoted context omitted.

I can write a program and send it to my friend - and they can actually run it - without me paying $99/year to Apple. Try that on your M1.

You can run unsigned software on an M1 Mac, clicking “run anyway” isn’t that hard lol

That is untrue for native arm apps. The OS actually requires signing. If you are running an x86 app through Rosetta you can currently avoid code signing requirement.

https://eclecticlight.co/2020/08/22/apple-silicon-macs-will-...

Re: Open-Sourcing our Firmware

#368
post #276
post #165

I checked the keyboard debouncing logic [0] and it was fine. Some keyboards from other manufacturers, notably Lenovo Thinkpads, have absurd debouncing algorithms that scramble keys or add delays, so it's good to see Framework has a correct solution. [0]: https://github.com/FrameworkComputer/EmbeddedController/blob...

I find the has_ghosting() function more problematic and reminds me of why C just sucks even if it is the appropriate choice. c and c2 loop variables so a typo can hose you horribly. A global variable to hold the array length. ! instead of comparison to 0. Having to offset the second loop by 1. Early return which means the function will normally work fine but might result in N^2 extra time depending upon the data stat…

> A global variable to hold the array length.

This is a microcontroller firmware. Moving what is essentially a constant around the stack would be insanity.

> ! instead of comparison to 0

Not a problem and even idiomatic.

> Early return which means the function will normally work fine but might result in N^2 extra time depending upon the data state.

It only takes N^2 time when all columns have at least one key pressed but not have at least two rows in common in any of them (except maybe the last two) - hardly a state that you care that much about. Would you really want to increase the latency/power consumption for single key presses just to have the exceptional case not be slower than normal?

If you wanted to you could restrict the early exit with the same test for having at least two bits set. If the key matrix has no unused slots you would then only check if there is another column which shares any set row bits (because it would then share all of them), which could let you make the algorithm O(n) with some additional memory for row bit counts. But the code would be more complicated and the number of columns is not dymanic. Plus the key matrix most likely has unused slots precisely to avoid ghosting for common combinations.

> A bit trick relying on unsigned underflow without pointing out that unsigned is a key constraint even though it has a comment.

The variable with type is declared right before the bit trick. If you change it to signed when there are bit operations, especially ones you don't understand, then you deserve what you get. However, this trick does not rely on unsigned underflow. the only concern with signed (assuming two's complement) would be if the sign bit is the only one set, in which case the signed underflow would be undefined at the language level - but not a problem at the hardware level since two's complement addition/subtraction is exactly the same as unsigned addition/subtraction.

> An extra missing const on the incoming pointer (should be: const uint8_t * const).

const on the outside of function parameter types (as opposed to inside them) does not change how the function can be called. Sure, you could make all local variables const if they can be but for such a tiny function that really does not add anything.

> Braces left off the short-circuit if conditionals.

Meh, that is a code style choice and no reason to complain about C. Also not really that dangerous with modern compilers that warn based on misleading indentation.

And you missed the actually bad part of the function: The comment that says the colummns are ORed together when they are ANDed.

Re: Open-Sourcing our Firmware

#369

Earlier quoted context omitted.

> 1) do mechanical switches with zero bounce really exist? You just use a switch with 2 outputs: for on, and off position. Triggering 2 at the same time is impossible. > 2) are they cost effective enough to be used in consumer keyboards? Surely less than a percentage of a cent in extra cost.

>You just use a switch with 2 outputs: for on, and off position. Triggering 2 at the same time is impossible. But then the switch will still bounce except now it bounces with an extra state and you need extra logic to read an extra output per switch and debounce both outputs, which also makes PCB's more complex further increasing the cost. >Surely less than a percentage of a cent in extra cost. With the extra PCB and…

> But then the switch will still bounce except now it bounces with an extra state and you need extra logic to read an extra output per switch and debounce both outputs, which also makes PCB's more complex further increasing the cost.

No, you don't need to debounce both. Both signals will never be connected at once.

Re: Open-Sourcing our Firmware

#370
post #177

Earlier quoted context omitted.

Debounce is an interesting topic[0], I tend to use hardware debounce whenever possible on my own projects. [0]: https://hackaday.com/2010/11/09/debounce-code-one-post-to-ru...

Don't accept a keypress if the same key was previously pressed less than x milliseconds ago. What else is there to know about debouncing?

The problem is that you're dealing with an analogue signal. The gold standard for debouncing because of that is a low-pass filter, which is implementable by a resistor and capacitor, and way more reliable (and responsive) than any software solution.
Post reply on HN