#include "gpio.h" /* all pins used as gpio(input/output/irq) must be defined here */ void gpio_init(void){ rcu_periph_clock_enable(RCU_GPIOA); rcu_periph_clock_enable(RCU_GPIOB); rcu_periph_clock_enable(RCU_GPIOC); rcu_periph_clock_enable(RCU_GPIOF); //hall 2 detect gpio_mode_input(GPIOC, GPIO_PUPD_NONE, GPIO_PIN_13); //hall 1 detect gpio_mode_input(GPIOC, GPIO_PUPD_NONE, GPIO_PIN_15); //IR uart0 enable gpio_mode_output(GPIOC, GPIO_PUPD_NONE, GPIO_OTYPE_PP, GPIO_OSPEED_10MHZ, GPIO_PIN_14); //IR uart2 enable gpio_mode_output(GPIOF, GPIO_PUPD_NONE, GPIO_OTYPE_PP, GPIO_OSPEED_10MHZ, GPIO_PIN_0); //power good detect gpio_mode_input(GPIOF, GPIO_PUPD_NONE, GPIO_PIN_7); //temp senser enable gpio_mode_output(GPIOF, GPIO_PUPD_NONE, GPIO_OTYPE_PP, GPIO_OSPEED_10MHZ, GPIO_PIN_1); //charger detect gpio_mode_input(GPIOB, GPIO_PUPD_NONE, GPIO_PIN_10); //aux 12v power enable gpio_mode_output(GPIOB, GPIO_PUPD_NONE, GPIO_OTYPE_PP, GPIO_OSPEED_10MHZ, GPIO_PIN_2); //aux 12v lock detect gpio_mode_input(GPIOB, GPIO_PUPD_NONE, GPIO_PIN_11); #if 0 //LED 0,1,2 gpio_mode_output(GPIOB, GPIO_PUPD_NONE, GPIO_OTYPE_PP, GPIO_OSPEED_10MHZ, GPIO_PIN_12); gpio_mode_output(GPIOB, GPIO_PUPD_NONE, GPIO_OTYPE_PP, GPIO_OSPEED_10MHZ, GPIO_PIN_13); gpio_mode_output(GPIOB, GPIO_PUPD_NONE, GPIO_OTYPE_PP, GPIO_OSPEED_10MHZ, GPIO_PIN_14); //LED3,4 gpio_mode_output(GPIOA, GPIO_PUPD_NONE, GPIO_OTYPE_PP, GPIO_OSPEED_10MHZ, GPIO_PIN_8); gpio_mode_output(GPIOA, GPIO_PUPD_NONE, GPIO_OTYPE_PP, GPIO_OSPEED_10MHZ, GPIO_PIN_9); #endif //cs1180 power enable gpio_mode_output(GPIOB, GPIO_PUPD_NONE, GPIO_OTYPE_PP, GPIO_OSPEED_10MHZ, GPIO_PIN_12); //DC-DC enable gpio_mode_output(GPIOA, GPIO_PUPD_NONE, GPIO_OTYPE_PP, GPIO_OSPEED_10MHZ, GPIO_PIN_11); //DC-DC power good indicat gpio_mode_input(GPIOF, GPIO_PUPD_NONE, GPIO_PIN_7); //ms5238 irq gpio_mode_input(GPIOA, GPIO_PUPD_NONE, GPIO_PIN_12); //detect cs1180 ready gpio_mode_input(GPIOA, GPIO_PUPD_NONE, GPIO_PIN_0); }