Examples updated to use new rcc_periph_clock_enable function
This commit is contained in:
@@ -47,8 +47,8 @@
|
||||
static void adc_setup(void)
|
||||
{
|
||||
//ADC
|
||||
rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_ADC12EN);
|
||||
rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_IOPAEN);
|
||||
rcc_periph_clock_enable(RCC_ADC12);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
//ADC
|
||||
gpio_mode_setup(GPIOA, GPIO_MODE_ANALOG, GPIO_PUPD_NONE, GPIO0);
|
||||
gpio_mode_setup(GPIOA, GPIO_MODE_ANALOG, GPIO_PUPD_NONE, GPIO1);
|
||||
@@ -77,8 +77,8 @@ static void adc_setup(void)
|
||||
static void usart_setup(void)
|
||||
{
|
||||
/* Enable clocks for GPIO port A (for GPIO_USART2_TX) and USART2. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USART2EN);
|
||||
rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_IOPAEN);
|
||||
rcc_periph_clock_enable(RCC_USART2);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
|
||||
/* Setup GPIO pin GPIO_USART2_TX/GPIO9 on GPIO port A for transmit. */
|
||||
gpio_mode_setup(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO2 | GPIO3);
|
||||
@@ -98,7 +98,7 @@ static void usart_setup(void)
|
||||
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_IOPEEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOE);
|
||||
gpio_mode_setup(GPIOE, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE,
|
||||
GPIO8 | GPIO9 | GPIO10 | GPIO11 | GPIO12 | GPIO13 |
|
||||
GPIO14 | GPIO15);
|
||||
|
||||
@@ -35,7 +35,7 @@ static void clock_setup(void)
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
/* Enable GPIOD clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_IOPEEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOE);
|
||||
|
||||
/* Set GPIO12 (in GPIO port D) to 'output push-pull'. */
|
||||
gpio_mode_setup(GPIOE, GPIO_MODE_OUTPUT,
|
||||
@@ -45,7 +45,7 @@ static void gpio_setup(void)
|
||||
static void button_setup(void)
|
||||
{
|
||||
/* Enable GPIOA clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_IOPAEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
|
||||
/* Set GPIO0 (in GPIO port A) to 'input open-drain'. */
|
||||
gpio_mode_setup(GPIOA, GPIO_MODE_INPUT, GPIO_PUPD_NONE, GPIO0);
|
||||
|
||||
@@ -28,7 +28,7 @@ static void clock_setup(void)
|
||||
rcc_clock_setup_hsi(&hsi_8mhz[CLOCK_64MHZ]);
|
||||
|
||||
/* Enable GPIOE clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_IOPEEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOE);
|
||||
}
|
||||
|
||||
static void gpio_setup(void)
|
||||
|
||||
@@ -45,8 +45,8 @@
|
||||
|
||||
static void i2c_setup(void)
|
||||
{
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_I2C1EN);
|
||||
rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_IOPBEN);
|
||||
rcc_periph_clock_enable(RCC_I2C1);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
rcc_set_i2c_clock_hsi(I2C1);
|
||||
|
||||
i2c_reset(I2C1);
|
||||
@@ -70,8 +70,8 @@ static void i2c_setup(void)
|
||||
static void usart_setup(void)
|
||||
{
|
||||
/* Enable clocks for GPIO port A (for GPIO_USART2_TX) and USART2. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USART2EN);
|
||||
rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_IOPAEN);
|
||||
rcc_periph_clock_enable(RCC_USART2);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
|
||||
/* Setup GPIO pin GPIO_USART2_TX/GPIO9 on GPIO port A for transmit. */
|
||||
gpio_mode_setup(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO2 | GPIO3);
|
||||
@@ -91,7 +91,7 @@ static void usart_setup(void)
|
||||
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_IOPEEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOE);
|
||||
gpio_mode_setup(GPIOE, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE,
|
||||
GPIO8 | GPIO9 | GPIO10 | GPIO11 | GPIO12 | GPIO13 |
|
||||
GPIO14 | GPIO15);
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
/* Enable GPIOE clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_IOPEEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOE);
|
||||
|
||||
/* Set GPIO12 (in GPIO port E) to 'output push-pull'. */
|
||||
gpio_mode_setup(GPIOE, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO12);
|
||||
|
||||
@@ -45,11 +45,11 @@
|
||||
|
||||
static void spi_setup(void)
|
||||
{
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_SPI1EN);
|
||||
rcc_periph_clock_enable(RCC_SPI1);
|
||||
/* For spi signal pins */
|
||||
rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_IOPAEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
/* For spi mode select on the l3gd20 */
|
||||
rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_IOPEEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOE);
|
||||
|
||||
/* Setup GPIOE3 pin for spi mode l3gd20 select. */
|
||||
gpio_mode_setup(GPIOE, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO3);
|
||||
@@ -81,8 +81,8 @@ static void spi_setup(void)
|
||||
static void usart_setup(void)
|
||||
{
|
||||
/* Enable clocks for GPIO port A (for GPIO_USART2_TX) and USART2. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USART2EN);
|
||||
rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_IOPAEN);
|
||||
rcc_periph_clock_enable(RCC_USART2);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
|
||||
/* Setup GPIO pin GPIO_USART2_TX/GPIO9 on GPIO port A for transmit. */
|
||||
gpio_mode_setup(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO2 | GPIO3);
|
||||
@@ -102,7 +102,7 @@ static void usart_setup(void)
|
||||
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_IOPEEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOE);
|
||||
gpio_mode_setup(GPIOE, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE,
|
||||
GPIO8 | GPIO9 | GPIO10 | GPIO11 | GPIO12 | GPIO13 |
|
||||
GPIO14 | GPIO15);
|
||||
|
||||
@@ -237,8 +237,8 @@ static void usb_setup(void)
|
||||
{
|
||||
/* Enable clocks for GPIO port A (for GPIO_USART2_TX) and USART2. */
|
||||
rcc_usb_prescale_1();
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USBEN);
|
||||
rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_IOPAEN);
|
||||
rcc_periph_clock_enable(RCC_USB);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
|
||||
/* Setup GPIO pin GPIO_USART2_TX/GPIO9 on GPIO port A for transmit. */
|
||||
gpio_mode_setup(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO11 | GPIO12);
|
||||
|
||||
Reference in New Issue
Block a user