Skip to content

Commit

Permalink
Created a first version with teams shortcuts, next testing
Browse files Browse the repository at this point in the history
  • Loading branch information
martijncasteel committed May 7, 2023
1 parent 41c1799 commit 3572334
Show file tree
Hide file tree
Showing 9 changed files with 238 additions and 170 deletions.
6 changes: 3 additions & 3 deletions code/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ The [binaries](bin/) can be flashed on the board using the Makefile in the respe
# built intermediates in /build and binary in ../bin
make

# flash to microcontroller, *check port id*
make flash
# flash to microcontroller
make flash PORT=/dev/ttyUSB0

# set fuses on microcontroller
make fuses
make fuses PORT=/dev/ttyUSB0

# remove intermediates and binary
make clean
Expand Down
108 changes: 0 additions & 108 deletions code/bin/launchpad-shortcuts.hex

This file was deleted.

120 changes: 120 additions & 0 deletions code/bin/launchpad-teams-shortcuts.hex
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
:100000000C949D000C94BA000C94BA000C94BA00A5
:100010000C94BA000C94BA000C94BA000C94BA0078
:100020000C94BA000C94BA000C945C010C94DC01A2
:100030000C94BA000C94BA000C94BA000C94BA0058
:100040000C94BA000C94BA000C94BA000C94BA0048
:100050000C94BA000C94BA000C94BA000C94BA0038
:100060000C94BA000C94BA000C94BA000C94BA0028
:100070000C94BA000C94BA000C94BA000C94BA0018
:100080000C94BA000C94BA000C94BA000C94BA0008
:100090000C94BA000C94BA000C94BA000C94BA00F8
:1000A0000C94BA000C94BA000C94BA00050109072C
:1000B000A101050719E029E715012501750195083A
:1000C0008102050719002965150025657508950247
:1000D0008100050C1500250109EA09E97501950261
:1000E0008102750695019101050815002501090990
:1000F0000917091809200921750195019122750335
:1001000095019101C0090222000101008032090419
:100110000000010300000009211101000122590023
:10012000070581030800121201000200000020D818
:1001300004D5E60001010200010011241FBECFEF2B
:10014000DAE0DEBFCDBF11E0A0E0B1E0E6E2F7E02B
:1001500002C005900D92A833B107D9F721E0A8E3BA
:10016000B1E001C01D92A034B207E1F70E94620322
:100170000C9491030C940000F894E8EDF0E0808179
:100180008F77808380818068808380818F7D80836A
:10019000A7EDB0E08C9181608C9380818161808338
:1001A000E0EEF0E080818B7F808380818E7F808392
:1001B00078948BE391E008959C0170E0461757070F
:1001C00008F4BA016115710511F480E00895809179
:1001D000E80080FFFCCF8091E80082FD1DC0CB01CC
:1001E0006132710510F080E290E050E040E0F901EA
:1001F000E40FF51FE491E093F1004F5F5F4F481764
:100200005907ACF3681B790B280F391F8091E80060
:100210008E7F8093E800D6CF8FEF0895262F30E0B1
:100220002E5F3F4F4217530708F49A0122503109BD
:10023000369527954091E80040FFFCCF4091E800BB
:1002400042FD1CC06E5F6093F10043E04093F100FB
:10025000FC0190E080E08217930739F48091E80078
:100260008E7F8093E80080E008955081418132962E
:100270005093F1004093F1000196EDCF8FEF089578
:10028000CF93DF9300D0CDB7DEB79A838983E1EFB8
:10029000F0E080838A8180838B8180838C8180835E
:1002A000E981FA81108211821282138280E00F901C
:1002B0000F90DF91CF9108951F920F920FB60F927A
:1002C00011242F933F934F935F936F937F938F935B
:1002D0009F93AF93BF93EF93FF938091DA0080FFDA
:1002E00029C08091DA008E7F8093DA008091D90056
:1002F00080FF1EC089B5826189BD09B400FEFDCFB3
:100300008091E2008C608093E20010923801FF91AE
:10031000EF91BF91AF919F918F917F916F915F917D
:100320004F913F912F910F900FBE0F901F901895F6
:1003300019BCEDCF8091E1001092E10083FF22C053
:100340008091E100877F8093E1001092E90091E0C5
:100350009093EB008091EC008E7F8093EC00809175
:10036000ED0082628093ED00109238018091EE00E2
:1003700087FFCDCF9093EA001092EA0088E0809347
:10038000F000C5CF90913801992309F282FFBFCFC9
:100390008091E1008B7F8093E10081E08093E90010
:1003A0008091E80085FFB3CF8CE391E00E9440018B
:1003B0008AE38093E800ABCF1F920F920FB60F92A3
:1003C00011242F933F934F935F936F937F938F935A
:1003D0009F93AF93BF93EF93FF93CF93DF93CDB7EB
:1003E000DEB7A097DEBFCDBF1092E9008091E80094
:1003F00083FF4CC02091F1003091F1008091F10019
:100400009091F1004091F1004091F1004091F10094
:100410006091F1005091E800527F5093E800353030
:1004200039F5211133C02091E8002E7F2093E80098
:100430002091E80020FFFCCF80688093E300A09625
:100440000FB6F894DEBF0FBECDBFDF91CF91FF9105
:10045000EF91BF91AF919F918F917F916F915F913C
:100460004F913F912F910F900FBE0F901F901895B5
:10047000363009F049C0562F203809F084C0E7E231
:10048000F1E0913009F486C0963031F48091EB00B0
:1004900081628093EB00D3CF923031F462E285E049
:1004A00091E00E94DC00CBCF933081F7811112C024
:1004B0008091000190910101A0910201B09103018E
:1004C00089839A83AB83BC8364E0CE0101960E944A
:1004D0000E01B5CF813059F480E2E4E0F1E0DE01B5
:1004E000119601900D928A95E1F76EE1EECF823080
:1004F00069F684E1E4E2F1E0DE01119601900D92EB
:100500008A95E1F762E1E1CF3930F1F421114CC075
:10051000809338018091E8008E7F8093E80081E02D
:100520008093E9008093EB008091EC00816C8093D4
:10053000EC008091ED0086608093ED008EE1809369
:10054000EA001092EA007BCF383061F4203809F0DD
:100550009DCF8091E80080FFFCCF8091380180938F
:10056000F1000DC0311136C0203809F08FCF8091D5
:10057000E80080FFFCCF1092F1001092F100809112
:10058000E8008E7F24C0213809F080CF913229F411
:10059000E7E1F1E06491CF0184CF923209F076CFA8
:1005A00069E58CEA90E07DCF213209F06FCF809130
:1005B000E80082FFFCCF8091F10080933B018091A5
:1005C000E8008E7F8093E8008091E8008B7F809325
:1005D000E80035CF313061F4213A09F057CF8091EE
:1005E000E80080FFFCCF8CE391E00E944001C7CF80
:1005F0003A3031F4213209F049CF80933A01BFCF2C
:10060000323009F043CF213A09F040CF8091E80021
:1006100080FFFCCF80913A01A2CFCF93DF9300D02F
:1006200000D0CDB7DEB7FC0180819181A281B3817A
:10063000892B8A2B8B2BD9F599B190958091390113
:1006400089279093390119821A821B821C8281FFAB
:1006500012C081E0898389819A81AB81BC818083CA
:100660009183A283B38380E00F900F900F900F903F
:10067000DF91CF910895982F9C7011F083E0EACF1D
:1006800084FF09C080E090E0A0E0B0E189839A8314
:10069000AB83BC83E0CF85FF05C080E090E0A0E0A5
:1006A000B1E0F4CF86FDEACF87FDE8CFD4CF81E07B
:1006B000DBCFFC018081882319F0889A80E00895BF
:1006C0008898FCCF8FEF8BB98AB11AB8809A0E94B4
:1006D000BC008C01C0E0D2E37C018FEFE81AF80A7D
:1006E0008C2F6D2F0E948503911104C0C7010E94B9
:1006F0000D03C0E0C8010E945903CF5F8FE99FE05E
:100700000197F1F700C00000EBCF991B79E004C01E
:10071000991F961708F0961B881F7A95C9F7809540
:060720000895F894FFCFDC
:10072600090413044D0061007200740069006A0038
:100736006E002000430061007300740065006500D0
:100746006C0000004C00610075006E0063006800DC
:08075600700061006400000066
:00000001FF
12 changes: 11 additions & 1 deletion code/teams-shortcuts/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,19 @@
* PIND7 - raise/lower hand - ctrl + shift + K
*/

#define LCTRL 0x01
#define LSHIFT 0x02
#define LGUI 0x08

#define KEY_H 0x0B
#define KEY_K 0x0E
#define KEY_M 0x10
#define KEY_O 0x12
#define KEY_SPACE 0x2C

#define LED PORTF0

int8_t check_buttons(uint8_t* dout);
int8_t check_buttons(uint32_t* dout);
int8_t animate_led(uint8_t* din);

#endif
70 changes: 31 additions & 39 deletions code/teams-shortcuts/include/usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@
* @param din is used for incoming reports for led status.
* @param dout holds the report towards the host holding the key presses.
*/
typedef struct Report {
uint8_t din, dout;
} data16_t;
typedef struct Data{
uint8_t din;
uint32_t dout;
} data_t;

data16_t* usb_init();
data_t* usb_init();

int8_t send_pgm_data(uint8_t* descriptor, uint8_t length, uint16_t wLength);
int8_t send_uint16_data(uint16_t* data, uint8_t length, uint16_t wLength);
int8_t send_dout_data(uint32_t* data);

// request types, see table 9-2 of USB2.0 specification
// HOST-TO-DEVICE -> IN, DEVICE-TO-HOST -> OUT
Expand Down Expand Up @@ -89,7 +91,7 @@ int8_t send_uint16_data(uint16_t* data, uint8_t length, uint16_t wLength);

// defined length of configuration and report descriptor
#define CONFIG_SIZE 34
#define REPORT_SIZE 105
#define REPORT_SIZE 89


// Stored in PROGMEM (Program Memory) Flash
Expand Down Expand Up @@ -159,53 +161,43 @@ static const uint8_t configuration_descriptor[] PROGMEM = {
* for BTN6 or the first two bits of this report.
*
* @note change REPORT_SIZE if changed
* @todo change to use keyboard shortcuts, see board.h
*/
static const uint8_t report_descriptor[] PROGMEM = {
0x05, 0x01, // usage page (generic desktop)
0x09, 0x07, // usage (keypad)
0xA1, 0x01, // collection (application)

0x05, 0x0b, // usage Page (Telephony)
0x15, 0xff, // logical minimum (-1)
0x25, 0x01, // logical maximum (1)
0x09, 0x2f, // usage (Phone Mute, OOC) - BTN6
0x75, 0x02, // report size (2)
0x95, 0x01, // report count (1)
0x81, 0x26, // input (data, var, relative, no preferred state)
0x05, 0x07, // usage page (modifier keys)
0x19, 0xE0, // usage minimum
0x29, 0xE7, // usage maximum
0x15, 0x01, // logical minimum
0x25, 0x01, // logical maximum
0x75, 0x01, // report size 1
0x95, 0x08, // report count 8
0x81, 0x02, // input (data, var, absolute)

0x05, 0x07, // usage page (keycodes)
0x19, 0x00, // usage minimum
0x29, 0x65, // usage maximum
0x15, 0x00, // logical minimum
0x25, 0x65, // logical maximum
0x75, 0x08, // report size 8
0x95, 0x02, // report count 2
0x81, 0x00, // input (data, array)

0x05, 0x0c, // Usage Page (Consumer)

0x05, 0x0c, // usage Page (consumer)
0x15, 0x00, // logical minimum (0)
0x25, 0x01, // logical maximum (1)
0x09, 0xe2, // usage (volume mute, OOC) - BTN4
0x75, 0x01, // report size (1)
0x95, 0x01, // report count (1)
0x81, 0x06, // input (data, var, relative, preferred state)

0x05, 0x0b, // usage Page (Telephony)
0x09, 0x2f, // usage (phone mute, OOC) - BTN5
0x75, 0x01, // report size (1)
0x95, 0x01, // report count (1)
0x81, 0x06, // input (data, var, relative, preferred state)

0x05, 0x0c, // usage Page (Consumer)
0x09, 0xea, // usage (Volume Decrement, RTC) - BTN3
0x09, 0xe9, // usage (Volume Increment, RTC) - BTN2
0x75, 0x01, // report size (1)
0x95, 0x02, // report count (2)
0x81, 0x02, // input (data, var, absolute, preferred state)

0x05, 0x0b, // usage Page (Telephony)
0x09, 0x21, // usage (Flash, MC) - BTN0
0x75, 0x01, // report size (1)
0x95, 0x01, // report count (1)
0x81, 0x02, // input (data, var, absolute, preferred state)

0x05, 0x0c, // usage Page (Consumer)
0x09, 0xe2, // usage (volume mute, OOC) - BTN1
0x75, 0x01, // report size (1)
0x75, 0x06, // report size (6)
0x95, 0x01, // report count (1)
0x81, 0x06, // input (data, var, relative, preferred state)
0x91, 0x01, // output (const, padding)


0x05, 0x08, // usage page (Led page)
Expand All @@ -220,9 +212,9 @@ static const uint8_t report_descriptor[] PROGMEM = {
0x95, 0x01, // report count (5)
0x91, 0x22, // output (data, absolute, no preffered)

0x75, 0x01, // report size (1)
0x95, 0x03, // report count (3)
0x91, 0x01, // output (const)
0x75, 0x03, // report size (3)
0x95, 0x01, // report count (1)
0x91, 0x01, // output (const, padding)

0xc0 // end collection
};
Expand Down

0 comments on commit 3572334

Please sign in to comment.