usb_keyboard

USB HID easy keyboard interface

Author Albert Faber, Copyright © 2010, all rights reserved.
Adapted-by Joep Suijs
Compiler >=2.4j

Description

An easy to use USB HID keyboard library
the USB interface. By default nothing has to be defined by the user, below
an example how to use the library


                                                                        
include usb_keyboard
..
usb_keyboard_init()
..
;-- wait till USB becomes available
while ( !usb_is_configured() )  loop
end loop
..
;-- main loop
var byte ch
forever loop
;   -- call the flush routine on a regular base in the main loop
;   -- in order to keep the USB communicaiton alive
    usb_keyboard_flush()
    .....
    if ( usb_is_configured() )
       if ( pin_x )
		   ush_keyboard_send_key( 0x00, USB_KEYBOARD_KEY_A )
       else
		   ush_keyboard_send_key( 0x00, USB_KEYBOARD_KEY_NONE )


Sources

http://www.usb.org for USB specifications


Notes

-


Dependencies


Summary

Global variables/contants

Procedures

Private

Functions


API details

Global variables/contants

Procedures

  • usb_handle_class_request_callback()

    No documentation found

  • ush_keyboard_send_key( byte in modifier_key, byte in key )

    ush_keyboard_send_key - send a key code (blocking!)
       
    ush_keyboard_send_key() sends a key code toward the USB HID host
    the call is blocking and assumes that the HID communcation channel
    has been established. See also definitions for key codes (starting
    with USB_KEYBOARD_KEY_xxxx) and for the modifier key definitions
    starting with USB_KEYBOARD_MKEY_. Note that once a key code has been
    send, the HID host assumes that the key remains pressed, until a
    USB_KEYBOARD_KEY_NONE (or other key) is send towards the HID host
    
    

  • usb_handle_class_ctrl_read_callback()

    No documentation found

  • usb_ep_data_in_callback(byte in end_point, word in buffer_addr, byte in byte_count)

    No documentation found

  • ush_keyboard_send_ascii(byte in ascii)

    ush_keyboard_send_ascii - send a ascii char (blocking!)
      
    Translate to keycode & use ush_keyboard_send_key() to send/release.
    See ush_keyboard_send_key() for details!
    
    

  • usb_handle_class_ctrl_write_callback()

    No documentation found

  • usb_keyboard_flush()

    usb_keyboard_flush shall be called on a regular base (millisecond range)
    in order to keep the USB communcation alive. Therfore it is adviced to
    call the usb_keyboard _flush procedure in the main loop of your 
    application
    
    

  • usb_keyboard_init()

    usb_keyboard_init will setup the HID USB communication with the HOST, 
    however, this can be a time consuming process, therefore this call 
    is non blocking. In order to check if communication with the HOST 
    has been established, one can call the usb_is_configured() function, see
    usb_is_configured() documentation for additional details.
    
    

Private

Functions


Related samples

Here are the list of samples which use this library:

18f14k5018f14k50_usb_hid_keyboard.jal
18f245018f2450_usb_hid_keyboard.jal
18f455018f4550_usb_hid_keyboard.jal