Author Topic: Next GH-brewed KB design - 'The Light' (open for discussion)  (Read 109375 times)

0 Members and 1 Guest are viewing this topic.

Offline The_Ed

  • Posts: 1350
  • Location: MN - USA
  • Asperger's... SQUIRREL! I'm Anal Retentive *****!
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #600 on: Fri, 22 June 2012, 11:13:32 »
24ppr is 96 2-bit codes per revolution. I have attached one of the rotary encoders up to 2 LEDs before to manually observe this process. It does exactly as it says it does. At a 5ms debouncing time for each 2-bit code I would be able to turn it at 2 RPS with no issues.

I would think interrupts would be bad for something like a rotary encoder that is in a constant state of chattering. And wouldn't be able to tell time like a variable that is updated once a millisecond during polling.

Unless the interrupt can be told to only fire for every 5ms of constant state. In which case it would be more efficient.

Like I said, I've never programmed hardware before.

1000hz is a standard, but a higher multiple could also be used. Anything less would be too little in my opinion.
« Last Edit: Fri, 22 June 2012, 12:30:51 by The_Ed »
Reaper "frelled" me... Twice... Did he "frell" you too?... *brohug*
I'm camping for a week, and moving twice in a month. I'll get back to you when I can (If I don't then just send me another PM).
R.I.P.ster

Offline Soarer

  • * Moderator
  • Posts: 1918
  • Location: UK
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #601 on: Fri, 22 June 2012, 11:40:09 »
Oh, it needs to debounce. Fair enough. Well the main timebase will be the per-column timer interrupt, running at something like 4 to 16 kHz (a constant freq., just not decided yet).

2 RPM seems hellish slow though!

Offline The_Ed

  • Posts: 1350
  • Location: MN - USA
  • Asperger's... SQUIRREL! I'm Anal Retentive *****!
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #602 on: Fri, 22 June 2012, 12:14:39 »
2 RPS for any knob is more than enough. You need to regrip it like every half turn.

4 to 16 kHz / 20 to 22 columns < 1000hz... That's between 180hz and 800hz... Not nearly enough...
« Last Edit: Fri, 22 June 2012, 12:31:11 by The_Ed »
Reaper "frelled" me... Twice... Did he "frell" you too?... *brohug*
I'm camping for a week, and moving twice in a month. I'll get back to you when I can (If I don't then just send me another PM).
R.I.P.ster

Offline Soarer

  • * Moderator
  • Posts: 1918
  • Location: UK
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #603 on: Fri, 22 June 2012, 12:19:04 »
Keyboards typically scan at maybe a couple of hundred Hz. 1000Hz would be nice if we can.

And, again, it's not 20 to 22 columns, it's 16 or less. (8 * 16 = 128 keys).

So 15 seconds for half a turn of the knob???!!!
« Last Edit: Fri, 22 June 2012, 12:22:37 by Soarer »

Offline hazeluff

  • * Vendor
  • Posts: 2384
  • Location: Vancouver, BC
  • 光復香港
    • Hazeluff
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #604 on: Fri, 22 June 2012, 12:24:42 »
I haven't been keeping up with this and it seems a lots gone through, anyone mind recapping it to save me the pain of reading through the recent stuff?
Fight For Freedom. Stand with Hong Kongers

Offline The_Ed

  • Posts: 1350
  • Location: MN - USA
  • Asperger's... SQUIRREL! I'm Anal Retentive *****!
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #605 on: Fri, 22 June 2012, 12:25:13 »
There was a 137? key layout talked about a few months ago in this thread. 8 x 18 = 144. 4000 / 18 = 220hz... NEEDS MOAR!...
Reaper "frelled" me... Twice... Did he "frell" you too?... *brohug*
I'm camping for a week, and moving twice in a month. I'll get back to you when I can (If I don't then just send me another PM).
R.I.P.ster

Offline The_Ed

  • Posts: 1350
  • Location: MN - USA
  • Asperger's... SQUIRREL! I'm Anal Retentive *****!
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #606 on: Fri, 22 June 2012, 12:26:41 »
Quote from: Soarer;619560
So 15 seconds for half a turn of the knob???!!!

I've been up all night... RPS is what I meant...
Reaper "frelled" me... Twice... Did he "frell" you too?... *brohug*
I'm camping for a week, and moving twice in a month. I'll get back to you when I can (If I don't then just send me another PM).
R.I.P.ster

Offline The_Ed

  • Posts: 1350
  • Location: MN - USA
  • Asperger's... SQUIRREL! I'm Anal Retentive *****!
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #607 on: Fri, 22 June 2012, 12:29:48 »
Quote from: hazeluff;619569
I haven't been keeping up with this and it seems a lots gone through, anyone mind recapping it to save me the pain of reading through the recent stuff?

Rotary encoders... That is all...

Now go read everything you missed, it's good for you. And disregard RPM, I meant RPS.

Oh, and I have 152 posts in this thread alone. That's like a quarter of this thread... And more than 17% of my posts... And a large portion of my posts in this thread were rolled back too...
« Last Edit: Fri, 22 June 2012, 12:37:28 by The_Ed »
Reaper "frelled" me... Twice... Did he "frell" you too?... *brohug*
I'm camping for a week, and moving twice in a month. I'll get back to you when I can (If I don't then just send me another PM).
R.I.P.ster

Offline Soarer

  • * Moderator
  • Posts: 1918
  • Location: UK
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #608 on: Fri, 22 June 2012, 12:44:50 »
Quote from: hazeluff;619569
I haven't been keeping up with this and it seems a lots gone through, anyone mind recapping it to save me the pain of reading through the recent stuff?

PrinsValium and litster got married and are on honeymoon.
djuzah, mkawa and the_ed have huddled into an irritation of trolls.
The prototype is still absent.
There was a run on suncream at the store because of rumours of 100,000 lumen keyboards.
The network has confirmed a second series, so the first won't have any real ending...

Offline The_Ed

  • Posts: 1350
  • Location: MN - USA
  • Asperger's... SQUIRREL! I'm Anal Retentive *****!
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #609 on: Fri, 22 June 2012, 12:48:47 »
Wow, it's scary how close to reality those are... Cree XM-L FTW!

The aluminum cases act as the heatsinks!
Reaper "frelled" me... Twice... Did he "frell" you too?... *brohug*
I'm camping for a week, and moving twice in a month. I'll get back to you when I can (If I don't then just send me another PM).
R.I.P.ster

Offline The_Ed

  • Posts: 1350
  • Location: MN - USA
  • Asperger's... SQUIRREL! I'm Anal Retentive *****!
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #610 on: Fri, 22 June 2012, 12:52:58 »
Any chance on the clock being 32kHz? That would raise the actual poll rate high enough.
Reaper "frelled" me... Twice... Did he "frell" you too?... *brohug*
I'm camping for a week, and moving twice in a month. I'll get back to you when I can (If I don't then just send me another PM).
R.I.P.ster

Offline REVENGE

  • Posts: 568
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #611 on: Fri, 22 June 2012, 13:01:42 »
Quote from: Soarer;619593
PrinsValium and litster got married and are on honeymoon.
djuzah, mkawa and the_ed have huddled into an irritation of trolls.
The prototype is still absent.
There was a run on suncream at the store because of rumours of 100,000 lumen keyboards.
The network has confirmed a second series, so the first won't have any real ending...

:rofl:

Funny only because it's truth.
◕ ‿ ◕

Offline Soarer

  • * Moderator
  • Posts: 1918
  • Location: UK
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #612 on: Fri, 22 June 2012, 13:11:20 »
Quote from: The_Ed;619603
Any chance on the clock being 32kHz? That would raise the actual poll rate high enough.

No.

Offline The_Ed

  • Posts: 1350
  • Location: MN - USA
  • Asperger's... SQUIRREL! I'm Anal Retentive *****!
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #613 on: Fri, 22 June 2012, 13:16:02 »
That means I'll either have to lessen the debouncing time or have less than 2 RPS. Is 16kHz very likely?
Reaper "frelled" me... Twice... Did he "frell" you too?... *brohug*
I'm camping for a week, and moving twice in a month. I'll get back to you when I can (If I don't then just send me another PM).
R.I.P.ster

Offline litster

  • Posts: 2890
  • rare caps?! THAT'S A SMILIN
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #614 on: Fri, 22 June 2012, 13:22:48 »
Quote from: Soarer;619593
PrinsValium and litster got married and are on honeymoon.
djuzah, mkawa and the_ed have huddled into an irritation of trolls.
The prototype is still absent.
There was a run on suncream at the store because of rumours of 100,000 lumen keyboards.
The network has confirmed a second series, so the first won't have any real ending...

Quote from: The_Ed;619597
Wow, it's scary how close to reality those are... Cree XM-L FTW!

The aluminum cases act as the heatsinks!

Quote from: REVENGE;619606
:rofl:

Funny only because it's truth.

I was scanning the posts and then I saw my name next to "married"!  BTW, I am going to meet BiNiaRiS this weekend for our secret rendezvous.  Please don't tell Prins!

Offline The_Ed

  • Posts: 1350
  • Location: MN - USA
  • Asperger's... SQUIRREL! I'm Anal Retentive *****!
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #615 on: Fri, 22 June 2012, 13:27:34 »
My dad likes kraken. Rum and coke is his favorite drink. But why the hell would you drive 3-4 hours each way?!
Reaper "frelled" me... Twice... Did he "frell" you too?... *brohug*
I'm camping for a week, and moving twice in a month. I'll get back to you when I can (If I don't then just send me another PM).
R.I.P.ster

Offline litster

  • Posts: 2890
  • rare caps?! THAT'S A SMILIN
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #616 on: Fri, 22 June 2012, 13:33:42 »
Dedication, man.  Dedication.

Offline mkawa

  •  No Marketplace Access
  • Posts: 6562
  • (ツ)@@@. crankypants
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #617 on: Fri, 22 June 2012, 13:34:45 »
Quote from: litster;619621
I was scanning the posts and then I saw my name next to "married"!  BTW, I am going to meet BiNiaRiS this weekend for our secret rendezvous.  Please don't tell Prins!
don't be silly litster, you're happily married to ping!

besides, prins is a swedish prince. it would never work :(

anyway i think most of us are out of sync here. someone take the lock and atomically present a schematic and some sample code in one shot. that person should naturally not be the_ed because i never have any idea what he's talking about. (rotary encoder? wth?)

also, seriously, have bini invoice me for beer money (or just take it out of my balance). i'd be there sorting with you guys if i weren't crunching for a deadline down south :(

to all the brilliant friends who have left us, and all the students who climb on their shoulders.

Offline REVENGE

  • Posts: 568
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #618 on: Fri, 22 June 2012, 13:37:23 »
Quote from: litster;619621
I was scanning the posts and then I saw my name next to "married"!  BTW, I am going to meet BiNiaRiS this weekend for our secret rendezvous.  Please don't tell Prins!
Oh no! Now he's having an affair with BiNi?!?!

What sort of nasty Cherry vintage board swapping is going on here!
◕ ‿ ◕

Offline mkawa

  •  No Marketplace Access
  • Posts: 6562
  • (ツ)@@@. crankypants
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #619 on: Fri, 22 June 2012, 13:39:39 »
Quote from: REVENGE;619637
Oh no! Now he's having an affair with BiNi?!?!

What sort of nasty Cherry vintage board swapping is going on here!
there are no cherries involved here. bini's cherry(ies?) was stolen long ago

he said he still has some minitouches though!

to all the brilliant friends who have left us, and all the students who climb on their shoulders.

Offline The_Ed

  • Posts: 1350
  • Location: MN - USA
  • Asperger's... SQUIRREL! I'm Anal Retentive *****!
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #620 on: Fri, 22 June 2012, 13:39:59 »
Rotary encoders can be used for volume and seeking forward and backward. No more clicking! Multimedia FTW!
Reaper "frelled" me... Twice... Did he "frell" you too?... *brohug*
I'm camping for a week, and moving twice in a month. I'll get back to you when I can (If I don't then just send me another PM).
R.I.P.ster

Offline mkawa

  •  No Marketplace Access
  • Posts: 6562
  • (ツ)@@@. crankypants
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #621 on: Fri, 22 June 2012, 13:42:26 »
why don't you just attach one to a teensy or arduino board and do whatever you want with it then? this is a keyboard project, not a discrete volume control project (although: quick plug for ti kan's d1 and lcduino kits! http://www.amb.org/audio/delta1/)

to all the brilliant friends who have left us, and all the students who climb on their shoulders.

Offline litster

  • Posts: 2890
  • rare caps?! THAT'S A SMILIN
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #622 on: Fri, 22 June 2012, 13:51:13 »
Quote from: mkawa;619634
that person should naturally not be the_ed because i never have any idea what he's talking about. (rotary encoder? wth?)


Mr. Ed is the Ed!


Offline The_Ed

  • Posts: 1350
  • Location: MN - USA
  • Asperger's... SQUIRREL! I'm Anal Retentive *****!
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #623 on: Fri, 22 June 2012, 13:51:52 »
Why can't I add rotary encoders to a CUSTOM keyboard?
Reaper "frelled" me... Twice... Did he "frell" you too?... *brohug*
I'm camping for a week, and moving twice in a month. I'll get back to you when I can (If I don't then just send me another PM).
R.I.P.ster

Offline The_Ed

  • Posts: 1350
  • Location: MN - USA
  • Asperger's... SQUIRREL! I'm Anal Retentive *****!
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #624 on: Fri, 22 June 2012, 14:01:54 »
Special Keyboard for Ed! YAY!

[ Attachment Invalid Or Does Not Exist ] 53695[/ATTACH]
Reaper "frelled" me... Twice... Did he "frell" you too?... *brohug*
I'm camping for a week, and moving twice in a month. I'll get back to you when I can (If I don't then just send me another PM).
R.I.P.ster

Offline Soarer

  • * Moderator
  • Posts: 1918
  • Location: UK
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #625 on: Fri, 22 June 2012, 14:03:53 »
Quote from: The_Ed;619613
That means I'll either have to lessen the debouncing time or have less than 2 RPS. Is 16kHz very likely?

I don't see how changing the scanning freq. changes anything there - isn't the max rate effectively a function of debounce time and number of steps / revolution?

A quick google finds some folk using hardware debounce, and interrupts. Which is how I would tackle it.

Also, it seems that maybe bouncing can be handled as if it is normal input, especially if you have an encoder with detents. The bouncing moves your internal counter up/down by one step each bounce (if you catch it), but that has no effect because you're waiting for four correct steps before making any output. If you don't catch the bounce, then you don't change your internal counter anyway. (You'd fail to catch a bounce if an interrupt fired, but when you looked the signal was in the same state as before).

For this firmware the emphasis is on the LEDs. At the fast end, we want 256 levels of brightness in PWM. At the slow end, we want a fast enough scan to avoid flicker and to read keys enough. In the middle, we want as many steps as possible so that the timing of the scannning interrupt isn't too critical. There really isn't much room for manoeuvre!

edit (sorry): We can easily keep a few pins aside for you, which can trigger interrupts (if you want). But messing with the timing stuff isn't going to happen - you'll just have to see if it works for you once it's done, I'm afraid.
« Last Edit: Fri, 22 June 2012, 14:12:38 by Soarer »

Offline mkawa

  •  No Marketplace Access
  • Posts: 6562
  • (ツ)@@@. crankypants
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #626 on: Fri, 22 June 2012, 14:16:21 »
Quote from: litster;619648
Mr. Ed is the Ed!

Show Image

this reference dates me but according to wikipedia, someone has to be a fellow named wilbur for this analogy to work. volunteers?

to all the brilliant friends who have left us, and all the students who climb on their shoulders.

Offline The_Ed

  • Posts: 1350
  • Location: MN - USA
  • Asperger's... SQUIRREL! I'm Anal Retentive *****!
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #627 on: Fri, 22 June 2012, 14:18:38 »
Quote
During the switch transitions noise is generated, typically lasting from 1 to 5 milliseconds; the switch is “bouncing”.

That's why I had a debounce time of 5ms. At 1000Hz that's 5 samples. 5ms x 96 codes per revolution = 480ms. 1 / 0.48 = 2.083 RPS.

At lower frequencies 5 samples is more than 5ms, so I get less RPS.

If I lower the number of samples I will retain my RPS, but risk debouncing issues.
Reaper "frelled" me... Twice... Did he "frell" you too?... *brohug*
I'm camping for a week, and moving twice in a month. I'll get back to you when I can (If I don't then just send me another PM).
R.I.P.ster

Offline mkawa

  •  No Marketplace Access
  • Posts: 6562
  • (ツ)@@@. crankypants
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #628 on: Fri, 22 June 2012, 14:20:48 »
ok, sorry, trolling again, but is it really that hard to add a second micro to dedicate to led scanning and computation? (potentially a series of matrix transforms if one wants to get really fancy)

i know the answer is yes, but i still have to ask!

edit: ok, ok 5 minutes of googling has convinced me that it's not worth it. the last thing we want to deal with on a frickin keyboard is an i2c bus or something equally complicated. we can probably just up the micro clock as high as we dare if we want to get fancy
« Last Edit: Fri, 22 June 2012, 14:35:54 by mkawa »

to all the brilliant friends who have left us, and all the students who climb on their shoulders.

Offline The_Ed

  • Posts: 1350
  • Location: MN - USA
  • Asperger's... SQUIRREL! I'm Anal Retentive *****!
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #629 on: Fri, 22 June 2012, 14:24:18 »
Quote from: Soarer;619654
edit (sorry): We can easily keep a few pins aside for you, which can trigger interrupts (if you want). But messing with the timing stuff isn't going to happen - you'll just have to see if it works for you once it's done, I'm afraid.

I've known this since the beginning. And who knows, it may only work if I rewrite the code. I may end up with a regular backlit board with fully functioning rotary encoders, or I may get lucky and get them fully functioning with individual LED control still working. Everyone can customize them any way they want.
Reaper "frelled" me... Twice... Did he "frell" you too?... *brohug*
I'm camping for a week, and moving twice in a month. I'll get back to you when I can (If I don't then just send me another PM).
R.I.P.ster

Offline Soarer

  • * Moderator
  • Posts: 1918
  • Location: UK
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #630 on: Fri, 22 June 2012, 14:26:41 »
Quote from: mkawa;619640
he said he still has some minitouches though!


The love that dare not speak its name.

Alps love.

Offline The_Ed

  • Posts: 1350
  • Location: MN - USA
  • Asperger's... SQUIRREL! I'm Anal Retentive *****!
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #631 on: Fri, 22 June 2012, 14:28:39 »
2 micro controllers were used in the original nixie ramos. It works for some projects, but I keep hearing an adamant "No" for keyboards...

Quote
The system is all controlled by 2 Atmega 168 micro controllers that run arduino. One of them handles all time-keeping and button/alarm events and the other handles displaying the digits on the tubes. Essentially I have one micro-controller as a master that sends short serial messages that tell the second micro-controller of what time it should display on the tubes.


Reaper "frelled" me... Twice... Did he "frell" you too?... *brohug*
I'm camping for a week, and moving twice in a month. I'll get back to you when I can (If I don't then just send me another PM).
R.I.P.ster

Offline Soarer

  • * Moderator
  • Posts: 1918
  • Location: UK
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #632 on: Fri, 22 June 2012, 14:33:29 »
Quote from: The_Ed;619670
I've known this since the beginning. And who knows, it may only work if I rewrite the code. I may end up with a regular backlit board with fully functioning rotary encoders, or I may get lucky and get them fully functioning with individual LED control still working. Everyone can customize them any way they want.

I reckon you'd be able to get it working somehow, but some - excuse me - mkawa, STFU about 2 CPUs! - some rewriting may be required for sure; sod's law says that even doing it your way would need a fair bit of tweaking to get it just right :-)

Offline mkawa

  •  No Marketplace Access
  • Posts: 6562
  • (ツ)@@@. crankypants
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #633 on: Fri, 22 June 2012, 14:36:51 »
Quote from: Soarer;619679
mkawa, STFU about 2 CPUs! -
look at my edit! look at my edit! i even googled!!

not only that but it just occurred to me that it shouldn't be too hard to export the keyboard's "frame buffer" as a device on the host controller anyway. YOU WILL GET YOUR WAVE THING EVEN IF I HAVE TO HACK FOR SEVERAL HOURS, SIR SOARER
« Last Edit: Fri, 22 June 2012, 14:46:07 by mkawa »

to all the brilliant friends who have left us, and all the students who climb on their shoulders.

Offline The_Ed

  • Posts: 1350
  • Location: MN - USA
  • Asperger's... SQUIRREL! I'm Anal Retentive *****!
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #634 on: Fri, 22 June 2012, 14:40:38 »
Sod's law - "bad fortune will be tailored to the individual", "anything that can go wrong, will", and "Toast will always land butter side down"...

Since it's firmware I can't just recompile and check for errors. I have to flash it and use it, then make tweaks, flash it again, rinse and repeat.
Reaper "frelled" me... Twice... Did he "frell" you too?... *brohug*
I'm camping for a week, and moving twice in a month. I'll get back to you when I can (If I don't then just send me another PM).
R.I.P.ster

Offline The_Ed

  • Posts: 1350
  • Location: MN - USA
  • Asperger's... SQUIRREL! I'm Anal Retentive *****!
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #635 on: Fri, 22 June 2012, 14:45:03 »
Quote from: mkawa;619681
look at my edit! look at my edit! i even googled!!

You didn't google hard enough. 2 is technically possible, but no one here wants to do it. So be it, I'm not in charge. I'll MAKE it work for my needs after this is finalized. Whether it's 1 or 2.
Reaper "frelled" me... Twice... Did he "frell" you too?... *brohug*
I'm camping for a week, and moving twice in a month. I'll get back to you when I can (If I don't then just send me another PM).
R.I.P.ster

Offline The_Ed

  • Posts: 1350
  • Location: MN - USA
  • Asperger's... SQUIRREL! I'm Anal Retentive *****!
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #636 on: Fri, 22 June 2012, 14:50:59 »
Quote from: mkawa;619681
not only that but it just occurred to me that it shouldn't be too hard to export the keyboard's "frame buffer" as a device on the host controller anyway. YOU WILL GET YOUR WAVE THING EVEN IF I HAVE TO HACK FOR SEVERAL HOURS, SIR SOARER


And you said I was confusing YOU with rotary encoders... Yeah, go get your "WAVE THING", and take your sweet time.

How did you become a moderator anyway? I've always been curious.
Reaper "frelled" me... Twice... Did he "frell" you too?... *brohug*
I'm camping for a week, and moving twice in a month. I'll get back to you when I can (If I don't then just send me another PM).
R.I.P.ster

Offline Soarer

  • * Moderator
  • Posts: 1918
  • Location: UK
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #637 on: Fri, 22 June 2012, 14:56:50 »
Quote from: The_Ed;619685
Sod's law - "bad fortune will be tailored to the individual", "anything that can go wrong, will", and "Toast will always land butter side down"...

Since it's firmware I can't just recompile and check for errors. I have to flash it and use it, then make tweaks, flash it again, rinse and repeat.
Yup :-)

With very little in the way of debugging, either. Prints are too slow, LEDs are too slow, 'scopes are hassle etc etc.

Offline mkawa

  •  No Marketplace Access
  • Posts: 6562
  • (ツ)@@@. crankypants
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #638 on: Fri, 22 June 2012, 15:03:21 »
Quote from: The_Ed;619698
And you said I was confusing YOU with rotary encoders... Yeah, go get your "WAVE THING", and take your sweet time.

How did you become a moderator anyway? I've always been curious.
this is clearly a rathole, but to elaborate for a second. here's the firmware model i have in my head:

we have a 2d matrix of chars, let's call it fbuf, representing the display state of the LED matrix (ie, fbuf[j] = "brightness of the (i,j)th LED"). we get to execute one firmware loop on the micro.

Code: [Select]
foreach tick:
  update fbuf;
  scan the LED matrix, updating the PWM registers with the contents of fbuf
  poll the keyswitch matrix
  dump active keys onto usb bus

but updating fbuf could take an arbitrary amount of time, depending on how much computation we'd like to do to yield the next display frame. because we only have one flow of control on the micro, this all has to happen sequentially, and if we scan the LED matrix too slowly, we will have flicker on the LEDs, or worse, we'll miss a keystroke.

so imagine instead that the host computer can write directly into the memory at fbuf (can you do DMA over usb? who knows, but let's pretend). then, the loop becomes simpler:

Code: [Select]
foreach tick:
  scan the LED matrix, updating the PWM registers with the contents of fbuf
  poll the keyswitch matrix
  dump active keys onto usb bus

soarer seems confident that we will have zero flicker if the firmware loop looks like this. to mutate fbuf, then, it suffices to write a simple driver on the host machine that dumps data into it.

finally, soarer is nixing my 2 micros suggestion because communication between them is needlessly complicated. coming from a high-level background, my model of multiprocessing is either a) shared memory or b) message passing. while these abstractions can be implemented at a micro level, there's a _lot_ of engineering required to build those abstractions, and there's no ready platform that does that engineering for us. basically, it's a lot of added complication for no particular reason, so his conclusion is quite sound.
« Last Edit: Fri, 22 June 2012, 15:10:52 by mkawa »

to all the brilliant friends who have left us, and all the students who climb on their shoulders.

Offline The_Ed

  • Posts: 1350
  • Location: MN - USA
  • Asperger's... SQUIRREL! I'm Anal Retentive *****!
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #639 on: Fri, 22 June 2012, 15:04:51 »
It's always good to broaden one's horizons. To make useful everyday things from scratch is a learning experience and journey.

I'll share my code when I get the rotary encoders working properly so other people can be lazy if they wanna copy.
Reaper "frelled" me... Twice... Did he "frell" you too?... *brohug*
I'm camping for a week, and moving twice in a month. I'll get back to you when I can (If I don't then just send me another PM).
R.I.P.ster

Offline The_Ed

  • Posts: 1350
  • Location: MN - USA
  • Asperger's... SQUIRREL! I'm Anal Retentive *****!
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #640 on: Fri, 22 June 2012, 15:15:31 »
I use long variable names so I know what the hell they are, and I never use foreach loops. I have used pointer arrays of classes, but I've never found a use for foreach... Maybe it's just how I think... I'd need to see more code to understand what you're on about...
Reaper "frelled" me... Twice... Did he "frell" you too?... *brohug*
I'm camping for a week, and moving twice in a month. I'll get back to you when I can (If I don't then just send me another PM).
R.I.P.ster

Offline mkawa

  •  No Marketplace Access
  • Posts: 6562
  • (ツ)@@@. crankypants
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #641 on: Fri, 22 June 2012, 15:54:40 »
read "foreach tick" as "while(1)". i think in the arduino macro language it's just like "do forever { ... }" or something like that

to all the brilliant friends who have left us, and all the students who climb on their shoulders.

Offline Soarer

  • * Moderator
  • Posts: 1918
  • Location: UK
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #642 on: Fri, 22 June 2012, 16:27:08 »
mkawa, you are forgetting that each tick is actually just for one column :) ... so the handler might look like:

Code: [Select]
ISR(tick) {
    // update column strobe and pwm for column
    // read column of keys
    // put any new key events for the column into a queue
    if ( ++column == num_columns ) {
        // process event queue and send to usb
        // if frame buffer is ready, copy it to output buffer
    }
}


Only the stuff before the 'if' is particularly time-sensitive, in fact only the column and pwm update.

Actual frame buffer updating could happen inside the if, or, more likely, in the main loop if it might take a while.

Offline mkawa

  •  No Marketplace Access
  • Posts: 6562
  • (ツ)@@@. crankypants
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #643 on: Fri, 22 June 2012, 17:05:09 »
hmm ok. so what's the flow of control into this isr block? is this what fires when there's an interrupt on a column? or is this just an iteration of a main processing loop? (that's iterating over each column in a cycle)

thanks for breaking this down for me soarer!

to all the brilliant friends who have left us, and all the students who climb on their shoulders.

Offline Soarer

  • * Moderator
  • Posts: 1918
  • Location: UK
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #644 on: Fri, 22 June 2012, 17:22:25 »
It's an interrupt firing off a timer, set to trigger at a few kHz, some multiple of the PWM frequency.

(In fact we could run it off one of the PWM interrupts, if we counted to the multiple before running it. It's easier to code using a separate timer though, I think).

Offline bpiphany

  • Posts: 1033
  • Location: Stockholm, Sweden
  • bpiph is a special type of crazy. //mkawa
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #645 on: Fri, 22 June 2012, 17:25:36 »
Damn it, you've been busy. We've celebrated midsummer here. I didn't read it all, particularly not the parts about marriage. The ErgoDox project is doing some serial IO communication. That is only to an expander though. I don't know if it is any harder doing it with another processor.

Offline mkawa

  •  No Marketplace Access
  • Posts: 6562
  • (ツ)@@@. crankypants
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #646 on: Fri, 22 June 2012, 17:58:00 »
Quote from: Soarer;619858
It's an interrupt firing off a timer, set to trigger at a few kHz, some multiple of the PWM frequency.

(In fact we could run it off one of the PWM interrupts, if we counted to the multiple before running it. It's easier to code using a separate timer though, I think).
got it, thanks!

i'll take a look at the ergodox. if dox's setup is robust enough, it's theoretically possible that we could just borrow it and place another micro in place of whatever the second thing is doing (although i suspect in the edox's case it's just an encoder and it's only moving data unidirectionally).
« Last Edit: Fri, 22 June 2012, 18:03:04 by mkawa »

to all the brilliant friends who have left us, and all the students who climb on their shoulders.

Offline Soarer

  • * Moderator
  • Posts: 1918
  • Location: UK
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #647 on: Fri, 22 June 2012, 18:20:00 »
Quote from: PrinsValium;619862
Damn it, you've been busy. We've celebrated midsummer here. I didn't read it all, particularly not the parts about marriage. The ErgoDox project is doing some serial IO communication. That is only to an expander though. I don't know if it is any harder doing it with another processor.

Not that busy really, still just spouting ideas :-)

Joining two processors up with SPI would be a fairly straightforward process, but not trivial. Mainly though, there needs to be a good reason for doing it, and I haven't heard one yet!!

Summer... hahahaha... I blinked and missed it - it was Monday and Tuesday this week. Yesterday some places had a month's worth of rain in 24 hours. Again. Can you please take the jetstream back now?

Offline mkawa

  •  No Marketplace Access
  • Posts: 6562
  • (ツ)@@@. crankypants
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #648 on: Fri, 22 June 2012, 18:23:57 »
[strike]a-ha! so is there is a shared register you can sandwich between them and not have to do this complex bus business. that said, this SPI thing looks like it's subject to write endurance, and not really meant for high traffic.[/strike] (google-fu fail) anyway, it does sound to me like soarer's reasoning is sound in that we don't need another micro. the only thing we might need is a bit more current, but i'm sure there's some way to do this without changing micros
« Last Edit: Fri, 22 June 2012, 18:27:22 by mkawa »

to all the brilliant friends who have left us, and all the students who climb on their shoulders.

Offline hazeluff

  • * Vendor
  • Posts: 2384
  • Location: Vancouver, BC
  • 光復香港
    • Hazeluff
Next GH-brewed KB design - 'The Light' (open for discussion)
« Reply #649 on: Fri, 22 June 2012, 19:38:39 »
Quote from: mkawa;619908
[strike]a-ha! so is there is a shared register you can sandwich between them and not have to do this complex bus business. that said, this SPI thing looks like it's subject to write endurance, and not really meant for high traffic.[/strike] (google-fu fail) anyway, it does sound to me like soarer's reasoning is sound in that we don't need another micro. the only thing we might need is a bit more current, but i'm sure there's some way to do this without changing micros

Extra USB power cable.So, use two slots instead of one maybe.



Man this chat has gone crazy. Anyway, I'm going to place whats on my mind onto here.

I am not a fan of using a second microcontroller. I'd rather Have a single more powerful controller. A second microcontroller makes separating the two tasks of running the switch and LED matrix simpler, it gives rise to having to interface the two together. Definitely doable, but an extra level of complexity that may not be needed.

I would like to test the very original idea, to see if that concept is viable at all.
Fight For Freedom. Stand with Hong Kongers