1
0
mirror of https://github.com/elua/elua.git synced 2025-01-08 20:56:17 +08:00

78 Commits

Author SHA1 Message Date
James Snyder
3fc868b534 ADC Changes
- removed getsmoothing, setfreerunning, samplesready
- isdone has returned so that one can check if the reason why the buffer is
  dry is because no more samples are being collected
- smoothing should support fairly large lengths now (as long as you have the
  memory)
- added support to adc.sample to take a table as the first argument so that a
  set of channels can be started at closer to the same time.
    example:
    adcchannels = {0,1,2,3}
    adc.sample(adcchannels,8)

    this should collect samples on all 4 channels starting nearly at the same
    time.

- more comments added to elua_adc.c to describe behavior.

Misc
- remove rndpow2, not being used
2009-03-03 01:23:45 +00:00
James Snyder
1e2e05ee55 Fix limitation that prevented smoothing lengths longer than 64. 2009-02-26 02:36:46 +00:00
James Snyder
554dd7126b ADC can now run in freerunning mode (keep collecting samples after ring buffer
is full). Clock and sampling frequency have been moved to a separate function
from burst.  There is now one function to initiate sampling called sample
which takes a channel and count.  setclock takes a channel, clock_id, and
frequency.  Adjustments should be made to make channel groupings somewhat
cleaner, but this is functional.

Suggestions are welcome for simplification :-)

I'll try and make some doc updates in the coming day or so to reflect
finalized adjustments.
2009-02-24 07:58:10 +00:00
Bogdan Marinescu
99c24861f4 Integrated support for Micromint Eagle 100 board (LM3S6918 Cortex-M3).
Fixed the cross compilation script.
Some DOS to UNIX EOL conversions.
2009-02-23 15:28:56 +00:00
James Snyder
2c175a72cb ADC updates & EABI Compiler Support for LM3S
ADC:
- getsamples split into getsamples and getsample.  getsamples always returns a
  table of results.  getsample returns single values (if available).

EABI compiler support:
- added a parameter to SConstruct called cprefix, which allows one to define a
  prefix other than the arm-elf used by some platforms.  Currently the only
  platform that does anything with this parameter is LM3S, conf.py scripts can
  be updated to handle the default toolchain prefix, and accommodate alternate
  ones if needed.
- Added sections to lm3s.ld (originally committed by Jesus Alvarez) to handle
  linking properly for arm-eabi targets.
2009-02-20 21:41:30 +00:00
James Snyder
b3f6110150 ADC bugfixes, and change to sample and burst being non-blocking. Samples are
acquired with getsamples.
2009-02-16 23:01:32 +00:00
Bogdan Marinescu
42ff856578 - the "pio" module is now called "gpio" (Dado will be finally happy :) )
- new addition to the PIO module: now you can use pin ranges in PIO expressions. For example:

  gpio.PA_3_6_DIR = gpio.OUTPUT -- make pins 3-6 from PORTA outputs
  gpio.PB_0_30_PULL = gpio.PULLUP -- activate pullups on all but the last pin of PORTB
  gpio.PB_3_6 = 11 -- set value 10 (1011) to pins 3-6 of PB (so PB.6 == 1, PB.5 == 0, PB.4 == 1, PB.3 == 1 )
  value = gpio.PB_2_9 -- read the value of pins 2-9 of PB into 'value'

  Of course, one can still specify a single pin instead of a range.
  This is still tested, but seems to work fine for now.
- romfs/ samples updated to work with the new module name and syntax
- small fix to buf.c (in the BUF_MOD_INCR macro).
2009-02-16 20:18:48 +00:00
James Snyder
db423ba662 ADC fixes and temporary workarounds for handling buffer resizing. 2009-02-16 07:37:28 +00:00
James Snyder
fbe307e12a Fairly large number of changes in here to make adc work with lua's provided
buf.c.

The smoothing buffer is still kept separate from the main buffering system,
but as samples come in via interrupt, they are placed into a "standard" elua
buf.  The size of this buf is configured according to whether one is grabbing
a bunch of samples rapidly (burst), or singly in order to accommodate the
expected number of incoming samples.  If smoothing is enabled, incoming
samples are claimed until the smoothing buffer is full, and then remaining
samples are left in the main buffer until they are collected.  This means that
whether one is collecting single samples or samples at burst rate, and
smoothing is enabled, the filter will only be providing samples that have
enough history.

Added a function to manually flush both smoothing and main buffers.
This would be useful if you know your state has changed and you only want
fresh samples that are going to be collected after a flush.

Also, a lot of functionality moved into elua_adc.c and common.c
(boundaries for what belongs where, might be evaluated), reducing the number
of platform.c specific functions dramatically.

Basic functionality seems to be working, but some more testing should be done.

Also, given that there's now a dynamic buffer behind everything, a shift in
the way sampling is handled could be done:
sample and burst functions could be made to be non-blocking, and to never
return anything except for errors.
a separate getsamples function could be used for removing samples collected by
either function from the buffer.
Suggestions are welcome as it would be nice to keep usage paradigms stable
after the 0.6 release.
2009-02-16 00:53:00 +00:00
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
Bogdan Marinescu
afa96dcc25 I was bored during a long training, so I added partial ANSI term support to i386. Now you can life.lua on it :) 2009-01-28 17:53:33 +00:00
James Snyder
da35498b02 - ADC now runs with an interrupt handler, which manages samples from each
channel.  Smoothing support (rolling average) has been added. adcscope has
  been updated to reflect these changes, and show output from 4 channels at
  once.

- fix for typo in stm32/platform.c
2009-01-27 20:49:45 +00:00
James Snyder
150005cad9 Quick ADC demo (not yet an actual scope, just writes text to OLED with last
reading).
2009-01-21 23:41:04 +00:00
Bogdan Marinescu
f729155fce - Lua Tiny RAM (LTR) patch is now integrated in eLua and is enabled by default
- all eLua modules updated to work with LTR
- "cpu" module added to avr32, at91sam7x, str7
- "disp" module no longer generic (now stays in src/modules/lm3s). For this reason, the "disp" platform interface was also removed.
- the "modcommon" mechanism in STM32 (ROM loader) was depreciated in favour of the Lua Tiny RAM patch (and the "stm3210lcd" module from the STM32 backend now uses LTR).
- small bugfixes
2009-01-11 20:43:02 +00:00
Bogdan Marinescu
843bb3dd59 Now we have both GPIO and timer support on AVR32. led.lua sample was also modified to work with the ATEVK1100 board. More to come after I get rid of some other projects. 2008-12-16 19:01:51 +00:00
Dado Sutter
77d626b26a href tags changed to relative (to current host) to avoid the need for "elua" host be known by DNS.
Modules tested ok after changes.
2008-12-13 21:31:20 +00:00
Dado Sutter
6ac505a181 Pong example remorphed for a require() / module () scheme.
It now illustrates how to create and use a module in Lua for eLua.
An LM3S platform-dependend module is created, exposing it's buttons, leds and offering some utility functions.
2008-12-08 19:39:47 +00:00
Dado Sutter
69157a6d21 pong.lua code updated to the new disp.stringdraw() and disp.imagedraw() disp module
syntax.
2008-12-01 01:46:19 +00:00
Dado Sutter
9083b3171c - Added support for RIT128x96x4 OLED Display on LM3S8962 platform, on module "disp"
- ls shell command enhanced with column aligned file sizes and total size report
- New section on CHANGELOG for ongoing dev changes, to ease up next release
- pong.lua added to examples in romfs
- minor URL and e-mail updates, to reflect the new eluaproject.net domain
2008-11-30 22:30:06 +00:00
Bogdan Marinescu
2f8d70c2c0 fixed some errors in index.pht, also made it smaller 2008-11-03 21:01:45 +00:00
Bogdan Marinescu
967722761a ready for 0.5 2008-11-01 18:32:37 +00:00
Bogdan Marinescu
df5a678aa5 multiple changes, documentation updated, getting ready for the new release 2008-10-31 21:32:15 +00:00
Bogdan Marinescu
2acd3cf89d - corrected the uIP support code in send mode
- added the eLua web server example (romfs/lhttpd.lua, romfs/index.pht, romfs/test.lua). Use "lua /rom/lhttpd.lua" from the console to run the server. The server code is largely WIP.
2008-10-27 19:20:23 +00:00
Bogdan Marinescu
f73ad2d08d modified the info.lua sample to take into account that pd doesn't have a clock() method anymore 2008-09-26 20:41:56 +00:00
Bogdan Marinescu
747da02673 - made the math lib configurable with the "platform libs" mechanism. This way one can have a floating point Lua (thus being able to use fundamental floating point operations), but without the
mathlib (sin, cos, tan and all the other functions from there).
- corrected "pwmled.lua" (removed a debug print)
- bumped version number to minor versn 0.4.1
2008-09-10 18:41:31 +00:00
Bogdan Marinescu
95e5875b82 getting ready for 0.4 2008-09-01 20:32:43 +00:00
Bogdan Marinescu
e0ae30c61e moved the files from examples in the ROM file system 2008-09-01 16:26:20 +00:00
Bogdan Marinescu
fc70505266 renamed files to romfs, now it's much less confusing hopefully 2008-09-01 13:32:05 +00:00