- 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
- "building" page completely rewritten
- a new page about the toolchains used in eLua
- a graphical representation of the system architecture (doc/wb_img/elua_arch.png) that will be used in a soon to come page about the eLua architecture
Also:
- validate.h updated with some new tests (still needs more work)
- "arm-gcc-eabi" toolchain name changed to "codesourcery", since this is obviously way more intuitive :)
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.
Recommended only for systems with very low memory (Flash/RAM), and prefferably systems running only precompiled Lua (if you need to compile the code, you might get into stack overflows, and this allocator is much more sensitive to this kind of stuff than dlmalloc()). In fact, this allocator seems to suggest that one should set the stack to at least 4k for the Lua parser to run properly even on small programs. I won't do this just yet, rather I'll keep on trying to move the Lua parser data structures from stack to heap. For now we're OK with the current configuration.
The allocator can handle multiple memory spaces.
Enable with "allocator=simple" on the scons command line.
...oh yes, also added a newline to the end of elua_adc.c :) (to avoid some annoying warnings)
for me as memcpy did.
Check out inc/utils.h, since this Duff's device is implemented as a macro
which could be used for unrolling other loops selectively.
- 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).
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.
- 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).
Code which was previously using buffer has been updated to work with the
changes.
API has also changed in accordance:
int buf_set(unsigned resid, unsigned resnum, u8 logsize, size_t dsize);
int buf_is_enabled( unsigned resid, unsigned resnum );
unsigned buf_get_size( unsigned resid, unsigned resnum );
unsigned buf_get_count( unsigned resid, unsigned resnum );
int buf_write( unsigned resid, unsigned resnum, t_buf_data *data, size_t dsize );
int buf_read( unsigned resid, unsigned resnum, t_buf_data *data, size_t dsize );
Essentially buf_rx_cb and buf_get_char have been renamed to buf_write and
buf_read. For these, one now passes a pointer to where the data is coming
from or going to, and a dsize parameter indicating how many bytes should be
copied. Also, buf_set takes this same dsize parameter, and keeps it in the
struct. This allows us to ensure that when data is read or written the
number of bytes matches the buffer element size.
I thought about maintaining compatibility functions to provide the original
buf_rx_cb and buf_get_byte API calls, however there weren't a large number
of uses of buf, so it wasn't hard to convert things.
One caveat: BUF_MOD_INCR assumes that byte counts for alternate type sizes
will be powers of 2.
Also, BUF_SIZE_xx's are assumed to refer to element counts.
- UART buffering enabled on LM3S
This doesn't include switching the ADC code over to using these buffers quite
yet.
I'm open to comments on these modifications if theres a better or simpler
approach. I've checked to make sure buffers work on LM3S, but I don't own any
other platforms to make sure there aren't unintended side-effects.
- now uses bitfields rather than HWREGBITW for keeping track of state
- started generalizing functionality for smoothing, state tracking etc... into
separate functions
- burst mode now works, including with smoothing enabled (only operates in a
blocking mode, non-blocking to come later)
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
the heap instead of the stack. Also, the stack size was bumped to at least
2048 bytes on all backends. Hopefully this will take care of most issues
related to stack overflows.
- new buffering system available. Originally I planned to make it fully
generic, but I came to the conclusions that this would take too much
development work and system resources (RAM/Flash) if done properly, so
currently it's only used on UART RX (although it could be easily extended
for other peripherals). For an example of use check the AT91SAM7X and
AVR32 backend (platform_init and associated interrupt handlers and also
platform_conf.h).
- new XMODEM implementation. Better, cleaner, bug fixed, and BSD instead of
GPL.
- AVR32 can use the huge (32MBytes) SDRAM on the board as system memory now.
- fixed an error in elua_sbrk/_sbrk_r (and revised the compilation options
for dlmalloc).
- added the CPU module and interrupt support on the STR9 platform.
- uart module changes: 'sendstr' is out, but the regular 'send' will send
strings instead of simple chars (which makes sense since Lua doesn't have
a "char" type). Also, the 'timer_id' and 'timout' parameters of the 'recv'
function are now optional.
- 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
- added virtual timers (on LM3S, AVR32 and AT91SAM7 for now)
- added interrupt handling code for AT91SAM7 and AVR32
- fixed two serious bugs that prevented the eLua image to run on both STR9 and LPC2888 (linker command file issues)
- fixed line endings (DOS->UNIX) in the STM32 library files
- fixed preprocessor errors (hopefully all of them) like #if ELUA_CPU == LM3S8962
- other minor or less than minor fixes :)
- 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
- added the resolver application (src/uip/resolv.*) to eLua (configurable by BUILD_DNS in build.h) to allow DNS lookups
- more functions in the "net" module, more tests, it seems to work fine now in both "server mode" and "client mode"
- console over TCP works once again, or should I say "now works". It turns out that it never worked with the code in SVN, because I committed a wrong file a while ago.
ANSI terminal support (yet) and "recv" doesn't work anymore because XMODEM doesn't work over TCP/IP. Only for LM3S8962/LM3S6965 for now, but it should straightforward (not easy though)
to port it to other platforms. Only static IP for now. More TCP/IP functions need to be implemented (and an eLua module must be written to access them). To enable console over TCP:
- enable "BUILD_CON_TCP" in build.h, also disable "BUILD_XMODEM" and "BUILD_TERM" in build.h (you'll get an error if you don't)
- disable "BUILD_CON_GENERIC" in build.h (you'll get an error if you don't)
- edit your network settings in build.h
- build the image&burn it
- telnet to the address configured in build.h. Be sure to use a decent telnet client, like the one in Linux or putty. Don't try with telnet from Windows, as it surely won't work. Also, it might
not work with the telnet client from Tera Term Pro (didn't test this).
- type 'exit' from shell to terminate the connection.
Also, note that from this point on you'll need a newer version of binutils to compile for Cortex. I'm using binutils-2.19.50.tar.bz2 (from the snapshots page). 2.18 might work too, but I didn't
test it.
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
I/O setup.
- the pd() module has a new method (board) and gets it CPU, platform and board name directly from the build system (command line macros). It's much easier to work like this.
- the samples (examples/) were updated to check pd.board() rather than pd.platform()/pd.cpu(), which is a much more logical way to do things, since it ties the sample to a
specific I/O configuration, not with a CPU.
- updated PWM code for AT91SAM7X, now the "piano" example works for both LM3Sxxxx and AT91SAM7X256.
- added 3 new methods to the PIO module: pullup(), pulldown(), ad nopullup(), their meaning is obvious.
- new shell command: mem
- new module: bit (for bit operations)
- removed UARTx, TMRx, SPIx, PWMx constants from the respectives modules, as they only waste memory space. But now the same
modules will return an error (via luaL_error) if an invalid resource ID is used. Note that this does not apply to PIO, since
PIO uses special encodings for ports/pins.
- new methods in pio: port and pin to return the port/pin encoded in a pio value.
LPC2888 board. The allocator used is dlmalloc, just as in Newlib, but it's a
newer version than can handle non-contiguous memory spaces (2.8.3, as opposed
to 2.6.4 in Newlib 1.16.0, I really have no idea why they're using such an
ancient version of dlmalloc). To use it add "allocator=multiple" to your scons
command line (default for LPC2888).
This takes care of my LPC2888 board (any many other board out there)
that have RAM both on the CPU itself and on a separate chip.
To use it add "allocator=tlsf" to your scons build command.
Even though the code for all the platform was modified, the new code
should not modify the "old" allocator behaviour.
Also added a new "mem" command to the shell, it gives information about
the current RAM state (total, used, free).
NOT YET TESTED !!! So use with care.