forked from mirrors/qmk_userspace
		
	Fix pin configuration of onekey for PS/2 mouse
This commit is contained in:
		
					parent
					
						
							
								4eb27ee890
							
						
					
				
			
			
				commit
				
					
						05be3d85d1
					
				
			
		
					 4 changed files with 14 additions and 14 deletions
				
			
		| 
						 | 
					@ -116,8 +116,8 @@ CONSOLE_ENABLE = yes	# Console for debug(+400)
 | 
				
			||||||
#SLEEP_LED_ENABLE = yes  # Breathing sleep LED during USB suspend
 | 
					#SLEEP_LED_ENABLE = yes  # Breathing sleep LED during USB suspend
 | 
				
			||||||
#NKRO_ENABLE = yes	# USB Nkey Rollover - not yet supported in LUFA
 | 
					#NKRO_ENABLE = yes	# USB Nkey Rollover - not yet supported in LUFA
 | 
				
			||||||
 | 
					
 | 
				
			||||||
PS2_MOUSE_ENABLE = yes  # PS/2 mouse(TrackPoint) support
 | 
					#PS2_MOUSE_ENABLE = yes  # PS/2 mouse(TrackPoint) support
 | 
				
			||||||
PS2_USE_BUSYWAIT = yes # uses primitive reference code
 | 
					#PS2_USE_BUSYWAIT = yes # uses primitive reference code
 | 
				
			||||||
#PS2_USE_INT = yes      # uses external interrupt for falling edge of PS/2 clock pin
 | 
					#PS2_USE_INT = yes      # uses external interrupt for falling edge of PS/2 clock pin
 | 
				
			||||||
#PS2_USE_USART = yes     # uses hardware USART engine for PS/2 signal receive(recomened)
 | 
					#PS2_USE_USART = yes     # uses hardware USART engine for PS/2 signal receive(recomened)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,5 @@
 | 
				
			||||||
Onekey
 | 
					Onekey
 | 
				
			||||||
======
 | 
					======
 | 
				
			||||||
Just one key keyboard for example. It sends 'a' key if pins PD0 and PD1 are short-circuited.
 | 
					Just one key keyboard for example. It sends 'a' key if pins PB0 and PB1 are short-circuited.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
https://github.com/tmk/tmk_keyboard/issues/56
 | 
					https://github.com/tmk/tmk_keyboard/issues/56
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -73,7 +73,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
#   define PS2_CLOCK_PORT  PORTD
 | 
					#   define PS2_CLOCK_PORT  PORTD
 | 
				
			||||||
#   define PS2_CLOCK_PIN   PIND
 | 
					#   define PS2_CLOCK_PIN   PIND
 | 
				
			||||||
#   define PS2_CLOCK_DDR   DDRD
 | 
					#   define PS2_CLOCK_DDR   DDRD
 | 
				
			||||||
#   define PS2_CLOCK_BIT   5
 | 
					#   define PS2_CLOCK_BIT   1
 | 
				
			||||||
#   define PS2_DATA_PORT   PORTD
 | 
					#   define PS2_DATA_PORT   PORTD
 | 
				
			||||||
#   define PS2_DATA_PIN    PIND
 | 
					#   define PS2_DATA_PIN    PIND
 | 
				
			||||||
#   define PS2_DATA_DDR    DDRD
 | 
					#   define PS2_DATA_DDR    DDRD
 | 
				
			||||||
| 
						 | 
					@ -87,7 +87,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
#define PS2_CLOCK_PORT  PORTD
 | 
					#define PS2_CLOCK_PORT  PORTD
 | 
				
			||||||
#define PS2_CLOCK_PIN   PIND
 | 
					#define PS2_CLOCK_PIN   PIND
 | 
				
			||||||
#define PS2_CLOCK_DDR   DDRD
 | 
					#define PS2_CLOCK_DDR   DDRD
 | 
				
			||||||
#define PS2_CLOCK_BIT   5
 | 
					#define PS2_CLOCK_BIT   1
 | 
				
			||||||
#define PS2_DATA_PORT   PORTD
 | 
					#define PS2_DATA_PORT   PORTD
 | 
				
			||||||
#define PS2_DATA_PIN    PIND
 | 
					#define PS2_DATA_PIN    PIND
 | 
				
			||||||
#define PS2_DATA_DDR    DDRD
 | 
					#define PS2_DATA_DDR    DDRD
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -139,29 +139,29 @@ uint8_t matrix_key_count(void)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Column pin configuration
 | 
					/* Column pin configuration
 | 
				
			||||||
 * col: 0
 | 
					 * col: 0
 | 
				
			||||||
 * pin: D0
 | 
					 * pin: B0
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static void  init_cols(void)
 | 
					static void  init_cols(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    // Input with pull-up(DDR:0, PORT:1)
 | 
					    // Input with pull-up(DDR:0, PORT:1)
 | 
				
			||||||
    DDRD  &= ~(1<<0);
 | 
					    DDRB  &= ~(1<<0);
 | 
				
			||||||
    PORTD |=  (1<<0);
 | 
					    PORTB |=  (1<<0);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static matrix_row_t read_cols(void)
 | 
					static matrix_row_t read_cols(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return (PIND&(1<<0) ? 0 : (1<<0));
 | 
					    return (PINB&(1<<0) ? 0 : (1<<0));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Row pin configuration
 | 
					/* Row pin configuration
 | 
				
			||||||
 * row: 0
 | 
					 * row: 0
 | 
				
			||||||
 * pin: D1
 | 
					 * pin: B1
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static void unselect_rows(void)
 | 
					static void unselect_rows(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    // Hi-Z(DDR:0, PORT:0) to unselect
 | 
					    // Hi-Z(DDR:0, PORT:0) to unselect
 | 
				
			||||||
    DDRD  &= ~0b00000010;
 | 
					    DDRB  &= ~0b00000010;
 | 
				
			||||||
    PORTD &= ~0b00000010;
 | 
					    PORTB &= ~0b00000010;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void select_row(uint8_t row)
 | 
					static void select_row(uint8_t row)
 | 
				
			||||||
| 
						 | 
					@ -169,8 +169,8 @@ static void select_row(uint8_t row)
 | 
				
			||||||
    // Output low(DDR:1, PORT:0) to select
 | 
					    // Output low(DDR:1, PORT:0) to select
 | 
				
			||||||
    switch (row) {
 | 
					    switch (row) {
 | 
				
			||||||
        case 0:
 | 
					        case 0:
 | 
				
			||||||
            DDRD  |= (1<<1);
 | 
					            DDRB  |= (1<<1);
 | 
				
			||||||
            PORTD &= ~(1<<1);
 | 
					            PORTB &= ~(1<<1);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue