Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the buttons #11

Open
baruch opened this issue Feb 24, 2015 · 4 comments
Open

Use the buttons #11

baruch opened this issue Feb 24, 2015 · 4 comments

Comments

@baruch
Copy link
Owner

baruch commented Feb 24, 2015

Find how to make use of the buttons and integrate them into a UI that doesn't necessarily depend on the serial port.

@UsrnameTaken
Copy link

Please take a look at screenshots from oscilloscope of pressing those two strange connected buttons (OK and UP).

@iafilius
Copy link

Hi Baruch and others

I like to share the way the buttons work, remained a secret for 2 years now.

Howto:
Default ports pd1 and pc7 are set as input and can read (primary) buttons set and down directly and are pushed when eq zero)

If no primary key is pressed, seconday keys can be scanned (up and ok buttons).

Scan button 4 (ok):
Pd1 output value set to zero
Pd1 define as output (set direction)
Read pc7, key pressed when zero
Return pd1 to input in pull-up mode

Scan button 3 (up)
Then the other way around
Pc7 output value to zero.
Pc7 define as output
Read pd1, key pressed when zero
Return pc7 to input with pull-up.

I had worries on triggering the SWIM logic on pd1, but until now i did not show any reactions.
You may disable it by setting in the cdg_GCR bit0 to 1

When scanning secondary keys the first line returned to pull-up needs quite some recovery time. About 10 NOP’s makes it ready for next button scan.

Wrote some test code and was able to read set,down,up and ok key reliable.

Currently called from main event loop as demo, maybe better call it from a timer with handler.

While make the implementation i had to remove random serial stuff else it didn’t flash as firmware was too big.

I can provide working demo code and scope images of key presses.
Those already provided

Regards, Arjan

@baruch
Copy link
Owner Author

baruch commented Nov 28, 2017

@iafilius thanks!

I haven't worked on the b3603 for a while, I'll try to see if I can integrate it into the firmware. It was a pain to use the device without the buttons.

As for the firmware size, there is another fork of this project that worked on reducing the size, I'll probably try to integrate that as well to reduce the size.

@iafilius
Copy link

Hi, uploaded the tested code , easy to integrate in main event loop (or called from timer)
uploaded the key scope pictures as well.
buttons.c.txt
buttons.h.txt
ds1z_quickprint47
ds1z_quickprint48
ds1z_quickprint49
ds1z_quickprint50
ds1z_quickprint52

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants