Damien George
4d7f4eb6a9
stmhal: Add ADC function to read data at a given frequency.
Reads ADC values into a bytearray (or similar) at a fixed rate. Needs a
better name and improved API. Also fix up DAC dma function (which also
needs a better name and API).
11 years ago
Damien George
e95da5b784
stmhal: Add I2C.scan method, to scan all devices on the bus.
Simple way to find the address of an attached I2C device.
11 years ago
Damien George
f6d25ecf7b
stmhal: Add simple README.txt to freshly-created filesystem.
11 years ago
Damien George
c13d0b3304
stmhal: Wrap skin-named-usarts in PYBV10 #if.
11 years ago
Damien George
cce7119a2b
stmhal: Work around crazy bug in USB CDC.
Packets of 64 bytes length are not send to the host until the following
packet is sent. Fixed by never sending packets of 64 bytes length.
11 years ago
Damien George
7e5be0b1b4
stmhal: Improved usart module a bit.
11 years ago
Damien George
6dba016a56
stmhal: Add pyb.wfi() function (calls __WFI).
11 years ago
Damien George
86a03044e3
stmhal: Add stdin/stdout/stderr objects.
Available via sys.std{in,out,err}. Basic reading and writing supported.
Even sys.stdin.readline!
11 years ago
Damien George
212f89e61a
stmhal: Improve USB CDC write function (increase timeout).
11 years ago
Damien George
73496fbbe4
py: Fix up source-line calculation.
Should address issue #475 .
11 years ago
Damien George
cb861a5c6a
stm[hal]: Init mp_sys_path and mp_sys_argv correctly.
11 years ago
Damien George
8a1cab952f
py: Fix mp_get_buffer, and use it in more places.
Must use mp_obj_get_type to get the type of an object. Can't assume
mp_obj_t is castable to mp_obj_base_t.
11 years ago
Damien George
0aab675108
stmhal: Little hack to dump GC allocation table using pyb.info().
Pass a single parameter (doesn't matter what): pyb.info(1), will dump
the GC alloc table.
11 years ago
Paul Sokolovsky
4165cd1c0c
stmhal: Update for static mod sys.
11 years ago
Damien George
82c7b1b1d5
stmhal: Put a USB structure in ROM; GC doesn't scan the data segment.
11 years ago
Damien George
b96c7c03ca
stmhal: Move fatfs volume/partition lookup table to ROM.
11 years ago
Damien George
60427864b1
stmhal: Move I2C objects to ROM.
11 years ago
Damien George
3f4898456b
stmhal: Add stm module, which contains some constants for the MCU.
Also contains raw memory read/write functions, read8, read16, read32,
write8, write16, write32. Can now do:
stm.write16(stm.GPIOA + stm.GPIO_BSRRL, 1 << 13)
This turns on the red LED.
With the new constant folding, the above constants for the GPIO address
are actually compiled to constants (and the addition done) at compile
time. For viper code and inline assembler, this optimisation will make
a big difference. In the inline assembler, using these constants would
not be possible without this constant folding.
11 years ago
Andrew Scheller
fec6f018ee
Tweak pybcdc.inf to match recent changes to pybcdc.h
11 years ago
Damien George
7a5f9e94ad
stmhal: Make /src/main.py just /main.py; allow SD to be used as root device.
11 years ago
Damien George
a5c18f3285
stmhal: Update windows driver; \r\n newlines and addition USB id.
11 years ago
Damien George
b99ca2cdde
stmhal: Add windows cdc .inf driver to flash filesystem.
11 years ago
Damien George
8e6f98b166
stmhal: Improve help() function.
11 years ago
Damien George
229347139b
stmhal: Add functionality to Servo object.
Can now calibrate, set pulse width, angle and speed.
11 years ago
Dave Hylands
3bbceeaaf7
Fix make-pins.py to support having multiple names for a pin.
SW and X17 now both map to PB3
11 years ago
Damien George
b04488151e
stmhal: Make USRSW re-register the EXTI callback each time it's set.
11 years ago
Damien George
2137bc7124
stmhal: in EXTI interrupt handler wrap uPy calls in gc_lock and nlr_buf.
11 years ago
Damien George
26cf55ae05
Add a check for NULL nlr_top in nlr_jump.
If no nlr_buf has been pushed, and an nlr_jump is called, then control
is transferred to nlr_jump_fail (which should bail out with a fatal
error).
11 years ago
Damien George
97790455fe
Improve REPL detecting when input needs to continue.
Full CPython compatibility with this requires actually parsing the
input so far collected, and if it fails parsing due to lack of tokens,
then continue collecting input. It's not worth doing it this way. Not
having compatibility at this level does not hurt the goals of Micro
Python.
11 years ago
Paul Sokolovsky
72d70cb045
unix, stmhal: Consistently use "FileIO" as class name for file objects.
They correspond to io.FileIO in io module hierarchy (with small caveat
that io.FileIO is raw file and works with bytes, not strings).
11 years ago
Andrew Scheller
902d9552c5
Replace some Makefile commands with variables in py/mkenv.mk
11 years ago
Damien George
65cad12d38
py: Add option to compiler to specify default code emitter.
Also add command line option to unix port to select emitter.
11 years ago
Damien George
27e735fd18
py: Replace stream_p with *stream_p in mp_obj_type_t.
This is to reduce ROM usage. stream_p is used in file and socket types
only (at the moment), so seems a good idea to make the protocol
functions a pointer instead of the actual structure.
It saves 308 bytes of ROM in the stmhal/ port, 928 in unix/.
11 years ago
Damien George
7efc5b3f34
py: Make globals and locals proper dictionary objects.
Finishes addressing issue #424 .
In the end this was a very neat refactor that now makes things a lot
more consistent across the py code base. It allowed some
simplifications in certain places, now that everything is a dict object.
Also converted builtins tables to dictionaries. This will be useful
when we need to turn builtins into a proper module.
11 years ago
Damien George
8b0535e23f
py: Change module globals from mp_map_t* to mp_obj_dict_t*.
Towards addressing issue #424 .
Had a small increase to ROM usage (order 60 bytes).
11 years ago
Damien George
12bab72d93
Improve GC finalisation code; add option to disable it.
11 years ago
Damien George
ea13f407a3
py: Change nlr_jump to nlr_raise, to aid in debugging.
This does not affect code size or performance when debugging turned off.
To address issue #420 .
11 years ago
Damien George
e20b6b418c
stmhal: autoflash now enters serial comms after flashing.
11 years ago
Damien George
38d3430320
stmhal: Add more escape seqs; add debugging output for escape seq.
11 years ago
Paul Sokolovsky
cdffa32699
stmhal readline: Parse XTERM Home/End key codes.
Which are ESC O H, ESC O F.
11 years ago
Dave Hylands
bf7d690e36
Add the git version to the banner
11 years ago
Damien George
3996611c1b
stmhal: Add home/end cursor support in readline.
Home/end work in picocom and screen (different codes in those 2
programs). Also, CTRL-A (for non-empty liny) and CTRL-E act as
home/end.
11 years ago
Damien George
57ad7aa66b
stmhal: On soft reset, if in raw REPL mode, don't run main.py.
11 years ago
Damien George
d8b47d3e02
stmhal: Fix raw REPL so that it passes through more ASCII chars.
11 years ago
Damien George
769b23a9c6
stmhal: Add powf, logf, log2f, log10f.
11 years ago
Damien George
aba9f51fef
stmhal: #undef log2f if it's defined.
11 years ago
Paul Sokolovsky
1d4d9ddd9e
stmhal: Reimplement file support using stream protocol API.
This adds readline(), readall(), etc. methods. Also other fixes to make
Python API compliant and "with" support.
11 years ago
Damien George
e90eefc84b
stmhal: Fix servo object; add fpclassify to math functions.
11 years ago
Damien George
a12be917a4
stmhal: Add timer module; move servo PWM from TIM2 to TIM5.
As per issue #257 , servo is better on TIM5 because TIM2 is connected to
more GPIO.
11 years ago
Damien George
69dee59ce4
stmhal: Add backspace key to readline (along with delete key).
11 years ago