Wykres commitów

12 Commity (master)

Autor SHA1 Wiadomość Data
Angus Gratton decf8e6a8b all: Remove the "STATIC" macro and just use "static" instead.
The STATIC macro was introduced a very long time ago in commit
d5df6cd44a.  The original reason for this was
to have the option to define it to nothing so that all static functions
become global functions and therefore visible to certain debug tools, so
one could do function size comparison and other things.

This STATIC feature is rarely (if ever) used.  And with the use of LTO and
heavy inline optimisation, analysing the size of individual functions when
they are not static is not a good representation of the size of code when
fully optimised.

So the macro does not have much use and it's simpler to just remove it.
Then you know exactly what it's doing.  For example, newcomers don't have
to learn what the STATIC macro is and why it exists.  Reading the code is
also less "loud" with a lowercase static.

One other minor point in favour of removing it, is that it stops bugs with
`STATIC inline`, which should always be `static inline`.

Methodology for this commit was:

1) git ls-files | egrep '\.[ch]$' | \
   xargs sed -Ei "s/(^| )STATIC($| )/\1static\2/"

2) Do some manual cleanup in the diff by searching for the word STATIC in
   comments and changing those back.

3) "git-grep STATIC docs/", manually fixed those cases.

4) "rg -t python STATIC", manually fixed codegen lines that used STATIC.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-03-07 14:20:42 +11:00
Elias Wimmer 2e101a8e44 extmod/modonewire: Improve write timings for better reliability.
When using long cables for sensors on onewire e.g. ds18b20, the current
default timings are too optimistic, leading to bus failures and CRC errors.

Stable results are achieved with the timings given by
https://www.analog.com/en/technical-articles/1wire-communication-through-software.html
2023-12-15 17:08:09 +11:00
Patrick Van Oosterwijck 06df3b2925 extmod/modonewire: Adopt Maxim recommended read timings.
The timing of the onewire module was way too fast when reading.  This
commit adopts read timings as recommended in Maxim application note 126:
6 us (pulse) / 9 us (sample) / 55 us (bit slot).  See also:
https://www.analog.com/en/technical-articles/1wire-communication-through-software.html

Signed-off-by: Damien George <damien@micropython.org>
2023-12-15 17:04:33 +11:00
Damien George efe23aca71 all: Remove third argument to MP_REGISTER_MODULE.
It's no longer needed because this macro is now processed after
preprocessing the source code via cpp (in the qstr extraction stage), which
means unused MP_REGISTER_MODULE's are filtered out by the preprocessor.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-02 16:31:37 +10:00
Jim Mussared bb794f05b7 extmod: Make port-included extmod modules use MP_REGISTER_MODULES.
_onewire, socket, and network were previously added by the port rather
than objmodule.c.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-18 20:49:12 +10:00
Damien George d41f6dde56 extmod/modonewire: Make _onewire module configurable via macro option.
Signed-off-by: Damien George <damien@micropython.org>
2021-09-02 13:11:23 +10:00
Damien George ec0503bd0c extmod/modonewire: Use pin_od_high/pin_od_low instead of pin_write.
The pin is configured in open-drain mode so these od_high/od_low methods
should be used.

Signed-off-by: Damien George <damien@micropython.org>
2021-01-29 23:57:10 +11:00
Damien George 69661f3343 all: Reformat C and Python source code with tools/codeformat.py.
This is run with uncrustify 0.70.1, and black 19.10b0.
2020-02-28 10:33:03 +11:00
Damien George 4904663748 extmod/modonewire: Fix reset timings to match 1-wire specs.
Fixes issue #4116.
2018-10-17 15:52:07 +11:00
Paul Sokolovsky f2140f9446 extmod/mod{lwip,onewire,webrepl}: Convert to mp_rom_map_elem_t. 2017-07-29 18:24:16 +03:00
Damien George eeaab1897b extmmod/modonewire: Rename public module to mp_module_onewire.
This follows naming scheme of other modules in extmod.
2017-06-22 16:17:46 +10:00
Damien George 6cc4da4cb8 extmod: Move modonewire.c from esp8266 to extmod directory.
It's now generic enough to be used by any port.
2017-06-22 16:06:00 +10:00