summaryrefslogtreecommitdiffstats
path: root/converter/sun_usb
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2013-02-25 00:40:15 +0100
committertmk <nobody@nowhere>2013-02-25 06:14:46 +0100
commit308abf598d4cc19be3c5b137bbd13d18510a083a (patch)
tree8cc5d21272b79d4011734ee074479c2bb99e7fc8 /converter/sun_usb
parentea1ede83c36272ccaeb5e4d80efc3885edbb9209 (diff)
downloadqmk_firmware-308abf598d4cc19be3c5b137bbd13d18510a083a.tar.gz
qmk_firmware-308abf598d4cc19be3c5b137bbd13d18510a083a.tar.xz
Fix software serial configure
Diffstat (limited to 'converter/sun_usb')
-rw-r--r--converter/sun_usb/config.h68
1 files changed, 37 insertions, 31 deletions
diff --git a/converter/sun_usb/config.h b/converter/sun_usb/config.h
index b4f0ff977..65ce9daf6 100644
--- a/converter/sun_usb/config.h
+++ b/converter/sun_usb/config.h
@@ -43,40 +43,46 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
* asynchronous, negative logic, 1200baud, no flow control
* 1-start bit, 8-data bit, non parity, 1-stop bit
*/
-#define SERIAL_BAUD 1200
-
-#define SERIAL_RXD_DDR DDRD
-#define SERIAL_RXD_PORT PORTD
-#define SERIAL_RXD_PIN PIND
-#define SERIAL_RXD_BIT 2
-#define SERIAL_RXD_VECT INT2_vect
-#define SERIAL_RXD_INIT() do { \
+#define SERIAL_SOFT_BAUD 1200
+#define SERIAL_SOFT_PARITY_NONE
+#define SERIAL_SOFT_BIT_ORDER_LSB
+#define SERIAL_SOFT_LOGIC_NEGATIVE
+/* RXD Port */
+#define SERIAL_SOFT_RXD_ENABLE
+#define SERIAL_SOFT_RXD_DDR DDRD
+#define SERIAL_SOFT_RXD_PORT PORTD
+#define SERIAL_SOFT_RXD_PIN PIND
+#define SERIAL_SOFT_RXD_BIT 2
+#define SERIAL_SOFT_RXD_VECT INT2_vect
+/* RXD Interupt */
+#define SERIAL_SOFT_RXD_INIT() do { \
/* pin configuration: input with pull-up */ \
- SERIAL_RXD_DDR &= ~(1<<SERIAL_RXD_BIT); \
- SERIAL_RXD_PORT |= (1<<SERIAL_RXD_BIT); \
- /* enable interrupt: INT2(rising edge) */ \
- EICRA |= ((1<<ISC21)|(1<<ISC20)); \
- EIMSK |= (1<<INT2); \
+ SERIAL_SOFT_RXD_DDR &= ~(1<<SERIAL_SOFT_RXD_BIT); \
+ SERIAL_SOFT_RXD_PORT |= (1<<SERIAL_SOFT_RXD_BIT); \
+ /* enable interrupt: INT2(rising edge) */ \
+ EICRA |= ((1<<ISC21)|(1<<ISC20)); \
+ EIMSK |= (1<<INT2); \
+ sei(); \
} while (0)
-#define SERIAL_RXD_INT_ENTER()
-#define SERIAL_RXD_INT_EXIT() do { \
- /* clear interrupt flag */ \
- EIFR = (1<<INTF2); \
+#define SERIAL_SOFT_RXD_INT_ENTER()
+#define SERIAL_SOFT_RXD_INT_EXIT() do { \
+ /* clear interrupt flag */ \
+ EIFR = (1<<INTF2); \
} while (0)
-#define SERIAL_RXD_READ() (~SERIAL_RXD_PIN&(1<<SERIAL_RXD_BIT))
-
-#define SERIAL_TXD_DDR DDRD
-#define SERIAL_TXD_PORT PORTD
-#define SERIAL_TXD_PIN PIND
-#define SERIAL_TXD_BIT 3
-/* negative logic */
-#define SERIAL_TXD_ON() do { SERIAL_TXD_PORT &= ~(1<<SERIAL_TXD_BIT); } while (0)
-#define SERIAL_TXD_OFF() do { SERIAL_TXD_PORT |= (1<<SERIAL_TXD_BIT); } while (0)
-#define SERIAL_TXD_INIT() do { \
- /* pin configuration: output */ \
- SERIAL_TXD_DDR |= (1<<SERIAL_TXD_BIT); \
- /* idle */ \
- SERIAL_TXD_ON(); \
+#define SERIAL_SOFT_RXD_READ() (SERIAL_SOFT_RXD_PIN&(1<<SERIAL_SOFT_RXD_BIT))
+/* TXD Port */
+#define SERIAL_SOFT_TXD_ENABLE
+#define SERIAL_SOFT_TXD_DDR DDRD
+#define SERIAL_SOFT_TXD_PORT PORTD
+#define SERIAL_SOFT_TXD_PIN PIND
+#define SERIAL_SOFT_TXD_BIT 3
+#define SERIAL_SOFT_TXD_HI() do { SERIAL_SOFT_TXD_PORT |= (1<<SERIAL_SOFT_TXD_BIT); } while (0)
+#define SERIAL_SOFT_TXD_LO() do { SERIAL_SOFT_TXD_PORT &= ~(1<<SERIAL_SOFT_TXD_BIT); } while (0)
+#define SERIAL_SOFT_TXD_INIT() do { \
+ /* pin configuration: output */ \
+ SERIAL_SOFT_TXD_DDR |= (1<<SERIAL_SOFT_TXD_BIT); \
+ /* idle */ \
+ SERIAL_SOFT_TXD_ON(); \
} while (0)
#endif