summaryrefslogtreecommitdiffstats
path: root/tmk_core/protocol/ps2_io_avr.c
diff options
context:
space:
mode:
authorWilliam Chang <william@factual.com>2019-11-20 22:17:07 -0800
committerWilliam Chang <william@factual.com>2019-11-20 22:17:07 -0800
commite7f4d56592b3975c38af329e77b4efd9108495e8 (patch)
tree0a416bccbf70bfdbdb9ffcdb3bf136b47378c014 /tmk_core/protocol/ps2_io_avr.c
parent71493b2f9bbd5f3d18373c518fa14ccafcbf48fc (diff)
parent8416a94ad27b3ff058576f09f35f0704a8b39ff3 (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'tmk_core/protocol/ps2_io_avr.c')
-rw-r--r--tmk_core/protocol/ps2_io_avr.c69
1 files changed, 26 insertions, 43 deletions
diff --git a/tmk_core/protocol/ps2_io_avr.c b/tmk_core/protocol/ps2_io_avr.c
index ed462345ba..a9ac5d338d 100644
--- a/tmk_core/protocol/ps2_io_avr.c
+++ b/tmk_core/protocol/ps2_io_avr.c
@@ -3,73 +3,56 @@
#include <util/delay.h>
/* Check port settings for clock and data line */
-#if !(defined(PS2_CLOCK_PORT) && \
- defined(PS2_CLOCK_PIN) && \
- defined(PS2_CLOCK_DDR) && \
- defined(PS2_CLOCK_BIT))
-# error "PS/2 clock port setting is required in config.h"
+#if !(defined(PS2_CLOCK_PORT) && defined(PS2_CLOCK_PIN) && defined(PS2_CLOCK_DDR) && defined(PS2_CLOCK_BIT))
+# error "PS/2 clock port setting is required in config.h"
#endif
-#if !(defined(PS2_DATA_PORT) && \
- defined(PS2_DATA_PIN) && \
- defined(PS2_DATA_DDR) && \
- defined(PS2_DATA_BIT))
-# error "PS/2 data port setting is required in config.h"
+#if !(defined(PS2_DATA_PORT) && defined(PS2_DATA_PIN) && defined(PS2_DATA_DDR) && defined(PS2_DATA_BIT))
+# error "PS/2 data port setting is required in config.h"
#endif
-
/*
* Clock
*/
-void clock_init(void)
-{
-}
+void clock_init(void) {}
-void clock_lo(void)
-{
- PS2_CLOCK_PORT &= ~(1<<PS2_CLOCK_BIT);
- PS2_CLOCK_DDR |= (1<<PS2_CLOCK_BIT);
+void clock_lo(void) {
+ PS2_CLOCK_PORT &= ~(1 << PS2_CLOCK_BIT);
+ PS2_CLOCK_DDR |= (1 << PS2_CLOCK_BIT);
}
-void clock_hi(void)
-{
+void clock_hi(void) {
/* input with pull up */
- PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT);
- PS2_CLOCK_PORT |= (1<<PS2_CLOCK_BIT);
+ PS2_CLOCK_DDR &= ~(1 << PS2_CLOCK_BIT);
+ PS2_CLOCK_PORT |= (1 << PS2_CLOCK_BIT);
}
-bool clock_in(void)
-{
- PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT);
- PS2_CLOCK_PORT |= (1<<PS2_CLOCK_BIT);
+bool clock_in(void) {
+ PS2_CLOCK_DDR &= ~(1 << PS2_CLOCK_BIT);
+ PS2_CLOCK_PORT |= (1 << PS2_CLOCK_BIT);
_delay_us(1);
- return PS2_CLOCK_PIN&(1<<PS2_CLOCK_BIT);
+ return PS2_CLOCK_PIN & (1 << PS2_CLOCK_BIT);
}
/*
* Data
*/
-void data_init(void)
-{
-}
+void data_init(void) {}
-void data_lo(void)
-{
- PS2_DATA_PORT &= ~(1<<PS2_DATA_BIT);
- PS2_DATA_DDR |= (1<<PS2_DATA_BIT);
+void data_lo(void) {
+ PS2_DATA_PORT &= ~(1 << PS2_DATA_BIT);
+ PS2_DATA_DDR |= (1 << PS2_DATA_BIT);
}
-void data_hi(void)
-{
+void data_hi(void) {
/* input with pull up */
- PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT);
- PS2_DATA_PORT |= (1<<PS2_DATA_BIT);
+ PS2_DATA_DDR &= ~(1 << PS2_DATA_BIT);
+ PS2_DATA_PORT |= (1 << PS2_DATA_BIT);
}
-bool data_in(void)
-{
- PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT);
- PS2_DATA_PORT |= (1<<PS2_DATA_BIT);
+bool data_in(void) {
+ PS2_DATA_DDR &= ~(1 << PS2_DATA_BIT);
+ PS2_DATA_PORT |= (1 << PS2_DATA_BIT);
_delay_us(1);
- return PS2_DATA_PIN&(1<<PS2_DATA_BIT);
+ return PS2_DATA_PIN & (1 << PS2_DATA_BIT);
}