635 Linux Test code

acidbeat311

New member
I have the code working perfectly to send data to the lcd. However, I am not understanding how to program the keypad for the 635 under the test code. Right now I would just like to be able to say
Code:
if(KEY_PRESS_UP == true)
    {
    outgoing_response.command = 31;
    outgoing_response.data[0]=0; //col
    outgoing_response.data[1]=1; //row
    memcpy(&outgoing_response.data[2],"this is button UP ",20);
    outgoing_response.data_length = 22;
    send_packet();
    }
How do I achieve this result?
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
 

CF Tech

Administrator
You would need something like this:
Code:
#include "serial.h" //from 633_Wintest
while(1)
  {
  if(check_for_packet())
    {
    //A packet has been received.
    //see if it is a key report
    if(incoming_response.type==0x80)
      {
      switch(incoming_response.data[0])
        {
        case 1:  //KEY_UP_PRESS
          outgoing_response.command = 31;
          outgoing_response.data[0]=0; //col
          outgoing_response.data[1]=1; //row
          memcpy(&outgoing_response.data[2],"this is button UP ",20);
          outgoing_response.data_length = 22;
          send_packet();
          break;
        case 2:  //KEY_DOWN_PRESS
          break;
        case 3:  //KEY_LEFT_PRESS
          break;
        case 4:  //KEY_RIGHT_PRESS
          break;
        case 5:  //KEY_ENTER_PRESS
          break;
        case 6:  //KEY_EXIT_PRESS
          break;
        case 7:  //KEY_UP_RELEASE
          break;
        case 8:  //KEY_DOWN_RELEASE
          break;
        case 9:  //KEY_LEFT_RELEASE
          break;
        case 10: //KEY_RIGHT_RELEASE
          break;
        case 11: //KEY_ENTER_RELEASE
          break;
        case 12: //KEY_EXIT_RELEASE
          break;
        }
      }
    else
      {
      printf("some packet received that was not a key\n");
      }
    }
  }
 

acidbeat311

New member
This is what I have now for the Keypad on the 635. It works. and works very well. Thanks to CF_Tech for pointing me in the right direction. I'm creating an internet streaming radio appliance that runs on Linux that uses MPLAYER. When a user scrolls through a station they like, the press the middle enter key and it loads MPlayer. I'm not so sure how to load Mplayer yet from within a C file.

please note that the previous code has different names for similar functionality.

example:
Code:
       if(incoming_command.type==0x80)
The code above is invalid for the 635

Also invalid is this on the 635 for linux
Code:
    if(incoming_response.data[0])
The 635 for linux uses incoming_command.data[0]

Code:
int i=1;
   while(i=1)
   {
   if(check_for_packet())
      { //A packet has been received.
        //see if it is a key report
       if(incoming_command.command==0x80)
       {
         switch(incoming_command.data[0])
         {
         case 1:  //KEY_UP_PRESS
          outgoing_response.command = 31;
          outgoing_response.data[0]=0; //col
          outgoing_response.data[1]=0; //row
          memcpy(&outgoing_response.data[2],"this is button UP   ",20);
          outgoing_response.data_length = 22;
          send_packet();
 	  break;
	 case 2:  //KEY_DOWN_PRESS
	  outgoing_response.command = 31;
          outgoing_response.data[0]=0; //col
          outgoing_response.data[1]=1; //row
          memcpy(&outgoing_response.data[2],"this is button down ",20);
          outgoing_response.data_length = 22;
          send_packet();
          break;
        case 3:  //KEY_LEFT_PRESS
	  outgoing_response.command = 31;
          outgoing_response.data[0]=0; //col
          outgoing_response.data[1]=2; //row
          memcpy(&outgoing_response.data[2],"this is button left ",20);
          outgoing_response.data_length = 22;
          send_packet();
          break;
        case 4:  //KEY_RIGHT_PRESS
	  outgoing_response.command = 31;
          outgoing_response.data[0]=0; //col
          outgoing_response.data[1]=3; //row
          memcpy(&outgoing_response.data[2],"this is button right",20);
          outgoing_response.data_length = 22;
          send_packet();
          break;
        case 5:  //KEY_ENTER_PRESS
	  outgoing_response.command = 6;
    	  outgoing_response.data_length = 0;
          send_packet();
          break;
        case 6:  //KEY_EXIT_PRESS
	  outgoing_response.command = 6;
    	  outgoing_response.data_length = 0;
          send_packet();
          break;
        case 7:  //KEY_UP_RELEASE
          break;
        case 8:  //KEY_DOWN_RELEASE
          break;
        case 9:  //KEY_LEFT_RELEASE
          break;
        case 10: //KEY_RIGHT_RELEASE
          break;
        case 11: //KEY_ENTER_RELEASE
          break;
        case 12: //KEY_EXIT_RELEASE
          break;
    	}
      }	
	
}
     
}
 
Last edited:

CF Tech

Administrator
On the host side, properly, it should be "incoming_response" and "outgoing_command". Since the host is master.

A bunch of our examples have that mixed up. They still work fine, but it can be a bit confusing.
 
Top