I have found this example on how to use onboard led
int t; // timer
RCC->CR |= 0x1; // set HSI
RCC->AHBENR 1 = RCC_AHBENR_GPIOAEN; // enable gpio port A
GPIOA->MODER |= GPIO_MODER_MODER4_0; // PA4 as input
GPIOA->OTYPER &= ~GPIO_OTYPER_OT_4; // output push-pull PA4
GPIOA->OSPEEDR &= ~GPIO_OSPEEDER_OSPEEDR4_0; // low speed PA4
GPIOA->PUPDR |= GPIO_PUPDR_PUPDR4_0; // set pull-up mode PA4
while (1) {
GPIOA->ODR |= GPIO_ODR_4; // led ON at PA4
t = 57500;
while (t > 0) t--; // countdown
GPIOA->ODR &= -GPIO_ODR_4; // led OFF at PA4
t = 57500;
while (t > 0) t--; // countdown
}
But has been written for Keil-MDK and doesn't work on Arduino IDE (it isn''t even able to recognize ~
on some lines ).
What is the correct way to use it on Arduino IDE?