Keyboard firmwares for Atmel AVR and Cortex-M
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

suart.S 3.9KB

Squashed 'tmk_core/' changes from 8da1898..e5f9940 e5f9940 Merge commit '1bc3dd200b023cecf063a0cb3ba347f77f6d759d' into core_update da03c50 Add note for L/R side bit being ignored e80f3c1 Add in basic documentation for Macro system 35e8a76 core: Swap position of PEQL and PENT in unimap 00751f1 Merge pull request #406 from 39aldo39/patch-1 e50d7de V-USB remote wakeup 4340997 core: Fix typo in definition AC_g 958144d core: Debug print for system and consumer keys e7e1030 core: Fix sleep_led 0866323 core: Change matrix_init and matrix_print 0dbf73d core: Add matrix_clear() and default impl. 3202ca3 core: Add suspend mode options 4cda3aa core: Fix suspend/wake for converters #386 4e15247 core: LUFA_DEBUG_SUART for serial debug b9cf8e7 core: Fix mechanical locking supoort #390 12aa0fd Merge branch 'nemith-master' fccb3fa core: Fix OPT_DEFS for mbed build 2e2d2c8 Merge branch 'master' of github.com:leizzer/tmk_keyboard f1d3634 Change .gitignore for ChibiOS 3aab802 core: Fix build config in protocol.mk 5e43da0 core: Add short names in unimap 7a56998 core: Fix dfu wait in rules.mk 6d9c500 Merge branch 'mediakey-fix' 08382ac core: Fix 'make dfu' message 78cb04e Fix OS X Recognizing keyboard as Mouse/Tablet a114714 core: 'make dfu' waits for bootloader to start d0a8f13 core: Fix unimap UNIMAP_NO case e17abef core: Change lufa NKRO report size 16 to 32 bytes 375b20f core: Fix common.mk for build options 394fdff core: Fix unimap layout comment 912326c core: Add unimap support 00f4011 core: Fix doc/keymap.md for new keymap framework ddbd7b4 core: Add default implemenation of keymap read 671cacc core: action codes are action_t struct now b4fdb27 core: Change chibios repo directory names 7daed10 core: Fix keycode.txt 90399d7 core: Fix USB remote wakeup on ATmega32U2 #361 3677e84 usb_usb: Add multiple keyboard support 54d5b26 core: Fix Logical Maximum in report descriptor bd0d372 core: Fix LUFA report descriptor 95327b5 Merge pull request #355 from papodaca/XT 62bf548 core: change API of adb.c to accept device address 3097c9e Fix function name in host.h 836e209 Merge branch 'core_split_160522' 3918ea2 Merge commit '20b787fc1284176834cbe7ca2134e4b36bec5828' 7f87b11 core: Add comment of register 3 of ADB ef6478a core: Add adb_host_talk() 5c665b4 update macro names in bluefruit 4f2c5bf Merge commit '71381457fa1311dfa0b58ba882a96db740640871' 53a9c08 Merge pull request #321 from njbair/master f08a656 core: Fix media/consumer keys d526de8 Clean up wording in keymap example 0bb3dbb Clarify layer precedence d915c75 clarify layer documentation 72070d4 ps2_usb: Fix for VUSB configuration 170e2dc Mostly working. Is unstable, will emit bad codes after a while. c8e45b5 core: Actionmap support aabaa24 Codes appear to be detected correctly, the break codes are broken. git-subtree-dir: tmk_core git-subtree-split: e5f994033cbc8700745ac0c6d12772820492eed0
il y a 7 ans
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. ;---------------------------------------------------------------------------;
  2. ; Software implemented UART module ;
  3. ; (C)ChaN, 2005 (http://elm-chan.org/) ;
  4. ;---------------------------------------------------------------------------;
  5. ; Bit rate settings:
  6. ;
  7. ; 1MHz 2MHz 4MHz 6MHz 8MHz 10MHz 12MHz 16MHz 20MHz
  8. ; 2.4kbps 138 - - - - - - - -
  9. ; 4.8kbps 68 138 - - - - - - -
  10. ; 9.6kbps 33 68 138 208 - - - - -
  11. ; 19.2kbps - 33 68 102 138 173 208 - -
  12. ; 38.4kbps - - 33 50 68 85 102 138 172
  13. ; 57.6kbps - - 21 33 44 56 68 91 114
  14. ; 115.2kbps - - - - 21 27 33 44 56
  15. .nolist
  16. #include <avr/io.h>
  17. .list
  18. #define BPS 44 /* Bit delay. (see above table) */
  19. #define BIDIR 0 /* 0:Separated Tx/Rx, 1:Shared Tx/Rx */
  20. #define OUT_1 sbi _SFR_IO_ADDR(SUART_OUT_PORT), SUART_OUT_BIT /* Output 1 */
  21. #define OUT_0 cbi _SFR_IO_ADDR(SUART_OUT_PORT), SUART_OUT_BIT /* Output 0 */
  22. #define SKIP_IN_1 sbis _SFR_IO_ADDR(SUART_IN_PIN), SUART_IN_BIT /* Skip if 1 */
  23. #define SKIP_IN_0 sbic _SFR_IO_ADDR(SUART_IN_PIN), SUART_IN_BIT /* Skip if 0 */
  24. #ifdef SPM_PAGESIZE
  25. .macro _LPMI reg
  26. lpm \reg, Z+
  27. .endm
  28. .macro _MOVW dh,dl, sh,sl
  29. movw \dl, \sl
  30. .endm
  31. #else
  32. .macro _LPMI reg
  33. lpm
  34. mov \reg, r0
  35. adiw ZL, 1
  36. .endm
  37. .macro _MOVW dh,dl, sh,sl
  38. mov \dl, \sl
  39. mov \dh, \sh
  40. .endm
  41. #endif
  42. ;---------------------------------------------------------------------------;
  43. ; Transmit a byte in serial format of N81
  44. ;
  45. ;Prototype: void xmit (uint8_t data);
  46. ;Size: 16 words
  47. .global xmit
  48. .func xmit
  49. xmit:
  50. #if BIDIR
  51. ldi r23, BPS-1 ;Pre-idle time for bidirectional data line
  52. 5: dec r23 ;
  53. brne 5b ;/
  54. #endif
  55. in r0, _SFR_IO_ADDR(SREG) ;Save flags
  56. com r24 ;C = start bit
  57. ldi r25, 10 ;Bit counter
  58. cli ;Start critical section
  59. 1: ldi r23, BPS-1 ;----- Bit transferring loop
  60. 2: dec r23 ;Wait for a bit time
  61. brne 2b ;/
  62. brcs 3f ;MISO = bit to be sent
  63. OUT_1 ;
  64. 3: brcc 4f ;
  65. OUT_0 ;/
  66. 4: lsr r24 ;Get next bit into C
  67. dec r25 ;All bits sent?
  68. brne 1b ; no, coutinue
  69. out _SFR_IO_ADDR(SREG), r0 ;End of critical section
  70. ret
  71. .endfunc
  72. ;---------------------------------------------------------------------------;
  73. ; Receive a byte
  74. ;
  75. ;Prototype: uint8_t rcvr (void);
  76. ;Size: 19 words
  77. .global rcvr
  78. .func rcvr
  79. rcvr:
  80. in r0, _SFR_IO_ADDR(SREG) ;Save flags
  81. ldi r24, 0x80 ;Receiving shift reg
  82. cli ;Start critical section
  83. 1: SKIP_IN_1 ;Wait for idle
  84. rjmp 1b
  85. 2: SKIP_IN_0 ;Wait for start bit
  86. rjmp 2b
  87. ldi r25, BPS/2 ;Wait for half bit time
  88. 3: dec r25
  89. brne 3b
  90. 4: ldi r25, BPS ;----- Bit receiving loop
  91. 5: dec r25 ;Wait for a bit time
  92. brne 5b ;/
  93. lsr r24 ;Next bit
  94. SKIP_IN_0 ;Get a data bit into r24.7
  95. ori r24, 0x80
  96. brcc 4b ;All bits received? no, continue
  97. out _SFR_IO_ADDR(SREG), r0 ;End of critical section
  98. ret
  99. .endfunc
  100. ; Not wait for start bit. This should be called after detecting start bit.
  101. .global recv
  102. .func recv
  103. recv:
  104. in r0, _SFR_IO_ADDR(SREG) ;Save flags
  105. ldi r24, 0x80 ;Receiving shift reg
  106. cli ;Start critical section
  107. ;1: SKIP_IN_1 ;Wait for idle
  108. ; rjmp 1b
  109. ;2: SKIP_IN_0 ;Wait for start bit
  110. ; rjmp 2b
  111. ldi r25, BPS/2 ;Wait for half bit time
  112. 3: dec r25
  113. brne 3b
  114. 4: ldi r25, BPS ;----- Bit receiving loop
  115. 5: dec r25 ;Wait for a bit time
  116. brne 5b ;/
  117. lsr r24 ;Next bit
  118. SKIP_IN_0 ;Get a data bit into r24.7
  119. ori r24, 0x80
  120. brcc 4b ;All bits received? no, continue
  121. ldi r25, BPS/2 ;Wait for half bit time
  122. 6: dec r25
  123. brne 6b
  124. 7: SKIP_IN_1 ;Wait for stop bit
  125. rjmp 7b
  126. out _SFR_IO_ADDR(SREG), r0 ;End of critical section
  127. ret
  128. .endfunc