Wykres commitów

11 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
Damien George b1229efbd1 all: Fix spelling mistakes based on codespell check.
Signed-off-by: Damien George <damien@micropython.org>
2023-04-27 18:03:06 +10:00
Trammell hudson 96a2cc5e13 esp8266/machine_pwm: Enable real open drain output on pin driven by PWM.
The PWM module now detects if the pin is open drain and if so switches it
to hardware open drain before starting the PWM.

The code that was explicitly turning off the open drain output during PWM
is also removed.

Together these changes allow driving external transistor high-current
switches with PWM.

Signed-off-by: Trammell hudson <hudson@trmm.net>
2022-11-15 12:51:32 +11:00
Damien George 5b700b0af9 all: Reformat remaining C code that doesn't have a space after a comma.
Signed-off-by: Damien George <damien@micropython.org>
2022-05-05 13:30:40 +10:00
Olivier Ortigues e32302c1a6 esp8266/esppwm: Fix PWM glitch when setting duty on different channel.
The PWM driver uses a double buffer for the PWM timing array, one in
current use and the other one to update when changing duty parameters.
The issue was that once the duty parameters were changed the updated buffer
was applied immediately without synchronising to the start of the PWM
period.  By moving the buffer toggling/swapping to the interrupt when the
cycle is done there are no more glitches.
2020-05-27 16:15:28 +10:00
stijn 84fa3312cf all: Format code to add space after C++-style comment start.
Note: the uncrustify configuration is explicitly set to 'add' instead of
'force' in order not to alter the comments which use extra spaces after //
as a means of indenting text for clarity.
2020-04-23 11:24:25 +10:00
Damien George feb2577585 all: Remove spaces between nested paren and inside function arg paren.
Using new options enabled in the uncrustify configuration.
2020-03-25 00:39:46 +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
Olivier Ortigues b691aa0aae esp8266/esppwm: Always start timer to avoid glitch from full to nonfull.
The PWM at full value was not considered as an "active" channel so if no
other channel was used the timer used to mange PWM was not started.  So
when another duty value was set the PWM timer restarted and there was a
visible glitch when driving LEDs.  Such a glitch can be seen with the
following code (assuming active-low LED on pin 0):

    p = machine.PWM(machine.Pin(0))
    p.duty(1023) # full width, LED is off
    p.duty(1022) # LED flashes brightly then goes dim

This patch fixes the glitch.
2018-03-05 11:39:44 +11:00
Olivier Ortigues 5c83d05b49 esp8266/esppwm: Clip negative duty numbers to 0.
Prior to this patch a negative duty would lead to full PWM.
2018-02-15 11:12:41 +11:00
Damien George 01dd7804b8 ports: Make new ports/ sub-directory and move all ports there.
This is to keep the top-level directory clean, to make it clear what is
core and what is a port, and to allow the repository to grow with new ports
in a sustainable way.
2017-09-06 13:40:51 +10:00