Skip to content

Commit caa8e1c

Browse files
docs: fix missing pin methods and improve docs
- fix missing space in directive that caused methods to be omitted. - recast the get_mode() return values as their Python values rather than C names which aren't defined in Python. - remove duplicate class definition for MicroBitAnalogDigitalPin.
1 parent f3908e2 commit caa8e1c

File tree

1 file changed

+9
-19
lines changed

1 file changed

+9
-19
lines changed

docs/pin.rst

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -144,28 +144,27 @@ its own to that.
144144
145145
Set the pin to high if ``value`` is 1, or to low, if it is 0.
146146

147-
.. py:method::set_pull(value)
147+
.. py:method:: set_pull(value)
148148
149149
Set the pull state to one of three possible values: ``pin.PULL_UP``,
150150
``pin.PULL_DOWN`` or ``pin.NO_PULL`` (where ``pin`` is an instance of
151151
a pin). See below for discussion of default pull states.
152152

153-
154-
.. py:method::get_pull()
153+
.. py:method:: get_pull()
155154
156155
Returns the pull configuration on a pin, which can be one of three
157156
possible values: ``NO_PULL``, ``PULL_DOWN``, or ``PULL_UP``. These
158157
are set using the ``set_pull()`` method or automatically configured
159158
when a pin mode requires it.
160159

161-
.. py:method::get_mode()
160+
.. py:method:: get_mode()
162161
163-
Returns the pin mode. When a pin is used for a specific function, like
164-
writing a digital value, or reading an analog value, the pin mode
165-
changes. Pins can have one of the following modes: ``MODE_UNUSED``,
166-
``MODE_WRITE_ANALOG``, ``MODE_READ_DIGITAL``, ``MODE_WRITE_DIGITAL``,
167-
``MODE_DISPLAY``, ``MODE_BUTTON``, ``MODE_MUSIC``, ``MODE_AUDIO_PLAY``,
168-
``MODE_TOUCH``, ``MODE_I2C``, ``MODE_SPI``.
162+
Returns the pin mode. When a pin is used for a specific function, like
163+
writing a digital value, or reading an analog value, the pin mode
164+
changes. Pins can have one of the following modes: ``"unused"``,
165+
``"analog"``, ``"read_digital"``, ``"write_digital"``,
166+
``"display"``, ``"button"``, ``"music"``, ``"audio"``,
167+
``"touch"``, ``"i2c"``, ``"spi"``.
169168

170169

171170
.. py:class:: MicroBitAnalogDigitalPin
@@ -175,7 +174,6 @@ its own to that.
175174
Read the voltage applied to the pin, and return it as an integer
176175
between 0 (meaning 0V) and 1023 (meaning 3.3V).
177176

178-
179177
.. py:method:: write_analog(value)
180178
181179
Output a PWM signal on the pin, with the duty cycle proportional to
@@ -193,14 +191,6 @@ its own to that.
193191
microseconds. The minimum valid value is 256µs.
194192

195193

196-
.. py:class:: MicroBitAnalogDigitalPin
197-
198-
.. py:method:: read_analog()
199-
200-
Read the voltage applied to the pin, and return it as an integer
201-
between 0 (meaning 0V) and 1023 (meaning 3.3V).
202-
203-
204194
.. py:class:: MicroBitTouchPin
205195
206196
.. py:method:: is_touched()

0 commit comments

Comments
 (0)