Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PWM with STM8S_StdPeriph_Driver #162

Open
BotLights opened this issue Jun 7, 2024 · 0 comments
Open

PWM with STM8S_StdPeriph_Driver #162

BotLights opened this issue Jun 7, 2024 · 0 comments

Comments

@BotLights
Copy link

Did anyone get any success using the Standard Peripheral Driver?
Couldn't get an output for timer1 channel1 on pin PC6.

Chip : STM8S003F3P6
IDE : Arduino IDE 1.8.9

Code :
void TIM1_Config(void)
{
TIM1_DeInit();
TIM1_TimeBaseInit(100, TIM1_COUNTERMODE_CENTERALIGNED3, 50, 0);
TIM1_OC1Init(TIM1_OCMODE_PWM1,
TIM1_OUTPUTSTATE_ENABLE,
TIM1_OUTPUTNSTATE_DISABLE,
25,
TIM1_OCPOLARITY_HIGH,
TIM1_OCNPOLARITY_HIGH,
TIM1_OCIDLESTATE_RESET,
TIM1_OCNIDLESTATE_RESET);
TIM1_Cmd(ENABLE);
TIM1_CtrlPWMOutputs(ENABLE);
}

void setup() {
TIM1_Config();
pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
digitalWrite(LED_BUILTIN, LOW);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant