mirror of
				https://github.com/mfulz/qmk_firmware.git
				synced 2025-10-31 13:22:31 +01:00 
			
		
		
		
	Update led_update_kb example (#7451)
* Update led_update_kb example * Update comment to explain pin behavior * wordsmith * wordsmithing 2
This commit is contained in:
		
							parent
							
								
									eae21eed74
								
							
						
					
					
						commit
						3541f01a72
					
				| @ -132,31 +132,16 @@ Some examples include: | |||||||
| bool led_update_kb(led_t led_state) { | bool led_update_kb(led_t led_state) { | ||||||
|     bool res = led_update_user(led_state); |     bool res = led_update_user(led_state); | ||||||
|     if(res) { |     if(res) { | ||||||
|         if (led_state.num_lock) { |         // writePin sets the pin high for 1 and low for 0. | ||||||
|             writePinLow(B0); |         // In this example the pins are inverted, setting | ||||||
|         } else { |         // it low/0 turns it on, and high/1 turns the LED off. | ||||||
|             writePinHigh(B0); |         // This behavior depends on whether the LED is between the pin | ||||||
|         } |         // and VCC or the pin and GND. | ||||||
|         if (led_state.caps_lock) { |         writePin(B0, !led_state.num_lock); | ||||||
|             writePinLow(B1); |         writePin(B1, !led_state.caps_lock); | ||||||
|         } else { |         writePin(B2, !led_state.scroll_lock); | ||||||
|             writePinHigh(B1); |         writePin(B3, !led_state.compose); | ||||||
|         } |         writePin(B4, !led_state.kana); | ||||||
|         if (led_state.scroll_lock) { |  | ||||||
|             writePinLow(B2); |  | ||||||
|         } else { |  | ||||||
|             writePinHigh(B2); |  | ||||||
|         } |  | ||||||
|         if (led_state.compose) { |  | ||||||
|             writePinLow(B3); |  | ||||||
|         } else { |  | ||||||
|             writePinHigh(B3); |  | ||||||
|         } |  | ||||||
|         if (led_state.kana) { |  | ||||||
|             writePinLow(B4); |  | ||||||
|         } else { |  | ||||||
|             writePinHigh(B4); |  | ||||||
|         } |  | ||||||
|     } |     } | ||||||
|     return res; |     return res; | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Yan-Fa Li
						Yan-Fa Li