Simplify extrakeys sending at the host driver level (#18230)
* Simplify extrakeys sending at the host driver level * There are two arguments here * Wrong syntax * Adjust keyboards which use a custom host driver
This commit is contained in:
		
							parent
							
								
									0ceaaaae8e
								
							
						
					
					
						commit
						09d668eb0e
					
				
					 12 changed files with 70 additions and 149 deletions
				
			
		| 
						 | 
				
			
			@ -31,7 +31,7 @@ uint8_t hex_digit_to_keycode(uint8_t digit) {
 | 
			
		|||
}
 | 
			
		||||
} // namespace
 | 
			
		||||
 | 
			
		||||
TestDriver::TestDriver() : m_driver{&TestDriver::keyboard_leds, &TestDriver::send_keyboard, &TestDriver::send_mouse, &TestDriver::send_system, &TestDriver::send_consumer} {
 | 
			
		||||
TestDriver::TestDriver() : m_driver{&TestDriver::keyboard_leds, &TestDriver::send_keyboard, &TestDriver::send_mouse, &TestDriver::send_extra} {
 | 
			
		||||
    host_set_driver(&m_driver);
 | 
			
		||||
    m_this = this;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -53,12 +53,8 @@ void TestDriver::send_mouse(report_mouse_t* report) {
 | 
			
		|||
    m_this->send_mouse_mock(*report);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TestDriver::send_system(uint16_t data) {
 | 
			
		||||
    m_this->send_system_mock(data);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TestDriver::send_consumer(uint16_t data) {
 | 
			
		||||
    m_this->send_consumer(data);
 | 
			
		||||
void TestDriver::send_extra(uint8_t report_id, uint16_t data) {
 | 
			
		||||
    m_this->send_extra_mock(report_id, data);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
namespace internal {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,15 +32,13 @@ class TestDriver {
 | 
			
		|||
 | 
			
		||||
    MOCK_METHOD1(send_keyboard_mock, void(report_keyboard_t&));
 | 
			
		||||
    MOCK_METHOD1(send_mouse_mock, void(report_mouse_t&));
 | 
			
		||||
    MOCK_METHOD1(send_system_mock, void(uint16_t));
 | 
			
		||||
    MOCK_METHOD1(send_consumer_mock, void(uint16_t));
 | 
			
		||||
    MOCK_METHOD2(send_extra_mock, void(uint8_t, uint16_t));
 | 
			
		||||
 | 
			
		||||
   private:
 | 
			
		||||
    static uint8_t     keyboard_leds(void);
 | 
			
		||||
    static void        send_keyboard(report_keyboard_t* report);
 | 
			
		||||
    static void        send_mouse(report_mouse_t* report);
 | 
			
		||||
    static void        send_system(uint16_t data);
 | 
			
		||||
    static void        send_consumer(uint16_t data);
 | 
			
		||||
    static void        send_extra(uint8_t report_id, uint16_t data);
 | 
			
		||||
    host_driver_t      m_driver;
 | 
			
		||||
    uint8_t            m_leds = 0;
 | 
			
		||||
    static TestDriver* m_this;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue