Commit Graph

29 Commits

Author SHA1 Message Date
Damien George
a3320e7811 stmhal/i2c: Remove use of legacy I2C_NOSTRETCH_DISABLED option.
In the new HAL this is renamed to I2C_NOSTRETCH_DISABLE.
2016-11-22 17:40:50 +11:00
Damien George
d49d81b167 stmhal: Refactor pin usage to use mp_hal_pin API. 2016-10-18 14:34:08 +11:00
Krzysztof Blazewicz
06a1194300 stmhal/{accel,lcd}: use GPIO_{set,clear}_pin
different HAL versions implement GPIO differently (BSRR vs BSRRH+BSRRL),
this way both drivers are portable between different HAL's
2016-09-09 10:38:08 +02:00
Damien George
12c61ddddd stmhal/accel: Raise an exception if the accel couldn't be initialised.
On PYBLITEv1.0 there is no accelerometer and in this case the Accel()
constructor should not silently succeed.
2016-04-29 15:43:15 +01:00
Damien George
5b3f0b7f39 py: Change first arg of type.make_new from mp_obj_t to mp_obj_type_t*.
The first argument to the type.make_new method is naturally a uPy type,
and all uses of this argument cast it directly to a pointer to a type
structure.  So it makes sense to just have it a pointer to a type from
the very beginning (and a const pointer at that).  This patch makes
such a change, and removes all unnecessary casting to/from mp_obj_t.
2016-01-11 00:49:27 +00:00
Damien George
6f70283909 stmhal: Make accel AVDD pin configurable via mpconfigboard.h. 2015-10-29 22:40:42 +00:00
Dave Hylands
ea8bf81058 stmhal: Replace #include "stm32f4xx_hal.h" with #include STM32_HAL_H. 2015-07-30 00:38:25 +01:00
Damien George
2cf6dfa280 stmhal: Prefix includes with py/; remove need for -I../py. 2015-01-01 21:06:20 +00:00
Damien George
ecc88e949c Change some parts of the core API to use mp_uint_t instead of uint/int.
Addressing issue #50, still some way to go yet.
2014-08-30 00:35:11 +01:00
Damien George
fa1ecda3fd stmhal, accel: Increase start-up times to 30ms; add extra 30ms delay.
For accel to start-up reliably, need to wait 30ms between on/off, and
30ms for it to enter active mode.  With this fix the accel can be read
immediately after initialising it.

Addresses issue #763.
2014-07-31 10:39:52 +01:00
Damien George
f1dbd78b30 stmhal: Document pyb.Accel() constructor, that it takes time to start. 2014-06-01 17:57:06 +01:00
Damien George
04b9147e15 Add license header to (almost) all files.
Blanket wide to all .c and .h files.  Some files originating from ST are
difficult to deal with (license wise) so it was left out of those.

Also merged modpyb.h, modos.h, modstm.h and modtime.h in stmhal/.
2014-05-03 23:27:38 +01:00
Paul Sokolovsky
9b71b16a94 unix,stmhal: Make "mpconfig.h" be first included, as other headers depend on it. 2014-05-02 18:08:16 +03:00
Damien George
8d09640b22 stmhal: Add documentation in comments, and script to generate HTML.
Decided to write own script to pull documentation from comments in C code.
Style for writing auto generated documentation is: start line with ///
and then use standard markdown to write the comment.  Keywords
recognised by the scraper begin with backslash.  See code for examples.

Running: python gendoc.py modpyb.c accel.c adc.c dac.c extint.c i2c.c
led.c pin.c rng.c servo.c spi.c uart.c usrsw.c, will generate a HTML
structure in gendoc-out/.

gendoc.py is crude but functional.  Needed something quick, and this was
it.
2014-04-29 22:55:34 +01:00
Damien George
b97c2f4c14 stmhal, accel: Add TODO comment. 2014-04-21 18:30:38 +01:00
Damien George
eb8bdf4df3 stmhal, SPI and I2C: Improvements to functionality and consistency. 2014-04-21 00:10:04 +01:00
Damien George
ff91156d34 stmhal: Improved configurability for I2C and SPI busses.
The HAL handles for the I2C/SPI objects are rather large, so we don't
want to unnecessarily include them.
2014-04-20 19:06:15 +01:00
Damien George
57e415859a stmhal: Tidy up and improve consistency across modules. 2014-04-20 00:30:09 +01:00
Damien George
d689430e79 stmhal: Add SPI class.
Also some updates to compile with latest changes to core py.
2014-04-20 00:16:30 +01:00
Damien George
15d18069c5 py: Remove old "run time" functions that were 1 liners. 2014-03-31 16:28:13 +01:00
Damien George
df6567e634 Merge map.h into obj.h.
Pretty much everyone needs to include map.h, since it's such an integral
part of the Micro Python object implementation.  Thus, the definitions
are now in obj.h instead.  map.h is removed.
2014-03-30 13:54:02 +01:00
Damien George
d17926db71 Rename rt_* to mp_*.
Mostly just a global search and replace.  Except rt_is_true which
becomes mp_obj_is_true.

Still would like to tidy up some of the names, but this will do for now.
2014-03-30 13:35:08 +01:00
Damien George
eed6f26bed stmhal: Use rt_check_nargs to check number of arguments. 2014-03-26 22:46:03 +00:00
Damien George
9b196cddab Remove mp_obj_type_t.methods entry and use .locals_dict instead.
Originally, .methods was used for methods in a ROM class, and
locals_dict for methods in a user-created class.  That distinction is
unnecessary, and we can use locals_dict for ROM classes now that we have
ROMable maps.

This removes an entry in the bloated mp_obj_type_t struct, saving a word
for each ROM object and each RAM object.  ROM objects that have a
methods table (now a locals_dict) need an extra word in total (removed
the methods pointer (1 word), no longer need the sentinel (2 words), but
now need an mp_obj_dict_t wrapper (4 words)).  But RAM objects save a
word because they never used the methods entry.

Overall the ROM usage is down by a few hundred bytes, and RAM usage is
down 1 word per user-defined type/class.

There is less code (no need to check 2 tables), and now consistent with
the way ROM modules have their tables initialised.

Efficiency is very close to equivaluent.
2014-03-26 21:47:19 +00:00
Damien George
c12b2213c1 Change mp_method_t.name from const char * to qstr.
Addresses issue #377.
2014-03-26 20:15:40 +00:00
Damien George
6cfda3084d stmhal: Add I2C support; change accel driver to use new I2C. 2014-03-25 23:26:14 +00:00
Damien George
0e9d96f18f stmhal: Make Led, Servo and Accel their class, not a function. 2014-03-24 11:48:39 +00:00
Damien George
9050b2ee33 stmhal: Improved interface to accelerometer. 2014-03-23 15:34:54 +00:00
Damien George
f78d9b1a72 stmhal: Add accelerometer driver; fix bug with LFN. 2014-03-20 23:33:30 +00:00