1
0
mirror of https://github.com/elua/elua.git synced 2025-01-25 01:02:54 +08:00
elua/romfs/index.pht
Bogdan Marinescu 45285ea064 - LTR: even if we (obviously) can't set new keys/values in a rotable, we still respect the __newindex metamethod. This allows for interesting tricks, like the one shown below :)
- complete rewrite of the PIO module. New usage:

pio.PA = 10 -- set the value of PA to 10
pio.PB_1 = 1 -- set the value of pin 1 of PB to 1

local value = pio.PB -- get the value of PB
local value = pio.PB_3 -- get the value of pin 3 of PB

pio.PA_DIR = pio.OUTPUT/pio.INPUT - set the direction of PA
pio.dir[ pio.PA ] = pio.OUTPUT/pio.INPUT - same as above

pio.PA_2_DIR = pio.OUTPUT/pio.INPUT - set the direction of pin 2 of PA
pio.dir[ pio.PA_2 ] = pio.OUTPUT/pio.INPUT - same as above

pio.PA_PULL = pio.PULLUP/pio.PULLDOWN/pio.NOPULL - set pulls on PA
pio.pull[ pio.PA ] = pio.PULLUP/pio.PULLDOWN/pio.NOPULL - same as above

pio.P0_3_PULL = pio.PULLUP/pio.PULLDOWN/pio.NOPULL - set pulls on pin 3 of P0
pio.pull[ pio.P0_3 ] = pio.PULLUP/pio.PULLDOWN/pio.NOPULL - same as above

- samples modified to use the new PIO syntax
- bugfix in AT91SAM7X256 UART int handler
- fixed yet another bug in AVR32's libc (actually replaced strcmp (which is broken on AVR32) with a custom version).
2009-02-10 17:54:01 +00:00

51 lines
1.6 KiB
Plaintext

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><title>eLua webserver test</title>
</head><body>
<p align="center"><big>Welcome to the <b>eLua</b> web server!</big><br></p>
<br>
<div style="text-align: left;">The right column of the following table is generated by embedded Lua code:<br>
<br>
<table width="400" border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td><b>eLua CPU</b></td>
<td><?lua print(pd.cpu()) ?></td>
</tr>
<tr>
<td><b>eLua board</b></td>
<td><?lua print(pd.board()) ?></td>
</tr>
</tbody>
</table>
<br>
And now let's test CGI. Use the form below to control the on-board LED.<br><br>
<form method="get" action="/index.pht" name="led">
<table width="400" border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="center"><input type="submit" value="Led ON" name="ledon"></td>
<td style="center"><input type="submit" value="Led OFF" name="ledoff"></td>
</tr>
</tbody>
</table>
</form>
<?lua
pio.PF_0_DIR = pio.OUTPUT
if reqdata['ledon'] then
pio.PF_0 = 1
print '<br><font color="blue"><b>The LED is now ON</b></font><br>'
elseif reqdata['ledoff'] then
pio.PF_0 = 0
print '<br><font color="blue"><b>The LED is now OFF</b></font><br>'
elseif next(reqdata) ~= nil then
print '<br><font color="red"><b>Invalid CGI request!</b></font><br>'
end
?>
<br>
Press <a href="/test.lua">here</a> to go to a test page generated completely by a Lua script.<br>
<br>
<span style="font-weight: bold;">AND MOST IMPORTANTLY... remember to have fun with eLua! :)</span><br>
</div>
</body></html>