Keyboard

The keyboard scan matrix is defined in kdefs.h and may need to be changed for different keyboards.

Porting the code to another microprocessor architecture requires modification or leverage of the existing code for processor specific features, along with pin definitions.

4.3.8Initialization

Initialization of the enCoRe II LV chip is done by code that is generated in boot.asm by the PSoC Designer software. The module boot.asm calls main once the enCoRe II LV has been configured and initialized.

Main initializes the components of the keyboard along with timer, isr and radio modules. The main routine then goes into an infinite loop monitoring keyboard activity and sleeping between keystrokes.

4.3.9Wireless Protocol Data Payload

The keyboard protocol has been optimized to reduce the ‘on time’ of the radio and power consump- tion.

The radio driver offers the ability to send variable length packets, allowing the opportunity to mini- mize the number of bytes transmitted over the air, in order to extend battery life.

The following transmission packet formats are implemented in this RDK. The report formats show the application payload and the radio protocol overhead with example packet headers.

4.3.9.1Keyboard Application Report Formats

The first byte of the data packet payload, byte 2 of the radio packet, is used as a keyboard applica- tion report header. There are five possible keyboard application reports. The reports are:

Standard 101 Keys report

Multimedia Keys report

Power Keys report

Keep Alive report

Battery Voltage Level report

The first application report byte is Scan Code 1 if the byte is less than 0xFC. Otherwise, the first application report byte is the Application Report Header (Multimedia, Power, Battery, or Keep Alive). This also assumes that multimedia and power keys do not use modifier keys and that 0xFF, 0xFE, 0xFD and 0xFC are not valid Standard 101 key scan codes.

Trailing zeros in the reports are also removed to further minimize the number of bytes sent by the radio.

The LP radio sends the reports with the format shown in Table 4-4.

Table 4-4. LP Generic Report

Byte

 

 

1

 

 

Bits:

7:4

3

2

1

0

Field:

4

BCDR

Toggle

DTO

DT1

 

 

 

 

 

 

2

7:0

Application

Report

Header

..

7:0

..

7:0

N

7:0

Byte N

4.3.9.1.1Standard 101 Keys Report

If the Application Report Header byte is less than 0xFC, then this indicates that this report is a Stan- dard 101 Keys report and the first byte is the actual scan code rather than the Report Header. This is

66

CY4672 Reference Design Guide, Document # 001-16968 Revision **

[+] Feedback

Page 66
Image 66
Cypress CY4672 manual Initialization, Keyboard Application Report Formats