scanAsync improved
This commit is contained in:
		
							parent
							
								
									c65d505969
								
							
						
					
					
						commit
						69e6e69c77
					
				| @ -67,41 +67,13 @@ void Keyboard::scanAsync() | |||||||
|     /** Without delay - scanning only one column per cycle **/ |     /** Without delay - scanning only one column per cycle **/ | ||||||
|     if (millis() < _timeElapsed + this->_debounce) |     if (millis() < _timeElapsed + this->_debounce) | ||||||
|         return; |         return; | ||||||
|     uint8_t key = 0; |     uint8_t key = 4*_current_scan_col; | ||||||
|     switch (_current_scan_col) |     scanColumn(&key, 1, 4); | ||||||
|     { |     pcf8574->digitalWrite(7-(_current_scan_col+1)%3, LOW); | ||||||
|         default: |     pcf8574->digitalWrite(7-_current_scan_col, HIGH); | ||||||
|             pcf8574->digitalWrite(7, LOW); |     _current_scan_col++;  | ||||||
|             _current_scan_col = 1; |     if(_current_scan_col>2) | ||||||
|             break; |         _current_scan_col = 0;   | ||||||
|         case 1: |  | ||||||
|         { |  | ||||||
|             scanColumn(&key, 1, 4); |  | ||||||
|             pcf8574->digitalWrite(6, LOW);             |  | ||||||
|             pcf8574->digitalWrite(7, HIGH); |  | ||||||
|             _current_scan_col = 2; |  | ||||||
|             break; |  | ||||||
|         } |  | ||||||
|         case 2: |  | ||||||
|         { |  | ||||||
|             key=4; |  | ||||||
|             scanColumn(&key, 1, 4); |  | ||||||
|             pcf8574->digitalWrite(5, LOW);             |  | ||||||
|             pcf8574->digitalWrite(6, HIGH); |  | ||||||
|             _current_scan_col = 3; |  | ||||||
|             break; |  | ||||||
|         } |  | ||||||
|         case 3: |  | ||||||
|         { |  | ||||||
|             key=8; |  | ||||||
|             scanColumn(&key, 1, 4); |  | ||||||
|             pcf8574->digitalWrite(7, LOW);             |  | ||||||
|             pcf8574->digitalWrite(5, HIGH); |  | ||||||
|             _current_scan_col = 1; |  | ||||||
|             break; |  | ||||||
|         } |  | ||||||
|         break; |  | ||||||
|     } |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void Keyboard::scanColumn(uint8_t* key_ptr, uint8_t start, uint8_t stop){ | void Keyboard::scanColumn(uint8_t* key_ptr, uint8_t start, uint8_t stop){ | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user