mirror of
https://github.com/elua/elua.git
synced 2025-01-08 20:56:17 +08:00
bd1465ca50
Conflicts: SConstruct doc/en/arch_platform.html doc/en/comunity.html doc/en/overview.html doc/en/refman.html doc/en/refman_gen.html doc/en/status.html doc/en/tut_bootstick.html doc/images/lng_pt.png doc/images/minusnode.png doc/images/next.png doc/images/node.png doc/images/nodelast.png doc/images/plusnode.png doc/images/plusnodelast.png doc/images/previous.png doc/images/showall.png doc/images/sync.png doc/images/vertline.png doc/pt/arch.html doc/pt/arch_coding.html doc/pt/arch_con_term.html doc/pt/arch_newport.html doc/pt/arch_overview.html doc/pt/arch_platform.html doc/pt/arch_tcpip.html doc/pt/building.html doc/pt/comunity.html doc/pt/dl_binaries.html doc/pt/dl_old.html doc/pt/dl_sources.html doc/pt/downloads.html doc/pt/examples.html doc/pt/faq.html doc/pt/installing_i386.html doc/pt/installing_lm3s.html doc/pt/news.html doc/pt/overview.html doc/pt/refman_dep.html doc/pt/refman_gen.html doc/pt/status.html doc/pt/tc_386.html doc/pt/toolchains.html doc/pt/tut_openocd.html doc/pt/using.html romfs/LM3S.lua romfs/led.lua romfs/morse.lua romfs/pong.lua src/lua/linit.c src/modules/auxmods.h src/platform/lm3s/platform.c src/platform/lm3s/platform_conf.h src/platform/sim/platform_conf.h
315 lines
10 KiB
Lua
315 lines
10 KiB
Lua
-- eLua reference manual - pio module
|
|
|
|
data_en =
|
|
{
|
|
|
|
-- Title
|
|
title = "eLua reference manual - pio module",
|
|
|
|
-- Menu name
|
|
menu_name = "pio",
|
|
|
|
-- Overview
|
|
overview = [[This module contains functions for accessing the CPU's PIO (Programmable Input Output) pins. It contains two set of functions with identical
|
|
names and behaviour. One set groups the functions used to access individual pins from ports, the other groups the functions used to access full ports.</p>
|
|
<p>With the $pio$ module, you specifiy names of $ports$ as they appear in your eLua's CPU datasheet. For example, if your CPU's ports are named $PA, PB$
|
|
and $PC$, you can reffer to them using $pio.PA$, $pio.PB$ and $pio.PC$, respectively. If your CPU uses $P0$, $P1$, $P2$ instead of $PA$, $PB$ and $PC$,
|
|
you can simply use $pio.P0$, $pio.P1$ and $pio.P2$ instead.</p>
|
|
<p>You can also reffer to individual $pins$ instead of ports. With the same notation as above, $pio.PA_0$ refers to the first pin of port $PA$,
|
|
$P0_15$ refers to the 16th pin of port $P0$ and so on.
|
|
]],
|
|
|
|
-- Functions
|
|
funcs =
|
|
{
|
|
{ sig = "#pio.pin.setdir#( direction, pin1, pin2, ..., pinn )",
|
|
desc = "Set pin(s) direction",
|
|
args =
|
|
{
|
|
"$direction$ - the pin direction, can be either $pio.INPUT$ or $pio.OUTPUT$",
|
|
"$pin1$ - the first pin",
|
|
"$pin2 (optional)$ - the second pin",
|
|
"$pinn (optional)$ - the %n%-th pin"
|
|
}
|
|
},
|
|
|
|
{ sig = "#pio.pin.setpull#( type, pin1, pin2, ..., pinn )",
|
|
desc = "Enable/disable pullups/pulldowns on the specified pin(s)",
|
|
args =
|
|
{
|
|
[[$type$ - 'pull' type, can be either $pio.PULLUP$ to enable pullups, $pio.PULLDOWN$ to enable pulldowns, or $pio.NOPULL$ to disable both pullups and
|
|
pulldowns]],
|
|
"$pin1$ - the first pin",
|
|
"$pin2 (optional)$ - the second pin",
|
|
"$pinn (optional)$ - the %n%-th pin",
|
|
}
|
|
},
|
|
|
|
{ sig = "#pio.pin.setval#( value, pin1, pin2, ..., pinn )",
|
|
desc = "Set pin(s) value",
|
|
args=
|
|
{
|
|
"$value$ - pin value, can be either 0 or 1",
|
|
"$pin1$ - the first pin",
|
|
"$pin2 (optional)$ - the second pin",
|
|
"$pinn (optional)$ - the %n%-th pin"
|
|
}
|
|
},
|
|
|
|
{ sig = "val1, val2, ..., valn = #pio.pin.getval#( pin1, pin2, ..., pinn )",
|
|
desc = "Get value of pin(s)",
|
|
args =
|
|
{
|
|
"$pin1$ - the first pin",
|
|
"$pin2 (optional)$ - the second pin",
|
|
"$pinn (optional)$ - the %n%-th pin",
|
|
},
|
|
ret = "The value(s) of the pin(s), either 0 or 1"
|
|
},
|
|
|
|
{ sig = "#pio.pin.sethigh#( pin1, pin2, ..., pinn )",
|
|
desc = "Set pin(s) to 1 (high)",
|
|
args =
|
|
{
|
|
"$pin1$ - the first pin",
|
|
"$pin2 (optional)$ - the second pin",
|
|
"$pinn (optinoal)$ - the %n%-th pin"
|
|
}
|
|
},
|
|
|
|
{ sig = "#pio.pin.setlow#( pin1, pin2, ..., pinn )",
|
|
desc = "Set pin(s) to 0 (low)",
|
|
args =
|
|
{
|
|
"$pin1$ - the first pin",
|
|
"$pin2 (optional)$ - the second pin",
|
|
"$pinn (optinoal)$ - the %n%-th pin"
|
|
}
|
|
},
|
|
|
|
{ sig = "#pio.port.setdir#( direction, port1, port2, ..., portn )",
|
|
desc = "Set port(s) direction",
|
|
args =
|
|
{
|
|
"$direction$ - the port direction, can be either $pio.INPUT$ or $pio.OUTPUT$",
|
|
"$port1$ - the first port",
|
|
"$port2 (optional)$ - the second port",
|
|
"$portn (optional)$ - the %n%-th port"
|
|
}
|
|
},
|
|
|
|
{ sig = "#pio.port.setpull#( type, port1, port2, ..., portn )",
|
|
desc = "Enable/disable pullups/pulldowns on the specified port(s)",
|
|
args =
|
|
{
|
|
[[$type$ - 'pull' type, can be either $pio.PULLUP$ to enable pullups, $pio.PULLDOWN$ to enable pulldowns, or $pio.NOPULL$ to disable both pullups and
|
|
pulldowns]],
|
|
"$port1$ - the first port",
|
|
"$port2 (optional)$ - the second port",
|
|
"$portn (optional)$ - the %n%-th port",
|
|
}
|
|
},
|
|
|
|
{ sig = "#pio.port.setval#( value, port1, port2, ..., portn )",
|
|
desc = "Set port(s) value",
|
|
args=
|
|
{
|
|
"$value$ - port value",
|
|
"$port1$ - the first port",
|
|
"$port2 (optional)$ - the second port",
|
|
"$portn (optional)$ - the %n%-th port"
|
|
}
|
|
},
|
|
|
|
{ sig = "val1, val2, ..., valn = #pio.port.getval#( port1, port2, ..., portn )",
|
|
desc = "Get value of port(s)",
|
|
args =
|
|
{
|
|
"$port1$ - the first port",
|
|
"$port2 (optional)$ - the second port",
|
|
"$portn (optional)$ - the %n%-th port",
|
|
},
|
|
ret = "The value(s) of the port(s)"
|
|
},
|
|
|
|
{ sig = "#pio.port.sethigh#( port1, port2, ..., portn )",
|
|
desc = "Set port(s) to all 1 (high)",
|
|
args =
|
|
{
|
|
"$port1$ - the first port",
|
|
"$port2 (optional)$ - the second port",
|
|
"$portn (optinoal)$ - the %n%-th port"
|
|
}
|
|
},
|
|
|
|
{ sig = "#pio.port.setlow#( port1, port2, ..., portn )",
|
|
desc = "Set port(s) to all 0 (low)",
|
|
args =
|
|
{
|
|
"$port1$ - the first port",
|
|
"$port2 (optional)$ - the second port",
|
|
"$portn (optinoal)$ - the %n%-th port"
|
|
}
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
data_pt =
|
|
{
|
|
|
|
-- Title
|
|
title = "eLua reference manual - pio module",
|
|
|
|
-- Menu name
|
|
menu_name = "pio",
|
|
|
|
-- Overview
|
|
overview = [[This module contains functions for accessing the CPU's PIO (Programmable Input Output) pins. It contains two set of functions with identical
|
|
names and behaviour. One set groups the functions used to access individual pins from ports, the other groups the functions used to access full ports.</p>
|
|
<p>With the $pio$ module, you specifiy names of $ports$ as they appear in your eLua's CPU datasheet. For example, if your CPU's ports are named $PA, PB$
|
|
and $PC$, you can reffer to them using $pio.PA$, $pio.PB$ and $pio.PC$, respectively. If your CPU uses $P0$, $P1$, $P2$ instead of $PA$, $PB$ and $PC$,
|
|
you can simply use $pio.P0$, $pio.P1$ and $pio.P2$ instead.</p>
|
|
<p>You can also reffer to individual $pins$ instead of ports. With the same notation as above, $pio.PA_0$ refers to the first pin of port $PA$,
|
|
$P0_15$ refers to the 16th pin of port $P0$ and so on.
|
|
]],
|
|
|
|
-- Functions
|
|
funcs =
|
|
{
|
|
{ sig = "#pio.pin.setdir#( direction, pin1, pin2, ..., pinn )",
|
|
desc = "Set pin(s) direction",
|
|
args =
|
|
{
|
|
"$direction$ - the pin direction, can be either $pio.INPUT$ or $pio.OUTPUT$",
|
|
"$pin1$ - the first pin",
|
|
"$pin2 (optional)$ - the second pin",
|
|
"$pinn (optional)$ - the %n%-th pin"
|
|
}
|
|
},
|
|
|
|
{ sig = "#pio.pin.setpull#( type, pin1, pin2, ..., pinn )",
|
|
desc = "Enable/disable pullups/pulldowns on the specified pin(s)",
|
|
args =
|
|
{
|
|
[[$type$ - 'pull' type, can be either $pio.PULLUP$ to enable pullups, $pio.PULLDOWN$ to enable pulldowns, or $pio.NOPULL$ to disable both pullups and
|
|
pulldowns]],
|
|
"$pin1$ - the first pin",
|
|
"$pin2 (optional)$ - the second pin",
|
|
"$pinn (optional)$ - the %n%-th pin",
|
|
}
|
|
},
|
|
|
|
{ sig = "#pio.pin.setval#( value, pin1, pin2, ..., pinn )",
|
|
desc = "Set pin(s) value",
|
|
args=
|
|
{
|
|
"$value$ - pin value, can be either 0 or 1",
|
|
"$pin1$ - the first pin",
|
|
"$pin2 (optional)$ - the second pin",
|
|
"$pinn (optional)$ - the %n%-th pin"
|
|
}
|
|
},
|
|
|
|
{ sig = "val1, val2, ..., valn = #pio.pin.getval#( pin1, pin2, ..., pinn )",
|
|
desc = "Get value of pin(s)",
|
|
args =
|
|
{
|
|
"$pin1$ - the first pin",
|
|
"$pin2 (optional)$ - the second pin",
|
|
"$pinn (optional)$ - the %n%-th pin",
|
|
},
|
|
ret = "The value(s) of the pin(s), either 0 or 1"
|
|
},
|
|
|
|
{ sig = "#pio.pin.sethigh#( pin1, pin2, ..., pinn )",
|
|
desc = "Set pin(s) to 1 (high)",
|
|
args =
|
|
{
|
|
"$pin1$ - the first pin",
|
|
"$pin2 (optional)$ - the second pin",
|
|
"$pinn (optinoal)$ - the %n%-th pin"
|
|
}
|
|
},
|
|
|
|
{ sig = "#pio.pin.setlow#( pin1, pin2, ..., pinn )",
|
|
desc = "Set pin(s) to 0 (low)",
|
|
args =
|
|
{
|
|
"$pin1$ - the first pin",
|
|
"$pin2 (optional)$ - the second pin",
|
|
"$pinn (optinoal)$ - the %n%-th pin"
|
|
}
|
|
},
|
|
|
|
{ sig = "#pio.port.setdir#( direction, port1, port2, ..., portn )",
|
|
desc = "Set port(s) direction",
|
|
args =
|
|
{
|
|
"$direction$ - the port direction, can be either $pio.INPUT$ or $pio.OUTPUT$",
|
|
"$port1$ - the first port",
|
|
"$port2 (optional)$ - the second port",
|
|
"$portn (optional)$ - the %n%-th port"
|
|
}
|
|
},
|
|
|
|
{ sig = "#pio.port.setpull#( type, port1, port2, ..., portn )",
|
|
desc = "Enable/disable pullups/pulldowns on the specified port(s)",
|
|
args =
|
|
{
|
|
[[$type$ - 'pull' type, can be either $pio.PULLUP$ to enable pullups, $pio.PULLDOWN$ to enable pulldowns, or $pio.NOPULL$ to disable both pullups and
|
|
pulldowns]],
|
|
"$port1$ - the first port",
|
|
"$port2 (optional)$ - the second port",
|
|
"$portn (optional)$ - the %n%-th port",
|
|
}
|
|
},
|
|
|
|
{ sig = "#pio.port.setval#( value, port1, port2, ..., portn )",
|
|
desc = "Set port(s) value",
|
|
args=
|
|
{
|
|
"$value$ - port value",
|
|
"$port1$ - the first port",
|
|
"$port2 (optional)$ - the second port",
|
|
"$portn (optional)$ - the %n%-th port"
|
|
}
|
|
},
|
|
|
|
{ sig = "val1, val2, ..., valn = #pio.port.getval#( port1, port2, ..., portn )",
|
|
desc = "Get value of port(s)",
|
|
args =
|
|
{
|
|
"$port1$ - the first port",
|
|
"$port2 (optional)$ - the second port",
|
|
"$portn (optional)$ - the %n%-th port",
|
|
},
|
|
ret = "The value(s) of the port(s)"
|
|
},
|
|
|
|
{ sig = "#pio.port.sethigh#( port1, port2, ..., portn )",
|
|
desc = "Set port(s) to all 1 (high)",
|
|
args =
|
|
{
|
|
"$port1$ - the first port",
|
|
"$port2 (optional)$ - the second port",
|
|
"$portn (optinoal)$ - the %n%-th port"
|
|
}
|
|
},
|
|
|
|
{ sig = "#pio.port.setlow#( port1, port2, ..., portn )",
|
|
desc = "Set port(s) to all 0 (low)",
|
|
args =
|
|
{
|
|
"$port1$ - the first port",
|
|
"$port2 (optional)$ - the second port",
|
|
"$portn (optinoal)$ - the %n%-th port"
|
|
}
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|