Changed examples to new rcc definitions.

This commit is contained in:
Thomas Otto 2010-05-11 14:50:55 +02:00
parent b2bca1f1a4
commit d08ee7e333
12 changed files with 29 additions and 29 deletions

View File

@ -26,7 +26,7 @@ void clock_setup(void)
rcc_clock_setup_in_hse_8mhz_out_72mhz(); rcc_clock_setup_in_hse_8mhz_out_72mhz();
/* Enable GPIOC clock. */ /* Enable GPIOC clock. */
rcc_peripheral_enable_clock(&RCC_APB2ENR, IOPCEN); rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
} }

View File

@ -241,10 +241,10 @@ void clock_setup(void)
rcc_clock_setup_in_hse_8mhz_out_72mhz(); rcc_clock_setup_in_hse_8mhz_out_72mhz();
/* Enable TIM3 clock. */ /* Enable TIM3 clock. */
rcc_peripheral_enable_clock(&RCC_APB1ENR, TIM3EN); rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_TIM3EN);
/* Enable GPIOC, Alternate Function clocks. */ /* Enable GPIOC, Alternate Function clocks. */
rcc_peripheral_enable_clock(&RCC_APB2ENR, IOPCEN | AFIOEN); rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN | RCC_APB2ENR_AFIOEN);
} }
void gpio_setup(void) void gpio_setup(void)

View File

@ -26,8 +26,8 @@
void usart_setup(void) void usart_setup(void)
{ {
/* Enable clocks for GPIO port A (for GPIO_USART1_TX) and USART1. */ /* Enable clocks for GPIO port A (for GPIO_USART1_TX) and USART1. */
rcc_peripheral_enable_clock(&RCC_APB2ENR, IOPAEN); rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
rcc_peripheral_enable_clock(&RCC_APB2ENR, USART1EN); rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_USART1EN);
/* Setup GPIO pin GPIO_USART1_TX/GPIO9 on GPIO port A for transmit. */ /* Setup GPIO pin GPIO_USART1_TX/GPIO9 on GPIO port A for transmit. */
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ, gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ,
@ -48,7 +48,7 @@ void usart_setup(void)
void gpio_setup(void) void gpio_setup(void)
{ {
/* Enable GPIOB clock. */ /* Enable GPIOB clock. */
rcc_peripheral_enable_clock(&RCC_APB2ENR, IOPBEN); rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
/* Set GPIO6/7 (in GPIO port B) to 'output push-pull' for the LEDs. */ /* Set GPIO6/7 (in GPIO port B) to 'output push-pull' for the LEDs. */
gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_2_MHZ, gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_2_MHZ,
@ -60,7 +60,7 @@ void gpio_setup(void)
void adc_setup(void) void adc_setup(void)
{ {
int i; int i;
rcc_peripheral_enable_clock(&RCC_APB2ENR, ADC1EN); rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_ADC1EN);
/* make shure it didnt run during config */ /* make shure it didnt run during config */
adc_off(ADC1); adc_off(ADC1);

View File

@ -26,8 +26,8 @@
void usart_setup(void) void usart_setup(void)
{ {
/* Enable clocks for GPIO port A (for GPIO_USART1_TX) and USART1. */ /* Enable clocks for GPIO port A (for GPIO_USART1_TX) and USART1. */
rcc_peripheral_enable_clock(&RCC_APB2ENR, IOPAEN); rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
rcc_peripheral_enable_clock(&RCC_APB2ENR, USART1EN); rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_USART1EN);
/* Setup GPIO pin GPIO_USART1_TX/GPIO9 on GPIO port A for transmit. */ /* Setup GPIO pin GPIO_USART1_TX/GPIO9 on GPIO port A for transmit. */
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ, gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ,
@ -48,7 +48,7 @@ void usart_setup(void)
void gpio_setup(void) void gpio_setup(void)
{ {
/* Enable GPIOB clock. */ /* Enable GPIOB clock. */
rcc_peripheral_enable_clock(&RCC_APB2ENR, IOPBEN); rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
/* Set GPIO6/7 (in GPIO port B) to 'output push-pull' for the LEDs. */ /* Set GPIO6/7 (in GPIO port B) to 'output push-pull' for the LEDs. */
gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_2_MHZ, gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_2_MHZ,
@ -82,7 +82,7 @@ int main(void)
my_usart_print_string(USART1, "s1 "); my_usart_print_string(USART1, "s1 ");
my_usart_print_string(USART1, s1); my_usart_print_string(USART1, s1);
rcc_peripheral_enable_clock(&RCC_AHBENR, DMA1EN); rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_DMA1EN);
/* MEM2MEM mode for channel 1. */ /* MEM2MEM mode for channel 1. */
dma_enable_mem2mem_mode(DMA1, DMA_CHANNEL1); dma_enable_mem2mem_mode(DMA1, DMA_CHANNEL1);

View File

@ -29,7 +29,7 @@
void gpio_setup(void) void gpio_setup(void)
{ {
/* Enable GPIOB clock. */ /* Enable GPIOB clock. */
rcc_peripheral_enable_clock(&RCC_APB2ENR, IOPBEN); rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
/* Set GPIO6/7 (in GPIO port B) to 'output push-pull' for the LEDs. */ /* Set GPIO6/7 (in GPIO port B) to 'output push-pull' for the LEDs. */
gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_2_MHZ, gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_2_MHZ,
@ -57,7 +57,7 @@ void spi_setup()
{ {
/* the DOGM128 display is connected to SPI2, so initialise it correctly */ /* the DOGM128 display is connected to SPI2, so initialise it correctly */
rcc_peripheral_enable_clock(&RCC_APB1ENR, SPI2EN); rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_SPI2EN);
spi_set_unidirectional_mode(DOGM128_SPI); /* we want to send only */ spi_set_unidirectional_mode(DOGM128_SPI); /* we want to send only */
spi_disable_crc(DOGM128_SPI); /* no CRC for this slave */ spi_disable_crc(DOGM128_SPI); /* no CRC for this slave */

View File

@ -27,8 +27,8 @@
void usart_setup(void) void usart_setup(void)
{ {
/* Enable clocks for GPIO port A (for GPIO_USART1_TX) and USART1. */ /* Enable clocks for GPIO port A (for GPIO_USART1_TX) and USART1. */
rcc_peripheral_enable_clock(&RCC_APB2ENR, IOPAEN); rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
rcc_peripheral_enable_clock(&RCC_APB2ENR, USART1EN); rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_USART1EN);
/* Setup GPIO pin GPIO_USART1_TX/GPIO9 on GPIO port A for transmit. */ /* Setup GPIO pin GPIO_USART1_TX/GPIO9 on GPIO port A for transmit. */
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ, gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ,
@ -49,7 +49,7 @@ void usart_setup(void)
void gpio_setup(void) void gpio_setup(void)
{ {
/* Enable GPIOB clock. */ /* Enable GPIOB clock. */
rcc_peripheral_enable_clock(&RCC_APB2ENR, IOPBEN); rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
/* Set GPIO6/7 (in GPIO port B) to 'output push-pull' for the LEDs. */ /* Set GPIO6/7 (in GPIO port B) to 'output push-pull' for the LEDs. */
gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_2_MHZ, gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_2_MHZ,
@ -61,8 +61,8 @@ void gpio_setup(void)
void i2c_setup(void) void i2c_setup(void)
{ {
/* Enable clocks for I2C2 and AFIO. */ /* Enable clocks for I2C2 and AFIO. */
rcc_peripheral_enable_clock(&RCC_APB1ENR, I2C2EN); rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_I2C2EN);
rcc_peripheral_enable_clock(&RCC_APB2ENR, AFIOEN); rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN);
/* Set alternate functions for the SCL and SDA pins of I2C2. */ /* Set alternate functions for the SCL and SDA pins of I2C2. */
gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_50_MHZ, gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_50_MHZ,

View File

@ -29,11 +29,11 @@ void clock_setup(void)
rcc_clock_setup_in_hse_8mhz_out_72mhz(); rcc_clock_setup_in_hse_8mhz_out_72mhz();
/* Enable GPIOC clock. */ /* Enable GPIOC clock. */
rcc_peripheral_enable_clock(&RCC_APB2ENR, IOPCEN); rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
/* Enable clocks for GPIO port A (for GPIO_USART1_TX) and USART1. */ /* Enable clocks for GPIO port A (for GPIO_USART1_TX) and USART1. */
rcc_peripheral_enable_clock(&RCC_APB2ENR, IOPAEN); rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
rcc_peripheral_enable_clock(&RCC_APB2ENR, USART1EN); rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_USART1EN);
} }
void usart_setup(void) void usart_setup(void)

View File

@ -28,7 +28,7 @@ u32 temp32;
void gpio_setup(void) void gpio_setup(void)
{ {
/* Enable GPIOB clock. */ /* Enable GPIOB clock. */
rcc_peripheral_enable_clock(&RCC_APB2ENR, IOPBEN); rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
/* Set GPIO6/7 (in GPIO port B) to 'output push-pull' for the LEDs. */ /* Set GPIO6/7 (in GPIO port B) to 'output push-pull' for the LEDs. */
gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_2_MHZ, gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_2_MHZ,

View File

@ -26,7 +26,7 @@
void gpio_setup(void) void gpio_setup(void)
{ {
/* Enable GPIOB clock. */ /* Enable GPIOB clock. */
rcc_peripheral_enable_clock(&RCC_APB2ENR, IOPBEN); rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
/* Set GPIO6/7 (in GPIO port B) to 'output push-pull' for the LEDs. */ /* Set GPIO6/7 (in GPIO port B) to 'output push-pull' for the LEDs. */
gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_2_MHZ, gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_2_MHZ,
@ -60,7 +60,7 @@ int main(void)
gpio_clear(GPIOB, GPIO7); /* LED1 on */ gpio_clear(GPIOB, GPIO7); /* LED1 on */
gpio_set(GPIOB, GPIO6); /* LED2 off */ gpio_set(GPIOB, GPIO6); /* LED2 off */
rcc_peripheral_enable_clock(&RCC_APB1ENR, TIM2EN); rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_TIM2EN);
/* the goal is to let the LED2 glow for a second and then be off for a second */ /* the goal is to let the LED2 glow for a second and then be off for a second */

View File

@ -26,7 +26,7 @@ void clock_setup(void)
rcc_clock_setup_in_hse_8mhz_out_72mhz(); rcc_clock_setup_in_hse_8mhz_out_72mhz();
/* Enable GPIOC clock. */ /* Enable GPIOC clock. */
rcc_peripheral_enable_clock(&RCC_APB2ENR, IOPCEN); rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
} }

View File

@ -26,7 +26,7 @@ void gpio_setup(void)
/* Manually: */ /* Manually: */
// RCC_APB2ENR |= IOPCEN; // RCC_APB2ENR |= IOPCEN;
/* Using API functions: */ /* Using API functions: */
rcc_peripheral_enable_clock(&RCC_APB2ENR, IOPCEN); rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
/* Set GPIO12 (in GPIO port C) to 'output push-pull'. */ /* Set GPIO12 (in GPIO port C) to 'output push-pull'. */
/* Manually: */ /* Manually: */

View File

@ -26,11 +26,11 @@ void clock_setup(void)
rcc_clock_setup_in_hse_8mhz_out_72mhz(); rcc_clock_setup_in_hse_8mhz_out_72mhz();
/* Enable GPIOC clock. */ /* Enable GPIOC clock. */
rcc_peripheral_enable_clock(&RCC_APB2ENR, IOPCEN); rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
/* Enable clocks for GPIO port B (for GPIO_USART3_TX) and USART3. */ /* Enable clocks for GPIO port B (for GPIO_USART3_TX) and USART3. */
rcc_peripheral_enable_clock(&RCC_APB2ENR, IOPBEN); rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
rcc_peripheral_enable_clock(&RCC_APB1ENR, USART3EN); rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USART3EN);
} }
void usart_setup(void) void usart_setup(void)