Skip to content
  • Damien George's avatar
    stm32: Change pin_X and pyb_pin_X identifiers to be pointers to objects. · 2dca693c
    Damien George authored
    Rather than pin objects themselves.  The actual object is now pin_X_obj and
    defines are provided so that pin_X is &pin_X_obj.  This makes it so that
    code that uses pin objects doesn't need to know if they are literals or
    objects (that need pointers taken) or something else.  They are just
    entities that can be passed to the map_hal_pin_xxx functions.  This mirrors
    how the core handles constant objects (eg mp_const_none which is
    &mp_const_none_obj) and allows for the possibility of different
    implementations of the pin layer.
    
    For example, prior to this patch there was the following:
    
        extern const pin_obj_t pin_A0;
        #define pyb_pin_X1 pin_A0
        ...
        mp_hal_pin_high(&pin_A0);
    
    and now there is:
    
        extern const pin_obj_t pin_A0_obj;
        #define pin_A0 (&pin_A0_obj)
        #define pyb_pin_X1 pin_A0
        ...
        mp_hal_pin_high(pin_A0);
    
    This patch should have minimal effect on board configuration files.  The
    only change that may be needed is if a board has .c files that configure
    pins.
    2dca693c