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

438 Commits

Author SHA1 Message Date
Dado Sutter
1657931da7 Functions description formatting tests
(notably in adc and uart modules)
Text revisions
2009-02-17 05:10:44 +00:00
James Snyder
5a6a4d017e Switch byte copying in buf.c to a Duff's device. This seems to work as well
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.
2009-02-17 03:52:29 +00:00
Dado Sutter
7d2203c54b Reference Manual revised to reflect the new ADC doc
General revision
Anchors refactored to indicate container modules
Ongoing work ........
2009-02-17 00:44:44 +00:00
James Snyder
95b9bd97c2 Minor consistency change for ADC on LM3S. 2009-02-16 23:06:07 +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
Dado Sutter
4a8edbeb0b Features added to WebBook HTML generator :
- New parameters in wb_usr to specify:
- logo image file name
- search box visibility
- search box title and label
- vertical size of title bar (for bigger logos)

Features changed in WebBook HTML generator:
- copywrite notice now optional
- mail contact now optional
- UTF-8 used for Portuguese version
- search box now has a separate template to allow positioning flexibility

HTML Templates enhanced

Ongoing work....
2009-02-16 17:15:17 +00:00
James Snyder
db423ba662 ADC fixes and temporary workarounds for handling buffer resizing. 2009-02-16 07:37:28 +00:00
Dado Sutter
793e125c97 Snyder's platform dependent ADC module initial doc added to Reference Manual
Menu tree and individual function anchors edited
Ongoing work
2009-02-16 02:38:13 +00:00
Dado Sutter
174fbf43b9 Helping svn to do something simple :)
Ongoing work
2009-02-16 01:51:21 +00:00
Dado Sutter
1af14aea4c ongoing work... 2009-02-16 01:49:54 +00:00
Dado Sutter
04b952cf06 Removing consolidated files
Ongoing work
2009-02-16 00:58:04 +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
Dado Sutter
eafb837414 Content added
Menu tree revised
Anchors refactored
Ongoing work
2009-02-15 22:24:34 +00:00
James Snyder
f9d9dd1817 Update license notice to reflect replaced xmodem code. 2009-02-13 20:02:13 +00:00
Dado Sutter
faa0485013 Some initial site content migrated
Ongoing work
2009-02-12 05:16:01 +00:00
Dado Sutter
989e87d2e6 Restoring a wrongly commited file (sorry guys) 2009-02-12 03:56:20 +00:00
Dado Sutter
a592452dba New site sections added
Minor corrections
Site content will begin to migrate soon now
Ongoing work
2009-02-12 03:52:46 +00:00
Dado Sutter
9fb879d8a3 -- Items added on Menu Tree
-- Ongoing work, far from final :)
2009-02-11 05:16:37 +00:00
Dado Sutter
dd2eb8b081 - Refining the future eLua Doc structure.
- Single css style for locale versions
- Current site structure partially migrated to the menu tree
- Ongoing work ......
2009-02-11 05:03:03 +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
James Snyder
a973e8f4e9 Modification of buf.c so that logsize^2 represents number of bytes in buffer.
Element byte counts must be a power of 2.
2009-02-10 05:50:48 +00:00
James Snyder
c6fd54ce7e - Buffer refactored to handle multibyte data.
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.
2009-02-09 03:43:47 +00:00
Dado Sutter
b2edeca528 Platform Dependent Section created 2009-02-04 03:22:49 +00:00
Dado Sutter
e64a80124e Portuguese version structure added 2009-02-03 20:50:59 +00:00
Dado Sutter
634528c5a6 Missing link and filename fixes 2009-02-03 20:12:12 +00:00
Dado Sutter
54d447d2bb Filename fixes 2009-02-03 19:59:46 +00:00
Dado Sutter
c853d97e27 Modules added to the menu tree structure
Skeleton content for some pages (english version only)
Menu Tree is functional
2009-02-03 19:50:37 +00:00
Dado Sutter
1a8fb598c6 Last branch now opens
Alphabetic ordered
Ongoing work ....
2009-02-03 12:52:33 +00:00
Dado Sutter
d2c4225b14 Files updated for two language (English and Portuguese) structure 2009-02-02 23:03:37 +00:00
Dado Sutter
4d7da08259 reference menu tree structure testing 2009-02-02 22:49:13 +00:00
Dado Sutter
a75755fdcc English and Portuguese test content for the new doc structure still under development.
To be enhanced very soon. This is just an initial commit to allow colaborative dev.
2009-02-02 21:11:46 +00:00
Dado Sutter
6137c01714 New HTML doc structure still under evaluation and development.
Please read file readme.txt on /doc for more info.
2009-02-02 21:08:31 +00:00
Bogdan Marinescu
bdecd89d31 small typo in i386 2009-02-01 18:47:25 +00:00
James Snyder
709d18c080 Updated ADC Module:
- 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)
2009-01-31 21:04:08 +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
16e4dba18d line endings for rit128 changed to unix. 2009-01-27 20:49:34 +00:00
Bogdan Marinescu
0d9fcf9909 - lua parsing: lparser.c was modified to allocate some of its structures to
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.
2009-01-22 19:46:47 +00:00
James Snyder
569a9f69e7 fix to correctly use multiple input channels 2009-01-22 03:25:09 +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
James Snyder
cd2e9e1cf0 Initial ADC implementation. 2009-01-21 23:40:34 +00:00
James Snyder
88ccbc5375 Typo fix. :-) 2009-01-21 23:40:03 +00:00
Pedro Bittencourt
fe072acadd Completing some comments about lua function calls on that module 2009-01-19 20:34:06 +00:00
Dado Sutter
1acaa67361 Fixed mistyped syntax of disp.imagedraw() function 2009-01-19 20:25:50 +00:00
Bogdan Marinescu
69e02e0375 bugfix: mathlib's rotable not included anymore in 'lualong' mode 2009-01-14 11:03:28 +00:00
Bogdan Marinescu
093108faad eLua stack overflow fix
DETAILS: for most platforms, the main stack size was set to 256 bytes to
save RAM. During a routine Lua debugging session, I discovered that there
are at least two data structures in Lua (declared on the stack) that can
lead to a stack overflow problem because of their size:

lparser.h -> struct FuncState (original size: 572) is allocated on the stack
when the parser needs to compile a Lua function
lstrlib.c -> MatchState (original size: 272) is allocated on the stack
everytime the string library does match-related operations.

To fix the first problem I modified these macros in luaconf.h:

/*
@@ LUAI_MAXUPVALUES is the maximum number of upvalues per function
@* (must be smaller than 250).
*/

LUAI_MAXUPVALUES from 60 to 10

/*
@@ LUAI_MAXVARS is the maximum number of local variables per function
@* (must be smaller than 250).
*/
LUAI_MAXVARS from 200 to 25

The new size of the FuncState structure: 124

To fix the second problem I modified this macro in luaconf.g

/*
@@ LUA_MAXCAPTURES is the maximum number of captures that a pattern
@* can do during pattern-matching.
** CHANGE it if you need more captures. This limit is arbitrary.
*/

LUA_MAXCAPTURES from 32 to 10

The new size of the MatchState structure: 96

All these values are experimental, but they should work well.

Also, I forced the main stack to 512 bytes in all the backends. Hopefully
this will take care of this problem.
2009-01-12 11:52:58 +00:00
Bogdan Marinescu
a529d5d835 LTR bugfix: wrong metatable query for rotables in luaV_gettable 2009-01-12 10:35:58 +00:00
Bogdan Marinescu
dd5294d821 changed propedit 2009-01-11 20:44:22 +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