MOSAIC-LoPoW / octa-stack-students

octa-stack student version
8 stars 0 forks source link

Interrupts already defined #55

Open MatthiasW1004 opened 2 years ago

MatthiasW1004 commented 2 years ago

If I try to generate an interrupt using a push button, I can't make the bin file because the EXTI0_IRQHandler is already defined elsewhere. How can I make it use my IRQHandler? image image

MatsDeMeyer commented 2 years ago

The clean solution is using the EXTI0_IRQHandler that is already defined in the stm32l4xx_it file, and placing your code there. If you really want to use your own handler, delete the already defined one or make it "weak" so that it uses another one if there is one

MatthiasW1004 commented 2 years ago

I fixed it like this: image

MatthiasW1004 commented 2 years ago

For the RTC alarm callback, I want to use HAL_RTC_RegisterCallback. It is defined in the stm32l4xx_hal_rtc file but it does not recognize the defined parameters. image image

MatsDeMeyer commented 2 years ago

VSCode does tend to highlight stuff as undefined, does your code compile?

MatthiasW1004 commented 2 years ago

No it does not, it gives me the 'not declared' error

Klievan commented 2 years ago

Could you post the full error the compiler is giving?

MatthiasW1004 commented 2 years ago

image

MatthiasW1004 commented 2 years ago

I am also wondering why the code where this function is defined is more blurry than the code above: image

MatthiasW1004 commented 2 years ago

Do you maybe have an example in your octastack about how to use the RTC-Alarm interrupt? Or something similar?

Klievan commented 2 years ago

Hi Matthias,

Mats is unavailable right now but I'll try to help you out here. Like you noticed, the function that you're trying to call is dimmed, which means that the #if directive above is probably returning false, so the code below is not being included. Try defining USE_HAL_RTC_REGISTER_CALLBACKS to 1 in your makefile https://stackoverflow.com/questions/53288150/how-to-add-define-in-makefile

MatthiasW1004 commented 2 years ago

I changed the value in the hal_conf_template file but it still does not work. For some reason I also cannot add the define in the make file as said in the stackoverflow discussion

Klievan commented 2 years ago

Are you getting the same error?

MatthiasW1004 commented 2 years ago

image

And I get the same error. I also tried changing it here: image

MatthiasW1004 commented 2 years ago

image This is the documentation about it

Klievan commented 2 years ago

And the error remains the same? Have you tried to do a clean build?

MatthiasW1004 commented 2 years ago

Yes, tried the clean build, even tried other ways to define the USE_HAL_RTC_REGISTER_CALLBACKS but still the same error.

Klievan commented 2 years ago

Did you import ./core/ST/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rtc.h?

MatthiasW1004 commented 2 years ago

image I did like this, I think it is correct right?

Klievan commented 2 years ago

It is if you also added the correct entries in your makefile. Could you show those?

MatthiasW1004 commented 2 years ago

image

This is the full make file