// Insert compiler directives to set the optimization to zero
// We do not want the compiler to optimize out any code
#pragma GCC push_options
#pragma GCC optimize ("O0")
//Include the header file.
//In STM32 microcontroller programming, the header files provided by the
//manufacturer (STMicroelectronics) contain the necessary definitions,
//constants, and function prototypes specific to the microcontroller's peripherals
//and features.
#include "stm32c0xx.h"
//Include Systick Timer header file
#include "mySysTick.h"
int main(void)
{
// Enable GPIOD and configure PD0 as an output pin
RCC->IOPENR |= (1UL << 3);
GPIOD -> MODER &= ~(3UL);
GPIOD ->MODER |= (1UL);
//Configure PD2 as an output
GPIOD -> MODER &= ~(3UL << 4);
GPIOD ->MODER |= (1UL << 4);
while (1)
{
// Toggle the state of PD0
GPIOD ->ODR ^= (1UL);
// call a delay. Accurately timed delay using the SysTick Timer
myDelay(1000);
}
}