/*
 * pwm.c
 *
 *  Created on: Jan 16, 2018
 *      Author: wn
 */

#include "pwm.h"
#include "stm32f1xx_hal.h"
#include <PontCoopScheduler.h>


extern TIM_HandleTypeDef htim3;


void pwmExec(void *handle) {

}

void pwmInit() {
//  schAdd(pwmExec, NULL, 0, 1000);

  __HAL_TIM_SET_AUTORELOAD(&htim3, 10000);

  __HAL_TIM_SET_COMPARE(&htim3, TIM_CHANNEL_1, 200);
  HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_1);

  __HAL_TIM_SET_COMPARE(&htim3, TIM_CHANNEL_2, 1000);
  HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_2);

  __HAL_TIM_SET_COMPARE(&htim3, TIM_CHANNEL_3, 2000);
  HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_3);

  __HAL_TIM_SET_COMPARE(&htim3, TIM_CHANNEL_4, 8000);
  HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_4);

}


