nRF51 SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Gazell Pairing Desktop Device Emulator

Modules

 Keyboard Emulator
 
 Mouse Emulator
 Emulates a mouse using one of the nRF51's timer peripherals.
 

Functions

int main ()
 Main function. More...
 
void mouse_sensor_new_sample_generated_cb ()
 Callback function called when a new sample is generated by the mouse sensor. When the mouse sensor is enabled, this function will be called at a rate as specified by mouse_sensor_init().
 

Variables

static bool host_id_received = false
 Host ID received.
 
static bool system_addr_received = false
 System address receivedfrom Host.
 
static bool dyn_key_ok = false
 Dynamic key is up to date.
 

Configuration

#define BUTTON_SEND_KEYBOARD_DATA   0
 GPIO pin for reading from a button to emulate a keypress.
 
#define BUTTON_SEND_MOUSE_DATA   1
 GPIO pin for reading from a button to emulate a mouse movement.
 
#define LED_PORT   NRF_GPIO_PORT_SELECT_PORT1
 
#define KEYBOARD_LED   8
 
#define MOUSE_LED   9
 
#define SYS_ADDR_OK_LED   10
 
#define HOST_ID_OK_LED   11
 
#define DYN_KEY_OK_LED   12
 

Static (internal) functions.

static void read_mouse_and_send (void)
 
static void read_keyboard_and_send (void)
 
static gzp_id_req_res_t send_host_id_req (void)
 

Detailed Description

This project can be used as a starting point for developing a nRF51 series mouse or keyboard using Gazell for communicating with a legacy nRF24LU1 USB dongle. It can communicate "out of the box" with the Dongle reference design and the nRFreadySimplePairing.exe application, that can be found in the nRFready Desktop v1.2.3.

This project sends mouse movement packets to the USB dongle when pin 1 is low (button connected to pin 1 pressed) and sends the 'a' keyboard character to the USB dongle when pin 2 goes from high to low (button connected to pin 2 pressed).

Function Documentation

static void read_mouse_and_send ( void  )
static

Checks to see whether the mouse sensor has data to send. If so, adds this to the (unencrypted) Gazell TX FIFO on pipe NRFR_MOUSE_EP.

static void read_keyboard_and_send ( void  )
static

Checks to see whether the mouse sensor has data and send unencrypted.

If so, adds this to the (unencrypted) Gazell TX FIFO on pipe NRFR_MOUSE_EP. Checks to see whether the keyboard has data and send encrypted.

If the Device does net yet have the system address it will try to obtain it. After obtaining the system address it will attempt to obtain the Host ID. The keyboard data is discarded if pairing is not successful. It may take a few attempts to obtain the Host ID as this may not be yet generated at the Host.

static gzp_id_req_res_t send_host_id_req ( void  )
static

Send a Host ID request and process the response.

If the request was rejected or failed (i.e. timed out), system_addr_received will be reset and the pairing process will begin on the next keypress.

If the request was received, subsequent keyboard data will be transmitted on an encrypted link.

If teh request is still pending, nothing is done. Further keypresses will initiate another

Returns
The result of the Host ID request.
int main ( void  )
Returns
ANSI required int return type.