/**************************************************************************** * * Copyright © 2015-2019 STMicroelectronics - All Rights Reserved * * This software is licensed under SLA0098 terms that can be found in the * DM00779817_1_0.pdf file in the licenses directory of this software product. * * THIS SOFTWARE IS DISTRIBUTED "AS IS," AND ALL WARRANTIES ARE DISCLAIMED, * INCLUDING MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * *****************************************************************************/ /* Inclusion of the main header files of all the imported components in the order specified in the application wizard. The file is generated automatically.*/ #include "components.h" #include "pwm_lld_cfg.h" int frrequency = 200; void pwmpcb(PWMDriver *pwmp) { (void)pwmp; // pal_lld_clearpad(PORT_A, Led_D11); } void pwmc1cb(PWMDriver *pwmp) { (void)pwmp; // pal_lld_setpad(PORT_A, Led_D11); } /* * Application entry point. */ int main(void) { /* Initialization of all the imported components in the order specified in the application wizard. The function is generated automatically.*/ componentsInit(); /* Enable IRQ */ irqIsrEnable(); pwm_lld_start(&PWMD2, &pwm_config_pwmcfg); pwm_lld_start(&PWMD3, &pwm_config_pwmcfg); pwm_lld_start(&PWMD4, &pwm_config_pwmcfg); // // pwm_lld_change_period(&PWMD2, frrequency); // pwm_lld_change_period(&PWMD3, frrequency); // pwm_lld_change_period(&PWMD4, frrequency); /* * Starts the PWM channel 0 using 75% duty cycle. */ pwm_lld_enable_channel(&PWMD2, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD2, 6000)); pwm_lld_enable_channel(&PWMD2, 1, PWM_PERCENTAGE_TO_WIDTH(&PWMD2, 6000)); pwm_lld_enable_channel(&PWMD3, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD3, 4000)); pwm_lld_enable_channel(&PWMD3, 1, PWM_PERCENTAGE_TO_WIDTH(&PWMD3, 4000)); pwm_lld_enable_channel(&PWMD4, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD4, 2000)); pwm_lld_enable_channel(&PWMD4, 1, PWM_PERCENTAGE_TO_WIDTH(&PWMD4, 2000)); osalThreadDelayMilliseconds(2000); /* Application main loop.*/ for ( ; ; ) { } }