skullc-peripherals/Peripherals/Inc/peripherals_pwm_channel.hpp
Erki 55a8efa579
All checks were successful
continuous-integration/drone/push Build is passing
Clang format pass
2021-04-03 17:49:25 +03:00

44 lines
718 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() = delete;
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();
void SetCompare(const std::uint32_t compare);
};
}// namespace Peripherals
#endif /* PERIPHERALS_PWM_CHANNEL_HPP_ */