NavHAL 0.1.0
NAVRobotec's architecture-agnostic HAL for embedded systems.
Loading...
Searching...
No Matches
main.c File Reference
#include <stdint.h>
Include dependency graph for main.c:

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.

Macro Definition Documentation

◆ AHB1PERIPH_BASE

#define AHB1PERIPH_BASE   (PERIPH_BASE + 0x00020000)

◆ APB1PERIPH_BASE

#define APB1PERIPH_BASE   (PERIPH_BASE + 0x00000000)

◆ GPIOA_AFRL

#define GPIOA_AFRL   (*(volatile unsigned int *)(GPIOA_BASE + 0x20))

◆ GPIOA_BASE

#define GPIOA_BASE   (AHB1PERIPH_BASE + 0x0000)

◆ GPIOA_MODER

#define GPIOA_MODER   (*(volatile unsigned int *)(GPIOA_BASE + 0x00))

◆ PERIPH_BASE

#define PERIPH_BASE   0x40000000

◆ RCC_AHB1ENR

#define RCC_AHB1ENR   (*(volatile unsigned int *)(RCC_BASE + 0x30))

◆ RCC_APB1ENR

#define RCC_APB1ENR   (*(volatile unsigned int *)(RCC_BASE + 0x40))

◆ RCC_BASE

#define RCC_BASE   (AHB1PERIPH_BASE + 0x3800)

◆ TIM2_ARR

#define TIM2_ARR   (*(volatile unsigned int *)(TIM2_BASE + 0x2C))

◆ TIM2_BASE

#define TIM2_BASE   (APB1PERIPH_BASE + 0x0000)

◆ TIM2_CCER

#define TIM2_CCER   (*(volatile unsigned int *)(TIM2_BASE + 0x20))

◆ TIM2_CCMR1

#define TIM2_CCMR1   (*(volatile unsigned int *)(TIM2_BASE + 0x18))

◆ TIM2_CCR1

#define TIM2_CCR1   (*(volatile unsigned int *)(TIM2_BASE + 0x34))

◆ TIM2_CR1

#define TIM2_CR1   (*(volatile unsigned int *)(TIM2_BASE + 0x00))

◆ TIM2_PSC

#define TIM2_PSC   (*(volatile unsigned int *)(TIM2_BASE + 0x28))

Function Documentation

◆ delay()

void delay ( void )

◆ main()

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).

◆ pwm_pa5_init()

void pwm_pa5_init ( uint32_t frequency,
float duty_cycle_percent )