45 lines
630 B
C++
45 lines
630 B
C++
/*
|
|
* peripherals_pwm.hpp
|
|
*
|
|
* Created on: Feb 24, 2021
|
|
* Author: erki
|
|
*/
|
|
|
|
#ifndef PERIPHERALS_PWM_CHANNEL_HPP_
|
|
#define PERIPHERALS_PWM_CHANNEL_HPP_
|
|
|
|
#include <cstdint>
|
|
|
|
#include <tim.h>
|
|
|
|
#include "peripherals_io.hpp"
|
|
|
|
namespace Peripherals
|
|
{
|
|
|
|
struct PwmChannel
|
|
{
|
|
TIM_HandleTypeDef* timer;
|
|
std::uint32_t channel;
|
|
std::uint32_t timer_code;
|
|
IO pin;
|
|
|
|
PwmChannel() = default;
|
|
|
|
PwmChannel(TIM_HandleTypeDef* timer,
|
|
const std::uint32_t channel,
|
|
const std::uint32_t timer_code,
|
|
const IO& pin);
|
|
|
|
void PinToPwm();
|
|
void PinToGpio();
|
|
|
|
void Enable();
|
|
void Disable();
|
|
};
|
|
|
|
}
|
|
|
|
|
|
#endif /* PERIPHERALS_PWM_CHANNEL_HPP_ */
|