julian_lpp wrote: Fri Jan 10, 2025 4:57 am
ag123 wrote: Fri Jan 10, 2025 4:33 am
it would take reviewing the codes to figure out what is done, but that among the things that needs to be done at the register level are:
- to configure Timer (3) (e.g. output compare) and the output registers so that the timer output goes to the pin (seting the timer registers)
- to configure the GPIO pin so that it select AFIO instead of gpio (setting the gpio registers)
this 2 steps would make the Timer PWM outputs appear at the pin.
Cant find the sources of hardware timer lib (to watch SetMode code implementation) ... are they already in form of sources in the arduino installation or are compiled when the stm core is installed?
The 'core' is generally installed in
https://support.arduino.cc/hc/en-us/art ... r-computer
Windows: C:\Users\{username}\AppData\Local\Arduino15
macOS: /Users/{username}/Library/Arduino15
Linux: /home/{username}/.arduino15
and further in the 'hardware' folder.
In Github it is here
https://github.com/stm32duino/Arduino_C ... eTimer.cpp
One of your code is:
Code: Select all
T3_channel_3 = STM_PIN_CHANNEL(pinmap_function(digitalPinToPinName(pin_T3_CH_3_PWM), PinMap_PWM));
gTimer3PWM->setMode(T3_channel_3, TIMER_OUTPUT_COMPARE_PWM1, pin_T3_CH_3_PWM);
for pinmap_function(), the declaration is here
https://github.com/stm32duino/Arduino_C ... nmap.h#L60
the definition is here
https://github.com/stm32duino/Arduino_C ... map.c#L355
and HardwareTimer->SetMode is here
https://github.com/stm32duino/Arduino_C ... r.cpp#L635
but I think the statement that configures the gpio is this
pinMode is here
https://github.com/stm32duino/Arduino_C ... ital.c#L29
all of them quite complex codes
Off-topic:
for LCD I'd guess mainly SPI is used. So that is mainly for the backlight?
Excuse me cant guess if it was a question for me, i'm not a native speaker, not even with gpt was able to figure out this phrase
I see you are using an LCD library in your code, so I think you are using an LCD e.g. ST7735
Code: Select all
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library for ST7735
//#include <Adafruit_ST7789.h> // Hardware-specific library for ST7789
#include <SPI.h>
So I'd guess that PWM is for the backlight?