From ad52d68a0ce0a757fee88729b20eab0f52414d7a Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Fri, 1 May 2015 16:10:45 +0100 Subject: [PATCH] Add function to configure a pin to a default state --- cpu/cc26xx/lpm.c | 11 +++++++++++ cpu/cc26xx/lpm.h | 12 ++++++++++++ 2 files changed, 23 insertions(+) diff --git a/cpu/cc26xx/lpm.c b/cpu/cc26xx/lpm.c index 4d1cdd3e0..28a7d7582 100644 --- a/cpu/cc26xx/lpm.c +++ b/cpu/cc26xx/lpm.c @@ -396,6 +396,17 @@ lpm_init() list_init(power_domain_locks_list); } /*---------------------------------------------------------------------------*/ +void +lpm_pin_set_default_state(uint32_t ioid) +{ + if(ioid == IOID_UNUSED) { + return; + } + + ti_lib_ioc_port_configure_set(ioid, IOC_PORT_GPIO, IOC_STD_OUTPUT); + ti_lib_gpio_dir_mode_set((1 << ioid), GPIO_DIR_MODE_IN); +} +/*---------------------------------------------------------------------------*/ /** * @} * @} diff --git a/cpu/cc26xx/lpm.h b/cpu/cc26xx/lpm.h index 6b603377e..757215cdd 100644 --- a/cpu/cc26xx/lpm.h +++ b/cpu/cc26xx/lpm.h @@ -154,6 +154,18 @@ void lpm_register_module(lpm_registered_module_t *module); * \brief Initialise the low-power mode management module */ void lpm_init(void); + +/** + * \brief Sets an IOID to a default state + * \param ioid IOID_0... + * + * This will set ioid to sw control, input, no pull. Input buffer and output + * driver will both be disabled + * + * The function will do nothing if ioid == IOID_UNUSED, so the caller does not + * have to check board configuration before calling this. + */ +void lpm_pin_set_default_state(uint32_t ioid); /*---------------------------------------------------------------------------*/ #endif /* LPM_H_ */ /*---------------------------------------------------------------------------*/