GPIO Pull-downs on the MK22

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

GPIO Pull-downs on the MK22

632 Views
roger5
Contributor III

I'm trying to understand how to use the GPIO pull-down resistors on the MK22 but I can't find any thing in the SDK examples that show how to use this can currently all the SDK documentation is unavailable because its offline for maintenance :-(

I found some code in

#if defined(FSL_FEATURE_PORT_HAS_PULL_ENABLE) && FSL_FEATURE_PORT_HAS_PULL_ENABLE
/*! @brief Internal resistor pull feature selection */
enum _port_pull
{
    kPORT_PullDisable = 0U, /*!< Internal pull-up/down resistor is disabled. */
    kPORT_PullDown = 2U,    /*!< Internal pull-down resistor is enabled. */
    kPORT_PullUp = 3U,      /*!< Internal pull-up resistor is enabled. */
};
#endif /* FSL_FEATURE_PORT_HAS_PULL_ENABLE */

So it does appear that the K22 has this feature, but I can't find any documentation on how to enable the Pull-Down and whether this feature is only available across the whole port or whether individual pins can be controlled.

Is the way to enable this using

PORT_SetPinConfig() ?

 and if so, are there any examples in the SDK examples  for GPIO and Pull-down or Pull-up

0 Kudos
1 Reply

543 Views
roger5
Contributor III

To reply to my own question.

I'm now using

     port_pin_config_t config = {
          kPORT_PullUp,
          kPORT_FastSlewRate,
          kPORT_PassiveFilterDisable,
          kPORT_OpenDrainDisable,
          kPORT_LowDriveStrength,
          kPORT_MuxAsGpio,
          kPORT_UnlockRegister,
     };

    // column lines
    PORT_SetPinConfig(Port_Key_Col0, Pin_Key_Col0, &config);
    PORT_SetPinConfig(Port_Key_Col1, Pin_Key_Col1, &config);
    PORT_SetPinConfig(Port_Key_Col2, Pin_Key_Col2, &config);
    PORT_SetPinConfig(Port_Key_Col3, Pin_Key_Col3, &config);

I think its working OK.

Thanks