However this doesn't include support for open drain outputs at the moment (although it can do internal pullups). I've created an issue for it here: https://github.com/espruino/Espruino/issues/225
I haven't tried this, but something like it should work:
digitalWrite(A0,0); // just set into output mode
poke32(0x40010800, (peek32(0x40010800) & (~0b1100)) | 0b0100); // mask out existing bits and set open drain
A0 is easy because it's the bottom 4 bits of port A :)
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Well, you should be able to use pinMode: http://www.espruino.com/Reference#l__global_pinMode
However this doesn't include support for open drain outputs at the moment (although it can do internal pullups). I've created an issue for it here: https://github.com/espruino/Espruino/issues/225
If you want it right now, you might find it interesting to use
peek32
/poke32
to set it up by poking the STM32's peripheral registers though. It's actually pretty easy - look upGPIO registers
in the STM32F103 reference (http://www.st.com/web/en/resource/technical/document/reference_manual/CD00171190.pdf).I haven't tried this, but something like it should work:
A0 is easy because it's the bottom 4 bits of port A :)