Skip to content

Incorrect value for OUTPUT_OPEN_DRAIN in esp32-hal-gpio.h #8590

Closed
@TMSL

Description

@TMSL

Board

ESP32S3 Dev Kit C

Device Description

It appears OUTPUT_OPEN_DRAIN should be 0x13 instead of 0x12.
In ESP32-hal-gpio.h:

//GPIO FUNCTIONS
#define INPUT 0x01
// Changed OUTPUT from 0x02 to behave the same as Arduino pinMode(pin,OUTPUT)
// where you can read the state of pin even when it is set as OUTPUT
#define OUTPUT 0x03 <=== OUTPUT
#define PULLUP 0x04
#define INPUT_PULLUP 0x05
#define PULLDOWN 0x08
#define INPUT_PULLDOWN 0x09
#define OPEN_DRAIN 0x10 <=== OPEN_DRAIN
#define OUTPUT_OPEN_DRAIN 0x12 <=== should be 0x13
#define ANALOG 0xC0

Hardware Configuration

tested with pullup resistor on gpio 38

Version

v2.0.11

IDE Name

Arduino 2.2.0

Operating System

Linux Mint

Flash frequency

80 MHz

PSRAM enabled

yes

Upload speed

115200

Description

Setting "OUTPUT_OPEN_DRAIN (= 0x12)" in pinmode does not work, but using OUTPUT | OPEN_DRAIN ( = 0x13) does.

Sketch

#define OUTPIN 38
hw_timer_t *My_timer = NULL;

void IRAM_ATTR onTimer(){

digitalWrite(OUTPIN, !digitalRead(OUTPIN));
}

void setup() {

// FAILS:
pinMode(OUTPIN, OUTPUT_OPEN_DRAIN); // to get OPEN DRAIN use "OUTPUT | OPEN_DRAIN"

// create 1MHz counter by setting prescaler to 80 (ESP32 w/80MHz clock)
My_timer = timerBegin(0, 80, true);
timerAttachInterrupt(My_timer, &onTimer, true);
timerAlarmWrite(My_timer, 5, true); //1000000 counts @ 1MHz -> 1sec, 5->5usec
timerAlarmEnable(My_timer); //Enable the configured timer
}

void loop() {
}

Debug Message

none

Other Steps to Reproduce

none

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions