Просмотр исходного кода

allow IR to transmit with GPIO pin

Oliver Fabel 1 год назад
Родитель
Сommit
359b354c3b

+ 1 - 1
docs/pages/features.md

@@ -21,6 +21,7 @@ The following features are enabled and supported by the interpreter:
 * The `reversed` function.
 * The `min` and `max` function.
 * Module-level `__init__` imports.
+* The `struct` module.
 
 ## Unsupported
 
@@ -61,7 +62,6 @@ The following features are disabled and _not_ supported by the interpreter:
 * The `micropython` module.
 * The `array` module.
 * The `collections` module.
-* The `struct` module.
 * The `gc` module.
 * The `sys` module.
 * The `select` module.

+ 1 - 1
lib/micropython

@@ -1 +1 @@
-Subproject commit c564e62afd65c1e91ad61087b178a75e1a39d1f5
+Subproject commit 14eebf684d7b08142aee1388026443ffc8e94ebe

+ 1 - 0
lib/micropython-port/mp_flipper_modflipperzero_canvas.c

@@ -1,4 +1,5 @@
 #include <gui/gui.h>
+#include <gui/elements.h>
 
 #include <mp_flipper_modflipperzero.h>
 #include <mp_flipper_runtime.h>

+ 10 - 2
lib/micropython-port/mp_flipper_modflipperzero_infrared.c

@@ -83,7 +83,8 @@ inline bool mp_flipper_infrared_transmit(
     mp_flipper_infrared_signal_tx_provider callback,
     uint32_t repeat,
     uint32_t frequency,
-    float duty) {
+    float duty,
+    bool use_external_pin) {
     if(furi_hal_infrared_is_busy() || length == 0) {
         return false;
     }
@@ -99,7 +100,10 @@ inline bool mp_flipper_infrared_transmit(
     session->repeat = repeat;
     session->size = length;
 
-    furi_hal_infrared_set_tx_output(FuriHalInfraredTxPinInternal);
+    const FuriHalInfraredTxPin output = use_external_pin ? FuriHalInfraredTxPinExtPA7 :
+                                                           FuriHalInfraredTxPinInternal;
+
+    furi_hal_infrared_set_tx_output(output);
 
     furi_hal_infrared_async_tx_set_data_isr_callback(on_tx, session);
 
@@ -109,3 +113,7 @@ inline bool mp_flipper_infrared_transmit(
 
     return true;
 }
+
+inline bool mp_flipper_infrared_is_busy() {
+    return furi_hal_infrared_is_busy();
+}