nRF Desktop: API documentation

Following are the API elements used by the application.

HID reports

Header file: applications/nrf_desktop/configuration/common/hid_report_desc.h
Source file: applications/nrf_desktop/configuration/common/hid_report_desc.c
group nrf_desktop_hid_reports

HID Reports.

Enums

enum report_id

Identification numbers of HID reports.

Values:

enumerator REPORT_ID_RESERVED

Reserved.

enumerator REPORT_ID_MOUSE

Mouse input report.

enumerator REPORT_ID_KEYBOARD_KEYS

Keyboard input report.

enumerator REPORT_ID_SYSTEM_CTRL

System control input report.

enumerator REPORT_ID_CONSUMER_CTRL

Consumer control input report.

enumerator REPORT_ID_KEYBOARD_LEDS

Keyboard output report.

enumerator REPORT_ID_USER_CONFIG

Config channel feature report.

enumerator REPORT_ID_USER_CONFIG_OUT

Config channel output report.

enumerator REPORT_ID_VENDOR_IN

Reserved.

enumerator REPORT_ID_VENDOR_OUT

Reserved.

enumerator REPORT_ID_BOOT_MOUSE

Boot report - mouse.

enumerator REPORT_ID_BOOT_KEYBOARD

Boot report - keyboard.

enumerator REPORT_ID_COUNT

Number of reports.

Variables

static const uint8_t input_reports[] = {REPORT_ID_MOUSE, REPORT_ID_KEYBOARD_KEYS, REPORT_ID_SYSTEM_CTRL, REPORT_ID_CONSUMER_CTRL, REPORT_ID_BOOT_MOUSE, REPORT_ID_BOOT_KEYBOARD,}

Input reports map.

static const uint8_t output_reports[] = {REPORT_ID_KEYBOARD_LEDS,}

Output reports map.

const uint8_t hid_report_desc[]
const size_t hid_report_desc_size

LED states

Header file: applications/nrf_desktop/configuration/common/led_state.h
Source file: applications/nrf_desktop/src/modules/led_state.c
group nrf_desktop_led_state

LED State.

Defines

LED_UNAVAILABLE
LED_PEER_COUNT

Enums

enum led_system_state

System states represented by LED.

Values:

enumerator LED_SYSTEM_STATE_IDLE

Device is idle.

enumerator LED_SYSTEM_STATE_CHARGING

Device is charging.

enumerator LED_SYSTEM_STATE_ERROR

Device in error state.

enumerator LED_SYSTEM_STATE_COUNT

Number of system states.

enum led_peer_state

Peer states represented by LED.

Values:

enumerator LED_PEER_STATE_DISCONNECTED

Peer is disconnected.

enumerator LED_PEER_STATE_CONNECTED

Peer is connected.

Device searches for peer.

enumerator LED_PEER_STATE_CONFIRM_SELECT

Device waits for user to confirm peer switch.

enumerator LED_PEER_STATE_CONFIRM_ERASE

Device waits for user to confirm bond erase.

enumerator LED_PEER_STATE_ERASE_ADV

Device searches for new peer before bond erase.

enumerator LED_PEER_STATE_COUNT

Number of peer states.

enum led_id_nrf_desktop

LED identification.

Values:

enumerator LED_ID_SYSTEM_STATE

LED representing system state.

enumerator LED_ID_PEER_STATE

LED representing peer state.

enumerator LED_ID_COUNT

Number of LEDs.

USB events

Header file: applications/nrf_desktop/src/events/usb_event.h
Source file: applications/nrf_desktop/src/modules/usb_state.c
group nrf_desktop_usb_event

USB Event.

File defines a set of events used to transmit the information about USB state between the application modules.

Enums

enum usb_state

Peer states.

Values:

enumerator USB_STATE_DISCONNECTED

Cable is not attached.

enumerator USB_STATE_POWERED

Cable attached but no communication.

enumerator USB_STATE_ACTIVE

Cable attached and data is exchanged.

enumerator USB_STATE_SUSPENDED

Cable attached but port is suspended.

enumerator USB_STATE_COUNT

Number of states.

struct usb_state_event
#include <usb_event.h>

USB state event.

Public Members

struct app_event_header header

Event header.

enum usb_state state

State of the USB module.