ArduinoCore-API icon indicating copy to clipboard operation
ArduinoCore-API copied to clipboard

add pin open-drian and push-pull mode

Open Pillar1989 opened this issue 6 years ago • 4 comments

https://github.com/arduino/ArduinoCore-API/blob/e1eb8de126786b7701b211332dda3f09aa400f35/api/Common.h#L18-L23

typedef enum {
  INPUT           = 0x0,
  OUTPUT          = 0x1,
  INPUT_PULLUP    = 0x2,
  INPUT_PULLDOWN  = 0x3,
  OUPUT_PUSHPULL  = 0x4,
  OUPUT_OPENDRAIN  = 0x5,
} PinMode;

Pillar1989 avatar Jul 01 '19 02:07 Pillar1989

What does OUPUT_PUSHPULL mean? How is it different from regular OUTPUT?

PaulStoffregen avatar Jul 01 '19 03:07 PaulStoffregen

https://en.wikipedia.org/wiki/Push%E2%80%93pull_output

It seems that the basic circuit knowledge of this kind of chip still needs to be popularized.

Pillar1989 avatar Jul 01 '19 04:07 Pillar1989

Maybe you didn't understand my question. The normal OUTPUT name Arduino has supported since its earliest days has represented the normal push-pull output circuitry.

So the question is why do we need the name OUPUT_PUSHPULL which represents the exact same thing?

PaulStoffregen avatar Jul 01 '19 10:07 PaulStoffregen

@PaulStoffregen You are right. I am really sloppy on this issue. Is the definition below better?

typedef enum {
  INPUT           = 0x0,
  OUTPUT          = 0x1,
  OUTPUT_PUSHPULL = 0x1,
  INPUT_PULLUP    = 0x2,
  INPUT_PULLDOWN  = 0x3,
  OUPUT_OPENDRAIN  = 0x4,
} PinMode;

Pillar1989 avatar Jul 02 '19 06:07 Pillar1989