Many mizar32.lcd() Lua functions used to tail-call the i2c_send_command()
functions, whereas they should explicitly return 0, the number of return
values from the Lua function. OK, i2c_send_command did return 0 but this
will change in future when it can detect slave presence and collisions.
On AVR32UC3A0 parts, the GPIO pins are named PA0-31, PB0-31, PC0-5 and
PX0-39. There is no port X: these pins map to five backwards ranges of
bits in the third and fourth sets of GPIO registers (where PC0-5 are
the first six of the third register set).
Already we map pio.PX_nn names to these values, and this commit puts the
reverse mapping into place in pio.decode().
Test program to verify correct mapping:
function eval(s)
return( loadstring( "return(" .. s .. ")" ) )()
end
for i=0,39 do
name = "pio.PX_" .. tostring(i)
gpio = eval(name)
print( name, gpio, pio.decode(gpio) )
end
These changes allow you to "#define UIP_CONF_IPV6 1" in uip-conf.h
for an IPV6-capable network layer.
This also removes a pointless inclusion in avr32/uip-conf.h
The changes to the other three .c files (from "build.h" to "platform_conf.h")
are just orthogonal future-proofing.
This change defers enabling the SPI clocks to platform_spi_setup()
so that, if SPI ports are not used and BUILD_MMCFS is disabled,
power consumption is reduced.
This change removes the extra undocumented uart.SYS_TIMER and
net.SYS_TIMER constants, which are equal to tmr.SYS_TIMER.
The documentation says to use tmr.SYS_TIMER and in the rare case
of uart or net being compiled in but not tmr, the system timer
can be had by using nil or omitting the parameter.
newline characters.
The console used to drop the second one of repeated \r or \n characters
because it would stash the second one in std_prev_char, then at the start
of the next call to std_read(), would poke the \r into the start of the
line buffer, returning a line that began with \r or \n.
This change processes the lookahead character the same as regular ones.
Previously, when pasting multiple lines into the console, the first
character of half the lines would not be echoed. This was due to it being
slurped up by the CRLF lookahead detector, but not being echoed when it was
regurgitated. This change fixes that.
Previously, if you removed a buffer from e uart, the buffer was
removed but the interrupt routine was left intalled, which made
the interpreter hang if you typed a character on the serial port.
Now you can enable and disable UART buffers.
This also changes the order of interrupt handler to
- install the handler
- enable the interrupt
instead of the other way round, so there is no window of time with the
interrupt enabled but no handler installed.
Previously, every call except the first one to uart.set_buffer()
with a buffer size > 0 would fail, as platform_cpu_set_int() returns
whether it used to be enabled or not, which is 0 the first time
(which happens to == PLATFORM_INT_OK) but 1 every time after that.
This change makes 0 and 1 success; all failure values are negative
so that people can now change UART buffer sizes.
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.
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
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.
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
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
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 =