Fix 1<col instead of 1<<col typo in matrix_is_on()
				
					
				
			This commit is contained in:
		
				
					committed by
					
						 Drashna Jaelre
						Drashna Jaelre
					
				
			
			
				
	
			
			
			
						parent
						
							4d9b11af14
						
					
				
				
					commit
					6d2071ad6e
				
			| @@ -112,7 +112,7 @@ uint8_t matrix_scan(void) | |||||||
|             if (timeout > 10000){ |             if (timeout > 10000){ | ||||||
|                 break; |                 break; | ||||||
|             } |             } | ||||||
|         }  |         } | ||||||
|         uart_data[i] = SERIAL_UART_DATA; |         uart_data[i] = SERIAL_UART_DATA; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -134,7 +134,7 @@ uint8_t matrix_scan(void) | |||||||
| inline | inline | ||||||
| bool matrix_is_on(uint8_t row, uint8_t col) | bool matrix_is_on(uint8_t row, uint8_t col) | ||||||
| { | { | ||||||
|     return (matrix[row] & ((matrix_row_t)1<col)); |     return (matrix[row] & ((matrix_row_t)1<<col)); | ||||||
| } | } | ||||||
|  |  | ||||||
| inline | inline | ||||||
|   | |||||||
| @@ -116,7 +116,7 @@ uint8_t matrix_scan(void) | |||||||
|             if (timeout > 10000){ |             if (timeout > 10000){ | ||||||
|                 break; |                 break; | ||||||
|             } |             } | ||||||
|         }  |         } | ||||||
|         uart_data[i] = SERIAL_UART_DATA; |         uart_data[i] = SERIAL_UART_DATA; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -138,7 +138,7 @@ uint8_t matrix_scan(void) | |||||||
| inline | inline | ||||||
| bool matrix_is_on(uint8_t row, uint8_t col) | bool matrix_is_on(uint8_t row, uint8_t col) | ||||||
| { | { | ||||||
|     return (matrix[row] & ((matrix_row_t)1<col)); |     return (matrix[row] & ((matrix_row_t)1<<col)); | ||||||
| } | } | ||||||
|  |  | ||||||
| inline | inline | ||||||
|   | |||||||
| @@ -102,7 +102,7 @@ uint8_t matrix_scan(void) | |||||||
|             if (timeout > 10000){ |             if (timeout > 10000){ | ||||||
|                 break; |                 break; | ||||||
|             } |             } | ||||||
|         }  |         } | ||||||
|         uart_data[i] = SERIAL_UART_DATA; |         uart_data[i] = SERIAL_UART_DATA; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -124,7 +124,7 @@ uint8_t matrix_scan(void) | |||||||
| inline | inline | ||||||
| bool matrix_is_on(uint8_t row, uint8_t col) | bool matrix_is_on(uint8_t row, uint8_t col) | ||||||
| { | { | ||||||
|     return (matrix[row] & ((matrix_row_t)1<col)); |     return (matrix[row] & ((matrix_row_t)1<<col)); | ||||||
| } | } | ||||||
|  |  | ||||||
| inline | inline | ||||||
|   | |||||||
| @@ -102,7 +102,7 @@ uint8_t matrix_scan(void) | |||||||
|             if (timeout > 10000){ |             if (timeout > 10000){ | ||||||
|                 break; |                 break; | ||||||
|             } |             } | ||||||
|         }  |         } | ||||||
|         uart_data[i] = SERIAL_UART_DATA; |         uart_data[i] = SERIAL_UART_DATA; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -124,7 +124,7 @@ uint8_t matrix_scan(void) | |||||||
| inline | inline | ||||||
| bool matrix_is_on(uint8_t row, uint8_t col) | bool matrix_is_on(uint8_t row, uint8_t col) | ||||||
| { | { | ||||||
|     return (matrix[row] & ((matrix_row_t)1<col)); |     return (matrix[row] & ((matrix_row_t)1<<col)); | ||||||
| } | } | ||||||
|  |  | ||||||
| inline | inline | ||||||
|   | |||||||
| @@ -218,7 +218,7 @@ bool matrix_is_modified(void) | |||||||
| inline | inline | ||||||
| bool matrix_is_on(uint8_t row, uint8_t col) | bool matrix_is_on(uint8_t row, uint8_t col) | ||||||
| { | { | ||||||
|     return (matrix[row] & ((matrix_row_t)1<col)); |     return (matrix[row] & ((matrix_row_t)1<<col)); | ||||||
| } | } | ||||||
|  |  | ||||||
| inline | inline | ||||||
|   | |||||||
| @@ -158,7 +158,7 @@ void matrix_init(void) { | |||||||
|         matrix[i] = 0; |         matrix[i] = 0; | ||||||
|         matrix_debouncing[i] = 0; |         matrix_debouncing[i] = 0; | ||||||
|     } |     } | ||||||
|      |  | ||||||
|     matrix_init_quantum(); |     matrix_init_quantum(); | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -209,7 +209,7 @@ uint8_t matrix_scan(void) | |||||||
|             debouncing = false; |             debouncing = false; | ||||||
|         } |         } | ||||||
| #   endif | #   endif | ||||||
|          |  | ||||||
|     if (i2c_transaction(SLAVE_I2C_ADDRESS_RIGHT, 0x3F, 0)){ //error has occured for main right half |     if (i2c_transaction(SLAVE_I2C_ADDRESS_RIGHT, 0x3F, 0)){ //error has occured for main right half | ||||||
|         error_count_right++; |         error_count_right++; | ||||||
|         if (error_count_right > ERROR_DISCONNECT_COUNT){ //disconnect half |         if (error_count_right > ERROR_DISCONNECT_COUNT){ //disconnect half | ||||||
| @@ -220,7 +220,7 @@ uint8_t matrix_scan(void) | |||||||
|    }else{ //no error |    }else{ //no error | ||||||
|         error_count_right = 0; |         error_count_right = 0; | ||||||
|     } |     } | ||||||
|      |  | ||||||
|     if (i2c_transaction(SLAVE_I2C_ADDRESS_ARROW, 0X3FFF, 8)){ //error has occured for arrow cluster |     if (i2c_transaction(SLAVE_I2C_ADDRESS_ARROW, 0X3FFF, 8)){ //error has occured for arrow cluster | ||||||
|         error_count_arrow++; |         error_count_arrow++; | ||||||
|         if (error_count_arrow > ERROR_DISCONNECT_COUNT){ //disconnect arrow cluster |         if (error_count_arrow > ERROR_DISCONNECT_COUNT){ //disconnect arrow cluster | ||||||
| @@ -258,7 +258,7 @@ bool matrix_is_modified(void) | |||||||
| inline | inline | ||||||
| bool matrix_is_on(uint8_t row, uint8_t col) | bool matrix_is_on(uint8_t row, uint8_t col) | ||||||
| { | { | ||||||
|     return (matrix[row] & ((matrix_row_t)1<col)); |     return (matrix[row] & ((matrix_row_t)1<<col)); | ||||||
| } | } | ||||||
|  |  | ||||||
| inline | inline | ||||||
|   | |||||||
| @@ -218,7 +218,7 @@ bool matrix_is_modified(void) | |||||||
| inline | inline | ||||||
| bool matrix_is_on(uint8_t row, uint8_t col) | bool matrix_is_on(uint8_t row, uint8_t col) | ||||||
| { | { | ||||||
|     return (matrix[row] & ((matrix_row_t)1<col)); |     return (matrix[row] & ((matrix_row_t)1<<col)); | ||||||
| } | } | ||||||
|  |  | ||||||
| inline | inline | ||||||
|   | |||||||
| @@ -218,7 +218,7 @@ bool matrix_is_modified(void) | |||||||
| inline | inline | ||||||
| bool matrix_is_on(uint8_t row, uint8_t col) | bool matrix_is_on(uint8_t row, uint8_t col) | ||||||
| { | { | ||||||
|     return (matrix[row] & ((matrix_row_t)1<col)); |     return (matrix[row] & ((matrix_row_t)1<<col)); | ||||||
| } | } | ||||||
|  |  | ||||||
| inline | inline | ||||||
|   | |||||||
| @@ -198,7 +198,7 @@ uint8_t matrix_scan(void) | |||||||
| inline | inline | ||||||
| bool matrix_is_on(uint8_t row, uint8_t col) | bool matrix_is_on(uint8_t row, uint8_t col) | ||||||
| { | { | ||||||
|     return (matrix[row] & ((matrix_row_t)1<col)); |     return (matrix[row] & ((matrix_row_t)1<<col)); | ||||||
| } | } | ||||||
|  |  | ||||||
| inline | inline | ||||||
|   | |||||||
| @@ -167,7 +167,7 @@ inline | |||||||
| bool matrix_is_on(uint8_t row, uint8_t col) | bool matrix_is_on(uint8_t row, uint8_t col) | ||||||
|  |  | ||||||
| { | { | ||||||
|     return (matrix[row] & ((matrix_row_t)1<col)); |     return (matrix[row] & ((matrix_row_t)1<<col)); | ||||||
| } | } | ||||||
|  |  | ||||||
| inline | inline | ||||||
|   | |||||||
| @@ -97,7 +97,7 @@ uint8_t matrix_scan(void) | |||||||
| inline | inline | ||||||
| bool matrix_is_on(uint8_t row, uint8_t col) | bool matrix_is_on(uint8_t row, uint8_t col) | ||||||
| { | { | ||||||
|     return (matrix[row] & ((matrix_row_t)1<col)); |     return (matrix[row] & ((matrix_row_t)1<<col)); | ||||||
| } | } | ||||||
|  |  | ||||||
| inline | inline | ||||||
|   | |||||||
| @@ -112,7 +112,7 @@ uint8_t matrix_scan(void) | |||||||
| inline | inline | ||||||
| bool matrix_is_on(uint8_t row, uint8_t col) | bool matrix_is_on(uint8_t row, uint8_t col) | ||||||
| { | { | ||||||
|     return (matrix[row] & ((matrix_row_t)1<col)); |     return (matrix[row] & ((matrix_row_t)1<<col)); | ||||||
| } | } | ||||||
|  |  | ||||||
| inline | inline | ||||||
|   | |||||||
| @@ -103,7 +103,7 @@ uint8_t matrix_scan(void) | |||||||
|             if (timeout > 10000){ |             if (timeout > 10000){ | ||||||
|                 break; |                 break; | ||||||
|             } |             } | ||||||
|         }  |         } | ||||||
|         uart_data[i] = SERIAL_UART_DATA; |         uart_data[i] = SERIAL_UART_DATA; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -125,7 +125,7 @@ uint8_t matrix_scan(void) | |||||||
| inline | inline | ||||||
| bool matrix_is_on(uint8_t row, uint8_t col) | bool matrix_is_on(uint8_t row, uint8_t col) | ||||||
| { | { | ||||||
|     return (matrix[row] & ((matrix_row_t)1<col)); |     return (matrix[row] & ((matrix_row_t)1<<col)); | ||||||
| } | } | ||||||
|  |  | ||||||
| inline | inline | ||||||
|   | |||||||
| @@ -1,15 +1,15 @@ | |||||||
| /* Copyright 2017 Mattia Dal Ben | /* Copyright 2017 Mattia Dal Ben | ||||||
|  *  |  * | ||||||
|  * This program is free software: you can redistribute it and/or modify |  * This program is free software: you can redistribute it and/or modify | ||||||
|  * it under the terms of the GNU General Public License as published by |  * it under the terms of the GNU General Public License as published by | ||||||
|  * the Free Software Foundation, either version 2 of the License, or |  * the Free Software Foundation, either version 2 of the License, or | ||||||
|  * (at your option) any later version. |  * (at your option) any later version. | ||||||
|  *  |  * | ||||||
|  * This program is distributed in the hope that it will be useful, |  * This program is distributed in the hope that it will be useful, | ||||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  * GNU General Public License for more details. |  * GNU General Public License for more details. | ||||||
|  *  |  * | ||||||
|  * You should have received a copy of the GNU General Public License |  * You should have received a copy of the GNU General Public License | ||||||
|  * along with this program.  If not, see <http://www.gnu.org/licenses/>. |  * along with this program.  If not, see <http://www.gnu.org/licenses/>. | ||||||
|  */ |  */ | ||||||
| @@ -132,7 +132,7 @@ uint8_t matrix_scan(void) | |||||||
| inline | inline | ||||||
| bool matrix_is_on(uint8_t row, uint8_t col) | bool matrix_is_on(uint8_t row, uint8_t col) | ||||||
| { | { | ||||||
|     return (matrix[row] & ((matrix_row_t)1<col)); |     return (matrix[row] & ((matrix_row_t)1<<col)); | ||||||
| } | } | ||||||
|  |  | ||||||
| inline | inline | ||||||
|   | |||||||
| @@ -137,7 +137,7 @@ void matrix_init(void) { | |||||||
|  |  | ||||||
| uint8_t matrix_scan(void) | uint8_t matrix_scan(void) | ||||||
| { | { | ||||||
|     if (mcp23018_status) {  |     if (mcp23018_status) { | ||||||
|         /* if there was an error */ |         /* if there was an error */ | ||||||
|         if (++mcp23018_reset_loop == 0) { |         if (++mcp23018_reset_loop == 0) { | ||||||
|             /* since mcp23018_reset_loop is 8 bit - we'll try to reset once in 255 matrix scans |             /* since mcp23018_reset_loop is 8 bit - we'll try to reset once in 255 matrix scans | ||||||
| @@ -190,7 +190,7 @@ bool matrix_is_modified(void) | |||||||
| inline | inline | ||||||
| bool matrix_is_on(uint8_t row, uint8_t col) | bool matrix_is_on(uint8_t row, uint8_t col) | ||||||
| { | { | ||||||
|     return (matrix[row] & ((matrix_row_t)1<col)); |     return (matrix[row] & ((matrix_row_t)1<<col)); | ||||||
| } | } | ||||||
|  |  | ||||||
| inline | inline | ||||||
| @@ -246,7 +246,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) | |||||||
|     select_row(current_row); |     select_row(current_row); | ||||||
|     wait_us(30); |     wait_us(30); | ||||||
|  |  | ||||||
|     if (mcp23018_status) {  |     if (mcp23018_status) { | ||||||
|         /* if there was an error */ |         /* if there was an error */ | ||||||
|         return 0; |         return 0; | ||||||
|     } else { |     } else { | ||||||
| @@ -279,7 +279,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) | |||||||
|  |  | ||||||
| static void select_row(uint8_t row) | static void select_row(uint8_t row) | ||||||
| { | { | ||||||
|     if (mcp23018_status) {  |     if (mcp23018_status) { | ||||||
|         /* if there was an error do nothing */ |         /* if there was an error do nothing */ | ||||||
|     } else { |     } else { | ||||||
|         /* set active row low  : 0 |         /* set active row low  : 0 | ||||||
|   | |||||||
| @@ -112,7 +112,7 @@ uint8_t matrix_scan(void) | |||||||
|             if (timeout > 10000){ |             if (timeout > 10000){ | ||||||
|                 break; |                 break; | ||||||
|             } |             } | ||||||
|         }  |         } | ||||||
|         uart_data[i] = SERIAL_UART_DATA; |         uart_data[i] = SERIAL_UART_DATA; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -134,7 +134,7 @@ uint8_t matrix_scan(void) | |||||||
| inline | inline | ||||||
| bool matrix_is_on(uint8_t row, uint8_t col) | bool matrix_is_on(uint8_t row, uint8_t col) | ||||||
| { | { | ||||||
|     return (matrix[row] & ((matrix_row_t)1<col)); |     return (matrix[row] & ((matrix_row_t)1<<col)); | ||||||
| } | } | ||||||
|  |  | ||||||
| inline | inline | ||||||
|   | |||||||
| @@ -184,7 +184,7 @@ bool matrix_is_modified(void) | |||||||
| inline | inline | ||||||
| bool matrix_is_on(uint8_t row, uint8_t col) | bool matrix_is_on(uint8_t row, uint8_t col) | ||||||
| { | { | ||||||
|     return (matrix[row] & ((matrix_row_t)1<col)); |     return (matrix[row] & ((matrix_row_t)1<<col)); | ||||||
| } | } | ||||||
|  |  | ||||||
| inline | inline | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user