1
0
mirror of https://github.com/elua/elua.git synced 2025-01-08 20:56:17 +08:00
elua/doc/eluadoc/arch_platform_pwm.lua
James Snyder bd1465ca50 Merge 0.6 branch to trunk.
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
2009-10-13 02:14:27 +00:00

151 lines
5.8 KiB
Lua

-- eLua platform interface - PWM
data_en =
{
-- Title
title = "eLua platform interface - PWM",
-- Menu name
menu_name = "PWM",
-- Overview
overview = "This part of the platform interface groups functions related to the PWM channel(s) of the MCU.",
-- Data structures, constants and types
structures =
{
{ text = [[// PWM operations
enum
{
PLATFORM_PWM_OP_START,
PLATFORM_PWM_OP_STOP,
PLATFORM_PWM_OP_SET_CLOCK,
PLATFORM_PWM_OP_GET_CLOCK
} ]],
name = "PWM operations",
desc = "This enum lists all the operations that can be executed on a given PWM channel."
},
},
-- Functions
funcs =
{
{ sig = "int #platform_pwm_exists#( unsigned id );",
desc = [[Checks if the platform has the PWM channel specified as argument. Implemented in %src/common.c%, it uses the $NUM_PWM$ macro that must be defined in the
platform's $platform_conf.h$ file (see @arch_overview.html#platforms@here@ for details). For example:</p>
~#define NUM_PWM 4 $// The platform has 4 PWM channels$~<p> ]],
args = "$id$ - PWM channel ID",
ret = "1 if the specified PWM channel exists, 0 otherwise"
},
{ sig = "u32 #platform_pwm_setup#( unsigned id, u32 frequency, unsigned duty );",
desc = "Sets up a PWM channel",
args =
{
"$id$ - PWM channel ID",
"$frequency$ - PWM channel frequency (in hertz)",
"$duty$ - PWM channel duty cycle, specified as percent (from 0 to 100). Note that some platform don't allow the full 0%-100% duty cycle"
},
ret = "The actual frequency set on the PWM channel, which might differ from the $frequency$ parameter, depeding on the hardware",
},
{ sig = "u32 #platform_pwm_op#( unsigned id, int op, u32 data );",
desc = "Executes an operation on a PWM channel",
args =
{
"$id$ - PWM channel ID",
[[$op$ - the operation that must be executed. It can take any value from @#pwm_operations@this enum@, as follows:
<ul>
<li>$PLATFORM_PWM_OP_START$: starts PWM generation on the specified channel.</li>
<li>$PLATFORM_PWM_OP_STOP$: stops PWM generation on the specified channel.</li>
<li>$PLATFORM_PWM_OP_SET_CLOCK$: sets the $base$ clock of the specified PWM channel (which will be used to generate the frequencies requested by
@#platform_pwm_setup@platform_pwm_setup@) to $data$ hertz.</li>
<li>$PLATFORM_PWM_OP_GET_CLOCK$: get the $base$ clock of the specified PWM channel.</li>
</ul>]],
"$data$ - when used with $op$ == $PLATFORM_PWM_OP_SET_CLOCK$ it is used to specify the value of the base clock. Not used with other operations."
},
ret =
{
"the actual value of the base clock when $op$ == $PLATFORM_PWM_OP_SET_CLOCK$, which might be different than $data$ depending on the hardware",
"the value of the base clock when $op$ == $PLATFORM_PWM_OP_GET_CLOCK$",
"irellevant for other operations"
}
}
}
}
data_pt =
{
-- Title
title = "eLua platform interface - PWM",
-- Menu name
menu_name = "PWM",
-- Overview
overview = "This part of the platform interface groups functions related to the PWM channel(s) of the MCU.",
-- Data structures, constants and types
structures =
{
{ text = [[// PWM operations
enum
{
PLATFORM_PWM_OP_START,
PLATFORM_PWM_OP_STOP,
PLATFORM_PWM_OP_SET_CLOCK,
PLATFORM_PWM_OP_GET_CLOCK
} ]],
name = "PWM operations",
desc = "This enum lists all the operations that can be executed on a given PWM channel."
},
},
-- Functions
funcs =
{
{ sig = "int #platform_pwm_exists#( unsigned id );",
desc = [[Checks if the platform has the PWM channel specified as argument. Implemented in %src/common.c%, it uses the $NUM_PWM$ macro that must be defined in the
platform's $platform_conf.h$ file (see @arch_overview.html#platforms@here@ for details). For example:</p>
~#define NUM_PWM 4 $// The platform has 4 PWM channels$~<p> ]],
args = "$id$ - PWM channel ID",
ret = "1 if the specified PWM channel exists, 0 otherwise"
},
{ sig = "u32 #platform_pwm_setup#( unsigned id, u32 frequency, unsigned duty );",
desc = "Sets up a PWM channel",
args =
{
"$id$ - PWM channel ID",
"$frequency$ - PWM channel frequency (in hertz)",
"$duty$ - PWM channel duty cycle, specified as percent (from 0 to 100). Note that some platform don't allow the full 0%-100% duty cycle"
},
ret = "The actual frequency set on the PWM channel, which might differ from the $frequency$ parameter, depeding on the hardware",
},
{ sig = "u32 #platform_pwm_op#( unsigned id, int op, u32 data );",
desc = "Executes an operation on a PWM channel",
args =
{
"$id$ - PWM channel ID",
[[$op$ - the operation that must be executed. It can take any value from @#pwm_operations@this enum@, as follows:
<ul>
<li>$PLATFORM_PWM_OP_START$: starts PWM generation on the specified channel.</li>
<li>$PLATFORM_PWM_OP_STOP$: stops PWM generation on the specified channel.</li>
<li>$PLATFORM_PWM_OP_SET_CLOCK$: sets the $base$ clock of the specified PWM channel (which will be used to generate the frequencies requested by
@#platform_pwm_setup@platform_pwm_setup@) to $data$ hertz.</li>
<li>$PLATFORM_PWM_OP_GET_CLOCK$: get the $base$ clock of the specified PWM channel.</li>
</ul>]],
"$data$ - when used with $op$ == $PLATFORM_PWM_OP_SET_CLOCK$ it is used to specify the value of the base clock. Not used with other operations."
},
ret =
{
"the actual value of the base clock when $op$ == $PLATFORM_PWM_OP_SET_CLOCK$, which might be different than $data$ depending on the hardware",
"the value of the base clock when $op$ == $PLATFORM_PWM_OP_GET_CLOCK$",
"irellevant for other operations"
}
}
}
}