#include <stdint.h>
Macros | |
#define | PERIPH_BASE 0x40000000 |
#define | AHB1PERIPH_BASE (PERIPH_BASE + 0x00020000) |
#define | APB1PERIPH_BASE (PERIPH_BASE + 0x00000000) |
#define | RCC_BASE (AHB1PERIPH_BASE + 0x3800) |
#define | GPIOA_BASE (AHB1PERIPH_BASE + 0x0000) |
#define | TIM2_BASE (APB1PERIPH_BASE + 0x0000) |
#define | RCC_AHB1ENR (*(volatile unsigned int *)(RCC_BASE + 0x30)) |
#define | RCC_APB1ENR (*(volatile unsigned int *)(RCC_BASE + 0x40)) |
#define | GPIOA_MODER (*(volatile unsigned int *)(GPIOA_BASE + 0x00)) |
#define | GPIOA_AFRL (*(volatile unsigned int *)(GPIOA_BASE + 0x20)) |
#define | TIM2_PSC (*(volatile unsigned int *)(TIM2_BASE + 0x28)) |
#define | TIM2_ARR (*(volatile unsigned int *)(TIM2_BASE + 0x2C)) |
#define | TIM2_CCR1 (*(volatile unsigned int *)(TIM2_BASE + 0x34)) |
#define | TIM2_CCMR1 (*(volatile unsigned int *)(TIM2_BASE + 0x18)) |
#define | TIM2_CCER (*(volatile unsigned int *)(TIM2_BASE + 0x20)) |
#define | TIM2_CR1 (*(volatile unsigned int *)(TIM2_BASE + 0x00)) |
Functions | |
void | pwm_pa5_init (uint32_t frequency, float duty_cycle_percent) |
void | delay () |
int | main (void) |
Main entry point. |
#define AHB1PERIPH_BASE (PERIPH_BASE + 0x00020000) |
#define APB1PERIPH_BASE (PERIPH_BASE + 0x00000000) |
#define GPIOA_AFRL (*(volatile unsigned int *)(GPIOA_BASE + 0x20)) |
#define GPIOA_BASE (AHB1PERIPH_BASE + 0x0000) |
#define GPIOA_MODER (*(volatile unsigned int *)(GPIOA_BASE + 0x00)) |
#define PERIPH_BASE 0x40000000 |
#define RCC_AHB1ENR (*(volatile unsigned int *)(RCC_BASE + 0x30)) |
#define RCC_APB1ENR (*(volatile unsigned int *)(RCC_BASE + 0x40)) |
#define RCC_BASE (AHB1PERIPH_BASE + 0x3800) |
#define TIM2_ARR (*(volatile unsigned int *)(TIM2_BASE + 0x2C)) |
#define TIM2_BASE (APB1PERIPH_BASE + 0x0000) |
#define TIM2_CCER (*(volatile unsigned int *)(TIM2_BASE + 0x20)) |
#define TIM2_CCMR1 (*(volatile unsigned int *)(TIM2_BASE + 0x18)) |
#define TIM2_CCR1 (*(volatile unsigned int *)(TIM2_BASE + 0x34)) |
#define TIM2_CR1 (*(volatile unsigned int *)(TIM2_BASE + 0x00)) |
#define TIM2_PSC (*(volatile unsigned int *)(TIM2_BASE + 0x28)) |
void delay | ( | void | ) |
int main | ( | void | ) |
Main entry point.
Main application entry point.
Initializes GPIOA pin 5 as output and toggles it in an infinite loop. Typically connected to an LED (e.g., onboard LED on Nucleo boards).
void pwm_pa5_init | ( | uint32_t | frequency, |
float | duty_cycle_percent ) |