some major steps toward making the usb-usb converter work
This commit is contained in:
		
							parent
							
								
									42f895a4bc
								
							
						
					
					
						commit
						2aa5e44640
					
				
					 9 changed files with 59 additions and 24 deletions
				
			
		|  | @ -4,30 +4,14 @@ | |||
| #include "debug.h" | ||||
| 
 | ||||
| 
 | ||||
| report_keyboard_t usb_hid_keyboard_report; | ||||
| uint16_t usb_hid_time_stamp; | ||||
| 
 | ||||
| 
 | ||||
| void KBDReportParser::Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf) | ||||
| { | ||||
|     bool is_error = false; | ||||
|     report_keyboard_t *report = (report_keyboard_t *)buf; | ||||
|     ::memcpy(&report, buf, sizeof(report_keyboard_t)); | ||||
|     time_stamp = millis(); | ||||
| 
 | ||||
|     dprintf("KBDReport: %02X %02X", report->mods, report->reserved); | ||||
|     dprintf("input %d:  %02X %02X", hid->GetAddress(), report.mods, report.reserved); | ||||
|     for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { | ||||
|         if (IS_ERROR(report->keys[i])) { | ||||
|             is_error = true; | ||||
|         } | ||||
|         dprintf(" %02X", report->keys[i]); | ||||
|         dprintf(" %02X", report.keys[i]); | ||||
|     } | ||||
|     dprint("\r\n"); | ||||
| 
 | ||||
|     // ignore error and not send report to computer
 | ||||
|     if (is_error) { | ||||
|         dprint("Error usage! \r\n"); | ||||
|         return; | ||||
|     } | ||||
| 
 | ||||
|     ::memcpy(&usb_hid_keyboard_report, buf, sizeof(report_keyboard_t)); | ||||
|     usb_hid_time_stamp = millis(); | ||||
| } | ||||
|  |  | |||
|  | @ -2,11 +2,14 @@ | |||
| #define PARSER_H | ||||
| 
 | ||||
| #include "hid.h" | ||||
| #include "report.h" | ||||
| 
 | ||||
| class KBDReportParser : public HIDReportParser | ||||
| { | ||||
| public: | ||||
| 	virtual void Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf); | ||||
|     report_keyboard_t report; | ||||
|     uint16_t time_stamp; | ||||
|     virtual void Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf); | ||||
| }; | ||||
| 
 | ||||
| #endif | ||||
|  |  | |||
|  | @ -1,4 +1,42 @@ | |||
| 
 | ||||
| #----------------------------------------------------------------------------
 | ||||
| # On command line:
 | ||||
| #
 | ||||
| # make all = Make software.
 | ||||
| #
 | ||||
| # make clean = Clean out built project files.
 | ||||
| #
 | ||||
| # make coff = Convert ELF to AVR COFF.
 | ||||
| #
 | ||||
| # make extcoff = Convert ELF to AVR Extended COFF.
 | ||||
| #
 | ||||
| # make program = Download the hex file to the device.
 | ||||
| #                Please customize your programmer settings(PROGRAM_CMD)
 | ||||
| #
 | ||||
| # make teensy = Download the hex file to the device, using teensy_loader_cli.
 | ||||
| #               (must have teensy_loader_cli installed).
 | ||||
| #
 | ||||
| # make dfu = Download the hex file to the device, using dfu-programmer (must
 | ||||
| #            have dfu-programmer installed).
 | ||||
| #
 | ||||
| # make flip = Download the hex file to the device, using Atmel FLIP (must
 | ||||
| #             have Atmel FLIP installed).
 | ||||
| #
 | ||||
| # make dfu-ee = Download the eeprom file to the device, using dfu-programmer
 | ||||
| #               (must have dfu-programmer installed).
 | ||||
| #
 | ||||
| # make flip-ee = Download the eeprom file to the device, using Atmel FLIP
 | ||||
| #                (must have Atmel FLIP installed).
 | ||||
| #
 | ||||
| # make debug = Start either simulavr or avarice as specified for debugging, 
 | ||||
| #              with avr-gdb or avr-insight as the front end for debugging.
 | ||||
| #
 | ||||
| # make filename.s = Just compile filename.c into the assembler code only.
 | ||||
| #
 | ||||
| # make filename.i = Create a preprocessed source file for use in submitting
 | ||||
| #                   bug reports to the GCC project.
 | ||||
| #
 | ||||
| # To rebuild project do "make clean" then "make all".
 | ||||
| #----------------------------------------------------------------------------
 | ||||
| 
 | ||||
| # Target file name (without extension).
 | ||||
| TARGET = usb_hid_test | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Balz Guenat
						Balz Guenat