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

1031 Commits

Author SHA1 Message Date
Martin Guy
a2c22b0aac Make compilation of usb-cdc.c conditional on BUILD_USB_CDC
...instead of compiling it and having the linker drop the unused symbols.
2012-02-01 18:40:08 +01:00
Martin Guy
cd81e0d3dd avr32 usb-cdc cleanup: remove tabs and ^Ms and add Atmel copyright 2012-02-01 18:28:13 +01:00
Martin Guy
3e48d16846 AVR32 bugfix: pwm.setclock() used to stop the system timer.
Now that the system timer uses PWM clock B, the pwm setclock() code
needs to read-modify-write the mode register instead of just setting it.
The most obvious symptom was that after a call to pwm.setclock() you
needed to press enter twice to get a new Lua prompt instead of once.
2012-02-01 15:26:23 +01:00
Martin Guy
d19bb6537a Fix typo in commentary 2012-02-01 15:05:22 +01:00
Martin Guy
ca12cd69e3 Drop outdated commentary 2012-01-30 17:18:18 +01:00
James Snyder
f045668c61 Merge pull request #8 from elua/avr32_usbcdc
This patch adds support for the USB-CDC (UART on USB) for avr32.
2012-01-29 11:16:56 -08:00
Nuccio Raciti
4a67f9dd5c This patch adds support for the USB-CDC (UART on USB)
for avr32.
It was tested *only* on a Mizar32 board.

Signed-off-by: Nuccio Raciti <raciti.nuccio@gmail.com>
2012-01-27 21:34:05 +01:00
Martin Guy
ac7677284e Mizar32: Disable FOSC32 again, which doesn't work in the hardware 2012-01-23 14:29:26 +01:00
Martin Guy
3e1398e987 Add math.pow() to integer version of math library
An integer version of the power function exists anyway for the ^ operator,
so create a binding to its synonym in the math library when LUA_NUMBER_INTEGRAL
2012-01-23 13:22:06 +01:00
James Snyder
b045088f65 Fix git command check to look for code 0 return 2012-01-21 16:23:31 -06:00
Martin Guy
b72f620aed Fix to previous commit: unsigned values never look negative! 2012-01-21 20:00:34 +01:00
Martin Guy
84a17973fb Merge branch 'master' of github.com:elua/elua 2012-01-21 19:32:37 +01:00
Martin Guy
0e09fd9006 Reject negative frequency values in adc.setclock() 2012-01-21 19:30:31 +01:00
Bogdan Marinescu
6f93ebdd29 Merge branch 'master' of github.com:elua/elua 2012-01-21 17:33:08 +02:00
Martin Guy
69eb5cc478 Put the order of timer parameters back to what it used to be
This patch undoes the change in the order of timer parameters for:
net.accept() net.recv() tmr.delay() tmr.setclock() tmr.set_match_int()
tmr.gettimediff()  and also changes the new tmr.getdiffnow() to have the
same parameter ordering as the others.
The default timer ID (the systimer), which previously was obtained with an
optional last parameter, is now obtained by supplying nil as the timer ID.
2012-01-21 17:30:38 +02:00
Martin Guy
b95ec14fa9 Reconfigure Mizar32 for product launch
The product launch configs are to have the eLua shell only in the
larger models and as many basic modules as will fit in the 128K version
2012-01-21 15:16:30 +01:00
Martin Guy
3f48d87780 Fix compiler warning about pointer signedness 2012-01-21 14:01:25 +01:00
Martin Guy
d0ac60c65b AVR32 config changes fot default CPU, allocator and memory use
Changes the default Mizar32 CPU to the 256K model,
the default allocator for the 128K Mizar32 to simple (the smallest)
the default allocator for other Mizar32s to multiple to avoid newlib's
  dlmalloc bug
and only use one memory region on AVR32 platforms when newlib or simple
  for the same newlib dlmalloc bug and because simple can only handle
  one region
2012-01-21 12:24:35 +01:00
Martin Guy
34c634dbf7 AVR32: Configure ADC within spec and at optimal values
The previous Atmel code didn't set the PRESCAL filend, so overclocked
the ADC at 7.5Mhz or 8.25Mhz (according to PBA_FREQ) instead of the
maximum of 5MHz for 10-bit conversions and 8MHz for 8-bit.
It also set the sample-hold and startup times to their maxima instead
of just within spec.

This change calculates the optimal in-spec values for these fields,
also improving the maximum sampling rate, from 64ks/sec to 71ks/sec
and is preparatory work for being able to set the sampling rate.

Tested on Mizar32 and EVK1100
2012-01-21 09:41:54 +01:00
James Snyder
ed9793a42e Add support for git version determination to SCons build system 2012-01-20 18:15:53 -06:00
James Snyder
8060e0e2c9 Merge branch 'master' into include_git_rev 2012-01-20 17:22:56 -06:00
James Snyder
d608453878 Apply strexh/strexb fix to lpc17xx as well 2012-01-20 17:20:51 -06:00
James Snyder
879642e1e1 Workaround for strexh/strexb same register error: http://lists.gnu.org/archive/html/bug-binutils/2011-12/msg00112.html 2012-01-18 19:01:43 -06:00
Martin Guy
a77fc80604 Tiny optimization in AVR32 UART code
The values for the stopbit defines happen to be the same in eLua
headers and avr32 headers, so check for this and when true replace
a no-op switch statement with an =
2012-01-17 11:58:04 +01:00
Martin Guy
c8a82fa8bf Include 32768Hz crystal on Mizar32 - now it will be there. 2012-01-16 10:14:16 +01:00
Martin Guy
98d85709a9 Mizar32 conf: enable DHCP client by default 2012-01-16 07:00:07 +01:00
Martin Guy
dbf721b0cd jaFix typo in previous commit 2012-01-15 14:01:21 +01:00
Martin Guy
4019718521 AVR32: Move virtual timer channel definition to platform conf file
Instead of defining the virtual timer channel twice in two .c files,
define it once in each board's platform_conf.h file. Although all the
currently-supported UC3 parts (A & B) have 3 timers, the UC3C parts have 6.
2012-01-15 08:00:19 +01:00
Martin Guy
a5a20783a9 Fix tmr.getmaxdelay() with virtual and system timers when LUA_NUMBER_INTEGRAL
tmr.getmaxdelay() used to return -1 for the system timer and -2 for
virtual timers in the integer build due to Lua integers being signed.
This makes them return 2147483647 and 2147483646 resectively.
2012-01-15 06:37:13 +01:00
Martin Guy
ffe0338b89 Fix commentary in previous commit
The new AVR32 delay code doesn't just handle up to 30 second delays;
it handles the whole range.
2012-01-02 14:26:29 +01:00
Martin Guy
89b78f288a Fix random 60-second pause bug in AVR32 I2C code
The I2C delay routine would very occasionally pause execution for
60 seconds then continue. This was due to an Atmel delay routine
that claimed to handle the 32-bit counter register overflowing
but didn't. Specifically, in the old code, when delay_end_cycle was
very close to 2^32, the counter register could wrap to 0 before it
was compared for being > delay_end_cycle, resulting in a 2^32-cycle
pause, about a minute.  If the end_cycle were exactly 2^32-1,
the delay might have takes several minute-long cycles to finish.

This commit also fixes the bug in the SDRAM init code where the
delay code was copied from. In that case the odds of the bug biting
were very small indeed, since it was immediately after system startup
and in SDRAM init code there are no interrupt routines running.
However, the correct code is also shorter.
2012-01-01 22:52:31 +01:00
Robert G. Jakabosky
6d26eed80f Update EGC to r6 from r4 2011-12-28 18:05:48 -06:00
Martin Guy
c9c4311f15 Apply fix to Lua 5.1.4 bug #11
See http://www.lua.org/bugs.html -> Lua 5.1.4 -> bug 11
"Parser may collect a prototype while building it."
2011-12-18 18:36:36 +01:00
Martin Guy
e7ec5a84fd Apply fix to Lua 5.1.4 bug #10
See http://www.lua.org/bugs.html -> Lua 5.1.4 -> bug 10
Repeat-by:
  meta={}
  setmetatable(meta, meta)
  meta.__newindex = function(t, key, value) print("set") end
  o = setmetatable({}, meta)
  o.x = 10    -- should print 'set'
Lua 5.1.4 fix adapted to eLua's rotable mods
2011-12-18 18:31:04 +01:00
Bogdan Marinescu
e823c8d3fc RFS server fix for serial connections
On Linux, the serial connection was not setup properly, which led to
weird errors in the RFS server. This fix disables any input processing
in the termios layer, thus fixing the problem. Thanks to Markus Korber
for reporting and fixing the issue.
2011-12-17 17:17:46 +02:00
Bogdan Marinescu
a0ecdc124b RFS server fix
Read from the UART file descriptor until no data can be read
anymore (POSIX only). This is needed because sometimes the
RFS server didn't read all the available data and signaled errors.
2011-12-15 23:35:17 +02:00
Martin Guy
3195763d16 Fix typo in tmr doc 2011-12-11 18:19:49 +01:00
Martin Guy
ddcec49ae1 Drop timer support in Mizar32 128k default build to that the image fits.
The default config for the 128K Mizar32 board no longer fitted into the
available 129KB of flash. This drops the timer modules so that it does.
2011-12-11 17:34:26 +01:00
Martin Guy
2f560fb16b Fix compilation error when optram=0
This commit fixes
src/modules/tmr.c:203: warning: implicit declaration of function 'LNUMVAL'
src/modules/tmr.c:203: error: initializer element is not constant
src/modules/tmr.c:203: error: (near initialization for 'tmr_map[11].func')
due to missing #if LUA_OPTIMIZE_MEMORY > 0
2011-12-11 17:19:24 +01:00
Martin Guy
bbd7c635b9 AVR32 platform: Replace literal constant with its symbolic name
Numer of hardware timer IDs is available as a symbolic constant
on AVR32. This uses it instead of a literal "3".
2011-12-11 14:38:52 +01:00
Martin Guy
3b5fd90fb2 Move saving of old LCD cursor position to after the arg checking. 2011-12-10 18:15:02 +01:00
Martin Guy
8e3e4a634b optimize LCD reset code, as it is now a single command 2011-12-10 18:03:42 +01:00
Martin Guy
fb1d9c464c For new LCD firmware, drop need to limit data to 31 bytes
The previous Mizar32 LCD firmware had a limit of 31 bytes per
data message, while the new has no limit. This commit drops the
code that used to split long data transfers into 31-byte chunks.
2011-12-10 17:51:03 +01:00
Martin Guy
991bcec20d Fix typos in interrupt docs 2011-12-10 15:31:15 +01:00
Martin Guy
a4389ed77c Fix signed/unsigned conflicts in i2c data and integer parameters 2011-12-10 13:33:44 +01:00
Martin Guy
d3948700bc When defining a user character, restore cursor position using getpos()
When defining a user-defined character on the LCD panel, the hardware
forgets the current cursor position on the display.  We used to
restore it by keeping track of the cursor in software, but now that
the LCD firmware has a "report current cursor position" command,
we simply use that to save and restore the cursor position when
defining a char. Code saving: 272 bytes.

The old firmware could not return the current cursor position, so
previously, when defining a user-definable character, it could
2011-12-10 13:16:37 +01:00
Martin Guy
b07f2fd6c2 Implement and document mizar32.lcd.{getpos,buttons}() functions
The new LCD PIC firmware has the ability to return the cursor position
in the LCD character RAM and the state of the buttons. This commit
implements eLua module functions to make these available to users.
2011-12-10 12:50:31 +01:00
Martin Guy
1a087dbc7b Conform in-bracket spacing to eLua convention 2011-12-10 10:49:08 +01:00
Martin Guy
d154d93523 Fix mizar32.lcd.*() documentation 2011-12-10 09:58:52 +01:00
Martin Guy
f35b786ccc Use a #define for the LCD_RESET command, not a literal value 2011-12-09 19:20:18 +01:00