summaryrefslogtreecommitdiff
path: root/ports/esp8266/modmachine.h
diff options
context:
space:
mode:
authorTrammell hudson <hudson@trmm.net>2020-02-25 22:53:46 +0100
committerDamien George <damien@micropython.org>2022-11-15 12:51:32 +1100
commit96a2cc5e13113338c3e4b12a145a852819b623cf (patch)
tree67410dbf397910024ec50a141887e93e9cbbbb3c /ports/esp8266/modmachine.h
parent5228f4067da028f0663e1ec2ceda139e07865b9d (diff)
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>
Diffstat (limited to 'ports/esp8266/modmachine.h')
-rw-r--r--ports/esp8266/modmachine.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/ports/esp8266/modmachine.h b/ports/esp8266/modmachine.h
index 4a73d3b8e..9b7a5e3cb 100644
--- a/ports/esp8266/modmachine.h
+++ b/ports/esp8266/modmachine.h
@@ -21,6 +21,16 @@ typedef struct _pyb_pin_obj_t {
const pyb_pin_obj_t pyb_pin_obj[16 + 1];
+#define GPIO_MODE_INPUT (0)
+#define GPIO_MODE_OUTPUT (1)
+#define GPIO_MODE_OPEN_DRAIN (2) // synthesised
+#define GPIO_PULL_NONE (0)
+#define GPIO_PULL_UP (1)
+// Removed in SDK 1.1.0
+// #define GPIO_PULL_DOWN (2)
+
+extern uint8_t pin_mode[16 + 1];
+
void pin_init0(void);
uint mp_obj_get_pin(mp_obj_t pin_in);