PWM based motor driver added from other project

This commit is contained in:
2024-11-16 20:04:38 +01:00
parent f6608075ff
commit 0181c72a9d
17 changed files with 1288 additions and 6 deletions
+34
View File
@@ -0,0 +1,34 @@
/**
* @file pwmPort.hpp
* @author Gustice
* @brief C++ Wrapper for PWM-output
*
* @copyright Copyright (c) 2024
*/
#pragma once
#include "driver/gpio.h"
#include "driver/ledc.h"
#include "portBase.hpp"
#include <cstdint>
/**
* @brief PWM-Class
* @details Provides Write to PWM-Port
*/
class PwmPort : public PortBase {
public:
PwmPort(ledc_timer_t timer, ledc_channel_t channel, gpio_num_t output, ledc_timer_bit_t resolution, uint32_t frequency);
~PwmPort() = default;
void write(float duty);
void writeRaw(uint16_t duty);
protected:
const uint32_t FullScale;
const ledc_timer_t _timer;
const ledc_channel_t _channel;
const gpio_num_t _port;
private:
};