Esp8266 port

Posted on
  • I'm looking at the OneWire code and it sets the one-wire pin to open-drain, outputs some pulses and then does a jshPinGetValue without setting the pin to input. That's surprising... It seems like jshPinGetValue is expected to detect that the pin is not input mode and then switch it? Is it supposed to switch the pin back to the output mode it was in or leave it in input mode?
    Is jshPinSetValue supposed to do the same and switch to output if the pin isn't?

  • Most MPUs have kind of an 'outo-pin-mode': for no - and obviously some particular pin mode - settings, writing (a particular value) to a pin makes it an output, and reading from it makes it an input... It can be confusing at some times, but smartly applied, it reduces the amount of code and circuitry... It all depends how the output/input pin hareware registers are set and configured and are wired. The setup allows to have have them independent.

    With open-drain is like bipolar open-collector: only hight / logical 1 matters from a driving / output point of view, and low / logical 0 behaves like tri-state. Said so, the input is driven be the outside and can be either high / logical 1 or low / logical 0. If the pin line is connected to a bus like line and is 'terminated' - pulled in either direction - with a 'weak resistor', it works quite neat for the one-wire setup.

  • To resolve the jshPinGetValue issue: it makes sense to read the pin when it's in open-drain mode without changing its mode and it works correctly on the esp8266, the issue I encountered was a different one.

  • jshPinGetValue definitely shouldn't change state (same for SetValue). There are some specific functions for that (jshSetPinOutput iirc?) but they're in jspin.c as there's nothing platform dependent in them.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Esp8266 port

Posted by Avatar for tve @tve

Actions