mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-25 20:02:37 +03:00
Open-drain output mode
This commit is contained in:
parent
2d9c5d8297
commit
31a8539763
@ -40,6 +40,7 @@ void yield(void);
|
||||
#define INPUT 0x0
|
||||
#define OUTPUT 0x1
|
||||
#define INPUT_PULLUP 0x2
|
||||
#define OUTPUT_OPEN_DRAIN 0x4
|
||||
|
||||
#define PI 3.1415926535897932384626433832795
|
||||
#define HALF_PI 1.5707963267948966192313216916398
|
||||
|
@ -88,11 +88,20 @@ void pinMode(uint8_t pin, uint8_t mode)
|
||||
gpio_output_set(0, 0, 0, 1 << pin);
|
||||
PIN_PULLUP_EN(mux);
|
||||
}
|
||||
else
|
||||
else if (mode == OUPUT)
|
||||
{
|
||||
gpio_output_set(0, 0, 1 << pin, 0);
|
||||
}
|
||||
else if (mode == OUTPUT_OPEN_DRAIN)
|
||||
{
|
||||
GPIO_REG_WRITE(
|
||||
GPIO_PIN_ADDR(GPIO_ID_PIN(pin)),
|
||||
GPIO_REG_READ(GPIO_PIN_ADDR(GPIO_ID_PIN(pin))) |
|
||||
GPIO_PIN_PAD_DRIVER_SET(GPIO_PAD_DRIVER_ENABLE)
|
||||
);
|
||||
|
||||
GPIO_REG_WRITE(GPIO_ENABLE_ADDRESS, GPIO_REG_READ(GPIO_ENABLE_ADDRESS) | (1 << pin));
|
||||
}
|
||||
}
|
||||
|
||||
void digitalWrite(uint8_t pin, uint8_t val)
|
||||
|
Loading…
x
Reference in New Issue
Block a user