summaryrefslogtreecommitdiff
path: root/ports/esp32s2/common-hal/pulseio/PWMOut.h
diff options
context:
space:
mode:
authorScott Shawcroft <scott@adafruit.com>2020-07-23 13:11:33 -0700
committerGitHub <noreply@github.com>2020-07-23 13:11:33 -0700
commit6a46fd5b91d92609cf33eb93f1c4e24632451d25 (patch)
tree8739fcff562b2e776e273e2136ec768424c64de9 /ports/esp32s2/common-hal/pulseio/PWMOut.h
parentbca89c260f578edce6b66a699ff22e0e28d8293f (diff)
parentcf0a4d208e71260b6f2796ba4f1f0edc36f2dc04 (diff)
Merge pull request #3185 from hierophect/esp32-pulseio
ESP32-S2: PWMOut
Diffstat (limited to 'ports/esp32s2/common-hal/pulseio/PWMOut.h')
-rw-r--r--ports/esp32s2/common-hal/pulseio/PWMOut.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/ports/esp32s2/common-hal/pulseio/PWMOut.h b/ports/esp32s2/common-hal/pulseio/PWMOut.h
new file mode 100644
index 000000000..90a0c3ed9
--- /dev/null
+++ b/ports/esp32s2/common-hal/pulseio/PWMOut.h
@@ -0,0 +1,45 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 Lucian Copeland for Adafruit Industries
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_PULSEIO_PWMOUT_H
+#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_PULSEIO_PWMOUT_H
+
+#include "common-hal/microcontroller/Pin.h"
+#include "driver/ledc.h"
+
+typedef struct {
+ mp_obj_base_t base;
+ ledc_timer_config_t tim_handle;
+ ledc_channel_config_t chan_handle;
+ uint16_t pin_number;
+ uint8_t duty_resolution;
+ bool variable_frequency: 1;
+ bool deinited: 1;
+} pulseio_pwmout_obj_t;
+
+void pwmout_reset(void);
+
+#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_PULSEIO_PWMOUT_H