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

Public Types

enum  I2CStatus { I2C_NOT_STARTED =0 , I2C_STARTED =1 }
Public Types inherited from HardwareResource
enum  Type {
  UART , SPI , I2C , PWM ,
  CAN
}
 Enumeration of hardware resource types. More...

Public Member Functions

virtual bool reset ()
 Reset the hardware resource to a known default state.
virtual bool begin ()=0
virtual HardwareResource::Type getType () override
 Get the hardware resource type.
virtual void setPins (int8_t sdaPin, int8_t sclPin)
virtual void setBufferSize (uint32_t bufferSize)
virtual void setI2CNum (int8_t i2c_num)
virtual void setFrequency (uint32_t frequency)
virtual uint32_t setMaxFrequency (uint32_t frequency)
virtual void beginTransmission (uint8_t address)=0
virtual uint8_t endTransmission ()=0
virtual size_t write (uint8_t data)=0
virtual size_t write (const uint8_t *data, size_t quantity)=0
virtual size_t requestFrom (uint8_t address, size_t len, bool stopBit)=0
virtual int available ()=0
virtual int read ()=0
virtual int peek ()
virtual void flush ()=0
virtual uint8_t getMaxUsages () override
 Get the maximum simultaneous usages allowed for this resource.
virtual I2CStatus getI2CStatus () const
Public Member Functions inherited from HardwareResource
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.

Static Public Attributes

static constexpr uint32_t I2C_DEFAULT_FREQUENCY = 1700000

Protected Attributes

int8_t _sdaPin =-1
int8_t _sclPin =-1
uint32_t _frequency = I2C_DEFAULT_FREQUENCY
int8_t _i2c_num =-1
uint32_t _bufferSize = I2C_DEFAULT_BUFFER_LENGTH
I2CStatus _i2cStatus = I2C_NOT_STARTED
Protected Attributes inherited from HardwareResource
uint8_t usages =0
 Current usage counter.

Static Protected Attributes

static constexpr uint16_t I2C_DEFAULT_BUFFER_LENGTH = 32

Additional Inherited Members

Protected Member Functions inherited from HardwareResource
 HardwareResource ()=default
 Default constructor.

Member Function Documentation

◆ getMaxUsages()

virtual uint8_t I2CCore::getMaxUsages ( )
inlineoverridevirtual

Get the maximum simultaneous usages allowed for this resource.

Default implementation returns 1. Override in derived classes to permit multiple users.

Returns
uint8_t Maximum number of concurrent usages allowed.

Reimplemented from HardwareResource.

◆ getType()

virtual HardwareResource::Type I2CCore::getType ( )
inlineoverridevirtual

Get the hardware resource type.

Must be implemented by derived classes to return the correct Type enum value.

Returns
Type The type of the hardware resource.

Implements HardwareResource.

◆ reset()

virtual bool I2CCore::reset ( )
inlinevirtual

Reset the hardware resource to a known default state.

Default implementation clears the usage counter and logs the reset. Derived classes should call the base implementation and perform any additional hardware-specific reset steps.

Returns
true if the reset succeeded, false otherwise.

Reimplemented from HardwareResource.

Reimplemented in ESP32_I2CCore.

Here is the call graph for this function:
Here is the caller graph for this function:

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