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

8 Commits

Author SHA1 Message Date
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
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
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
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