xt_usb: read data on falling edge soft/hard reset
See https://github.com/tmk/tmk_keyboard/wiki/IBM-PC-XT-Keyboard-Protocol - read data on falling edge of clock - add soft reset and hard reset
This commit is contained in:
parent
3526fcaf15
commit
8a92f254e1
6 changed files with 78 additions and 39 deletions
|
|
@ -45,8 +45,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
/*
|
||||
* XT Pin interrupt
|
||||
*/
|
||||
#ifdef XT_USE_INT
|
||||
/* uses INT1 for clock line(ATMega32U4) */
|
||||
#define XT_CLOCK_PORT PORTD
|
||||
#define XT_CLOCK_PIN PIND
|
||||
#define XT_CLOCK_DDR DDRD
|
||||
|
|
@ -55,9 +53,23 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#define XT_DATA_PIN PIND
|
||||
#define XT_DATA_DDR DDRD
|
||||
#define XT_DATA_BIT 0
|
||||
#define XT_RST_PORT PORTB
|
||||
#define XT_RST_PIN PINB
|
||||
#define XT_RST_DDR DDRB
|
||||
#define XT_RST_BIT 7
|
||||
|
||||
/* hard reset: low pulse for 500ms and after that HiZ for safety */
|
||||
#define XT_RESET() do { \
|
||||
XT_RST_PORT &= ~(1<<XT_RST_BIT); \
|
||||
XT_RST_DDR |= (1<<XT_RST_BIT); \
|
||||
_delay_ms(500); \
|
||||
XT_RST_DDR &= ~(1<<XT_RST_BIT); \
|
||||
} while (0)
|
||||
|
||||
/* INT1 for falling edge of clock line */
|
||||
#define XT_INT_INIT() do { \
|
||||
EICRA |= ((1<<ISC11) | \
|
||||
(1<<ISC10)); \
|
||||
(0<<ISC10)); \
|
||||
} while (0)
|
||||
#define XT_INT_ON() do { \
|
||||
EIMSK |= (1<<INT1); \
|
||||
|
|
@ -66,6 +78,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
EIMSK &= ~(1<<INT1); \
|
||||
} while (0)
|
||||
#define XT_INT_VECT INT1_vect
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue