How to understand Pin.ALT



  • Hi,

    what does it mean if i write something like this?

    Pin('GP16', mode=Pin.ALT, pull=Pin.PULL_DOWN)
    

    i see this in
    https://github.com/danicampora/wipy-WS2812/blob/master/ws2812.py



  • @livius

    Ah, I understand what you mean.
    Don't know this either...

    But I think it is indeed for WiPy 1.0
    On this image it says GP16 is MOSI.
    I found the image according to this forum post.



  • @mmarkvoort

    near to understand but looking at maping rules:

    	LED/USB
    RST		5V
    P0 - G2		GND
    P1 - G1		3,3V
    P2 - G23	P23 - G10
    P3 - G24	P22 - G9
    P4 - G11	P21 - G8
    CLK - G12	P20 - G7
    MOSI - G13	P19 - G6
    MISO - G14	P18 - G30
    P8 - G15	P17 - G31
    P9 - G16	P16 - G3
    P10 - G17	P15 - G0
    P11 - G22	P14 - G4
    P12 - G28	P13 - G5
    

    and description about SPI default pins:

    # this uses the SPI default pins for CLK, MOSI and MISO (``P10``, ``P11`` and ``P12``)
    

    i do not understand why GP16? not e.g. GP17?

    Pin('GP16', mode=Pin.ALT, pull=Pin.PULL_DOWN)
    

    GP16 = P9 which is not default pin for SPI
    or maybe this driver is not for Wipy2 only Wipi1.0
    if this is true then now i am back understand this clearly :)



  • @livius

    I found this on the docs.micropython website:

    The Pin class allows to set an alternate function for a particular pin, but it does not specify any further operations on such a pin. Pins configured in alternate-function mode are usually not used as GPIO but are instead driven by other hardware peripherals.

    See here for more information.


Log in to reply
 

Pycom on Twitter