Mercurial > louis > kiibohd-controller
annotate Scan/UARTConnect/capabilities.kll @ 389:fc2c2a1e9615
Adding basic remote capabilities + UART Rx DMA buffers
- Rx buffers weren't fast enough, had to use DMA :D
- Basic LCD remote capabilities are working, single node
- Multi-node broadcast seems to have a bug still
- DMA ring buffer allowed for significant processing simplification
* There is an overrun risk, but the buffer is large and generally there isn't too much data being sent (just very quickly)
- Split out LCD layer stack capability into itself and an "exact" version used for updating remote nodes
author | Jacob Alexander <haata@kiibohd.com> |
---|---|
date | Thu, 15 Oct 2015 00:16:36 -0700 |
parents | dbefb68411e1 |
children |
rev | line source |
---|---|
307
ecd2ae35d25c
Initial commit for UARTConnect module
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
1 Name = UARTConnectCapabilities; |
ecd2ae35d25c
Initial commit for UARTConnect module
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
2 Version = 0.1; |
ecd2ae35d25c
Initial commit for UARTConnect module
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
3 Author = "HaaTa (Jacob Alexander) 2015"; |
ecd2ae35d25c
Initial commit for UARTConnect module
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
4 KLL = 0.3a; |
ecd2ae35d25c
Initial commit for UARTConnect module
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
5 |
ecd2ae35d25c
Initial commit for UARTConnect module
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
6 # Modified Date |
ecd2ae35d25c
Initial commit for UARTConnect module
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
7 Date = 2015-03-15; |
ecd2ae35d25c
Initial commit for UARTConnect module
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
8 |
ecd2ae35d25c
Initial commit for UARTConnect module
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
9 # UART Buffer Size |
ecd2ae35d25c
Initial commit for UARTConnect module
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
10 # Number of bytes to reserve for each side of UARTConnect |
ecd2ae35d25c
Initial commit for UARTConnect module
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
11 # For true NKRO support must be at least: <# of Keys> x 3 + 5 |
ecd2ae35d25c
Initial commit for UARTConnect module
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
12 UARTConnectBufSize => UARTConnectBufSize_define; |
ecd2ae35d25c
Initial commit for UARTConnect module
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
13 UARTConnectBufSize = 128; # MDErgo1 requires at least a 119 byte buffer |
ecd2ae35d25c
Initial commit for UARTConnect module
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
14 |
ecd2ae35d25c
Initial commit for UARTConnect module
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
15 # UART Speed |
ecd2ae35d25c
Initial commit for UARTConnect module
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
16 # *NOTE* This must be changed on every device in the chain or else UARTConnect will not work |
ecd2ae35d25c
Initial commit for UARTConnect module
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
17 # The faster the speed, the lower the latency, but higher chance for an error |
ecd2ae35d25c
Initial commit for UARTConnect module
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
18 UARTConnectBaud => UARTConnectBaud_define; |
ecd2ae35d25c
Initial commit for UARTConnect module
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
19 UARTConnectBaudFine => UARTConnectBaudFine_define; |
ecd2ae35d25c
Initial commit for UARTConnect module
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
20 # Generally, leave BaudFine at zero unless trying to tune the link to an external UART |
ecd2ae35d25c
Initial commit for UARTConnect module
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
21 # You'll want to look at the specific chip datasheet for the exact equation |
ecd2ae35d25c
Initial commit for UARTConnect module
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
22 # |
ecd2ae35d25c
Initial commit for UARTConnect module
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
23 # Example of 115200 Baud using a 48 MHz clock (mk20dx128vlf5) |
ecd2ae35d25c
Initial commit for UARTConnect module
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
24 # 48 MHz / ( 16 * Baud ) = BDH/L |
ecd2ae35d25c
Initial commit for UARTConnect module
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
25 # Baud: 115200 -> 48 MHz / ( 16 * 115200 ) = 26.0416667 |
ecd2ae35d25c
Initial commit for UARTConnect module
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
26 # Thus baud setting = 26 |
ecd2ae35d25c
Initial commit for UARTConnect module
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
27 # NOTE: If finer baud adjustment is needed see UARTx_C4 -> BRFA in the datasheet |
ecd2ae35d25c
Initial commit for UARTConnect module
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
28 # Baud fine setting = 0x02 |
389
fc2c2a1e9615
Adding basic remote capabilities + UART Rx DMA buffers
Jacob Alexander <haata@kiibohd.com>
parents:
360
diff
changeset
|
29 UARTConnectBaud = 1; # 4.5 Mbpsa @ 72 MHz |
347
136e47478441
UARTConnect enumeration working!
Jacob Alexander <haata@kiibohd.com>
parents:
307
diff
changeset
|
30 UARTConnectBaudFine = 0x0; |
307
ecd2ae35d25c
Initial commit for UARTConnect module
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
31 |
389
fc2c2a1e9615
Adding basic remote capabilities + UART Rx DMA buffers
Jacob Alexander <haata@kiibohd.com>
parents:
360
diff
changeset
|
32 #UARTConnectBaud = 39; # 115385 bps @ 72 MHz (close to 115200) |
fc2c2a1e9615
Adding basic remote capabilities + UART Rx DMA buffers
Jacob Alexander <haata@kiibohd.com>
parents:
360
diff
changeset
|
33 |
347
136e47478441
UARTConnect enumeration working!
Jacob Alexander <haata@kiibohd.com>
parents:
307
diff
changeset
|
34 # Cable Check Command Length |
136e47478441
UARTConnect enumeration working!
Jacob Alexander <haata@kiibohd.com>
parents:
307
diff
changeset
|
35 # This defines the length of the cable command |
136e47478441
UARTConnect enumeration working!
Jacob Alexander <haata@kiibohd.com>
parents:
307
diff
changeset
|
36 # 0xD2 11010010 is used for each check byte |
136e47478441
UARTConnect enumeration working!
Jacob Alexander <haata@kiibohd.com>
parents:
307
diff
changeset
|
37 # |
136e47478441
UARTConnect enumeration working!
Jacob Alexander <haata@kiibohd.com>
parents:
307
diff
changeset
|
38 # For example: |
136e47478441
UARTConnect enumeration working!
Jacob Alexander <haata@kiibohd.com>
parents:
307
diff
changeset
|
39 # Length: 4 |
136e47478441
UARTConnect enumeration working!
Jacob Alexander <haata@kiibohd.com>
parents:
307
diff
changeset
|
40 # Args: 0xD2 0xD2 0xD2 0xD2 |
136e47478441
UARTConnect enumeration working!
Jacob Alexander <haata@kiibohd.com>
parents:
307
diff
changeset
|
41 UARTConnectCableCheckLength => UARTConnectCableCheckLength_define; |
136e47478441
UARTConnect enumeration working!
Jacob Alexander <haata@kiibohd.com>
parents:
307
diff
changeset
|
42 UARTConnectCableCheckLength = 2; |
136e47478441
UARTConnect enumeration working!
Jacob Alexander <haata@kiibohd.com>
parents:
307
diff
changeset
|
43 |
360
dbefb68411e1
Initial UARTConnect scancode support
Jacob Alexander <haata@kiibohd.com>
parents:
347
diff
changeset
|
44 # Connect Enable |
dbefb68411e1
Initial UARTConnect scancode support
Jacob Alexander <haata@kiibohd.com>
parents:
347
diff
changeset
|
45 # Define used to indicate to non-connect modules that support should be compiled in |
dbefb68411e1
Initial UARTConnect scancode support
Jacob Alexander <haata@kiibohd.com>
parents:
347
diff
changeset
|
46 ConnectEnabled => ConnectEnabled_define; |
dbefb68411e1
Initial UARTConnect scancode support
Jacob Alexander <haata@kiibohd.com>
parents:
347
diff
changeset
|
47 ConnectEnabled = 1; |
dbefb68411e1
Initial UARTConnect scancode support
Jacob Alexander <haata@kiibohd.com>
parents:
347
diff
changeset
|
48 |