Not much Text in the post above, Forum Software kicked me out, so let me start over.
I decided to write my first component. Mostly because Eugene came up with a self-written component which refered to a program I had written before and I was not quite content with his implementation and favoured mine (of course!!!)
I would like to make a KeyPad (matrix keyboard) component which (as a component should be) is adaptable to different keypad-sizes and organization. So keypads from 2x2 (4 keys) up to 8x8 (64 keys) should be supported.
The keypad is connected directly to the required number of input-pins and with the help of a timer and an interrupt the key-presses are debounced, put into a buffer, repeated for long keypresses and can be retrieved from the buffer by some API-calls.
I will get you informed of every step I perform to get this component working and I would be glad about any comments, suggestions or hints from the community.
So, to start with a component, we will have to define at first its capabilities expressed in the parameters the user may change to fit the needs of his usage. To get a look at the way the software is going to work, look here http://www.cypress.com/?app=forum&id=2233&rID=56644
Rows(2..8) The keypad matrix organization
Scan Rate (5-100ms)
Number of equal key readings before a key is accepted (1..99)
Initial wait before a keys are repeated (250..1000ms)
Repetition wait time (100..1000ms)
Keyboard buffer size (2..20)
I do not know at this state of the design if I should have a hardware-signal for "Key pressed" or "Key Buffer not empty", so I'll suspend that for "changing a component" which will come later.
1. A function to return the current state of de-bounced matrix,
2. A function "interruptOnKeyPressed(keyNumber)" which generates an interrupt if a particular key is being pressed.
3. Same as 2 but operate on release of key "interruptOnKeyRelease(keyNumber)", not very ofter being used, but is a useful option to have.
Fine! You are #1 that jumped in!
Since it is not always the time for main() to check for a key pressed all detected and debounced keys are stored in a small buffer from which they can be read off. Have a look at the Keypad matrix program I will integrate into the component here:
http://www.cypress.com/?app=forum&id=2233&rID=56644 Then you will get a feeling how it is supposed to work.
What do you want "The current of state the matrix" for??? There is no intermediate debounced matrix state.
I write this component to keep the user apart from the "Key down - Key release" mechanism like in windows.
I think of (as I wrote earlier) to supply a "KeyPressed" signal. To connect an isr to it and question for a particular key is easy and should be supplied by the user (as first implementation). And I want to keep it small for the first version.
Here is the next part of my experiences in creating a component. Since I have a lot of pictures to show and seemingly I may attach only a single file to my post, I decided to create a PDF-document that contains all the text and pictures.
Take your time, relax and have a look at. Any comments are welcome.
Right where all the links saying "video library" point to: http://video.cypress.com/video-library/video/PSoC
Some more can be found in the trainign area: http://www.cypress.com/?id=1162&source=support
The 'Training on Demand' area has even more: http://www.cypress.com/?app=search&searchType=advanced&keyword=&rtID=134&id=0&applicationID=0&l=0
As I stated in the post following: Add manually the given address found in the .pdf-file into your browser's address. The videos I'm talking about are numbered 110 to 113. Here is an actual link www.cypress.com/ .
Hi Bob! How's everthing?
I want to ask you if the is an update of your keypad interface since you posted it? I suppose it can be used on psoc 5lp, right?
The Keypad component is not device-specific, so you may use it with PSoC3, 4, 5 or 5LP. You only should update the underlying components to their actual versions.