From: Nathael Pajani Date: Tue, 27 Sep 2016 21:06:54 +0000 (+0200) Subject: Small additions to core/system.[ch] Small addition to gpio driver header X-Git-Url: http://git.techno-innov.fr/?a=commitdiff_plain;h=929d3d1b62c7febae545093cdd103c6cfbd33bfb;p=soft%2Flpc122x%2Fcore Small additions to core/system.[ch] Small addition to gpio driver header --- diff --git a/core/system.c b/core/system.c index 5939c49..f8e6ecc 100644 --- a/core/system.c +++ b/core/system.c @@ -137,6 +137,12 @@ void subsystem_power(uint32_t power_bit, uint32_t on_off) sys_config->sys_AHB_clk_ctrl &= ~(power_bit); } } +/* Check whether a subsystem is powered or not */ +uint8_t subsystem_powered(uint32_t power_bit) +{ + struct lpc_sys_config* sys_config = LPC_SYS_CONFIG; + return (sys_config->sys_AHB_clk_ctrl & power_bit); +} /***************************************************************************** */ /* System Clock */ diff --git a/include/core/system.h b/include/core/system.h index dc3dfb1..4f06c0f 100644 --- a/include/core/system.h +++ b/include/core/system.h @@ -46,6 +46,8 @@ void enter_deep_sleep(void); /* Power on or off a subsystem */ void subsystem_power(uint32_t power_bit, uint32_t on_off); +/* Check whether a subsystem is powered or not */ +uint8_t subsystem_powered(uint32_t power_bit); /* Configure the brown-out detection. * Note: Brown-Out detection must be powered to operate the ADC (See Section 19.2 diff --git a/include/drivers/gpio.h b/include/drivers/gpio.h index 5ca197f..d4bad31 100644 --- a/include/drivers/gpio.h +++ b/include/drivers/gpio.h @@ -68,6 +68,12 @@ struct lpc_gpio /***************************************************************************** */ /* Public access to GPIO setup */ +enum gpio_ports { + GPIO_PORT0 = 0, + GPIO_PORT1, + GPIO_PORT2, +}; + #define GPIO_DIR_IN 0 #define GPIO_DIR_OUT 1