git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4435 35acf78f-673a-0410-8e92-d51de3d6d3f4

master
gdisirio 2012-07-08 12:46:22 +00:00
parent e4c592d9cf
commit 10703d315c
1 changed files with 41 additions and 4 deletions

View File

@ -85,13 +85,15 @@
* IO pins assignments. * IO pins assignments.
*/ */
[#list doc1.board.ports.* as port] [#list doc1.board.ports.* as port]
[#assign port_name = port?node_name?upper_case /]
[#assign pinidx = 0 /] [#assign pinidx = 0 /]
[#list port.* as pin] [#list port.* as pin]
[#assign pin_name = pin?node_name?upper_case /]
[#assign name = pin.@ID[0]?string?trim /] [#assign name = pin.@ID[0]?string?trim /]
[#if name?length == 0] [#if name?length == 0]
[#assign name = pin?node_name?upper_case /] [#assign name = pin_name /]
[/#if] [/#if]
#define ${(port?node_name + "_" + name)?right_pad(27, " ")} ${pinidx?string} #define ${(port_name + "_" + name)?right_pad(27, " ")} ${pinidx?string}
[#assign pinidx = pinidx + 1 /] [#assign pinidx = pinidx + 1 /]
[/#list] [/#list]
@ -117,14 +119,17 @@
#define PIN_AFIO_AF(n, v) ((v##U) << ((n % 8) * 4)) #define PIN_AFIO_AF(n, v) ((v##U) << ((n % 8) * 4))
[#list doc1.board.ports.* as port] [#list doc1.board.ports.* as port]
[#assign port_name = port?node_name?upper_case /]
/* /*
* ${port?node_name} setup: * ${port_name} setup:
* *
[#-- Generating pin descriptions inside the comment.--]
[#assign pinidx = 0 /] [#assign pinidx = 0 /]
[#list port.* as pin] [#list port.* as pin]
[#assign pin_name = pin?node_name?upper_case /]
[#assign name = pin.@ID[0]?string?trim /] [#assign name = pin.@ID[0]?string?trim /]
[#if name?length == 0] [#if name?length == 0]
[#assign name = pin?node_name?upper_case /] [#assign name = pin_name /]
[/#if] [/#if]
[#assign mode = pin.@Mode[0] /] [#assign mode = pin.@Mode[0] /]
[#assign type = pin.@Type[0] /] [#assign type = pin.@Type[0] /]
@ -144,6 +149,38 @@
[#assign pinidx = pinidx + 1 /] [#assign pinidx = pinidx + 1 /]
[/#list] [/#list]
*/ */
[#-- Generating MODER register value.--]
[#assign pinidx = 0 /]
[#list port.* as pin]
[#assign pin_name = pin?node_name?upper_case /]
[#assign name = pin.@ID[0]?string?trim /]
[#if name?length == 0]
[#assign name = pin_name /]
[/#if]
[#assign mode = pin.@Mode[0] /]
[#if mode == "Input"]
[#assign out = "PIN_MODE_INPUT(" + port_name + "_" + pin_name + ")" /]
[#elseif mode == "Output"]
[#assign out = "PIN_MODE_OUTPUT(" + port_name + "_" + pin_name + ")" /]
[#elseif mode == "Alternate"]
[#assign out = "PIN_MODE_ALTERNATE(" + port_name + "_" + pin_name + ")" /]
[#else]
[#assign out = "PIN_MODE_ANALOG(" + port_name + "_" + pin_name + ")" /]
[/#if]
[#if pinidx == 0]
[#assign line = "#define VAL_" + port_name + "_MODER (" + out /]
[#--#define VAL_${port_name}_MODER (${out?right_pad(30, " ")}[#rt]--]
[#else]
[#assign line = " " + out /]
[#-- ${out?right_pad(30, " ")}[#rt]--]
[/#if]
[#if pinidx < 15]
${(line + " |")?right_pad(76, " ") + "\\"}
[#else]
${line + ")"}
[/#if]
[#assign pinidx = pinidx + 1 /]
[/#list]
[/#list] [/#list]