Http://www.amobbs.com/forum.php? MoD = viewthread & tid = 4001689.
How to design a multi-level menu for key-Pressed Liquid Crystal
Typedef struct
{
Uchar keystateindex; // Index Number of the current State
Uchar keydnstate; // The status index number to be switched when the "down" Key is pressed.
Uchar keyupstate; // The status index number to be switched when you press the "up" key.
Uchar keycrstate; // The status index number to be switched when you press the "enter" key.
Uchar keybackstate; // The status index number to be switched when you press the "return" key.
Void (* currentoperate) (); // function operations that should be performed in the current status
} Kbdtabst ruct;
# Define size-of keybd-menu 55 // total menu Length
Kbdtabst ruct code keytab [size-of-keybd-menu] =
{
{0, 0, 0, 1, 0, mainjob1 },
{1, 7, 2, 8, 0, DSP point}, // The first layer
{2, 1, 3, 8, 0, dspcurve}, // The first layer
{3, 2, 4, 36, 0, DSP Kout}, // The first layer
{4, 3, 5, 50, 0, disclosedown}, // The first layer
{5, 4, 6, 8, 0, modifypoint}, // The first layer
{6, 5, 7, 52, 0, setclosedown}, // The first layer
{7, 6, 1, 0, 0, cancel}, // The first layer
...
...
{52, 53, 53, 0, 1, oksetclosedown1 },
{53, 52, 52, 0, 1, oksetclosedown2 },
{54, 0, 0, 0, 0, disable },
...
...
};
Void get keylnput (void)
{
Switch (Status & 0xf0)
{
Case 0xe0: // enter the Enter key to find the new menu Status Number.
...
Keyfuncindex = keytab [keyfuncindex]. keycrstate;
...
Break;
Case 0xb0: // press the down key to find the new menu Status Number.
...
Keyfuncindex = keytab [keyfuncindex]. keydn2state;
...
Break;
Case 0xd0: // up key to find the new menu Status Number
...
Keyfuncindex = keytab [keyfuncindex]. keyup2state;
...
Break;
Case 0x70: // return key to find the new menu Status Number
...
Keyfuncindex = keytab [keyfuncindex]. keyback2state;
...
Break;
Case 0;
Return; // handle errors
Break;
}
Keyfuncpt r = keytab [keyfuncindex]. currentoperate;
(* Keyfuncpt R) (); // execute the operation of the current button
}
The above is the framework structure, and the following is the application of this method.
Platform, at91rm9200, linux2.6.13, arm-linux-gcc3.3.2
Key wiring diagram (original file name: Key-connected figure .jpg)
LCD wiring diagram (original file name: .jpg)
Press-key driver ourdev_549702.rar (file size: 10 K)
(Original file name: keyboard.rar)
320 * bytes driver, ra8835controller (fully compatible with sed13351_ourdev_549703.rar (file size: 10 K)
(Original file name: lcd320_240.rar)
Export Application Program ourdev_549718.rar (file size: 36 K)
(Original file name: ui.rar)
Ourdev has made me grow a lot, so I will share some good things with you in the future.
By the way, I would like to take this opportunity to apologize to AMO. I once posted a few complaints, and I am not malicious. This is a curse caused by young people. Please forgive me.
I posted a technical post on ourdev for the first time. I don't know if this is detailed enough. If you have any questions, please point it out and add it.