CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

USb keyboard

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Ringo42



Joined: 07 May 2004
Posts: 263

View user's profile Send private message

USb keyboard
PostPosted: Wed Sep 13, 2006 8:25 am     Reply with quote

I'm using the usb dev kit and in it there is an example of sending keyboard data. is there a chart somewhere that shows the codes for all the keyboard keys (and then some)? Specificially I need to be able to send F18-F24.
Thanks
Ringo
_________________
Ringo Davis
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Wed Sep 13, 2006 9:06 am     Reply with quote

Just google keyboard and scancode. You will get several links to look at.
Ringo42



Joined: 07 May 2004
Posts: 263

View user's profile Send private message

PostPosted: Wed Sep 13, 2006 9:35 am     Reply with quote

Thanks, Scancode was the keyword I was missing.
_________________
Ringo Davis
Ringo42



Joined: 07 May 2004
Posts: 263

View user's profile Send private message

PostPosted: Wed Sep 20, 2006 1:05 pm     Reply with quote

I have the scancodes, but some appear to not work. For example Volume up is scancode 128 and vol down is 129. I'm using the usb dev kit and the mouse/kb example. I change the code where instead of sending an 'a' to teh computer it sends a vol down, but nothing happens. If I push the vol down button on my real keyboard then I see the volume slider move.
Here is the code snippet.
Code:

void usb_keyboard_task(void) {
   static int8 tx_msg[7]={0,0,0,0,0,0,0};
   static int8 leds;
   //F18=109
   //F19=110  etc
   //F24 = 115

   if (!input(BUTTON))
   {
//      tx_msg[2]=5;//b
      tx_msg[2]=129;// vol down
      tx_msg[3]=0;
      tx_msg[4]=0;
}
   else
   {
      tx_msg[2]=0;
      tx_msg[3]=0;
      tx_msg[4]=0;

   }
   usb_put_packet(2,tx_msg,sizeof(tx_msg),USB_DTS_TOGGLE);

   //receive NUM LOCK, CAPS LOCK, etc LED status from PC.
   //we won't do anything with it.
   if (usb_kbhit(2)) {
      usb_get_packet(2, &leds, 1);
   }
}


any ideas? What am I missing here?
_________________
Ringo Davis
Ringo42



Joined: 07 May 2004
Posts: 263

View user's profile Send private message

PostPosted: Wed Sep 20, 2006 1:28 pm     Reply with quote

along the same lines, how do you send a capital letter?
I tried
tx_msg[0]=225;// shift
tx_msg[2]=29;// z

to send a big Z but all I get is a little z.
Thanks
Ringo
_________________
Ringo Davis
Ringo42



Joined: 07 May 2004
Posts: 263

View user's profile Send private message

PostPosted: Fri Sep 22, 2006 11:50 am     Reply with quote

I figured out a little bit. If I change the following lines in usb_desc_kb.h Then I can get some of the higher scancodes to work, but they still stop working around 127.
// 0x25, 0x65, //logical max (101) //104, 105
0x25, 0x81, //logical max (129) //104, 105
// 0x29, 0x65, //usage max (101) //110, 111
0x29, 0x81, //usage max (129) //110, 111

Of course 2 of the main keys I need are 128 and 129 (Volume up and down).
Has anyone tried this before?
Ringo
_________________
Ringo Davis
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group