#include "stm32c0xx.h"
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, STM32!");
SysTick_Init();
// while (1) {
// // Example usage of delay
// Delay_ms(1000); // Delay for 1000 milliseconds (1 second)
// Serial.println("Hello test");
// // More code
// }
}
void loop() {
// put your main code here, to run repeatedly:
// delay(10); // this speeds up the simulation
}
void SysTick_Init(void) {
// Set the reload value to generate a 1ms interval
SysTick->LOAD = SystemCoreClock / 1000 - 1;
// Set SysTick clock source to the processor clock (HCLK)
SysTick->CTRL |= SysTick_CTRL_CLKSOURCE_Msk;
// Enable SysTick interrupt and enable SysTick timer
SysTick->CTRL |= SysTick_CTRL_TICKINT_Msk | SysTick_CTRL_ENABLE_Msk;
}
// void Delay_ms(uint32_t delay_ms) {
// volatile uint32_t start_tick = SysTick->VAL; // Current SysTick value
// volatile uint32_t delay_ticks = delay_ms * (SystemCoreClock / 1000); // Number of ticks to delay
// while ((SysTick->VAL - start_tick) < delay_ticks){
// }
// }
void osSystickHandler(void){
// void SysTick_Handler(void){
Serial.println("SUcess");
}Loading
st-nucleo-l031k6
st-nucleo-l031k6