MX hace 1 año
padre
commit
9ac162777f
Se han modificado 46 ficheros con 1009 adiciones y 806 borrados
  1. 8 1
      CHANGELOG.md
  2. 4 4
      application.fam
  3. 30 36
      docs/pages/conf.py
  4. 17 1
      docs/pages/reference.rst
  5. 4 3
      docs/pages/roadmap.md
  6. 5 5
      examples/dict_test.py
  7. 11 11
      examples/flipperzero_adc_test.py
  8. 19 15
      examples/flipperzero_canvas_test.py
  9. 5 5
      examples/flipperzero_dialog_message_test.py
  10. 10 6
      examples/flipperzero_draw_on_input_test.py
  11. 7 5
      examples/flipperzero_gpio_input_test.py
  12. 19 7
      examples/flipperzero_gpio_interrupt_test.py
  13. 5 3
      examples/flipperzero_input_test.py
  14. 7 7
      examples/flipperzero_light_test.py
  15. 9 7
      examples/flipperzero_speaker_note_test.py
  16. 9 7
      examples/flipperzero_speaker_test.py
  17. 8 7
      examples/greeter_test.py
  18. 1 1
      examples/import_error_test.py
  19. 1 1
      examples/import_test.py
  20. 56 53
      examples/infrared_signal_viewer.py
  21. 5 5
      examples/logger.py
  22. 3 3
      examples/open.py
  23. 1 1
      examples/overflow_test.py
  24. 1 1
      examples/raise_test.py
  25. 3 3
      examples/rand_test.py
  26. 60 55
      examples/tic_tac_toe.py
  27. 2 2
      examples/try_except_test.py
  28. 9 7
      examples/uart.py
  29. 7 6
      flipperzero/_adc.py
  30. 61 45
      flipperzero/_canvas.py
  31. 11 8
      flipperzero/_dialog.py
  32. 62 57
      flipperzero/_gpio.py
  33. 20 11
      flipperzero/_infrared.py
  34. 26 25
      flipperzero/_input.py
  35. 24 20
      flipperzero/_light.py
  36. 11 9
      flipperzero/_pwm.py
  37. 224 223
      flipperzero/_speaker.py
  38. 33 31
      flipperzero/_uart.py
  39. 2 2
      flipperzero/_vibro.py
  40. 77 74
      flipperzero/io.py
  41. 38 30
      flipperzero/logging.py
  42. 87 0
      flipperzero/random.py
  43. 1 1
      lib/micropython/genhdr/mpversion.h
  44. 4 0
      lib/micropython/genhdr/qstrdefs.generated.h
  45. 1 1
      lib/micropython/mpconfigport.h
  46. 1 1
      pyproject.toml

+ 8 - 1
CHANGELOG.md

@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ## [Unreleased]
 
+## [1.6.0] - 2024-11-17
+
+### Added
+
+* Enabled extra functions for the `random` module.
+
 ## [1.5.0] - 2024-10-06
 
 ### Added
@@ -156,7 +162,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 * Basic build setup
 * Minimal working example
 
-[Unreleased]: https://github.com/ofabel/mp-flipper/compare/v1.5.0...dev
+[Unreleased]: https://github.com/ofabel/mp-flipper/compare/v1.6.0...dev
+[1.6.0]: https://github.com/ofabel/mp-flipper/compare/v1.5.0...v1.6.0
 [1.5.0]: https://github.com/ofabel/mp-flipper/compare/v1.4.0...v1.5.0
 [1.4.0]: https://github.com/ofabel/mp-flipper/compare/v1.3.0...v1.4.0
 [1.3.0]: https://github.com/ofabel/mp-flipper/compare/v1.2.0...v1.3.0

+ 4 - 4
application.fam

@@ -5,7 +5,7 @@ App(
     entry_point="upython",
     stack_size=4 * 1024,
     fap_category="Tools",
-    fap_version="1.5",
+    fap_version="1.6",
     fap_description="Compile and execute MicroPython scripts",
     fap_icon="icon.png",
     fap_icon_assets="images",
@@ -40,7 +40,7 @@ App(
                 "-fsingle-precision-constant",
                 "-fno-math-errno",
             ],
-            cincludes=["."]
+            cincludes=["."],
         ),
         Lib(
             name="micropython-port",
@@ -57,7 +57,7 @@ App(
                 "-fsingle-precision-constant",
                 "-fno-math-errno",
             ],
-            cincludes=["."]
+            cincludes=["."],
         ),
-    ]
+    ],
 )

+ 30 - 36
docs/pages/conf.py

@@ -4,15 +4,17 @@ import sys
 
 base = pathlib.Path(__file__).parent.parent.parent
 root = base.__str__()
-flipperzero = base.joinpath('flipperzero').__str__()
+flipperzero = base.joinpath("flipperzero").__str__()
 
 sys.path.append(root)
 sys.path.append(flipperzero)
 
+
 def copy_dict(source, target):
     for key, value in source.__dict__.items():
         target.__dict__[key] = value
 
+
 import flipperzero.logging
 import logging
 
@@ -23,54 +25,46 @@ import io
 
 copy_dict(flipperzero.io, io)
 
+import flipperzero.random
+import random
+
+copy_dict(flipperzero.random, random)
+
 now = datetime.datetime.now()
 
-project = 'uPython'
-copyright = str(now.year) + ', Oliver Fabel'
-author = 'Oliver Fabel'
-release = '1.5.0'
-version = '1.5'
-language = 'en'
-
-extensions = [
-    'sphinx.ext.autodoc',
-    'myst_parser'
-]
-source_suffix = {
-    '.rst': 'restructuredtext',
-    '.md': 'markdown'
-}
+project = "uPython"
+copyright = str(now.year) + ", Oliver Fabel"
+author = "Oliver Fabel"
+release = "1.5.0"
+version = "1.5"
+language = "en"
+
+extensions = ["sphinx.ext.autodoc", "myst_parser"]
+source_suffix = {".rst": "restructuredtext", ".md": "markdown"}
 
-templates_path = [
-    'templates'
-]
+templates_path = ["templates"]
 exclude_patterns = []
-include_patterns = [
-    '**'
-]
+include_patterns = ["**"]
 
-html_theme = 'alabaster'
+html_theme = "alabaster"
 html_theme_options = {
-    'show_powered_by': False,
-    'extra_nav_links': {
-        'Source Code': 'https://www.github.com/ofabel/mp-flipper',
-        'Bugtracker': 'https://www.github.com/ofabel/mp-flipper/issues',
-        'Releases': 'https://lab.flipper.net/apps/upython'
-
-    }
+    "show_powered_by": False,
+    "extra_nav_links": {
+        "Source Code": "https://www.github.com/ofabel/mp-flipper",
+        "Bugtracker": "https://www.github.com/ofabel/mp-flipper/issues",
+        "Releases": "https://lab.flipper.net/apps/upython",
+    },
 }
 html_scaled_image_link = False
 html_copy_source = False
 html_show_copyright = False
 html_show_sphinx = False
-html_static_path = [
-    'static'
-]
-html_logo = 'assets/logo.png'
-html_favicon = 'assets/favicon.png'
+html_static_path = ["static"]
+html_logo = "assets/logo.png"
+html_favicon = "assets/favicon.png"
 
 autodoc_default_options = {
-    'member-order': 'bysource',
+    "member-order": "bysource",
 }
 
 add_module_names = True

+ 17 - 1
docs/pages/reference.rst

@@ -452,7 +452,7 @@ Functions
 I/O
 ---
 
-Read and write files on the SD card.
+Read and write SD card files.
 
 Constants
 ~~~~~~~~~
@@ -475,6 +475,22 @@ Classes
 .. autoclass:: io.TextFileIO
    :members: name, read, readline, readlines, readable, writable, write, flush, seek, tell, close, __enter__, __exit__, __del__
 
+Random
+------
+
+Generate pseudo-random number for various use cases. 
+
+Functions
+~~~~~~~~~
+
+.. autofunction:: random.random
+.. autofunction:: random.uniform
+.. autofunction:: random.randrange
+.. autofunction:: random.getrandbits
+.. autofunction:: random.randint
+.. autofunction:: random.choice
+.. autofunction:: random.seed
+
 Built-In
 --------
 

+ 4 - 3
docs/pages/roadmap.md

@@ -5,16 +5,17 @@ Here you can see what to expect from future releases.
 
 ## Next Release
 
-* Improved `print` function.
-* UART
+* SPI
 * I2C
 * Maybe USB HID
 
+_The next release might takes the form of a fork of the official firmware._
+_Check out [this issue](https://github.com/ofabel/mp-flipper/issues/4) for details._
+
 ## Planned
 
 * I2C
 * NFC
-* UART
 * USB HID
 * Subghz
 * Bluetooth

+ 5 - 5
examples/dict_test.py

@@ -1,9 +1,9 @@
 d = dict()
 
-for i in range(1,100):
-  d[str(i)] = i
+for i in range(1, 100):
+    d[str(i)] = i
 
-for k,v in d.items():
-  val = '{0} = {1}'.format(k, v)
+for k, v in d.items():
+    val = "{0} = {1}".format(k, v)
 
-  print(val)
+    print(val)

+ 11 - 11
examples/flipperzero_adc_test.py

@@ -3,18 +3,18 @@ import time
 
 f0.gpio_init_pin(f0.GPIO_PIN_PC1, f0.GPIO_MODE_ANALOG)
 
-for _ in range(1,1000):
-  raw_value = f0.adc_read_pin_value(f0.GPIO_PIN_PC1)
-  raw_voltage = f0.adc_read_pin_voltage(f0.GPIO_PIN_PC1)
-  
-  value = '{value} #'.format(value=raw_value)
-  voltage = '{value} mV'.format(value=raw_voltage)
+for _ in range(1, 1000):
+    raw_value = f0.adc_read_pin_value(f0.GPIO_PIN_PC1)
+    raw_voltage = f0.adc_read_pin_voltage(f0.GPIO_PIN_PC1)
 
-  f0.canvas_clear()
+    value = "{value} #".format(value=raw_value)
+    voltage = "{value} mV".format(value=raw_voltage)
 
-  f0.canvas_set_text(10, 32, value)
-  f0.canvas_set_text(70, 32, voltage)
+    f0.canvas_clear()
 
-  f0.canvas_update()
+    f0.canvas_set_text(10, 32, value)
+    f0.canvas_set_text(70, 32, voltage)
 
-  time.sleep_ms(10)
+    f0.canvas_update()
+
+    time.sleep_ms(10)

+ 19 - 15
examples/flipperzero_canvas_test.py

@@ -3,31 +3,35 @@ import flipperzero
 
 color = False
 
+
 def draw_action():
-  print('on draw')
+    print("on draw")
 
-  global color
+    global color
 
-  for x in range(0, 128):
-    color = not color
+    for x in range(0, 128):
+        color = not color
+
+        for y in range(0, 64):
+            flipperzero.canvas_set_color(
+                flipperzero.CANVAS_BLACK if color else flipperzero.CANVAS_WHITE
+            )
+            flipperzero.canvas_draw_dot(x, y)
 
-    for y in range(0, 64):
-      flipperzero.canvas_set_color(flipperzero.CANVAS_BLACK if color else flipperzero.CANVAS_WHITE)
-      flipperzero.canvas_draw_dot(x, y)
+            color = not color
+
+    color = not color
 
-      color = not color
-  
-  color = not color
+    flipperzero.canvas_set_text(64, 32, "Test")
 
-  flipperzero.canvas_set_text(64, 32, "Test")
+    flipperzero.canvas_update()
 
-  flipperzero.canvas_update()
 
-print('start')
+print("start")
 
 draw_action()
 
 for _ in range(1, 5):
-  time.sleep(1)
+    time.sleep(1)
 
-  draw_action()
+    draw_action()

+ 5 - 5
examples/flipperzero_dialog_message_test.py

@@ -1,9 +1,9 @@
 import flipperzero as f0
 
-f0.dialog_message_set_header('Important',64, 12)
-f0.dialog_message_set_text('Shutdown?', 64, 24)
-f0.dialog_message_set_button('Yes', f0.INPUT_BUTTON_LEFT)
-f0.dialog_message_set_button('No', f0.INPUT_BUTTON_RIGHT)
+f0.dialog_message_set_header("Important", 64, 12)
+f0.dialog_message_set_text("Shutdown?", 64, 24)
+f0.dialog_message_set_button("Yes", f0.INPUT_BUTTON_LEFT)
+f0.dialog_message_set_button("No", f0.INPUT_BUTTON_RIGHT)
 
 while f0.dialog_message_show() is not f0.INPUT_BUTTON_LEFT:
-  pass
+    pass

+ 10 - 6
examples/flipperzero_draw_on_input_test.py

@@ -1,12 +1,16 @@
 import time
 import flipperzero
 
+
 @flipperzero.on_input
 def on_input(button, type):
-  flipperzero.canvas_clear()
-  flipperzero.canvas_set_color(flipperzero.CANVAS_BLACK)
-  flipperzero.canvas_set_text(64, 32, '{button} - {type}'.format(button=button, type=type))
-  flipperzero.canvas_update()
+    flipperzero.canvas_clear()
+    flipperzero.canvas_set_color(flipperzero.CANVAS_BLACK)
+    flipperzero.canvas_set_text(
+        64, 32, "{button} - {type}".format(button=button, type=type)
+    )
+    flipperzero.canvas_update()
+
 
-for _ in range(1,1000):
-  time.sleep_ms(10)
+for _ in range(1, 1000):
+    time.sleep_ms(10)

+ 7 - 5
examples/flipperzero_gpio_input_test.py

@@ -2,11 +2,13 @@ import flipperzero as f0
 import time
 
 f0.gpio_init_pin(f0.GPIO_PIN_PA7, f0.GPIO_MODE_OUTPUT_PUSH_PULL)
-f0.gpio_init_pin(f0.GPIO_PIN_PC1, f0.GPIO_MODE_INPUT, f0.GPIO_PULL_UP, f0.GPIO_SPEED_HIGH)
+f0.gpio_init_pin(
+    f0.GPIO_PIN_PC1, f0.GPIO_MODE_INPUT, f0.GPIO_PULL_UP, f0.GPIO_SPEED_HIGH
+)
 
-for _ in range(0,15):
-  state = f0.gpio_get_pin(f0.GPIO_PIN_PC1)
+for _ in range(0, 15):
+    state = f0.gpio_get_pin(f0.GPIO_PIN_PC1)
 
-  f0.gpio_set_pin(f0.GPIO_PIN_PA7, state)
+    f0.gpio_set_pin(f0.GPIO_PIN_PA7, state)
 
-  time.sleep(1)
+    time.sleep(1)

+ 19 - 7
examples/flipperzero_gpio_interrupt_test.py

@@ -3,18 +3,30 @@ import time
 
 # init pins
 f0.gpio_init_pin(f0.GPIO_PIN_PA7, f0.GPIO_MODE_OUTPUT_PUSH_PULL)
-f0.gpio_init_pin(f0.GPIO_PIN_PC0, f0.GPIO_MODE_INTERRUPT_RISE, f0.GPIO_PULL_UP, f0.GPIO_SPEED_VERY_HIGH)
-f0.gpio_init_pin(f0.GPIO_PIN_PC1, f0.GPIO_MODE_INTERRUPT_RISE, f0.GPIO_PULL_UP, f0.GPIO_SPEED_VERY_HIGH)
+f0.gpio_init_pin(
+    f0.GPIO_PIN_PC0,
+    f0.GPIO_MODE_INTERRUPT_RISE,
+    f0.GPIO_PULL_UP,
+    f0.GPIO_SPEED_VERY_HIGH,
+)
+f0.gpio_init_pin(
+    f0.GPIO_PIN_PC1,
+    f0.GPIO_MODE_INTERRUPT_RISE,
+    f0.GPIO_PULL_UP,
+    f0.GPIO_SPEED_VERY_HIGH,
+)
+
 
 @f0.on_gpio
 def on_gpio(pin):
-  if pin == f0.GPIO_PIN_PC0:
-    f0.gpio_set_pin(f0.GPIO_PIN_PA7, True)
-  if pin == f0.GPIO_PIN_PC1:
-    f0.gpio_set_pin(f0.GPIO_PIN_PA7, False)
+    if pin == f0.GPIO_PIN_PC0:
+        f0.gpio_set_pin(f0.GPIO_PIN_PA7, True)
+    if pin == f0.GPIO_PIN_PC1:
+        f0.gpio_set_pin(f0.GPIO_PIN_PA7, False)
+
 
 for _ in range(1, 1500):
-  time.sleep_ms(10)
+    time.sleep_ms(10)
 
 # reset pins
 f0.gpio_init_pin(f0.GPIO_PIN_PA7, f0.GPIO_MODE_ANALOG)

+ 5 - 3
examples/flipperzero_input_test.py

@@ -1,9 +1,11 @@
 import time
 import flipperzero
 
+
 @flipperzero.on_input
 def on_input(button, type):
-  print('{button} - {type}'.format(button=button, type=type))
+    print("{button} - {type}".format(button=button, type=type))
+
 
-for _ in range(1,1000):
-  time.sleep_ms(10)
+for _ in range(1, 1000):
+    time.sleep_ms(10)

+ 7 - 7
examples/flipperzero_light_test.py

@@ -4,15 +4,15 @@ import flipperzero
 is_red = True
 
 for i in range(0, 25, 1):
-  brightness = i * 10
-  is_red = not is_red
+    brightness = i * 10
+    is_red = not is_red
 
-  flipperzero.light_set(flipperzero.LIGHT_RED, brightness if is_red else 0)
-  flipperzero.light_set(flipperzero.LIGHT_GREEN, brightness if not is_red else 0)
-  flipperzero.light_set(flipperzero.LIGHT_BLUE, 0)
-  flipperzero.light_set(flipperzero.LIGHT_BACKLIGHT, brightness)
+    flipperzero.light_set(flipperzero.LIGHT_RED, brightness if is_red else 0)
+    flipperzero.light_set(flipperzero.LIGHT_GREEN, brightness if not is_red else 0)
+    flipperzero.light_set(flipperzero.LIGHT_BLUE, 0)
+    flipperzero.light_set(flipperzero.LIGHT_BACKLIGHT, brightness)
 
-  time.sleep_ms(200)
+    time.sleep_ms(200)
 
 flipperzero.light_set(flipperzero.LIGHT_RED, 0)
 flipperzero.light_set(flipperzero.LIGHT_GREEN, 0)

+ 9 - 7
examples/flipperzero_speaker_note_test.py

@@ -1,19 +1,21 @@
 import time
 import flipperzero as f0
 
+
 def play_frequency(frequency: float):
-  volume = 0.8
+    volume = 0.8
+
+    f0.speaker_start(frequency, volume)
 
-  f0.speaker_start(frequency, volume)
+    for _ in range(0, 150):
+        volume *= 0.9945679
 
-  for _ in range(0, 150):
-    volume *= 0.9945679
+        f0.speaker_set_volume(volume)
 
-    f0.speaker_set_volume(volume)
+        time.sleep_ms(1)
 
-    time.sleep_ms(1)
+    f0.speaker_stop()
 
-  f0.speaker_stop()
 
 play_frequency(f0.SPEAKER_NOTE_C5)
 play_frequency(f0.SPEAKER_NOTE_D5)

+ 9 - 7
examples/flipperzero_speaker_test.py

@@ -1,19 +1,21 @@
 import time
 import flipperzero
 
+
 def play_frequency(frequency: float):
-  volume = 0.8
+    volume = 0.8
+
+    flipperzero.speaker_start(frequency, volume)
 
-  flipperzero.speaker_start(frequency, volume)
+    for _ in range(0, 150):
+        volume *= 0.9945679
 
-  for _ in range(0, 150):
-    volume *= 0.9945679
+        flipperzero.speaker_set_volume(volume)
 
-    flipperzero.speaker_set_volume(volume)
+        time.sleep_ms(1)
 
-    time.sleep_ms(1)
+    flipperzero.speaker_stop()
 
-  flipperzero.speaker_stop()
 
 play_frequency(100.0)
 play_frequency(200.0)

+ 8 - 7
examples/greeter_test.py

@@ -1,13 +1,14 @@
 class Greeter:
-  def __init__(self, name: str):
-    self._name = name
+    def __init__(self, name: str):
+        self._name = name
 
-  def __str__(self):
-    return 'hello {name}!'.format(name=self._name)
+    def __str__(self):
+        return "hello {name}!".format(name=self._name)
 
-  def __repr__(self):
-    return self.__str__()
+    def __repr__(self):
+        return self.__str__()
 
-world_greeter = Greeter('world')
+
+world_greeter = Greeter("world")
 
 print(world_greeter)

+ 1 - 1
examples/import_error_test.py

@@ -1 +1 @@
-import unknown_module
+import unknown_module

+ 1 - 1
examples/import_test.py

@@ -1,5 +1,5 @@
 from greeter_test import Greeter
 
-buddy = Greeter('buddy')
+buddy = Greeter("buddy")
 
 print(buddy)

+ 56 - 53
examples/infrared_signal_viewer.py

@@ -5,90 +5,93 @@ terminate = False
 index = 0
 signal = []
 
+
 def draw_signal():
-  global index
-  global signal
+    global index
+    global signal
+
+    f0.canvas_clear()
 
-  f0.canvas_clear()
+    level = False if index % 2 else True
+    x = 0
+    y_low = 32
+    y_high = 40
+    y_level = y_low
 
-  level = False if index % 2 else True
-  x = 0
-  y_low = 32
-  y_high = 40
-  y_level = y_low
+    for i in range(100):
+        i += index
 
-  for i in range(100):
-    i += index
+        if i > len(signal):
+            break
 
-    if i > len(signal):
-      break
+        duration = int(signal[i] / 100)
 
-    duration = int(signal[i] / 100)
+        if level:
+            f0.canvas_draw_line(x, y_low, x, y_high)
+            y_level = y_high
+        else:
+            f0.canvas_draw_line(x, y_high, x, y_low)
+            y_level = y_low
 
-    if level:
-      f0.canvas_draw_line(x, y_low, x, y_high)
-      y_level = y_high
-    else:
-      f0.canvas_draw_line(x, y_high, x, y_low)
-      y_level = y_low
+        f0.canvas_draw_line(x, y_level, x + duration, y_level)
 
-    f0.canvas_draw_line(x, y_level, x + duration, y_level)
+        x += duration
 
-    x += duration
+        level = not level
 
-    level = not level
+        if x > f0.canvas_width():
+            break
 
-    if x > f0.canvas_width():
-      break
+    f0.canvas_update()
 
-  f0.canvas_update()
 
 @f0.on_input
 def on_input(button, type):
-  global terminate
-  global index
-  global signal
+    global terminate
+    global index
+    global signal
 
-  # terminate upon back button press
-  if button == f0.INPUT_BUTTON_BACK and type == f0.INPUT_TYPE_SHORT:
-    terminate = True
+    # terminate upon back button press
+    if button == f0.INPUT_BUTTON_BACK and type == f0.INPUT_TYPE_SHORT:
+        terminate = True
 
-    return
-  
-  # transmit signal upon ok button
-  if button == f0.INPUT_BUTTON_OK and type == f0.INPUT_TYPE_SHORT and len(signal) > 0:
-    f0.infrared_transmit(signal)
+        return
 
-    return
+    # transmit signal upon ok button
+    if button == f0.INPUT_BUTTON_OK and type == f0.INPUT_TYPE_SHORT and len(signal) > 0:
+        f0.infrared_transmit(signal)
 
-  # scroll left upon button left
-  if button == f0.INPUT_BUTTON_LEFT and type == f0.INPUT_TYPE_SHORT:
-    index -= 1 if index > 0 else 0
+        return
 
-    draw_signal()
+    # scroll left upon button left
+    if button == f0.INPUT_BUTTON_LEFT and type == f0.INPUT_TYPE_SHORT:
+        index -= 1 if index > 0 else 0
 
-    return
-  
-  # scroll right upon button left
-  if button == f0.INPUT_BUTTON_RIGHT and type == f0.INPUT_TYPE_SHORT:
-    index += 1
-    index %= len(signal)
+        draw_signal()
 
-    draw_signal()
+        return
 
-    return
+    # scroll right upon button left
+    if button == f0.INPUT_BUTTON_RIGHT and type == f0.INPUT_TYPE_SHORT:
+        index += 1
+        index %= len(signal)
 
-f0.canvas_set_text(10, 32, 'Waiting for IR signal ...')
+        draw_signal()
+
+        return
+
+
+f0.canvas_set_text(10, 32, "Waiting for IR signal ...")
 f0.canvas_update()
 
 # receive signal
 signal = f0.infrared_receive()
 
 if len(signal):
-  draw_signal()
+    draw_signal()
 else:
-  terminate = True
+    terminate = True
 
 # wait upon termination
 while not terminate:
-  time.sleep_ms(1)
+    time.sleep_ms(1)

+ 5 - 5
examples/logger.py

@@ -2,11 +2,11 @@ import logging
 
 logging.setLevel(logging.TRACE)
 
-logging.trace('trace')
-logging.debug('debug %d %s',123,'message')
-logging.info('info %d %s',123,'message')
-logging.warn('warn %d %s',123,'message')
-logging.error('error %d %s',123,'message')
+logging.trace("trace")
+logging.debug("debug %d %s", 123, "message")
+logging.info("info %d %s", 123, "message")
+logging.warn("warn %d %s", 123, "message")
+logging.error("error %d %s", 123, "message")
 
 logging.log(logging.TRACE, "level: %d", logging.TRACE)
 logging.log(logging.DEBUG, "level: %d", logging.DEBUG)

+ 3 - 3
examples/open.py

@@ -1,5 +1,5 @@
-fp = open('/ext/spam.txt', 'w')
+fp = open("/ext/spam.txt", "w")
 
-fp.write('Some spam')
+fp.write("Some spam")
 
-fp.close()
+fp.close()

+ 1 - 1
examples/overflow_test.py

@@ -1 +1 @@
-data = list(range(0,9999))
+data = list(range(0, 9999))

+ 1 - 1
examples/raise_test.py

@@ -1 +1 @@
-raise Exception('something went wrong')
+raise Exception("something went wrong")

+ 3 - 3
examples/rand_test.py

@@ -2,6 +2,6 @@ from random import randint, seed
 
 seed(None)
 
-for limit in range(2,100):
-  value = randint(2, limit)
-  print(value)
+for limit in range(2, 100):
+    value = randint(2, limit)
+    print(value)

+ 60 - 55
examples/tic_tac_toe.py

@@ -1,12 +1,14 @@
 import time
 import flipperzero as f0
 
+
 def init_grid():
-  return [
-    [' ', ' ', ' '],
-    [' ', ' ', ' '],
-    [' ', ' ', ' '],
-  ]
+    return [
+        [" ", " ", " "],
+        [" ", " ", " "],
+        [" ", " ", " "],
+    ]
+
 
 m_exit = False
 
@@ -17,59 +19,62 @@ m_y = 1
 
 m_is_cross = True
 
+
 @f0.on_input
 def input_handler(button, type):
-  global m_exit
-  global m_grid
-  global m_x
-  global m_y
-  global m_is_cross
-
-  if button == f0.INPUT_BUTTON_BACK and type == f0.INPUT_TYPE_LONG:
-    m_exit = True
-  elif button == f0.INPUT_BUTTON_BACK and type == f0.INPUT_TYPE_SHORT:
-    m_grid = init_grid()
-  elif button == f0.INPUT_BUTTON_LEFT and type == f0.INPUT_TYPE_SHORT:
-    m_x = (m_x - 1) % 3
-  elif button == f0.INPUT_BUTTON_RIGHT and type == f0.INPUT_TYPE_SHORT:
-    m_x = (m_x + 1) % 3
-  elif button == f0.INPUT_BUTTON_UP and type == f0.INPUT_TYPE_SHORT:
-    m_y = (m_y - 1) % 3
-  elif button == f0.INPUT_BUTTON_DOWN and type == f0.INPUT_TYPE_SHORT:
-    m_y = (m_y + 1) % 3
-  elif button == f0.INPUT_BUTTON_OK and type == f0.INPUT_TYPE_SHORT:
-    m_grid[m_x][m_y] = 'X' if m_is_cross else 'O'
-    m_is_cross = not m_is_cross
+    global m_exit
+    global m_grid
+    global m_x
+    global m_y
+    global m_is_cross
+
+    if button == f0.INPUT_BUTTON_BACK and type == f0.INPUT_TYPE_LONG:
+        m_exit = True
+    elif button == f0.INPUT_BUTTON_BACK and type == f0.INPUT_TYPE_SHORT:
+        m_grid = init_grid()
+    elif button == f0.INPUT_BUTTON_LEFT and type == f0.INPUT_TYPE_SHORT:
+        m_x = (m_x - 1) % 3
+    elif button == f0.INPUT_BUTTON_RIGHT and type == f0.INPUT_TYPE_SHORT:
+        m_x = (m_x + 1) % 3
+    elif button == f0.INPUT_BUTTON_UP and type == f0.INPUT_TYPE_SHORT:
+        m_y = (m_y - 1) % 3
+    elif button == f0.INPUT_BUTTON_DOWN and type == f0.INPUT_TYPE_SHORT:
+        m_y = (m_y + 1) % 3
+    elif button == f0.INPUT_BUTTON_OK and type == f0.INPUT_TYPE_SHORT:
+        m_grid[m_x][m_y] = "X" if m_is_cross else "O"
+        m_is_cross = not m_is_cross
+
 
 def draw_grid():
-  global m_grid
-  global m_x
-  global m_y
-
-  f0.canvas_clear()
-  f0.canvas_draw_frame(2, 2, 60, 60)
-  
-  f0.canvas_draw_line(22, 2, 22, 62)
-  f0.canvas_draw_line(42, 2, 42, 62)
-  
-  f0.canvas_draw_line(2, 22, 62, 22)
-  f0.canvas_draw_line(2, 42, 62, 42)
-
-  px = m_x * 20 + 4
-  py = m_y * 20 + 4
-
-  f0.canvas_draw_frame(px, py, 16, 16)
-  
-  f0.canvas_set_text_align(f0.ALIGN_CENTER, f0.ALIGN_CENTER)
-
-  for x in range(0, 3):
-    for y in range(0, 3):
-      px = x * 20 + 10 + 2
-      py = y * 20 + 10 + 2
-      f0.canvas_set_text(px, py, m_grid[x][y])
-  
-  f0.canvas_update()
+    global m_grid
+    global m_x
+    global m_y
+
+    f0.canvas_clear()
+    f0.canvas_draw_frame(2, 2, 60, 60)
+
+    f0.canvas_draw_line(22, 2, 22, 62)
+    f0.canvas_draw_line(42, 2, 42, 62)
+
+    f0.canvas_draw_line(2, 22, 62, 22)
+    f0.canvas_draw_line(2, 42, 62, 42)
+
+    px = m_x * 20 + 4
+    py = m_y * 20 + 4
+
+    f0.canvas_draw_frame(px, py, 16, 16)
+
+    f0.canvas_set_text_align(f0.ALIGN_CENTER, f0.ALIGN_CENTER)
+
+    for x in range(0, 3):
+        for y in range(0, 3):
+            px = x * 20 + 10 + 2
+            py = y * 20 + 10 + 2
+            f0.canvas_set_text(px, py, m_grid[x][y])
+
+    f0.canvas_update()
+
 
 while not m_exit:
-  draw_grid()
-  time.sleep_ms(25)
+    draw_grid()
+    time.sleep_ms(25)

+ 2 - 2
examples/try_except_test.py

@@ -1,4 +1,4 @@
 try:
-  raise Exception('something went wrong')
+    raise Exception("something went wrong")
 except Exception as e:
-  print(e)
+    print(e)

+ 9 - 7
examples/uart.py

@@ -1,16 +1,18 @@
 import time
 import flipperzero as f0
 
+
 def read_from_uart():
-  with f0.uart_open(f0.UART_MODE_USART, 115200) as uart:
-    for _ in range(1000):
-      raw_data = uart.read()
+    with f0.uart_open(f0.UART_MODE_USART, 115200) as uart:
+        for _ in range(1000):
+            raw_data = uart.read()
+
+            if len(raw_data) > 0:
+                data = raw_data.decode()
 
-      if len(raw_data) > 0:
-        data = raw_data.decode()
+                print(data)
 
-        print(data)
+            time.sleep_ms(10)
 
-      time.sleep_ms(10)
 
 read_from_uart()

+ 7 - 6
flipperzero/_adc.py

@@ -1,29 +1,30 @@
 def adc_read_pin_value(pin: int) -> int:
-    '''
+    """
     Read the raw value from the ADC channel.
 
     :param pin: The pin to read (e.g. :const:`GPIO_PIN_PC1`).
     :returns: The raw value between 0 and 4095.
-    
+
     .. versionadded:: 1.3.0
 
     .. hint::
 
         Don't forget to initialize the pin first.
-    '''
+    """
     pass
 
+
 def adc_read_pin_voltage(pin: int) -> float:
-    '''
+    """
     Read the voltage from the ADC channel.
 
     :param pin: The pin to read (e.g. :const:`GPIO_PIN_PC1`).
     :returns: The voltage between 0 - 2.048 V with a precision of ~0.1%.
-    
+
     .. versionadded:: 1.3.0
 
     .. hint::
 
         Don't forget to initialize the pin first.
-    '''
+    """
     pass

+ 61 - 45
flipperzero/_canvas.py

@@ -1,5 +1,5 @@
 def canvas_update() -> None:
-    '''
+    """
     Updates the display buffer with your drawings from the canvas.
 
     .. versionadded:: 1.0.0
@@ -7,129 +7,139 @@ def canvas_update() -> None:
     .. note::
 
         Your drawings will only appear on the display after this function call.
-    '''
+    """
     pass
 
+
 def canvas_clear() -> None:
-    '''
+    """
     Clear the whole canvas. This does not affect the current display buffer.
     You need to call :func:`canvas_update` to reveal your changes.
 
     .. versionadded:: 1.0.0
-    '''
+    """
     pass
 
+
 def canvas_width() -> int:
-    '''
+    """
     Get the canvas width in pixels.
 
     .. versionadded:: 1.0.0
 
     :returns: The canvas width.
-    '''
+    """
     pass
 
+
 def canvas_height() -> int:
-    '''
+    """
     Get the canvas height in pixels.
 
     .. versionadded:: 1.0.0
 
     :returns: The canvas height.
-    '''
+    """
     pass
 
+
 COLOR_BLACK: int
-'''
+"""
 Constant value for the color `black`.
 
 .. versionadded:: 1.0.0
-'''
+"""
 
 COLOR_WHITE: int
-'''
+"""
 Constant value for the color `white`.
 
 .. versionadded:: 1.0.0
-'''
+"""
+
 
 def canvas_set_color(color: int) -> None:
-    '''
+    """
     Set the color to use when drawing or writing on the canvas.
 
     .. versionadded:: 1.0.0
 
     :param color: The color to use.
-    '''
+    """
     pass
 
+
 ALIGN_BEGIN: int
-'''
+"""
 Align element at `begin` (horizontal or vertical, depends on the context).
 
 .. versionadded:: 1.0.0
-'''
+"""
 
 ALIGN_END: int
-'''
+"""
 Align element at `end` (horizontal or vertical, depends on the context).
 
 .. versionadded:: 1.0.0
-'''
+"""
 
 ALIGN_CENTER: int
-'''
+"""
 Align element at `center` (horizontal or vertical, depends on the context).
 
 .. versionadded:: 1.0.0
-'''
+"""
+
 
 def canvas_set_text_align(x: int, y: int) -> None:
-    '''
-    Define how the text should be aligned in relation to the ``x`` and ``y`` coordinates 
+    """
+    Define how the text should be aligned in relation to the ``x`` and ``y`` coordinates
     when writing on the canvas, using the :func:`canvas_set_text` function.
 
     :param x: The horizontal alignment.
     :param y: The vertical alignment.
 
     .. versionadded:: 1.0.0
-    '''
+    """
     pass
 
+
 FONT_PRIMARY: int
-'''
+"""
 Constant value for the primary font.
 
 .. versionadded:: 1.0.0
-'''
+"""
 
 FONT_SECONDARY: int
-'''
+"""
 Constant value for the secondary font.
 
 .. versionadded:: 1.0.0
-'''
+"""
+
 
 def canvas_set_font(font: int) -> None:
-    '''
+    """
     Change the font to use when writing on the canvas using the :func:`canvas_set_text` function.
 
     :param font: The font to use.
 
     .. versionadded:: 1.0.0
-    '''
+    """
     pass
 
+
 def canvas_set_text(x: int, y: int, text: str) -> None:
-    '''
+    """
     Write text on the canvas at the position of ``x`` and ``y`` by using the currently active color, font and alignment settings.
-    
+
     :param x: The horizontal position.
     :param y: The vertical position.
     :param text: The text to write.
 
     .. versionadded:: 1.0.0
-    
+
     .. code-block::
 
         import flipperzero as f0
@@ -144,22 +154,24 @@ def canvas_set_text(x: int, y: int, text: str) -> None:
         * :func:`canvas_set_color` to change the canvas color.
         * :func:`canvas_set_text_align` to change the alignment settings.
         * :func:`canvas_set_font` to change the current font.
-    '''
+    """
     pass
 
+
 def canvas_draw_dot(x: int, y: int) -> None:
-    '''
+    """
     Draw a dot on the canvas by using the currently active color settings.
 
     :param x: The horizontal position.
     :param y: The vertical position.
 
     .. versionadded:: 1.0.0
-    '''
+    """
     pass
 
+
 def canvas_draw_box(x: int, y: int, w: int, h: int, r: int) -> None:
-    '''
+    """
     Draw a box on the canvas. The fill color is defined by the currently active color settings.
     Set the corner radius to zero to draw a rectangle without rounded corners.
 
@@ -170,11 +182,12 @@ def canvas_draw_box(x: int, y: int, w: int, h: int, r: int) -> None:
     :param r: The corner radius to use.
 
     .. versionadded:: 1.0.0
-    '''
+    """
     pass
 
+
 def canvas_draw_frame(x: int, y: int, w: int, h: int, r: int) -> None:
-    '''
+    """
     Draw a frame on the canvas. The border color is defined by the currently active color settings.
     Set the corner radius to zero to draw a rectangle without rounded corners.
 
@@ -185,11 +198,12 @@ def canvas_draw_frame(x: int, y: int, w: int, h: int, r: int) -> None:
     :param r: The corner radius to use.
 
     .. versionadded:: 1.0.0
-    '''
+    """
     pass
 
+
 def canvas_draw_line(x0: int, y0: int, x1: int, y1: int) -> None:
-    '''
+    """
     Draw a line on the canvas. The color is defined by the currently active color settings.
 
     :param x0: The horizontal start position.
@@ -198,11 +212,12 @@ def canvas_draw_line(x0: int, y0: int, x1: int, y1: int) -> None:
     :param y1: The vertical end sposition.
 
     .. versionadded:: 1.0.0
-    '''
+    """
     pass
 
+
 def canvas_draw_circle(x: int, y: int, r: int) -> None:
-    '''
+    """
     Draw a circle on the canvas. The border color is defined by the currently active color settings.
 
     :param x: The horizontal position.
@@ -210,11 +225,12 @@ def canvas_draw_circle(x: int, y: int, r: int) -> None:
     :param r: The radius to use.
 
     .. versionadded:: 1.0.0
-    '''
+    """
     pass
 
+
 def canvas_draw_disc(x: int, y: int, r: int) -> None:
-    '''
+    """
     Draw a disc on the canvas. The fill color is defined by the currently active color settings.
 
     :param x: The horizontal position.
@@ -222,5 +238,5 @@ def canvas_draw_disc(x: int, y: int, r: int) -> None:
     :param r: The radius to use.
 
     .. versionadded:: 1.0.0
-    '''
+    """
     pass

+ 11 - 8
flipperzero/_dialog.py

@@ -1,5 +1,5 @@
 def dialog_message_set_header(text: str, x: int, y: int, h: int, v: int) -> None:
-    '''
+    """
     Set a header text on the dialog box.
 
     :param text: The text to set.
@@ -9,11 +9,12 @@ def dialog_message_set_header(text: str, x: int, y: int, h: int, v: int) -> None
     :param v: The vertical alignment.
 
     .. versionadded:: 1.0.0
-    '''
+    """
     pass
 
+
 def dialog_message_set_text(text: str, x: int, y: int, h: int, v: int) -> None:
-    '''
+    """
     Set a text on the dialog box.
 
     :param text: The text to set.
@@ -23,22 +24,24 @@ def dialog_message_set_text(text: str, x: int, y: int, h: int, v: int) -> None:
     :param v: The vertical alignment.
 
     .. versionadded:: 1.0.0
-    '''
+    """
     pass
 
+
 def dialog_message_set_button(text: str, button: int) -> None:
-    '''
+    """
     Set the text of a dialog box button.
 
     :param text: The text to set.
     :param button: The button to use (e.g. :const:`INPUT_BUTTON_UP`).
 
     .. versionadded:: 1.0.0
-    '''
+    """
     pass
 
+
 def dialog_message_show() -> int:
-    '''
+    """
     Display the dialog box with the configured settings.
     This function is blocking.
 
@@ -57,5 +60,5 @@ def dialog_message_show() -> int:
 
         while f0.dialog_message_show() is not f0.INPUT_BUTTON_LEFT:
             pass
-    '''
+    """
     pass

+ 62 - 57
flipperzero/_gpio.py

@@ -1,67 +1,67 @@
 from typing import Callable
 
 GPIO_PIN_PC0: int
-'''
+"""
 Constant identifier for GPIO pin PC0.
 
 * This pin can be used as ADC input.
     
 .. versionadded:: 1.2.0
-'''
+"""
 
 GPIO_PIN_PC1: int
-'''
+"""
 Constant identifier for GPIO pin PC1.
 
 * This pin can be used as ADC input.
     
 .. versionadded:: 1.2.0
-'''
+"""
 
 GPIO_PIN_PC3: int
-'''
+"""
 Constant identifier for GPIO pin PC3.
 
 * This pin can be used as ADC input.
     
 .. versionadded:: 1.2.0
-'''
+"""
 
 GPIO_PIN_PB2: int
-'''
+"""
 Constant identifier for GPIO pin PB2.
     
 .. versionadded:: 1.2.0
-'''
+"""
 
 GPIO_PIN_PB3: int
-'''
+"""
 Constant identifier for GPIO pin PB3.
     
 .. versionadded:: 1.2.0
-'''
+"""
 
 GPIO_PIN_PA4: int
-'''
+"""
 Constant identifier for GPIO pin PA4.
 
 * This pin can be used as ADC input.
 * This pin can be used as PWM output.
     
 .. versionadded:: 1.2.0
-'''
+"""
 
 GPIO_PIN_PA6: int
-'''
+"""
 Constant identifier for GPIO pin PA6.
 
 * This pin can be used as ADC input.
     
 .. versionadded:: 1.2.0
-'''
+"""
 
 GPIO_PIN_PA7: int
-'''
+"""
 Constant identifier for GPIO pin PA7.
 
 * This pin can be used as ADC input.
@@ -70,101 +70,102 @@ Constant identifier for GPIO pin PA7.
 
     
 .. versionadded:: 1.2.0
-'''
+"""
 
 GPIO_MODE_INPUT: int
-'''
+"""
 Constant configuration value for the GPIO input mode.
     
 .. versionadded:: 1.2.0
-'''
+"""
 
 GPIO_MODE_OUTPUT_PUSH_PULL: int
-'''
+"""
 Constant configuration value for the GPIO output as push-pull mode.
     
 .. versionadded:: 1.2.0
-'''
+"""
 
 GPIO_MODE_OUTPUT_OPEN_DRAIN: int
-'''
+"""
 Constant configuration value for the GPIO output as open-drain mode.
     
 .. versionadded:: 1.2.0
-'''
+"""
 
 GPIO_MODE_ANALOG: int
-'''
+"""
 Constant configuration value for the GPIO analog mode.
     
 .. versionadded:: 1.2.0
-'''
+"""
 
 GPIO_MODE_INTERRUPT_RISE: int
-'''
+"""
 Constant configuration value for the GPIO interrupt on rising edges mode.
     
 .. versionadded:: 1.2.0
-'''
+"""
 
 GPIO_MODE_INTERRUPT_FALL: int
-'''
+"""
 Constant configuration value for the GPIO interrupt on falling edges mode.
     
 .. versionadded:: 1.2.0
-'''
+"""
 
 GPIO_PULL_NO: int
-'''
+"""
 Constant configuration value for the GPIO internal pull resistor disabled.
     
 .. versionadded:: 1.2.0
-'''
+"""
 
 GPIO_PULL_UP: int
-'''
+"""
 Constant configuration value for the GPIO internal pull-up resistor enabled.
     
 .. versionadded:: 1.2.0
-'''
+"""
 
 GPIO_PULL_DOWN: int
-'''
+"""
 Constant configuration value for the GPIO internal pull-down resistor enabled.
     
 .. versionadded:: 1.2.0
-'''
+"""
 
 GPIO_SPEED_LOW: int
-'''
+"""
 Constant configuration value for the GPIO in low speed.
     
 .. versionadded:: 1.2.0
-'''
+"""
 
 GPIO_SPEED_MEDIUM: int
-'''
+"""
 Constant configuration value for the GPIO in medium speed.
     
 .. versionadded:: 1.2.0
-'''
+"""
 
 GPIO_SPEED_HIGH: int
-'''
+"""
 Constant configuration value for the GPIO in high speed.
     
 .. versionadded:: 1.2.0
-'''
+"""
 
 GPIO_SPEED_VERY_HIGH: int
-'''
+"""
 Constant configuration value for the GPIO in very high speed.
     
 .. versionadded:: 1.2.0
-'''
+"""
+
 
 def gpio_init_pin(pin: int, mode: int, pull: int = None, speed: int = None) -> bool:
-    '''
+    """
     Initialize a GPIO pin.
 
     :param pin: The pin to initialize (e.g. :const:`GPIO_PIN_PA4`).
@@ -172,7 +173,7 @@ def gpio_init_pin(pin: int, mode: int, pull: int = None, speed: int = None) -> b
     :param pull: The pull resistor to use. Default is :const:`GPIO_PULL_NO`.
     :param speed: The speed to use. Default is :const:`GPIO_SPEED_LOW`.
     :returns: :const:`True` on success, :const:`False` otherwise.
-    
+
     .. versionadded:: 1.2.0
     .. versionchanged:: 1.3.0
        The return value changed from ``None`` to ``bool``.
@@ -181,55 +182,59 @@ def gpio_init_pin(pin: int, mode: int, pull: int = None, speed: int = None) -> b
 
         The interrupt modes :const:`GPIO_MODE_INTERRUPT_RISE` and :const:`GPIO_MODE_INTERRUPT_FALL` can be combined using bitwise OR.
         This allows you to handle rising `and` falling edges.
-    '''
+    """
     pass
 
+
 def gpio_deinit_pin(pin: int) -> None:
-    '''
+    """
     Deinitialize a GPIO pin.
 
     :param pin: The pin to deinitialize (e.g. :const:`GPIO_PIN_PA4`).
-    
+
     .. versionadded:: 1.3.0
 
     .. note::
 
         It's not strictly necessary to deinitialize your GPIO pins upon script termination, this is already covered by the interpreter.
-    '''
+    """
     pass
 
+
 def gpio_set_pin(pin: int, state: bool) -> None:
-    '''
+    """
     Set the state of an output pin.
 
     :param pin: The pin to set (e.g. :const:`GPIO_PIN_PA4`).
     :param state: The state to set.
-    
+
     .. versionadded:: 1.2.0
 
     .. hint::
 
         Don't forget to initialize the pin first.
-    '''
+    """
     pass
 
+
 def gpio_get_pin(pin: int) -> bool:
-    '''
+    """
     Read the state of an input pin.
 
     :param pin: The pin to read (e.g. :const:`GPIO_PIN_PA4`).
     :returns: :const:`True` if the pin is high, :const:`False` on a low signal.
-    
+
     .. versionadded:: 1.2.0
 
     .. hint::
 
         Don't forget to initialize the pin first.
-    '''
+    """
     pass
 
+
 def on_gpio() -> Callable[[int], None]:
-    '''
+    """
     Decorate a function to be used as GPIO interrupt handler. The decorated function will be invoked upon a GPIO interrupt.
 
     .. versionadded:: 1.0.0
@@ -244,9 +249,9 @@ def on_gpio() -> Callable[[int], None]:
         def interrupt_handler(pin):
             if pin == f0.GPIO_PIN_PC0:
                 ...
-    
+
     .. warning::
 
         You can only decorate one function per application.
-    '''
+    """
     pass

+ 20 - 11
flipperzero/_infrared.py

@@ -1,23 +1,31 @@
 from typing import List
 
+
 def infrared_receive(timeout: int = 1000000) -> List[int]:
-    '''
+    """
     Receive an infrared signal. This is a blocking method.
     The method blocks until a timeout occurs or the internal
     signal buffer (capacity is 1024 timings) is filled.
 
     :param timeout: The timeout to use in microseconds.
     :returns: A list of timings in microseconds, starting with high.
-    
+
     .. versionadded:: 1.3.0
-    '''
+    """
     pass
 
-def infrared_transmit(signal: List[int], repeat: int = 1, use_external_pin: bool = False, frequency: int = 38000, duty: float = 0.33) -> bool:
-    '''
+
+def infrared_transmit(
+    signal: List[int],
+    repeat: int = 1,
+    use_external_pin: bool = False,
+    frequency: int = 38000,
+    duty: float = 0.33,
+) -> bool:
+    """
     Transmit an infrared signal. This is a blocking method.
     The method blocks until the whole signal is sent.
-    The signal list has the same format as the return value 
+    The signal list has the same format as the return value
     of :func:`infrared_receive`. Hence you can directly re-send
     a received signal without any further processing.
 
@@ -27,17 +35,18 @@ def infrared_transmit(signal: List[int], repeat: int = 1, use_external_pin: bool
     :param frequency: The frequency to use for the PWM signal.
     :param duty: The duty cycle to use for the PWM signal.
     :returns: :const:`True` on success, :const:`False` otherwise.
-    
+
     .. versionadded:: 1.3.0
-    '''
+    """
     pass
 
+
 def infrared_is_busy() -> bool:
-    '''
+    """
     Check if the infrared subsystem is busy.
 
     :returns: :const:`True` if occupied, :const:`False` otherwise.
-    
+
     .. versionadded:: 1.3.0
-    '''
+    """
     pass

+ 26 - 25
flipperzero/_input.py

@@ -1,84 +1,85 @@
 from typing import Callable
 
 INPUT_BUTTON_UP: int
-'''
+"""
 Constant value for the `up` button.
 
 .. versionadded:: 1.0.0
-'''
+"""
 
 INPUT_BUTTON_DOWN: int
-'''
+"""
 Constant value for the `down` button.
 
 .. versionadded:: 1.0.0
-'''
+"""
 
 INPUT_BUTTON_RIGHT: int
-'''
+"""
 Constant value for the `right` button.
 
 .. versionadded:: 1.0.0
-'''
+"""
 
 INPUT_BUTTON_LEFT: int
-'''
+"""
 Constant value for the `left` button.
 
 .. versionadded:: 1.0.0
-'''
+"""
 
 INPUT_BUTTON_OK: int
-'''
+"""
 Constant value for the `ok` button.
 
 .. versionadded:: 1.0.0
-'''
+"""
 
 INPUT_BUTTON_BACK: int
-'''
+"""
 Constant value for the `back` button.
 
 .. versionadded:: 1.0.0
-'''
+"""
 
 INPUT_TYPE_PRESS: int
-'''
+"""
 Constant value for the `press` event of a button.
 
 .. versionadded:: 1.0.0
-'''
+"""
 
 INPUT_TYPE_RELEASE: int
-'''
+"""
 Constant value for the `release` event of a button.
 
 .. versionadded:: 1.0.0
-'''
+"""
 
 INPUT_TYPE_SHORT: int
-'''
+"""
 Constant value for the `short` press event of a button.
 
 .. versionadded:: 1.0.0
-'''
+"""
 
 INPUT_TYPE_LONG: int
-'''
+"""
 Constant value for the `long` press event of a button.
 
 .. versionadded:: 1.0.0
-'''
+"""
 
 INPUT_TYPE_REPEAT: int
-'''
+"""
 Constant value for the `repeat` press event of a button.
 
 .. versionadded:: 1.0.0
-'''
+"""
+
 
 def on_input() -> Callable[[int, int], None]:
-    '''
+    """
     Decorate a function to be used as input handler. The decorated function will be invoked upon interaction with one of the buttons on the Flipper.
 
     .. versionadded:: 1.0.0
@@ -92,9 +93,9 @@ def on_input() -> Callable[[int, int], None]:
             if button == f0.INPUT_BUTTON_BACK:
                 if type == f0.INPUT_TYPE_LONG:
                     ...
-    
+
     .. warning::
 
         You can only decorate one function per application.
-    '''
+    """
     pass

+ 24 - 20
flipperzero/_light.py

@@ -1,35 +1,36 @@
 from typing import Callable
 
 LIGHT_RED: int
-'''
+"""
 Constant value for the red LED light.
 
 .. versionadded:: 1.0.0
-'''
+"""
 
 LIGHT_GREEN: int
-'''
+"""
 Constant value for the green LED light.
 
 .. versionadded:: 1.0.0
-'''
+"""
 
 LIGHT_BLUE: int
-'''
+"""
 Constant value for the blue LED light.
 
 .. versionadded:: 1.0.0
-'''
+"""
 
 LIGHT_BACKLIGHT: int
-'''
+"""
 Constant value for the display backlight.
 
 .. versionadded:: 1.0.0
-'''
+"""
+
 
 def light_set(light: int, brightness: int) -> None:
-    '''
+    """
     Control the RGB LED on your Flipper. You can also set the brightness of multiple channels at once using bitwise operations.
     The ``brightness`` parameter accepts values from 0 (light off) to 255 (very bright).
 
@@ -39,19 +40,20 @@ def light_set(light: int, brightness: int) -> None:
     .. versionadded:: 1.0.0
 
     .. code-block::
-    
+
         import flipperzero as f0
-        
+
         f0.light_set(f0.LIGHT_RED | f0.LIGHT_GREEN, 250)
 
     .. tip::
 
         You can use  up to seven colors using `additive mixing <https://en.wikipedia.org/wiki/Additive_color>`_.
-    '''
+    """
     pass
 
+
 def light_blink_start(light: int, brightness: int, on_time: int, period: int) -> None:
-    '''
+    """
     Let the RGB LED blink. You can define the total duration of a blink period and the duration, the LED is active during a blink period.
     Hence, ``on_time`` must be smaller than ``period``. This is a non-blocking operation. The LED will continue to blink until you call :func:`light_blink_stop`.
 
@@ -63,15 +65,16 @@ def light_blink_start(light: int, brightness: int, on_time: int, period: int) ->
     .. versionadded:: 1.0.0
 
     .. code-block::
-    
+
         import flipperzero as f0
-        
+
         f0.light_blink_start(f0.LIGHT_RED, 150, 100, 200)
-    '''
+    """
     pass
 
+
 def light_blink_set_color(light: int) -> None:
-    '''
+    """
     Change the RGB LED's color while blinking. This is a non-blocking operation.
     Be aware, that you must start the blinking procedure first by using the :func:`light_blink_start` function.
     Call the :func:`light_blink_stop` function to stop the blinking LED.
@@ -79,13 +82,14 @@ def light_blink_set_color(light: int) -> None:
     :param light: The RGB channels to set.
 
     .. versionadded:: 1.0.0
-    '''
+    """
     pass
 
+
 def light_blink_stop() -> None:
-    '''
+    """
     Stop the blinking LED.
 
     .. versionadded:: 1.0.0
-    '''
+    """
     pass

+ 11 - 9
flipperzero/_pwm.py

@@ -1,37 +1,39 @@
 def pwm_start(pin: int, frequency: int, duty: int) -> bool:
-    '''
+    """
     Start or change the PWM signal on the corresponding GPIO pin.
 
     :param pin: The pin to read (e.g. :const:`GPIO_PIN_PA7`).
     :param frequency: The frequency to set in Hz.
     :param duty: The duty cycle per period in percent.
     :returns: :const:`True` on success, :const:`False` otherwise.
-    
+
     .. versionadded:: 1.3.0
 
     .. warning::
 
         You don't have to initialize the pin first.
-    '''
+    """
     pass
 
+
 def pwm_stop(pin: int) -> None:
-    '''
+    """
     Stop the PWM signal on the corresponding GPIO pin.
 
     :param pin: The pin to use (e.g. :const:`GPIO_PIN_PA7`).
-    
+
     .. versionadded:: 1.3.0
-    '''
+    """
     pass
 
+
 def pwm_is_running(pin: int) -> bool:
-    '''
+    """
     Check if the corresponding GPIO pin has a PWM signal output.
 
     :param pin: The pin to check (e.g. :const:`GPIO_PIN_PA7`).
     :returns: :const:`True` on success, :const:`False` otherwise.
-    
+
     .. versionadded:: 1.3.0
-    '''
+    """
     pass

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 224 - 223
flipperzero/_speaker.py


+ 33 - 31
flipperzero/_uart.py

@@ -1,21 +1,22 @@
 from typing import List
 
 UART_MODE_LPUART: int
-'''
+"""
 Constant value for the low power UART mode.
 
 .. versionadded:: 1.5.0
-'''
+"""
 
 UART_MODE_USART: int
-'''
+"""
 Constant value for the USART mode.
 
 .. versionadded:: 1.5.0
-'''
+"""
+
 
 class UART:
-    '''
+    """
     This represents an UART connection.
     The class has no :const:`__init__` method, use :func:`uart_open` to start an UART connection and receive an instance.
 
@@ -29,7 +30,7 @@ class UART:
 
         with f0.open(f0.UART_MODE_USART, 115200) as uart:
             lines = [line for line in uart]
-    
+
     An :class:`UART` instance can be used with a `context manager <https://docs.python.org/3/reference/datamodel.html#with-statement-context-managers>`_:
 
     .. code-block::
@@ -44,11 +45,11 @@ class UART:
         The read and write methods are non-blocking in terms of data availability.
         They don't block code execution upon data is available.
         Just an empty result will be returned.
-    '''
+    """
 
     def read(self, size: int = -1) -> bytes:
-        '''
-        Read from the connection. 
+        """
+        Read from the connection.
         The method will read up to ``size`` bytes and return them.
         If ``size`` is not specified, all available data will be returned.
         The method will return zero bytes, if no data is available.
@@ -57,11 +58,11 @@ class UART:
         :returns: Up to ``size`` bytes.
 
         .. versionadded:: 1.5.0
-        '''
+        """
         pass
 
     def readline(self, size: int = -1) -> bytes:
-        '''
+        """
         Read and return one line from the connection.
         If ``size`` is specified, at most ``size`` bytes will be read.
         The line terminator is always ``b'\\n'``.
@@ -70,22 +71,22 @@ class UART:
         :returns: Up to ``size`` bytes.
 
         .. versionadded:: 1.5.0
-        '''
+        """
         pass
 
     def readlines(self) -> List[bytes]:
-        '''
+        """
         Read and return a list of lines from the connection.
         The line terminator is always ``b'\\n'``.
 
         :returns: A list of bytes.
 
         .. versionadded:: 1.5.0
-        '''
+        """
         pass
 
     def write(self, data: bytes) -> int:
-        '''
+        """
         Write the given bytes to the connection stream.
         The number of written bytes will be returned.
         This can be less than the length of the provided data.
@@ -96,56 +97,57 @@ class UART:
         :returns: The number of bytes sent.
 
         .. versionadded:: 1.5.0
-        '''
+        """
         pass
 
     def flush(self) -> None:
-        '''
+        """
         Flush the transmission buffer to the underlying UART connection.
         This method blocks until all data is sent.
 
         .. versionadded:: 1.5.0
-        '''
+        """
         pass
 
     def close(self) -> None:
-        '''
+        """
         Close the UART connection.
 
         .. versionadded:: 1.5.0
-        '''
+        """
         pass
 
-    def __enter__(self) -> 'UART':
-        '''
+    def __enter__(self) -> "UART":
+        """
         This method is invoked, when the instance enters a runtime context.
 
         :returns: The :class:`UART` connection.
 
         .. versionadded:: 1.5.0
-        '''
+        """
         pass
 
     def __exit__(self, *args, **kwargs) -> None:
-        '''
+        """
         This method is invoked, when the instance leavs a runtime context.
         This basically calls :meth:`close` on the instance.
 
         .. versionadded:: 1.5.0
-        '''
+        """
         pass
 
     def __del__(self) -> None:
-        '''
+        """
         This method is invoked, when the garbage collector removes the object.
         This basically calls :meth:`close` on the instance.
 
         .. versionadded:: 1.5.0
-        '''
+        """
         pass
 
+
 def uart_open(mode: int, baud_rate: int) -> UART:
-    '''
+    """
     Open a connection to an UART enabled device by using the specified mode and baud rate.
 
     :param mode: The mode to use, either :const:`UART_MODE_LPUART` or :const:`UART_MODE_USART`.
@@ -155,10 +157,10 @@ def uart_open(mode: int, baud_rate: int) -> UART:
     .. versionadded:: 1.5.0
 
     .. code-block::
-    
+
         import flipperzero as f0
-        
+
         with f0.uart_open(f0.UART_MODE_USART, 115200) as uart:
             ...
-    '''
+    """
     pass

+ 2 - 2
flipperzero/_vibro.py

@@ -1,10 +1,10 @@
 def vibro_set(state: bool) -> bool:
-    '''
+    """
     Turn vibration on or off. This is a non-blocking operation. The vibration motor will continue to run until you stop it.
 
     :param state: :const:`True` to turn on vibration.
     :returns: :const:`True` if vibration is on.
 
     .. versionadded:: 1.0.0
-    '''
+    """
     pass

+ 77 - 74
flipperzero/io.py

@@ -4,57 +4,58 @@ import io
 _open = io.open
 
 SEEK_SET: int = 0
-'''
+"""
 Set the pointer position relative to the beginning of the stream.
 
 .. versionadded:: 1.5.0
-'''
+"""
 
 SEEK_CUR: int = 1
-'''
+"""
 Set the pointer position relative to the current position.
 
 .. versionadded:: 1.5.0
-'''
+"""
 
 SEEK_END: int = 2
-'''
+"""
 Set the pointer position relative to the end of the stream.
 
 .. versionadded:: 1.5.0
-'''
+"""
+
 
 class BinaryFileIO:
-    '''
+    """
     Represents a file, opened in binary mode.
 
     .. versionadded:: 1.5.0
-    '''
+    """
 
     name: str
-    '''
+    """
     The name of the file.
 
     .. versionadded:: 1.5.0
-    '''
+    """
 
     readable: bool
-    '''
+    """
     Read-only attribute, indicating if the file is readable.
     
     .. versionadded:: 1.5.0
-    '''
+    """
 
     writable: bool
-    '''
+    """
     Read-only attribute, indicating if the file is writable.
     
     .. versionadded:: 1.5.0
-    '''
+    """
 
     def read(self, size: int = -1) -> bytes:
-        '''
-        Read from the file. 
+        """
+        Read from the file.
         The method will read up to ``size`` bytes and return them.
         If ``size`` is not specified, all content up to EOF will be returned.
         If the internal pointer is already at EOF, an empty byte string ``b''`` will be returned.
@@ -63,11 +64,11 @@ class BinaryFileIO:
         :returns: Up to ``size`` bytes.
 
         .. versionadded:: 1.5.0
-        '''
+        """
         pass
 
     def readline(self, size: int = -1) -> bytes:
-        '''
+        """
         Read and return one line from the file.
         If ``size`` is specified, at most ``size`` bytes will be read.
         The line terminator is defined as ``b'\\n'``.
@@ -78,11 +79,11 @@ class BinaryFileIO:
         :returns: Up to ``size`` bytes.
 
         .. versionadded:: 1.5.0
-        '''
+        """
         pass
 
     def readlines(self) -> typing.List[bytes]:
-        '''
+        """
         Read and return a list of lines from the file.
         The line terminator is defined as ``b'\\n'``.
         The new line character is included in the return value.
@@ -91,11 +92,11 @@ class BinaryFileIO:
         :returns: A list of bytes.
 
         .. versionadded:: 1.5.0
-        '''
+        """
         pass
 
     def write(self, data: bytes) -> int:
-        '''
+        """
         Write the given bytes to the file.
         The number of written bytes will be returned.
         This can be less than the length of the provided data.
@@ -104,19 +105,19 @@ class BinaryFileIO:
         :returns: The number of bytes written.
 
         .. versionadded:: 1.5.0
-        '''
+        """
         pass
 
     def flush(self) -> None:
-        '''
+        """
         Write the contents of the file buffer to the file on the SD card.
 
         .. versionadded:: 1.5.0
-        '''
+        """
         pass
 
     def seek(self, offset: int, whence: int = SEEK_SET) -> int:
-        '''
+        """
         Set the pointer position by the given ``offset``, relative to the position indicated by ``whence``.
         The new absolute position will be returned.
 
@@ -125,86 +126,87 @@ class BinaryFileIO:
         :returns: The new absolute position.
 
         .. versionadded:: 1.5.0
-        '''
+        """
         pass
 
     def tell(self) -> int:
-        '''
+        """
         Get the current pointer position.
 
         :returns: The absolute position of the pointer.
 
         .. versionadded:: 1.5.0
-        '''
+        """
         pass
 
     def close(self) -> None:
-        '''
+        """
         Close the file handle.
 
         .. versionadded:: 1.5.0
-        '''
+        """
         pass
 
-    def __enter__(self) -> 'BinaryFileIO':
-        '''
+    def __enter__(self) -> "BinaryFileIO":
+        """
         This method is invoked, when the instance enters a runtime context.
 
         :returns: The :class:`BinaryFileIO` instance.
 
         .. versionadded:: 1.5.0
-        '''
+        """
         pass
 
     def __exit__(self, *args, **kwargs) -> None:
-        '''
+        """
         This method is invoked, when the instance leavs a runtime context.
         This basically calls :meth:`close` on the instance.
 
         .. versionadded:: 1.5.0
-        '''
+        """
         pass
 
     def __del__(self) -> None:
-        '''
+        """
         This method is invoked, when the garbage collector removes the object.
         This basically calls :meth:`close` on the instance.
 
         .. versionadded:: 1.5.0
-        '''
+        """
         pass
 
+
 class TextFileIO:
-    '''
+    """
     Represents a file, opened in text mode.
 
     .. versionadded:: 1.5.0
-    '''
+    """
 
     name: str
-    '''
+    """
     The name of the file.
 
     .. versionadded:: 1.5.0
-    '''
+    """
 
     readable: bool
-    '''
+    """
     Read-only attribute, indicating if the file is readable.
     
     .. versionadded:: 1.5.0
-    '''
+    """
 
     writable: bool
-    '''
+    """
     Read-only attribute, indicating if the file is writable.
     
     .. versionadded:: 1.5.0
-    '''
+    """
 
     def read(self, size: int = -1) -> str:
-        '''
-        Read from the file. 
+        """
+        Read from the file.
         The method will read up to ``size`` characters and return them.
         If ``size`` is not specified, all content up to EOF will be returned.
         If the internal pointer is already at EOF, an empty string will be returned.
@@ -213,11 +215,11 @@ class TextFileIO:
         :returns: Up to ``size`` characters.
 
         .. versionadded:: 1.5.0
-        '''
+        """
         pass
 
     def readline(self, size: int = -1) -> str:
-        '''
+        """
         Read and return one line from the file.
         If ``size`` is specified, at most ``size`` characters will be read.
         The line terminator is defined as ``'\\n'``.
@@ -228,11 +230,11 @@ class TextFileIO:
         :returns: Up to ``size`` characters.
 
         .. versionadded:: 1.5.0
-        '''
+        """
         pass
 
     def readlines(self) -> typing.List[str]:
-        '''
+        """
         Read and return a list of lines from the file.
         The line terminator is defined as ``'\\n'``.
         The new line character is included in the return value.
@@ -241,11 +243,11 @@ class TextFileIO:
         :returns: A list of strings.
 
         .. versionadded:: 1.5.0
-        '''
+        """
         pass
 
     def write(self, data: str) -> int:
-        '''
+        """
         Write the given string to the file.
         The number of written characters will be returned.
         This can be less than the length of the provided data.
@@ -254,19 +256,19 @@ class TextFileIO:
         :returns: The number of characters written.
 
         .. versionadded:: 1.5.0
-        '''
+        """
         pass
 
     def flush(self) -> None:
-        '''
+        """
         Write the contents of the file buffer to the file on the SD card.
 
         .. versionadded:: 1.5.0
-        '''
+        """
         pass
 
     def seek(self, offset: int, whence: int = SEEK_SET) -> int:
-        '''
+        """
         Set the pointer position by the given ``offset``, relative to the position indicated by ``whence``.
         The new absolute position will be returned.
 
@@ -275,57 +277,58 @@ class TextFileIO:
         :returns: The new absolute position.
 
         .. versionadded:: 1.5.0
-        '''
+        """
         pass
 
     def tell(self) -> int:
-        '''
+        """
         Get the current pointer position.
 
         :returns: The absolute position of the pointer.
 
         .. versionadded:: 1.5.0
-        '''
+        """
         pass
 
     def close(self) -> None:
-        '''
+        """
         Close the file handle.
 
         .. versionadded:: 1.5.0
-        '''
+        """
         pass
 
-    def __enter__(self) -> 'TextFileIO':
-        '''
+    def __enter__(self) -> "TextFileIO":
+        """
         This method is invoked, when the instance enters a runtime context.
 
         :returns: The :class:`BinaryFileIO` instance.
 
         .. versionadded:: 1.5.0
-        '''
+        """
         pass
 
     def __exit__(self, *args, **kwargs) -> None:
-        '''
+        """
         This method is invoked, when the instance leavs a runtime context.
         This basically calls :meth:`close` on the instance.
 
         .. versionadded:: 1.5.0
-        '''
+        """
         pass
 
     def __del__(self) -> None:
-        '''
+        """
         This method is invoked, when the garbage collector removes the object.
         This basically calls :meth:`close` on the instance.
 
         .. versionadded:: 1.5.0
-        '''
+        """
         pass
 
+
 def open(path: str, mode: str, *args, **kwargs) -> BinaryFileIO | TextFileIO:
-    '''
+    """
     Open a file on the file system with the specified mode.
     The file path must always be absolute, beginning with ``/ext``.
     The following modifiers are available:
@@ -343,7 +346,7 @@ def open(path: str, mode: str, *args, **kwargs) -> BinaryFileIO | TextFileIO:
         * - ``'w'``
           - Open for writing, truncating an existing file first.
         * - ``'b'``
-          - Open the file in binary mode. 
+          - Open the file in binary mode.
             The return value will be a :class:`BinaryFileIO` instance.
         * - ``'t'``
           - Open the in text mode.
@@ -353,7 +356,7 @@ def open(path: str, mode: str, *args, **kwargs) -> BinaryFileIO | TextFileIO:
           - Open for reading and writing.
             Will create the file, if it not exists.
             The pointer will be placed at the end of the file.
-    
+
     The modifiers can be combined, e.g. ``'rb+'`` would open a file for reading and writing in binary mode.
 
     :param path: The path to the file to open.
@@ -362,5 +365,5 @@ def open(path: str, mode: str, *args, **kwargs) -> BinaryFileIO | TextFileIO:
     :param kwargs: Is ignored at the moment.
 
     .. versionadded:: 1.5.0
-    '''
+    """
     return io._open(path, mode, *args, **kwargs)

+ 38 - 30
flipperzero/logging.py

@@ -1,49 +1,49 @@
 import typing
 
 TRACE: int = 6
-'''
+"""
 Constant value for the `trace` log level.
 
 .. versionadded:: 1.5.0
-'''
+"""
 
 DEBUG: int = 5
-'''
+"""
 Constant value for the `debug` log level.
 
 .. versionadded:: 1.5.0
-'''
+"""
 
 INFO: int = 4
-'''
+"""
 Constant value for the `info` log level.
 
 .. versionadded:: 1.5.0
-'''
+"""
 
 WARN: int = 3
-'''
+"""
 Constant value for the `warn` log level.
 
 .. versionadded:: 1.5.0
-'''
+"""
 
 ERROR: int = 2
-'''
+"""
 Constant value for the `error` log level.
 
 .. versionadded:: 1.5.0
-'''
+"""
 
 NONE: int = 1
-'''
+"""
 Constant value for logging disabled.
 
 .. versionadded:: 1.5.0
-'''
+"""
 
 level: int
-'''
+"""
 The threshold log level, as set by the :func:`setLevel` function.
 The initial value is set to the :const:`INFO` level.
 
@@ -52,10 +52,11 @@ The initial value is set to the :const:`INFO` level.
 .. hint::
 
     Don't change the value of this variable, use :func:`setLevel` instead.
-'''
+"""
+
 
 def setLevel(level: int) -> None:
-    '''
+    """
     Set the current log level of the application.
 
     :param level: The log level to set (e.g. :const:`INFO`).
@@ -66,21 +67,23 @@ def setLevel(level: int) -> None:
 
         This doesn't change the Flipper's effective log level settings.
         Check out the Flipper's `documentation <https://docs.flipper.net/basics/settings#d5TAt>`_ for details on this topic.
-    '''
+    """
     pass
 
+
 def getEffectiveLevel() -> int:
-    '''
+    """
     Get the effective log level from the Flipper's settings.
 
     :returns: The effective log level.
 
     .. versionadded:: 1.5.0
-    '''
+    """
     pass
 
+
 def trace(message: str, *args) -> None:
-    '''
+    """
     Log a message with level :const:`TRACE`.
     The ``message`` argument can be a format string with ``%`` placeholders.
     No % formatting operation is performed when ``args`` is empty.
@@ -97,11 +100,12 @@ def trace(message: str, *args) -> None:
         value = 42
 
         logging.trace('value is %d', value)
-    '''
+    """
     pass
 
+
 def debug(message: str, *args) -> None:
-    '''
+    """
     Log a message with level :const:`DEBUG`.
     See :func:`trace` for details on the usage.
 
@@ -109,11 +113,12 @@ def debug(message: str, *args) -> None:
     :param args: Values for the % formatting.
 
     .. versionadded:: 1.5.0
-    '''
+    """
     pass
 
+
 def info(message: str, *args) -> None:
-    '''
+    """
     Log a message with level :const:`INFO`.
     See :func:`trace` for details on the usage.
 
@@ -121,11 +126,12 @@ def info(message: str, *args) -> None:
     :param args: Values for the % formatting.
 
     .. versionadded:: 1.5.0
-    '''
+    """
     pass
 
+
 def warn(message: str, *args) -> None:
-    '''
+    """
     Log a message with level :const:`WARN`.
     See :func:`trace` for details on the usage.
 
@@ -133,11 +139,12 @@ def warn(message: str, *args) -> None:
     :param args: Values for the % formatting.
 
     .. versionadded:: 1.5.0
-    '''
+    """
     pass
 
+
 def error(message: str, *args) -> None:
-    '''
+    """
     Log a message with level :const:`ERROR`.
     See :func:`trace` for details on the usage.
 
@@ -145,11 +152,12 @@ def error(message: str, *args) -> None:
     :param args: Values for the % formatting.
 
     .. versionadded:: 1.5.0
-    '''
+    """
     pass
 
+
 def log(level: int, message: str, *args) -> None:
-    '''
+    """
     Log a message with the given log level.
     See :func:`trace` for details on the usage.
 
@@ -158,5 +166,5 @@ def log(level: int, message: str, *args) -> None:
     :param args: Values for the % formatting.
 
     .. versionadded:: 1.5.0
-    '''
+    """
     pass

+ 87 - 0
flipperzero/random.py

@@ -0,0 +1,87 @@
+def random() -> float:
+    '''
+    Get a random float value between 0.0 (inclusive) and 1.0 (exclusive).
+
+    :returns: The random value.
+
+    .. versionadded:: 1.6.0
+    '''
+    pass
+
+def randrange(start: int, stop: int, step: int = 1) -> int:
+    '''
+    Get a random integer between ``start`` (inclusive) and ``stop`` 
+    (exclusive) with an optional ``step`` between the values.
+
+    :param start: The start value.
+    :param stop: The end value.
+    :param step: The optional step value.
+    :returns: The random value.
+
+    .. versionadded:: 1.6.0
+
+    .. hint::
+
+        This function does only generate integer values.
+    '''
+    pass
+
+def randint(a: int, b: int) -> int:
+    '''
+    Get a random integer between ``a`` (inclusive) and ``b`` (inclusive).
+
+    :param a: The lower value.
+    :param b: The upper value.
+    :returns: The random value.
+
+    .. versionadded:: 1.6.0
+    '''
+    pass
+
+def choice[T](seq: list[T]) -> T:
+    '''
+    Get a random element from the provided sequence.
+
+    :param seq: The sequence to use.
+    :returns: A random element.
+
+    .. versionadded:: 1.6.0
+    '''
+    pass
+
+def getrandbits(k: int) -> int:
+    '''
+    Get ``k`` random bits. 
+
+    :param k: The number of bits.
+    :returns: The random bits.
+
+    .. versionadded:: 1.6.0
+    '''
+    pass
+
+def uniform(a: float, b: float) -> float:
+    '''
+    Get a random float value between ``a`` (inclusive) and ``b`` (inclusive).
+
+    :param a: The lower value.
+    :param b: The upper value.
+    :returns: The random value.
+
+    .. versionadded:: 1.6.0
+    '''
+    pass
+
+def seed(a: int) -> None:
+    '''
+    Initialize the random number generator. 
+
+    :param a: The initialization value to use.
+
+    .. versionadded:: 1.6.0
+
+    .. hint::
+
+        Random generator seeding is done automatically, so there is no need to call this function.
+    '''
+    pass

+ 1 - 1
lib/micropython/genhdr/mpversion.h

@@ -1,4 +1,4 @@
 // This file was generated by py/makeversionhdr.py
 #define MICROPY_GIT_TAG "v1.23.0"
 #define MICROPY_GIT_HASH "a61c446c0"
-#define MICROPY_BUILD_DATE "2024-10-06"
+#define MICROPY_BUILD_DATE "2024-11-15"

+ 4 - 0
lib/micropython/genhdr/qstrdefs.generated.h

@@ -389,6 +389,7 @@ QDEF1(MP_QSTR_canvas_text_height, 239, 18, "canvas_text_height")
 QDEF1(MP_QSTR_canvas_text_width, 86, 17, "canvas_text_width")
 QDEF1(MP_QSTR_canvas_update, 131, 13, "canvas_update")
 QDEF1(MP_QSTR_canvas_width, 180, 12, "canvas_width")
+QDEF1(MP_QSTR_choice, 46, 6, "choice")
 QDEF1(MP_QSTR_closure, 116, 7, "closure")
 QDEF1(MP_QSTR_debug, 212, 5, "debug")
 QDEF1(MP_QSTR_decode, 169, 6, "decode")
@@ -448,7 +449,9 @@ QDEF1(MP_QSTR_on_input, 141, 8, "on_input")
 QDEF1(MP_QSTR_pwm_is_running, 82, 14, "pwm_is_running")
 QDEF1(MP_QSTR_pwm_start, 240, 9, "pwm_start")
 QDEF1(MP_QSTR_pwm_stop, 200, 8, "pwm_stop")
+QDEF1(MP_QSTR_randint, 175, 7, "randint")
 QDEF1(MP_QSTR_random, 190, 6, "random")
+QDEF1(MP_QSTR_randrange, 163, 9, "randrange")
 QDEF1(MP_QSTR_rb, 213, 2, "rb")
 QDEF1(MP_QSTR_readable, 93, 8, "readable")
 QDEF1(MP_QSTR_readlines, 106, 9, "readlines")
@@ -474,6 +477,7 @@ QDEF1(MP_QSTR_time, 240, 4, "time")
 QDEF1(MP_QSTR_time_ns, 114, 7, "time_ns")
 QDEF1(MP_QSTR_trace, 164, 5, "trace")
 QDEF1(MP_QSTR_uart_open, 220, 9, "uart_open")
+QDEF1(MP_QSTR_uniform, 1, 7, "uniform")
 QDEF1(MP_QSTR_union, 246, 5, "union")
 QDEF1(MP_QSTR_vibro_set, 216, 9, "vibro_set")
 QDEF1(MP_QSTR_warn, 175, 4, "warn")

+ 1 - 1
lib/micropython/mpconfigport.h

@@ -59,7 +59,7 @@ typedef long mp_off_t;
 #define MICROPY_PY_TIME_TIME_TIME_NS (1)
 
 #define MICROPY_PY_RANDOM (1)
-#define MICROPY_PY_RANDOM_EXTRA_FUNCS (0)
+#define MICROPY_PY_RANDOM_EXTRA_FUNCS (1)
 
 #define MICROPY_PY_RANDOM_SEED_INIT_FUNC (mp_flipper_seed_init())
 

+ 1 - 1
pyproject.toml

@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
 
 [project]
 name = "flipperzero"
-version = "1.5.0"
+version = "1.6.0"
 authors = [
     { name = "Oliver Fabel" },
 ]

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio