Examples updated to use new rcc_periph_clock_enable function
This commit is contained in:
@@ -33,7 +33,7 @@ static void clock_setup(void)
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
/* Enable GPIOC clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
|
||||
/* Set GPIO9 (in GPIO port C) to 'output push-pull'. */
|
||||
gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_50_MHZ,
|
||||
@@ -43,7 +43,7 @@ static void gpio_setup(void)
|
||||
static void button_setup(void)
|
||||
{
|
||||
/* Enable GPIOA clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
|
||||
/* Set GPIO9 (in GPIO port A) to 'input with pull-up resistor'. */
|
||||
gpio_set_mode(GPIOA, GPIO_MODE_INPUT,
|
||||
|
||||
@@ -29,7 +29,7 @@ static void clock_setup(void)
|
||||
rcc_clock_setup_in_hse_8mhz_out_24mhz();
|
||||
|
||||
/* Enable GPIOC clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
}
|
||||
|
||||
static void gpio_setup(void)
|
||||
|
||||
@@ -53,7 +53,7 @@ static void clock_setup(void)
|
||||
static void led_setup(void)
|
||||
{
|
||||
/* Enable GPIOC clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
/* Set LEDs to output push-pull. */
|
||||
gpio_set_mode(LED_PORT, GPIO_MODE_OUTPUT_2_MHZ,
|
||||
GPIO_CNF_OUTPUT_PUSHPULL, LED_ALL);
|
||||
@@ -64,7 +64,7 @@ static void led_setup(void)
|
||||
static void joystick_setup(void)
|
||||
{
|
||||
/* Enable GPIOA clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
/* Set joystick pins to input. */
|
||||
gpio_set_mode(JOY_PORT, GPIO_MODE_INPUT,
|
||||
GPIO_CNF_INPUT_PULL_UPDOWN,
|
||||
|
||||
@@ -27,7 +27,7 @@ static void gpio_setup(void)
|
||||
/* Manually: */
|
||||
// RCC_APB2ENR |= RCC_APB2ENR_IOPCEN;
|
||||
/* Using API functions: */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
|
||||
/* Set GPIO9 (in GPIO port C) to 'output push-pull'. */
|
||||
/* Manually: */
|
||||
|
||||
@@ -247,7 +247,7 @@ int main(void)
|
||||
usbd_device *usbd_dev;
|
||||
|
||||
rcc_clock_setup_in_hsi_out_48mhz();
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN);
|
||||
rcc_periph_clock_enable(RCC_AFIO);
|
||||
|
||||
AFIO_MAPR |= AFIO_MAPR_SWJ_CFG_JTAG_OFF_SW_ON;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user