summaryrefslogtreecommitdiff
path: root/docs/wipy/quickref.rst
diff options
context:
space:
mode:
authorDaniel Campora <daniel@wipy.io>2015-07-28 23:03:53 +0200
committerDaniel Campora <daniel@wipy.io>2015-07-30 00:43:08 +0200
commit007878781c74e0e4213759d8ee07ee81b5342f5c (patch)
treefb4ee36746826043ce18993b488ac42b370f5cfa /docs/wipy/quickref.rst
parentcfc4c338015cb65a35228706c44485dd57ec238e (diff)
cc3200: Rename pins from GPIO to just GP.
This is how the names will be printed on the sticker that goes on top of the EMI shield. The shorter names also help saving a few bytes of RAM and ROM.
Diffstat (limited to 'docs/wipy/quickref.rst')
-rw-r--r--docs/wipy/quickref.rst34
1 files changed, 17 insertions, 17 deletions
diff --git a/docs/wipy/quickref.rst b/docs/wipy/quickref.rst
index a8e0bdc98..34517d273 100644
--- a/docs/wipy/quickref.rst
+++ b/docs/wipy/quickref.rst
@@ -27,14 +27,14 @@ See :ref:`pyb.Pin <pyb.Pin>`. ::
from pyb import Pin
- # initialize GPIO2 in gpio mode (af=0) and make it an output
- p_out = Pin('GPIO2', af=0, mode=Pin.OUT)
+ # initialize GP2 in gpio mode (af=0) and make it an output
+ p_out = Pin('GP2', af=0, mode=Pin.OUT)
p_out.high()
p_out.low()
p_out.toggle()
- # make GPIO1 an input with the pull-up enabled
- p_in = Pin('GPIO1', af = 0, mode=Pin.IN, type = Pin.STD_PU)
+ # make GP1 an input with the pull-up enabled
+ p_in = Pin('GP1', af = 0, mode=Pin.IN, type = Pin.STD_PU)
p_in.value() # get value, 0 or 1
Timers
@@ -50,7 +50,7 @@ See :ref:`pyb.Timer <pyb.Timer>` and :ref:`pyb.Pin <pyb.Pin>`. ::
tim_a.time() # get the value in microseconds
tim_a.freq(1) # 1 Hz
- p_out = Pin('GPIO2', af=0, mode=Pin.OUT)
+ p_out = Pin('GP2', af=0, mode=Pin.OUT)
tim_a.callback(handler=lambda t: p_out.toggle())
PWM (pulse width modulation)
@@ -61,8 +61,8 @@ See :ref:`pyb.Pin <pyb.Pin>` and :ref:`pyb.Timer <pyb.Timer>`. ::
from pyb import Timer
from pyb import Pin
- # assign GPIO25 to alternate function 5 (PWM)
- p_out = Pin('GPIO25', af=9, type=Pin.STD)
+ # assign GP25 to alternate function 5 (PWM)
+ p_out = Pin('GP25', af=9, type=Pin.STD)
# timer 2 in PWM mode and width must be 16 buts
tim = Timer(2, mode=Timer.PWM, width=16)
@@ -88,8 +88,8 @@ See :ref:`pyb.Pin <pyb.Pin>` and :ref:`pyb.UART <pyb.UART>`. ::
from pyb import Pin, UART
# first assign TX and RX to the correct pins
- Pin('GPIO1', af=3, mode=Pin.STD_PU) # TX
- Pin('GPIO2', af=3, mode=Pin.STD_PU) # RX
+ Pin('GP1', af=3, mode=Pin.STD_PU) # TX
+ Pin('GP2', af=3, mode=Pin.STD_PU) # RX
uart = UART(1, 9600)
uart.write('hello')
@@ -103,10 +103,10 @@ See :ref:`pyb.Pin <pyb.Pin>` and :ref:`pyb.SPI <pyb.SPI>`. ::
from pyb import Pin, SPI
# first assign CLK, MISO, MOSI, CS to the correct pins
- Pin('GPIO14', af=7, mode=Pin.STD) # CLK
- Pin('GPIO15', af=7, mode=Pin.STD) # MISO
- Pin('GPIO16', af=7, mode=Pin.STD) # MOSI
- Pin('GPIO17', af=7, mode=Pin.STD) # NSS/CS
+ Pin('GP14', af=7, mode=Pin.STD) # CLK
+ Pin('GP15', af=7, mode=Pin.STD) # MISO
+ Pin('GP16', af=7, mode=Pin.STD) # MOSI
+ Pin('GP17', af=7, mode=Pin.STD) # NSS/CS
# configure the SPI master @ 2MHz
spi = SPI(1, SPI.MASTER, baudrate=200000, polarity=0, phase=0)
@@ -122,8 +122,8 @@ See :ref:`pyb.Pin <pyb.Pin>` and :ref:`pyb.I2C <pyb.I2C>`. ::
from pyb import Pin, I2C
# first assign SCL and SDA to the correct pins
- Pin('GPIO23', af=9, mode=Pin.STD_PU) # SCL
- Pin('GPIO24', af=9, mode=Pin.STD_PU) # SDA
+ Pin('GP23', af=9, mode=Pin.STD_PU) # SCL
+ Pin('GP24', af=9, mode=Pin.STD_PU) # SDA
# configure the I2C bus
i2c = I2C(1, I2C.MASTER, baudrate=100000)
@@ -174,7 +174,7 @@ See :ref:`pyb.SD <pyb.SD>`. ::
# SD card pins need special configuration so we pass 'em to the constructor
# data pin, data af, clock pin, clock af, cmd pin, cmd af
- sd = pyb.SD('GPIO15', 8, 'GPIO10', 6, 'GPIO11', 6)
+ sd = pyb.SD('GP15', 8, 'GP10', 6, 'GP11', 6)
sd.enable()
WLAN (WiFi)
@@ -220,7 +220,7 @@ See :ref:`pyb.HeartBeat <pyb.HeartBeat>`. ::
from pyb import HeartBeat
- # disable the heart beat indication (you are free to use this LED connected to GPIO25)
+ # disable the heart beat indication (you are free to use this LED connected to GP25)
HeartBeat().disable()
# enable the heart beat again
HeartBeat().enable()