Refactor send_extra (#18615)
				
					
				
			This commit is contained in:
		
							parent
							
								
									cbe1c22d46
								
							
						
					
					
						commit
						6dbbeea46a
					
				
					 16 changed files with 68 additions and 107 deletions
				
			
		| 
						 | 
				
			
			@ -58,7 +58,7 @@
 | 
			
		|||
uint8_t keyboard_leds(void);
 | 
			
		||||
void    send_keyboard(report_keyboard_t *report);
 | 
			
		||||
void    send_mouse(report_mouse_t *report);
 | 
			
		||||
void    send_extra(uint8_t report_id, uint16_t data);
 | 
			
		||||
void    send_extra(report_extra_t *report);
 | 
			
		||||
 | 
			
		||||
/* host struct */
 | 
			
		||||
host_driver_t chibios_driver = {keyboard_leds, send_keyboard, send_mouse, send_extra};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -943,7 +943,7 @@ void shared_in_cb(USBDriver *usbp, usbep_t ep) {
 | 
			
		|||
 * ---------------------------------------------------------
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
void send_extra(uint8_t report_id, uint16_t data) {
 | 
			
		||||
void send_extra(report_extra_t *report) {
 | 
			
		||||
#ifdef EXTRAKEY_ENABLE
 | 
			
		||||
    osalSysLock();
 | 
			
		||||
    if (usbGetDriverStateI(&USB_DRIVER) != USB_ACTIVE) {
 | 
			
		||||
| 
						 | 
				
			
			@ -962,10 +962,7 @@ void send_extra(uint8_t report_id, uint16_t data) {
 | 
			
		|||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    static report_extra_t report;
 | 
			
		||||
    report = (report_extra_t){.report_id = report_id, .usage = data};
 | 
			
		||||
 | 
			
		||||
    usbStartTransmitI(&USB_DRIVER, SHARED_IN_EPNUM, (uint8_t *)&report, sizeof(report_extra_t));
 | 
			
		||||
    usbStartTransmitI(&USB_DRIVER, SHARED_IN_EPNUM, (uint8_t *)report, sizeof(report_extra_t));
 | 
			
		||||
    osalSysUnlock();
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue