CANTram Framework 1.0.1
Dieses Framework ermöglicht die Nutzung der CANTram Hardware, einer Mikrocontroller basierten mdoularen Steuerung.
Loading...
Searching...
No Matches
PWMCore Class Referenceabstract
Inheritance diagram for PWMCore:
Collaboration diagram for PWMCore:

Public Member Functions

virtual void begin ()
 Initialize PWM core resources.
virtual bool addChannel (OutputDefinition *def)=0
 Add/allocate a PWM channel for the given output definition.
virtual void setDuty (OutputDefinition *def, uint16_t duty)=0
 Set PWM duty cycle for a registered output.
HardwareResource::Type getType () override
 Get the hardware resource type.
Public Member Functions inherited from HardwareResource
virtual bool reset ()
 Reset the hardware resource to a known default state.
bool requestUsage ()
 Request a usage slot for this resource.
uint8_t getUsages ()
 Get the current number of usages of this resource.
bool isUsed ()
 Check if the resource is currently used.
virtual uint8_t getRemainingUsages ()
 Get remaining usage capacity for this resource.

Protected Member Functions

 PWMCore ()=default
 Protected default constructor.
virtual uint8_t getMaxUsages () override
 Get the maximum simultaneous usages allowed for this resource.
Protected Member Functions inherited from HardwareResource
 HardwareResource ()=default
 Default constructor.

Protected Attributes

bool _initialized =false
 Internal initialized flag.
Protected Attributes inherited from HardwareResource
uint8_t usages =0
 Current usage counter.

Additional Inherited Members

Public Types inherited from HardwareResource
enum  Type {
  UART , SPI , I2C , PWM ,
  CAN
}
 Enumeration of hardware resource types. More...

Constructor & Destructor Documentation

◆ PWMCore()

PWMCore::PWMCore ( )
protecteddefault

Protected default constructor.

Prevent direct instantiation of the base class. Derived implementations should call this constructor from their constructors.

Member Function Documentation

◆ addChannel()

virtual bool PWMCore::addChannel ( OutputDefinition * def)
pure virtual

Add/allocate a PWM channel for the given output definition.

Reserve any internal timer/channel resources required to drive PWM on the provided OutputDefinition. The implementation should validate that the OutputDefinition supports PWM and return true on success.

Parameters
defPointer to the OutputDefinition to register for PWM.
Returns
true if the channel was added/allocated successfully, false otherwise.

Implemented in ESP32PWMCore.

◆ begin()

virtual void PWMCore::begin ( )
virtual

Initialize PWM core resources.

Perform any platform-specific initialization required before PWM channels can be allocated or used. Implementations should set internal initialized state and configure timers/hardware as needed.

Returns
void

Reimplemented in ESP32PWMCore.

◆ getMaxUsages()

virtual uint8_t PWMCore::getMaxUsages ( )
inlineoverrideprotectedvirtual

Get the maximum simultaneous usages allowed for this resource.

PWMCore limits concurrent users by default to a single module (the main module). Override in derived classes only if multiple simultaneous users are supported.

Returns
uint8_t Maximum number of concurrent usages (default 1).

Reimplemented from HardwareResource.

Reimplemented in ESP32PWMCore.

◆ getType()

HardwareResource::Type PWMCore::getType ( )
inlineoverridevirtual

Get the hardware resource type.

Overrides HardwareResource::getType() to identify this resource as a PWM type.

Returns
HardwareResource::Type Type::PWM

Implements HardwareResource.

◆ setDuty()

virtual void PWMCore::setDuty ( OutputDefinition * def,
uint16_t duty )
pure virtual

Set PWM duty cycle for a registered output.

Drive the output described by def with the specified duty value. Duty units are implementation-specific but are expected to be in the range 0..4095 for 12-bit resolution.

Parameters
defPointer to the OutputDefinition to set PWM on.
dutyDuty value to apply (e.g., 0..4095 for 12-bit resolution).
Returns
void

Implemented in ESP32PWMCore.

Member Data Documentation

◆ _initialized

bool PWMCore::_initialized =false
protected

Internal initialized flag.

Indicates whether begin() has been called and hardware is ready for PWM operations.


The documentation for this class was generated from the following file:
  • C:/Users/leowa/Documents/PlatformIO/Projects/CANTramFrameworkUsage/lib/CANTramFramework/include/PWMCore.h