Examples updated to use new rcc_periph_clock_enable function
This commit is contained in:
@@ -50,16 +50,16 @@ struct can_rx_msg can_rx_msg;
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
/* Enable Alternate Function clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN);
|
||||
rcc_periph_clock_enable(RCC_AFIO);
|
||||
|
||||
/* Enable GPIOA clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
|
||||
/* Enable GPIOB clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
|
||||
/* Enable GPIOC clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
|
||||
/* Preconfigure LEDs. */
|
||||
gpio_set(GPIOA, GPIO8); /* LED0 off */
|
||||
@@ -103,9 +103,9 @@ static void systick_setup(void)
|
||||
static void can_setup(void)
|
||||
{
|
||||
/* Enable peripheral clocks. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_CANEN);
|
||||
rcc_periph_clock_enable(RCC_AFIO);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
rcc_periph_clock_enable(RCC_CAN);
|
||||
|
||||
AFIO_MAPR |= AFIO_MAPR_CAN1_REMAP_PORTB;
|
||||
|
||||
|
||||
@@ -27,9 +27,9 @@ static void clock_setup(void)
|
||||
rcc_clock_setup_in_hse_12mhz_out_72mhz();
|
||||
|
||||
/* Enable GPIOB, GPIOC, and AFIO clocks. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
rcc_periph_clock_enable(RCC_AFIO);
|
||||
}
|
||||
|
||||
static void gpio_setup(void)
|
||||
|
||||
@@ -242,8 +242,8 @@ int main(void)
|
||||
|
||||
rcc_clock_setup_in_hsi_out_48mhz();
|
||||
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
|
||||
rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_OTGFSEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
rcc_periph_clock_enable(RCC_OTGFS);
|
||||
|
||||
gpio_set(GPIOC, GPIO2);
|
||||
gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_2_MHZ,
|
||||
|
||||
@@ -233,7 +233,7 @@ int main(void)
|
||||
{
|
||||
usbd_device *usbd_dev;
|
||||
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
|
||||
if (!gpio_get(GPIOA, GPIO10)) {
|
||||
/* Boot the application if it's valid. */
|
||||
@@ -250,8 +250,8 @@ int main(void)
|
||||
|
||||
rcc_clock_setup_in_hsi_out_48mhz();
|
||||
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
|
||||
rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_OTGFSEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
rcc_periph_clock_enable(RCC_OTGFS);
|
||||
|
||||
gpio_set(GPIOC, GPIO2);
|
||||
gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_50_MHZ,
|
||||
|
||||
@@ -325,11 +325,11 @@ int main(void)
|
||||
|
||||
rcc_clock_setup_in_hse_12mhz_out_72mhz();
|
||||
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_SPI2EN);
|
||||
rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_OTGFSEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
rcc_periph_clock_enable(RCC_SPI2);
|
||||
rcc_periph_clock_enable(RCC_OTGFS);
|
||||
|
||||
/* Configure SPI2: PB13(SCK), PB14(MISO), PB15(MOSI). */
|
||||
gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_10_MHZ,
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
static void usart_setup(void)
|
||||
{
|
||||
/* Enable clocks for GPIO port A (for GPIO_USART1_TX) and USART1. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USART2EN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_USART2);
|
||||
|
||||
/* Setup GPIO pin GPIO_USART1_TX/GPIO9 on GPIO port A for transmit. */
|
||||
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ,
|
||||
@@ -50,8 +50,8 @@ static void usart_setup(void)
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
/* Enable GPIO clocks. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
|
||||
/* Setup the LEDs. */
|
||||
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_2_MHZ,
|
||||
@@ -64,7 +64,7 @@ static void adc_setup(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_ADC1EN);
|
||||
rcc_periph_clock_enable(RCC_ADC1);
|
||||
|
||||
/* Make sure the ADC doesn't run during config. */
|
||||
adc_off(ADC1);
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
static void usart_setup(void)
|
||||
{
|
||||
/* Enable clocks for GPIO port A (for GPIO_USART1_TX) and USART1. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USART2EN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_USART2);
|
||||
|
||||
/* Setup GPIO pin GPIO_USART1_TX/GPIO9 on GPIO port A for transmit. */
|
||||
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ,
|
||||
@@ -51,8 +51,8 @@ static void usart_setup(void)
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
/* Enable GPIO clocks. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
|
||||
/* Setup the LEDs. */
|
||||
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_2_MHZ,
|
||||
@@ -65,14 +65,9 @@ static void timer_setup(void)
|
||||
{
|
||||
/* Set up the timer TIM2 for injected sampling */
|
||||
uint32_t timer;
|
||||
volatile uint32_t *rcc_apbenr;
|
||||
uint32_t rcc_apb;
|
||||
|
||||
timer = TIM2;
|
||||
rcc_apbenr = &RCC_APB1ENR;
|
||||
rcc_apb = RCC_APB1ENR_TIM2EN;
|
||||
|
||||
rcc_peripheral_enable_clock(rcc_apbenr, rcc_apb);
|
||||
rcc_periph_clock_enable(RCC_TIM2);
|
||||
|
||||
/* Time Base configuration */
|
||||
timer_reset(timer);
|
||||
@@ -89,8 +84,7 @@ static void timer_setup(void)
|
||||
static void adc_setup(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_ADC1EN);
|
||||
rcc_periph_clock_enable(RCC_ADC1);
|
||||
|
||||
/* Make sure the ADC doesn't run during config. */
|
||||
adc_off(ADC1);
|
||||
|
||||
@@ -32,8 +32,8 @@ volatile uint16_t temperature = 0;
|
||||
static void usart_setup(void)
|
||||
{
|
||||
/* Enable clocks for GPIO port A (for GPIO_USART1_TX) and USART1. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USART2EN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_USART2);
|
||||
|
||||
/* Setup GPIO pin GPIO_USART1_TX/GPIO9 on GPIO port A for transmit. */
|
||||
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ,
|
||||
@@ -54,8 +54,8 @@ static void usart_setup(void)
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
/* Enable GPIO clocks. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
|
||||
/* Setup the LEDs. */
|
||||
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_2_MHZ,
|
||||
@@ -68,14 +68,9 @@ static void timer_setup(void)
|
||||
{
|
||||
/* Set up the timer TIM2 for injected sampling */
|
||||
uint32_t timer;
|
||||
volatile uint32_t *rcc_apbenr;
|
||||
uint32_t rcc_apb;
|
||||
|
||||
timer = TIM2;
|
||||
rcc_apbenr = &RCC_APB1ENR;
|
||||
rcc_apb = RCC_APB1ENR_TIM2EN;
|
||||
|
||||
rcc_peripheral_enable_clock(rcc_apbenr, rcc_apb);
|
||||
rcc_periph_clock_enable(RCC_TIM2);
|
||||
|
||||
/* Time Base configuration */
|
||||
timer_reset(timer);
|
||||
@@ -100,7 +95,7 @@ static void adc_setup(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_ADC1EN);
|
||||
rcc_periph_clock_enable(RCC_ADC1);
|
||||
|
||||
/* Make sure the ADC doesn't run during config. */
|
||||
adc_off(ADC1);
|
||||
|
||||
@@ -36,8 +36,8 @@ uint8_t channel_array[4]; /* for injected sampling, 4 channels max, for regular,
|
||||
static void usart_setup(void)
|
||||
{
|
||||
/* Enable clocks for GPIO port A (for GPIO_USART1_TX) and USART1. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USART2EN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_USART2);
|
||||
|
||||
/* Setup GPIO pin GPIO_USART1_TX/GPIO9 on GPIO port A for transmit. */
|
||||
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ,
|
||||
@@ -58,8 +58,8 @@ static void usart_setup(void)
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
/* Enable GPIO clocks. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
|
||||
/* Setup the LEDs. */
|
||||
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_2_MHZ,
|
||||
@@ -76,14 +76,9 @@ static void timer_setup(void)
|
||||
{
|
||||
/* Set up the timer TIM2 for injected sampling */
|
||||
uint32_t timer;
|
||||
volatile uint32_t *rcc_apbenr;
|
||||
uint32_t rcc_apb;
|
||||
|
||||
timer = TIM2;
|
||||
rcc_apbenr = &RCC_APB1ENR;
|
||||
rcc_apb = RCC_APB1ENR_TIM2EN;
|
||||
|
||||
rcc_peripheral_enable_clock(rcc_apbenr, rcc_apb);
|
||||
rcc_periph_clock_enable(RCC_TIM2);
|
||||
|
||||
/* Time Base configuration */
|
||||
timer_reset(timer);
|
||||
@@ -108,7 +103,7 @@ static void adc_setup(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_ADC1EN);
|
||||
rcc_periph_clock_enable(RCC_ADC1);
|
||||
|
||||
/* Make sure the ADC doesn't run during config. */
|
||||
adc_off(ADC1);
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
static void usart_setup(void)
|
||||
{
|
||||
/* Enable clocks for GPIO port A (for GPIO_USART1_TX) and USART1. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USART2EN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_USART2);
|
||||
|
||||
/* Setup GPIO pin GPIO_USART1_TX/GPIO9 on GPIO port A for transmit. */
|
||||
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ,
|
||||
@@ -50,8 +50,8 @@ static void usart_setup(void)
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
/* Enable GPIO clocks. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
|
||||
/* Setup the LEDs. */
|
||||
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_2_MHZ,
|
||||
@@ -64,7 +64,7 @@ static void adc_setup(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_ADC1EN);
|
||||
rcc_periph_clock_enable(RCC_ADC1);
|
||||
|
||||
/* Make sure the ADC doesn't run during config. */
|
||||
adc_off(ADC1);
|
||||
|
||||
@@ -50,16 +50,16 @@ struct can_rx_msg can_rx_msg;
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
/* Enable Alternate Function clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN);
|
||||
rcc_periph_clock_enable(RCC_AFIO);
|
||||
|
||||
/* Enable GPIOA clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
|
||||
/* Enable GPIOB clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
|
||||
/* Enable GPIOC clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
|
||||
/* Preconfigure LEDs. */
|
||||
gpio_set(GPIOA, GPIO8); /* LED1 off */
|
||||
@@ -103,9 +103,9 @@ static void systick_setup(void)
|
||||
static void can_setup(void)
|
||||
{
|
||||
/* Enable peripheral clocks. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_CAN1EN);
|
||||
rcc_periph_clock_enable(RCC_AFIO);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
rcc_periph_clock_enable(RCC_CAN1);
|
||||
|
||||
AFIO_MAPR |= AFIO_MAPR_CAN1_REMAP_PORTB;
|
||||
|
||||
|
||||
@@ -27,10 +27,10 @@ static void clock_setup(void)
|
||||
rcc_clock_setup_in_hse_12mhz_out_72mhz();
|
||||
|
||||
/* Enable GPIOA, GPIOB, GPIOC, and AFIO clocks. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
rcc_periph_clock_enable(RCC_AFIO);
|
||||
}
|
||||
|
||||
static void gpio_setup(void)
|
||||
|
||||
@@ -34,19 +34,17 @@ static void clock_setup(void)
|
||||
rcc_clock_setup_in_hse_12mhz_out_72mhz();
|
||||
|
||||
/* Enable GPIOA, GPIOB, GPIOC clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR,
|
||||
RCC_APB2ENR_IOPAEN | RCC_APB2ENR_IOPBEN |
|
||||
RCC_APB2ENR_IOPCEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
|
||||
/* Enable clocks for GPIO port A (for GPIO_USART2_TX) and USART2. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN |
|
||||
RCC_APB2ENR_AFIOEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USART2EN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_AFIO);
|
||||
rcc_periph_clock_enable(RCC_USART2);
|
||||
|
||||
/* Enable SPI1 Periph and gpio clocks */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR,
|
||||
RCC_APB2ENR_SPI1EN);
|
||||
|
||||
rcc_periph_clock_enable(RCC_SPI1);
|
||||
}
|
||||
|
||||
static void spi_setup(void) {
|
||||
|
||||
@@ -54,21 +54,20 @@ static void clock_setup(void)
|
||||
rcc_clock_setup_in_hse_12mhz_out_72mhz();
|
||||
|
||||
/* Enable GPIOA, GPIOB, GPIOC clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR,
|
||||
RCC_APB2ENR_IOPAEN | RCC_APB2ENR_IOPBEN |
|
||||
RCC_APB2ENR_IOPCEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
|
||||
/* Enable clocks for GPIO port A (for GPIO_USART2_TX) and USART2. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN |
|
||||
RCC_APB2ENR_AFIOEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USART2EN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_AFIO);
|
||||
rcc_periph_clock_enable(RCC_USART2);
|
||||
|
||||
/* Enable SPI1 Periph and gpio clocks */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR,
|
||||
RCC_APB2ENR_SPI1EN);
|
||||
rcc_periph_clock_enable(RCC_SPI1);
|
||||
|
||||
/* Enable DMA1 clock */
|
||||
rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_DMA1EN);
|
||||
rcc_periph_clock_enable(RCC_DMA1);
|
||||
}
|
||||
|
||||
static void spi_setup(void) {
|
||||
|
||||
@@ -64,21 +64,20 @@ static void clock_setup(void)
|
||||
rcc_clock_setup_in_hse_12mhz_out_72mhz();
|
||||
|
||||
/* Enable GPIOA, GPIOB, GPIOC clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR,
|
||||
RCC_APB2ENR_IOPAEN | RCC_APB2ENR_IOPBEN |
|
||||
RCC_APB2ENR_IOPCEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
|
||||
/* Enable clocks for GPIO port A (for GPIO_USART2_TX) and USART2. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN |
|
||||
RCC_APB2ENR_AFIOEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USART2EN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_AFIO);
|
||||
rcc_periph_clock_enable(RCC_USART2);
|
||||
|
||||
/* Enable SPI1 Periph and gpio clocks */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR,
|
||||
RCC_APB2ENR_SPI1EN);
|
||||
rcc_periph_clock_enable(RCC_SPI1);
|
||||
|
||||
/* Enable DMA1 clock */
|
||||
rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_DMA1EN);
|
||||
rcc_periph_clock_enable(RCC_DMA1);
|
||||
}
|
||||
|
||||
static void spi_setup(void) {
|
||||
|
||||
@@ -26,13 +26,12 @@ static void clock_setup(void)
|
||||
rcc_clock_setup_in_hse_12mhz_out_72mhz();
|
||||
|
||||
/* Enable GPIOA, GPIOB, GPIOC clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR,
|
||||
RCC_APB2ENR_IOPAEN | RCC_APB2ENR_IOPBEN |
|
||||
RCC_APB2ENR_IOPCEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
|
||||
/* Enable clocks for GPIO port B (for GPIO_USART3_TX) and USART3. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR,
|
||||
RCC_APB1ENR_USART2EN);
|
||||
rcc_periph_clock_enable(RCC_USART2);
|
||||
}
|
||||
|
||||
static void usart_setup(void)
|
||||
|
||||
@@ -28,16 +28,15 @@ static void clock_setup(void)
|
||||
rcc_clock_setup_in_hse_12mhz_out_72mhz();
|
||||
|
||||
/* Enable GPIOA, GPIOB, GPIOC clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR,
|
||||
RCC_APB2ENR_IOPAEN | RCC_APB2ENR_IOPBEN |
|
||||
RCC_APB2ENR_IOPCEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
|
||||
/* Enable clocks for GPIO port B (for GPIO_USART3_TX) and USART3. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR,
|
||||
RCC_APB1ENR_USART2EN);
|
||||
rcc_periph_clock_enable(RCC_USART2);
|
||||
|
||||
/* Enable DMA1 clock */
|
||||
rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_DMA1EN);
|
||||
rcc_periph_clock_enable(RCC_DMA1);
|
||||
}
|
||||
|
||||
static void usart_setup(void)
|
||||
|
||||
@@ -27,13 +27,13 @@ static void clock_setup(void)
|
||||
rcc_clock_setup_in_hse_12mhz_out_72mhz();
|
||||
|
||||
/* Enable GPIOA clock (for LED GPIOs). */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN | RCC_APB2ENR_IOPCEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
|
||||
/* Enable clocks for GPIO port A (for GPIO_USART2_TX) and USART2. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN |
|
||||
RCC_APB2ENR_AFIOEN);
|
||||
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USART2EN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_AFIO);
|
||||
rcc_periph_clock_enable(RCC_USART2);
|
||||
}
|
||||
|
||||
static void usart_setup(void)
|
||||
|
||||
@@ -120,12 +120,11 @@ static void clock_setup(void)
|
||||
rcc_clock_setup_in_hse_12mhz_out_72mhz();
|
||||
|
||||
/* Enable GPIOA clock (for LED GPIOs). */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
|
||||
/* Enable clocks for GPIO port A (for GPIO_USART2_TX) and USART2. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN |
|
||||
RCC_APB2ENR_AFIOEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USART2EN);
|
||||
rcc_periph_clock_enable(RCC_AFIO);
|
||||
rcc_periph_clock_enable(RCC_USART2);
|
||||
}
|
||||
|
||||
static void usart_setup(void)
|
||||
|
||||
@@ -32,12 +32,12 @@ static void clock_setup(void)
|
||||
rcc_clock_setup_in_hse_12mhz_out_72mhz();
|
||||
|
||||
/* Enable GPIOA clock (for LED GPIOs). */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
|
||||
/* Enable clocks for GPIO port A (for GPIO_USART2_TX) and USART2. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN |
|
||||
RCC_APB2ENR_AFIOEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USART2EN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_AFIO);
|
||||
rcc_periph_clock_enable(RCC_USART2);
|
||||
}
|
||||
|
||||
static void usart_setup(void)
|
||||
|
||||
@@ -26,7 +26,7 @@ static void clock_setup(void)
|
||||
rcc_clock_setup_in_hse_8mhz_out_72mhz();
|
||||
|
||||
/* Enable GPIOC clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
}
|
||||
|
||||
static void gpio_setup(void)
|
||||
|
||||
@@ -241,11 +241,11 @@ static void clock_setup(void)
|
||||
rcc_clock_setup_in_hse_8mhz_out_72mhz();
|
||||
|
||||
/* Enable TIM1 clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_TIM1EN);
|
||||
rcc_periph_clock_enable(RCC_TIM1);
|
||||
|
||||
/* Enable GPIOC, Alternate Function clocks. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR,
|
||||
RCC_APB2ENR_IOPAEN | RCC_APB2ENR_AFIOEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_AFIO);
|
||||
}
|
||||
|
||||
static void gpio_setup(void)
|
||||
|
||||
@@ -49,10 +49,10 @@ struct can_rx_msg can_rx_msg;
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
/* Enable Alternate Function clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN);
|
||||
rcc_periph_clock_enable(RCC_AFIO);
|
||||
|
||||
/* Enable GPIOB clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
|
||||
/* Preconfigure LEDs. */
|
||||
gpio_set(GPIOB, GPIO4); /* LED green off */
|
||||
@@ -87,9 +87,9 @@ static void systick_setup(void)
|
||||
static void can_setup(void)
|
||||
{
|
||||
/* Enable peripheral clocks. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_CAN1EN);
|
||||
rcc_periph_clock_enable(RCC_AFIO);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
rcc_periph_clock_enable(RCC_CAN1);
|
||||
|
||||
AFIO_MAPR |= AFIO_MAPR_CAN1_REMAP_PORTB;
|
||||
|
||||
|
||||
@@ -26,10 +26,10 @@ static void clock_setup(void)
|
||||
rcc_clock_setup_in_hsi_out_64mhz();
|
||||
|
||||
/* Enable alternate function peripheral clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN);
|
||||
rcc_periph_clock_enable(RCC_AFIO);
|
||||
|
||||
/* Enable GPIOB clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
}
|
||||
|
||||
static void gpio_setup(void)
|
||||
|
||||
@@ -28,10 +28,10 @@ uint32_t temp32;
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
/* Enable alternate function peripheral clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN);
|
||||
rcc_periph_clock_enable(RCC_AFIO);
|
||||
|
||||
/* Enable GPIOB clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
|
||||
gpio_clear(GPIOB, GPIO4); /* LED green on */
|
||||
gpio_set(GPIOB, GPIO5); /* LED red off */
|
||||
|
||||
@@ -26,9 +26,9 @@ static void clock_setup(void)
|
||||
rcc_clock_setup_in_hsi_out_64mhz();
|
||||
|
||||
/* Enable clocks for GPIO port B (for GPIO_USART1_TX and LED) and USART1. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_USART1EN);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
rcc_periph_clock_enable(RCC_AFIO);
|
||||
rcc_periph_clock_enable(RCC_USART1);
|
||||
}
|
||||
|
||||
static void usart_setup(void)
|
||||
|
||||
@@ -50,10 +50,10 @@ struct can_rx_msg can_rx_msg;
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
/* Enable GPIOA clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
|
||||
/* Enable GPIOB clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
|
||||
gpio_set(GPIOA, GPIO6); /* LED0 off */
|
||||
gpio_set(GPIOA, GPIO7); /* LED1 off */
|
||||
@@ -91,9 +91,9 @@ static void systick_setup(void)
|
||||
static void can_setup(void)
|
||||
{
|
||||
/* Enable peripheral clocks. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_CANEN);
|
||||
rcc_periph_clock_enable(RCC_AFIO);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_CAN);
|
||||
|
||||
/* Configure CAN pin: RX (input pull-up). */
|
||||
gpio_set_mode(GPIOA, GPIO_MODE_INPUT,
|
||||
|
||||
@@ -27,10 +27,10 @@ static void clock_setup(void)
|
||||
rcc_clock_setup_in_hse_8mhz_out_72mhz();
|
||||
|
||||
/* Enable GPIOA clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
|
||||
/* Enable GPIOB clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
}
|
||||
|
||||
static void gpio_setup(void)
|
||||
|
||||
@@ -241,13 +241,12 @@ static void clock_setup(void)
|
||||
rcc_clock_setup_in_hse_8mhz_out_72mhz();
|
||||
|
||||
/* Enable TIM3 clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_TIM3EN);
|
||||
rcc_periph_clock_enable(RCC_TIM3);
|
||||
|
||||
/* Enable GPIOC, Alternate Function clocks. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR,
|
||||
RCC_APB2ENR_IOPAEN |
|
||||
RCC_APB2ENR_IOPBEN |
|
||||
RCC_APB2ENR_AFIOEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
rcc_periph_clock_enable(RCC_AFIO);
|
||||
}
|
||||
|
||||
static void gpio_setup(void)
|
||||
|
||||
@@ -29,10 +29,10 @@ uint32_t temp32;
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
/* Enable GPIOA clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
|
||||
/* Enable GPIOB clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
|
||||
gpio_set(GPIOA, GPIO6); /* LED0 off */
|
||||
gpio_set(GPIOA, GPIO7); /* LED1 off */
|
||||
|
||||
@@ -26,12 +26,12 @@ static void clock_setup(void)
|
||||
rcc_clock_setup_in_hse_8mhz_out_72mhz();
|
||||
|
||||
/* Enable GPIOA clock (for LED GPIOs). */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
|
||||
/* Enable clocks for GPIO port B (for GPIO_USART1_TX) and USART1. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_USART1EN);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
rcc_periph_clock_enable(RCC_AFIO);
|
||||
rcc_periph_clock_enable(RCC_USART1);
|
||||
}
|
||||
|
||||
static void usart_setup(void)
|
||||
|
||||
@@ -27,12 +27,12 @@ static void clock_setup(void)
|
||||
rcc_clock_setup_in_hse_8mhz_out_72mhz();
|
||||
|
||||
/* Enable GPIOA clock (for LED GPIOs). */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
|
||||
/* Enable clocks for GPIO port B (for GPIO_USART1_TX) and USART1. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_USART1EN);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
rcc_periph_clock_enable(RCC_AFIO);
|
||||
rcc_periph_clock_enable(RCC_USART1);
|
||||
}
|
||||
|
||||
static void usart_setup(void)
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
static void usart_setup(void)
|
||||
{
|
||||
/* Enable clocks for GPIO port A (for GPIO_USART1_TX) and USART1. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_USART1EN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_USART1);
|
||||
|
||||
/* Setup GPIO pin GPIO_USART1_TX/GPIO9 on GPIO port A for transmit. */
|
||||
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ,
|
||||
@@ -48,7 +48,7 @@ static void usart_setup(void)
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
/* Enable GPIOB clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
|
||||
/* Set GPIO6/7 (in GPIO port B) to 'output push-pull' for the LEDs. */
|
||||
gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_2_MHZ,
|
||||
@@ -61,7 +61,7 @@ static void adc_setup(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_ADC1EN);
|
||||
rcc_periph_clock_enable(RCC_ADC1);
|
||||
|
||||
/* Make sure the ADC doesn't run during config. */
|
||||
adc_off(ADC1);
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
static void usart_setup(void)
|
||||
{
|
||||
/* Enable clocks for GPIO port A (for GPIO_USART1_TX) and USART1. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_USART1EN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_USART1);
|
||||
|
||||
/* Setup GPIO pin GPIO_USART1_TX/GPIO9 on GPIO port A for transmit. */
|
||||
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ,
|
||||
@@ -48,7 +48,7 @@ static void usart_setup(void)
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
/* Enable GPIOB clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
|
||||
/* Set GPIO6/7 (in GPIO port B) to 'output push-pull' for the LEDs. */
|
||||
gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_2_MHZ,
|
||||
@@ -84,7 +84,7 @@ int main(void)
|
||||
my_usart_print_string(USART1, "s1 ");
|
||||
my_usart_print_string(USART1, s1);
|
||||
|
||||
rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_DMA1EN);
|
||||
rcc_periph_clock_enable(RCC_DMA1);
|
||||
|
||||
/* MEM2MEM mode for channel 1. */
|
||||
dma_enable_mem2mem_mode(DMA1, DMA_CHANNEL1);
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
/* Enable GPIOB clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
|
||||
/* Set GPIO6/7 (in GPIO port B) to 'output push-pull' for the LEDs. */
|
||||
gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_2_MHZ,
|
||||
@@ -57,7 +57,7 @@ static void spi_setup(void)
|
||||
{
|
||||
/* The DOGM128 display is connected to SPI2, so initialise it. */
|
||||
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_SPI2EN);
|
||||
rcc_periph_clock_enable(RCC_SPI2);
|
||||
|
||||
spi_set_unidirectional_mode(DOGM128_SPI); /* We want to send only. */
|
||||
spi_disable_crc(DOGM128_SPI); /* No CRC for this slave. */
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
static void usart_setup(void)
|
||||
{
|
||||
/* Enable clocks for GPIO port A (for GPIO_USART1_TX) and USART1. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_USART1EN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_USART1);
|
||||
|
||||
/* Setup GPIO pin GPIO_USART1_TX/GPIO9 on GPIO port A for transmit. */
|
||||
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ,
|
||||
@@ -49,7 +49,7 @@ static void usart_setup(void)
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
/* Enable GPIOB clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
|
||||
/* Set GPIO6/7 (in GPIO port B) to 'output push-pull' for the LEDs. */
|
||||
gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_2_MHZ,
|
||||
@@ -61,8 +61,8 @@ static void gpio_setup(void)
|
||||
static void i2c_setup(void)
|
||||
{
|
||||
/* Enable clocks for I2C2 and AFIO. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_I2C2EN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN);
|
||||
rcc_periph_clock_enable(RCC_I2C2);
|
||||
rcc_periph_clock_enable(RCC_AFIO);
|
||||
|
||||
/* Set alternate functions for the SCL and SDA pins of I2C2. */
|
||||
gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_50_MHZ,
|
||||
|
||||
@@ -29,11 +29,11 @@ static void clock_setup(void)
|
||||
rcc_clock_setup_in_hse_8mhz_out_72mhz();
|
||||
|
||||
/* Enable GPIOC clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
|
||||
/* Enable clocks for GPIO port A (for GPIO_USART1_TX) and USART1. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_USART1EN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_USART1);
|
||||
}
|
||||
|
||||
static void usart_setup(void)
|
||||
|
||||
@@ -28,7 +28,7 @@ uint32_t temp32;
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
/* Enable GPIOB clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
|
||||
/* Set GPIO6/7 (in GPIO port B) to 'output push-pull' for the LEDs. */
|
||||
gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_2_MHZ,
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
/* Enable GPIOB clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
|
||||
/* Set GPIO6/7 (in GPIO port B) to 'output push-pull' for the LEDs. */
|
||||
gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_2_MHZ,
|
||||
@@ -57,7 +57,7 @@ int main(void)
|
||||
gpio_clear(GPIOB, GPIO7); /* LED1 on */
|
||||
gpio_set(GPIOB, GPIO6); /* LED2 off */
|
||||
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_TIM2EN);
|
||||
rcc_periph_clock_enable(RCC_TIM2);
|
||||
|
||||
/*
|
||||
* The goal is to let the LED2 glow for a second and then be
|
||||
|
||||
@@ -237,8 +237,8 @@ int main(void)
|
||||
|
||||
rcc_clock_setup_in_hsi_out_48mhz();
|
||||
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_AFIO);
|
||||
|
||||
AFIO_MAPR |= AFIO_MAPR_SWJ_CFG_JTAG_OFF_SW_ON;
|
||||
|
||||
|
||||
@@ -233,7 +233,7 @@ int main(void)
|
||||
{
|
||||
usbd_device *usbd_dev;
|
||||
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
|
||||
if (!gpio_get(GPIOA, GPIO10)) {
|
||||
/* Boot the application if it's valid. */
|
||||
@@ -250,13 +250,13 @@ int main(void)
|
||||
|
||||
rcc_clock_setup_in_hsi_out_48mhz();
|
||||
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_AFIO);
|
||||
|
||||
AFIO_MAPR |= AFIO_MAPR_SWJ_CFG_JTAG_OFF_SW_ON;
|
||||
gpio_set_mode(GPIOA, GPIO_MODE_INPUT, 0, GPIO15);
|
||||
|
||||
rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_OTGFSEN);
|
||||
rcc_periph_clock_enable(RCC_OTGFS);
|
||||
|
||||
usbd_dev = usbd_init(&stm32f107_usb_driver, &dev, &config, usb_strings, 4, usbd_control_buffer, sizeof(usbd_control_buffer));
|
||||
usbd_register_control_callback(
|
||||
|
||||
@@ -279,8 +279,8 @@ int main(void)
|
||||
{
|
||||
rcc_clock_setup_in_hsi_out_48mhz();
|
||||
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_AFIO);
|
||||
|
||||
AFIO_MAPR |= AFIO_MAPR_SWJ_CFG_JTAG_OFF_SW_ON;
|
||||
gpio_set_mode(GPIOA, GPIO_MODE_INPUT, 0, GPIO15);
|
||||
|
||||
@@ -34,7 +34,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 GPIO12 (in GPIO port C) to 'output push-pull'. */
|
||||
gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_50_MHZ,
|
||||
@@ -44,7 +44,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 GPIO0 (in GPIO port A) to 'input open-drain'. */
|
||||
gpio_set_mode(GPIOA, GPIO_MODE_INPUT, GPIO_CNF_INPUT_FLOAT, GPIO0);
|
||||
|
||||
@@ -34,7 +34,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 GPIO12 (in GPIO port C) to 'output push-pull'. */
|
||||
gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_50_MHZ,
|
||||
@@ -44,10 +44,10 @@ static void gpio_setup(void)
|
||||
static void exti_setup(void)
|
||||
{
|
||||
/* Enable GPIOA clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
|
||||
/* Enable AFIO clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN);
|
||||
rcc_periph_clock_enable(RCC_AFIO);
|
||||
|
||||
/* Enable EXTI0 interrupt. */
|
||||
nvic_enable_irq(NVIC_EXTI0_IRQ);
|
||||
|
||||
@@ -37,7 +37,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 GPIO12 (in GPIO port C) to 'output push-pull'. */
|
||||
gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_50_MHZ,
|
||||
@@ -47,10 +47,10 @@ static void gpio_setup(void)
|
||||
static void exti_setup(void)
|
||||
{
|
||||
/* Enable GPIOA clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
|
||||
/* Enable AFIO clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN);
|
||||
rcc_periph_clock_enable(RCC_AFIO);
|
||||
|
||||
/* Enable EXTI0 interrupt. */
|
||||
nvic_enable_irq(NVIC_EXTI0_IRQ);
|
||||
|
||||
@@ -26,7 +26,7 @@ static void clock_setup(void)
|
||||
rcc_clock_setup_in_hse_8mhz_out_72mhz();
|
||||
|
||||
/* Enable GPIOC clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
}
|
||||
|
||||
static void gpio_setup(void)
|
||||
|
||||
@@ -68,8 +68,8 @@ static void clock_setup(void)
|
||||
rcc_clock_setup_in_hse_8mhz_out_72mhz();
|
||||
|
||||
/* Enable GPIOB and GPIOC clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
}
|
||||
|
||||
static void gpio_setup(void)
|
||||
|
||||
@@ -26,7 +26,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 GPIO12 (in GPIO port C) to 'output push-pull'. */
|
||||
/* Manually: */
|
||||
|
||||
@@ -36,7 +36,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 GPIO12 (in GPIO port C) to 'output push-pull'. */
|
||||
gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_50_MHZ,
|
||||
@@ -46,10 +46,10 @@ static void gpio_setup(void)
|
||||
static void exti_setup(void)
|
||||
{
|
||||
/* Enable GPIOA clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
|
||||
/* Enable AFIO clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN);
|
||||
rcc_periph_clock_enable(RCC_AFIO);
|
||||
|
||||
/* Enable EXTI0 interrupt. */
|
||||
nvic_enable_irq(NVIC_EXTI0_IRQ);
|
||||
@@ -83,12 +83,12 @@ void exti0_isr(void)
|
||||
static void tim_setup(void)
|
||||
{
|
||||
/* Enable TIM1 clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_TIM1EN);
|
||||
rcc_periph_clock_enable(RCC_TIM1);
|
||||
|
||||
/* Enable GPIOA, GPIOB and Alternate Function clocks. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR,
|
||||
RCC_APB2ENR_IOPAEN |
|
||||
RCC_APB2ENR_IOPBEN | RCC_APB2ENR_AFIOEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
rcc_periph_clock_enable(RCC_AFIO);
|
||||
|
||||
/*
|
||||
* Set TIM1 channel output pins to
|
||||
|
||||
@@ -59,7 +59,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 GPIO12 (in GPIO port C) to 'output push-pull'. */
|
||||
gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_50_MHZ,
|
||||
@@ -71,7 +71,7 @@ static void gpio_setup(void)
|
||||
static void tim_setup(void)
|
||||
{
|
||||
/* Enable TIM2 clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_TIM2EN);
|
||||
rcc_periph_clock_enable(RCC_TIM2);
|
||||
|
||||
/* Enable TIM2 interrupt. */
|
||||
nvic_enable_irq(NVIC_TIM2_IRQ);
|
||||
|
||||
@@ -30,7 +30,7 @@ static void clock_setup(void)
|
||||
rcc_clock_setup_in_hse_8mhz_out_72mhz();
|
||||
|
||||
/* Enable GPIOC clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
}
|
||||
|
||||
static void trace_setup(void)
|
||||
|
||||
@@ -26,15 +26,14 @@ static void clock_setup(void)
|
||||
rcc_clock_setup_in_hse_8mhz_out_72mhz();
|
||||
|
||||
/* Enable GPIOC clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR,
|
||||
RCC_APB2ENR_IOPAEN | RCC_APB2ENR_IOPBEN |
|
||||
RCC_APB2ENR_IOPCEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
|
||||
/* Enable clocks for GPIO port B (for GPIO_USART3_TX) and USART3. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_USART1EN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR,
|
||||
RCC_APB1ENR_USART2EN |
|
||||
RCC_APB1ENR_USART3EN);
|
||||
rcc_periph_clock_enable(RCC_USART1);
|
||||
rcc_periph_clock_enable(RCC_USART2);
|
||||
rcc_periph_clock_enable(RCC_USART3);
|
||||
}
|
||||
|
||||
static void usart_setup(void)
|
||||
|
||||
@@ -27,11 +27,12 @@ static void clock_setup(void)
|
||||
rcc_clock_setup_in_hse_8mhz_out_72mhz();
|
||||
|
||||
/* Enable GPIOA clock (for LED GPIOs). */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
|
||||
/* Enable clocks for GPIO port A (for GPIO_USART1_TX) and USART1. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN |
|
||||
RCC_APB2ENR_AFIOEN | RCC_APB2ENR_USART1EN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_AFIO);
|
||||
rcc_periph_clock_enable(RCC_USART1);
|
||||
}
|
||||
|
||||
static void usart_setup(void)
|
||||
|
||||
@@ -120,11 +120,12 @@ static void clock_setup(void)
|
||||
rcc_clock_setup_in_hse_8mhz_out_72mhz();
|
||||
|
||||
/* Enable GPIOA clock (for LED GPIOs). */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
|
||||
/* Enable clocks for GPIO port A (for GPIO_USART1_TX) and USART1. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN |
|
||||
RCC_APB2ENR_AFIOEN | RCC_APB2ENR_USART1EN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_AFIO);
|
||||
rcc_periph_clock_enable(RCC_USART1);
|
||||
}
|
||||
|
||||
static void usart_setup(void)
|
||||
|
||||
@@ -32,11 +32,12 @@ static void clock_setup(void)
|
||||
rcc_clock_setup_in_hse_8mhz_out_72mhz();
|
||||
|
||||
/* Enable GPIOA clock (for LED GPIOs). */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
|
||||
/* Enable clocks for GPIO port A (for GPIO_USART1_TX) and USART1. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN |
|
||||
RCC_APB2ENR_AFIOEN | RCC_APB2ENR_USART1EN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_AFIO);
|
||||
rcc_periph_clock_enable(RCC_USART1);
|
||||
}
|
||||
|
||||
static void usart_setup(void)
|
||||
|
||||
@@ -240,7 +240,7 @@ int main(void)
|
||||
|
||||
rcc_clock_setup_in_hsi_out_48mhz();
|
||||
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
|
||||
gpio_set(GPIOC, GPIO11);
|
||||
gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_2_MHZ,
|
||||
|
||||
@@ -233,7 +233,7 @@ int main(void)
|
||||
{
|
||||
usbd_device *usbd_dev;
|
||||
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
|
||||
if (!gpio_get(GPIOA, GPIO10)) {
|
||||
/* Boot the application if it's valid. */
|
||||
@@ -250,7 +250,7 @@ int main(void)
|
||||
|
||||
rcc_clock_setup_in_hsi_out_48mhz();
|
||||
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
|
||||
gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_50_MHZ,
|
||||
GPIO_CNF_OUTPUT_PUSHPULL, GPIO11);
|
||||
|
||||
@@ -280,7 +280,7 @@ int main(void)
|
||||
|
||||
rcc_clock_setup_in_hsi_out_48mhz();
|
||||
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
|
||||
gpio_set(GPIOC, GPIO11);
|
||||
gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_2_MHZ,
|
||||
|
||||
@@ -233,7 +233,7 @@ int main(void)
|
||||
{
|
||||
usbd_device *usbd_dev;
|
||||
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
|
||||
if (!gpio_get(GPIOA, GPIO10)) {
|
||||
/* Boot the application if it's valid. */
|
||||
@@ -250,8 +250,8 @@ int main(void)
|
||||
|
||||
rcc_clock_setup_in_hsi_out_48mhz();
|
||||
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_AFIO);
|
||||
|
||||
AFIO_MAPR |= AFIO_MAPR_SWJ_CFG_JTAG_OFF_SW_ON;
|
||||
gpio_set_mode(GPIOA, GPIO_MODE_INPUT, 0, GPIO15);
|
||||
|
||||
@@ -27,7 +27,7 @@ static void clock_setup(void)
|
||||
rcc_clock_setup_in_hse_25mhz_out_72mhz();
|
||||
|
||||
/* Enable GPIOC clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
}
|
||||
|
||||
static void gpio_setup(void)
|
||||
|
||||
@@ -86,7 +86,9 @@ static void init_system(void)
|
||||
|
||||
static void init_usart(void)
|
||||
{
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_USART1EN | RCC_APB2ENR_IOPAEN | RCC_APB2ENR_AFIOEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_AFIO);
|
||||
rcc_periph_clock_enable(RCC_USART1);
|
||||
|
||||
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART1_TX);
|
||||
gpio_set_mode(GPIOA, GPIO_MODE_INPUT, GPIO_CNF_INPUT_FLOAT, GPIO_USART1_RX);
|
||||
|
||||
@@ -102,9 +102,9 @@ int main(void)
|
||||
|
||||
rcc_clock_setup_in_hse_25mhz_out_72mhz();
|
||||
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
|
||||
rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_OTGFSEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
rcc_periph_clock_enable(RCC_OTGFS);
|
||||
|
||||
/* LED output */
|
||||
gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_2_MHZ,
|
||||
|
||||
@@ -26,7 +26,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 GPIO5 (in GPIO port A) to 'output push-pull'. */
|
||||
/* Manually: */
|
||||
|
||||
@@ -26,10 +26,10 @@ static void clock_setup(void)
|
||||
rcc_clock_setup_in_hse_8mhz_out_72mhz();
|
||||
|
||||
/* Enable GPIOA clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
|
||||
/* Enable clocks for GPIO port A (for GPIO_USART2_TX) and USART2. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USART2EN);
|
||||
rcc_periph_clock_enable(RCC_USART2);
|
||||
}
|
||||
|
||||
static void usart_setup(void)
|
||||
|
||||
@@ -28,10 +28,10 @@ static void clock_setup(void)
|
||||
rcc_clock_setup_in_hse_8mhz_out_72mhz();
|
||||
|
||||
/* Enable GPIOA clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
|
||||
/* Enable clocks for GPIO port A (for LED GPIO_USART2_TX) and USART2. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USART2EN);
|
||||
rcc_periph_clock_enable(RCC_USART2);
|
||||
}
|
||||
|
||||
static void usart_setup(void)
|
||||
|
||||
@@ -243,8 +243,8 @@ int main(void)
|
||||
|
||||
rcc_clock_setup_in_hse_8mhz_out_72mhz();
|
||||
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN |
|
||||
RCC_APB2ENR_IOPCEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
|
||||
/* Setup GPIOC Pin 12 to pull up the D+ high, so autodect works
|
||||
* with the bootloader. The circuit is active low. */
|
||||
|
||||
@@ -39,13 +39,13 @@ static void clock_setup(void)
|
||||
{
|
||||
rcc_clock_setup_in_hsi_out_24mhz();
|
||||
/* Enable clocks for USART2 and DAC*/
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USART2EN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_DACEN);
|
||||
rcc_periph_clock_enable(RCC_USART2);
|
||||
rcc_periph_clock_enable(RCC_DAC);
|
||||
|
||||
/* and the ADC and IO ports */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_ADC1EN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
rcc_periph_clock_enable(RCC_ADC1);
|
||||
}
|
||||
|
||||
static void usart_setup(void)
|
||||
|
||||
@@ -32,7 +32,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,
|
||||
@@ -42,7 +42,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 GPIO0 (in GPIO port A) to 'input open-drain'. */
|
||||
gpio_set_mode(GPIOA, GPIO_MODE_INPUT, GPIO_CNF_INPUT_FLOAT, GPIO0);
|
||||
|
||||
@@ -28,7 +28,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)
|
||||
|
||||
@@ -26,7 +26,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 GPIO8 (in GPIO port C) to 'output push-pull'. */
|
||||
/* Manually: */
|
||||
|
||||
@@ -30,11 +30,11 @@ 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);
|
||||
|
||||
/* Enable clocks for GPIO port A (for GPIO_USART1_TX) and USART1. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_USART1EN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_USART1);
|
||||
}
|
||||
|
||||
static void usart_setup(void)
|
||||
|
||||
@@ -26,11 +26,11 @@ 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);
|
||||
|
||||
/* Enable clocks for GPIO port A (for GPIO_USART1_TX) and USART1. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_USART1EN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_USART1);
|
||||
}
|
||||
|
||||
static void usart_setup(void)
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
/* Enable GPIOC clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_AHB1ENR, RCC_AHB1ENR_IOPCEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
|
||||
/* Set GPIO3 and GPIO4 (in GPIO port C) to 'output push-pull'. */
|
||||
gpio_mode_setup(GPIOC, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO3 | GPIO4);
|
||||
|
||||
@@ -31,10 +31,11 @@ int _write(int file, char *ptr, int len);
|
||||
static void clock_setup(void)
|
||||
{
|
||||
/* Enable clocks on all the peripherals we are going to use. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_SPI2EN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_USART1EN);
|
||||
rcc_peripheral_enable_clock(&RCC_AHB1ENR,
|
||||
RCC_AHB1ENR_IOPCEN | RCC_AHB1ENR_IOPAEN | RCC_AHB1ENR_IOPBEN);
|
||||
rcc_periph_clock_enable(RCC_SPI2);
|
||||
rcc_periph_clock_enable(RCC_USART1);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
}
|
||||
|
||||
static void spi_setup(void)
|
||||
|
||||
@@ -30,9 +30,9 @@ int _write(int file, char *ptr, int len);
|
||||
static void clock_setup(void)
|
||||
{
|
||||
/* Enable clocks on all the peripherals we are going to use. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_USART1EN);
|
||||
rcc_peripheral_enable_clock(&RCC_AHB1ENR,
|
||||
RCC_AHB1ENR_IOPCEN | RCC_AHB1ENR_IOPAEN);
|
||||
rcc_periph_clock_enable(RCC_USART1);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
}
|
||||
|
||||
static void usart_setup(void)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -26,14 +26,14 @@
|
||||
static void clock_setup(void)
|
||||
{
|
||||
/* Enable GPIOD clock for LED & USARTs. */
|
||||
rcc_peripheral_enable_clock(&RCC_AHB1ENR, RCC_AHB1ENR_IOPDEN);
|
||||
rcc_peripheral_enable_clock(&RCC_AHB1ENR, RCC_AHB1ENR_IOPAEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOD);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
|
||||
/* Enable clocks for USART2. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USART2EN);
|
||||
rcc_periph_clock_enable(RCC_USART2);
|
||||
|
||||
/* Enable clocks for CRYP. */
|
||||
rcc_peripheral_enable_clock(&RCC_AHB2ENR, RCC_AHB2ENR_CRYPEN);
|
||||
rcc_periph_clock_enable(RCC_CRYP);
|
||||
}
|
||||
|
||||
static void usart_setup(void)
|
||||
|
||||
@@ -38,15 +38,15 @@ static void clock_setup(void)
|
||||
{
|
||||
rcc_clock_setup_hse_3v3(&hse_8mhz_3v3[CLOCK_3V3_168MHZ]);
|
||||
/* Enable GPIOD clock for LED & USARTs. */
|
||||
rcc_peripheral_enable_clock(&RCC_AHB1ENR, RCC_AHB1ENR_IOPDEN);
|
||||
rcc_peripheral_enable_clock(&RCC_AHB1ENR, RCC_AHB1ENR_IOPAEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOD);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
|
||||
/* Enable clocks for USART2 and dac */
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USART2EN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_DACEN);
|
||||
rcc_periph_clock_enable(RCC_USART2);
|
||||
rcc_periph_clock_enable(RCC_DAC);
|
||||
|
||||
/* And ADC*/
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_ADC1EN);
|
||||
rcc_periph_clock_enable(RCC_ADC1);
|
||||
}
|
||||
|
||||
static void usart_setup(void)
|
||||
|
||||
@@ -33,7 +33,7 @@ static void clock_setup(void)
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
/* Enable GPIOD clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_AHB1ENR, RCC_AHB1ENR_IOPDEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOD);
|
||||
|
||||
/* Set GPIO12 (in GPIO port D) to 'output push-pull'. */
|
||||
gpio_mode_setup(GPIOD, GPIO_MODE_OUTPUT,
|
||||
@@ -43,7 +43,7 @@ static void gpio_setup(void)
|
||||
static void button_setup(void)
|
||||
{
|
||||
/* Enable GPIOA clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_AHB1ENR, RCC_AHB1ENR_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_hse_3v3(&hse_8mhz_3v3[CLOCK_3V3_168MHZ]);
|
||||
|
||||
/* Enable GPIOD clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_AHB1ENR, RCC_AHB1ENR_IOPDEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOD);
|
||||
}
|
||||
|
||||
static void gpio_setup(void)
|
||||
|
||||
@@ -29,11 +29,11 @@ static void clock_setup(void)
|
||||
rcc_clock_setup_hse_3v3(&hse_8mhz_3v3[CLOCK_3V3_120MHZ]);
|
||||
|
||||
/* Enable GPIOD clock for LED & USARTs. */
|
||||
rcc_peripheral_enable_clock(&RCC_AHB1ENR, RCC_AHB1ENR_IOPDEN);
|
||||
rcc_peripheral_enable_clock(&RCC_AHB1ENR, RCC_AHB1ENR_IOPAEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOD);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
|
||||
/* Enable clocks for USART2. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USART2EN);
|
||||
rcc_periph_clock_enable(RCC_USART2);
|
||||
}
|
||||
|
||||
static void usart_setup(void)
|
||||
|
||||
@@ -27,7 +27,7 @@ static void gpio_setup(void)
|
||||
/* Manually: */
|
||||
// RCC_AHB1ENR |= RCC_AHB1ENR_IOPDEN;
|
||||
/* Using API functions: */
|
||||
rcc_peripheral_enable_clock(&RCC_AHB1ENR, RCC_AHB1ENR_IOPDEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOD);
|
||||
|
||||
/* Set GPIO12 (in GPIO port D) to 'output push-pull'. */
|
||||
/* Manually: */
|
||||
|
||||
@@ -26,10 +26,10 @@ static void rcc_setup(void)
|
||||
rcc_clock_setup_hse_3v3(&hse_8mhz_3v3[CLOCK_3V3_120MHZ]);
|
||||
|
||||
/* Enable GPIOD clock for onboard leds. */
|
||||
rcc_peripheral_enable_clock(&RCC_AHB1ENR, RCC_AHB1ENR_IOPDEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOD);
|
||||
|
||||
/* Enable rng clock */
|
||||
rcc_peripheral_enable_clock(&RCC_AHB2ENR, RCC_AHB2ENR_RNGEN);
|
||||
rcc_periph_clock_enable(RCC_RNG);
|
||||
}
|
||||
|
||||
static void rng_setup(void)
|
||||
|
||||
@@ -62,7 +62,7 @@ static void clock_setup(void)
|
||||
rcc_clock_setup_hse_3v3(&hse_8mhz_3v3[CLOCK_3V3_168MHZ]);
|
||||
|
||||
/* Enable GPIOD clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_AHB1ENR, RCC_AHB1ENR_IOPDEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOD);
|
||||
}
|
||||
|
||||
static void gpio_setup(void)
|
||||
|
||||
@@ -25,11 +25,11 @@
|
||||
static void clock_setup(void)
|
||||
{
|
||||
/* Enable GPIOD clock for LED & USARTs. */
|
||||
rcc_peripheral_enable_clock(&RCC_AHB1ENR, RCC_AHB1ENR_IOPDEN);
|
||||
rcc_peripheral_enable_clock(&RCC_AHB1ENR, RCC_AHB1ENR_IOPAEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOD);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
|
||||
/* Enable clocks for USART2. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USART2EN);
|
||||
rcc_periph_clock_enable(RCC_USART2);
|
||||
}
|
||||
|
||||
static void usart_setup(void)
|
||||
|
||||
@@ -27,11 +27,11 @@
|
||||
static void clock_setup(void)
|
||||
{
|
||||
/* Enable GPIOD clock for LED & USARTs. */
|
||||
rcc_peripheral_enable_clock(&RCC_AHB1ENR, RCC_AHB1ENR_IOPDEN);
|
||||
rcc_peripheral_enable_clock(&RCC_AHB1ENR, RCC_AHB1ENR_IOPAEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOD);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
|
||||
/* Enable clocks for USART2. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USART2EN);
|
||||
rcc_periph_clock_enable(RCC_USART2);
|
||||
}
|
||||
|
||||
static void usart_setup(void)
|
||||
|
||||
@@ -228,8 +228,8 @@ int main(void)
|
||||
|
||||
rcc_clock_setup_hse_3v3(&hse_8mhz_3v3[CLOCK_3V3_120MHZ]);
|
||||
|
||||
rcc_peripheral_enable_clock(&RCC_AHB1ENR, RCC_AHB1ENR_IOPAEN);
|
||||
rcc_peripheral_enable_clock(&RCC_AHB2ENR, RCC_AHB2ENR_OTGFSEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_OTGFS);
|
||||
|
||||
gpio_mode_setup(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE,
|
||||
GPIO9 | GPIO11 | GPIO12);
|
||||
|
||||
@@ -136,7 +136,7 @@ static void setup_button_press_timer(void)
|
||||
static int setup_rtc(void)
|
||||
{
|
||||
/* turn on power block to enable unlocking */
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_PWREN);
|
||||
rcc_periph_clock_enable(RCC_PWR);
|
||||
pwr_disable_backup_domain_write_protect();
|
||||
|
||||
/* reset rtc */
|
||||
@@ -269,13 +269,13 @@ static void reset_clocks(void)
|
||||
rcc_clock_setup_msi(&myclock_config);
|
||||
|
||||
/* buttons and uarts */
|
||||
rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_GPIOAEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
/* user feedback leds */
|
||||
rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_GPIOBEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
/* Enable clocks for USART2. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USART2EN);
|
||||
rcc_periph_clock_enable(RCC_USART2);
|
||||
/* And a timers for button presses */
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_TIM7EN);
|
||||
rcc_periph_clock_enable(RCC_TIM7);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
|
||||
@@ -37,15 +37,15 @@ static void clock_setup(void)
|
||||
{
|
||||
rcc_clock_setup_pll(&clock_config[CLOCK_VRANGE1_HSI_PLL_24MHZ]);
|
||||
/* Lots of things on all ports... */
|
||||
rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_GPIOAEN);
|
||||
rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_GPIOBEN);
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
|
||||
/* Enable clocks for USART2. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USART2EN);
|
||||
rcc_periph_clock_enable(RCC_USART2);
|
||||
|
||||
/* And timers. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_TIM6EN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_TIM7EN);
|
||||
rcc_periph_clock_enable(RCC_TIM6);
|
||||
rcc_periph_clock_enable(RCC_TIM7);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user