header

package
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2023 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EcatHeader

type EcatHeader struct {
	// contains filtered or unexported fields
}

Header represents an EtherCAT frame header.

The header consists of 11 bits for length, 1 bit reserved, and 4 bits for the type.

----------------- EtherCat Header -----------------

| EcatType: 4bit | Reserved: 1bit | Length: 11bit |

---------------------------------------------------

func DefaultEcatHeader

func DefaultEcatHeader() EcatHeader

DefaultEcatHeader creates and returns a default EtherCAT header with EcatType=1, Reserved=0, and Length=0.

Returns:

  • EcatHeader: Default EtherCAT header

func NewEcatHeader

func NewEcatHeader(length uint16) (EcatHeader, error)

NewEcatHeader creates a new EtherCAT header with the specified length. It returns an error if the provided length is outside the valid range [0, 2047].

Parameters:

  • length (uint16): Length value for the EtherCAT header

Returns:

  • EcatHeader: New EtherCAT header
  • error: Error if length is outside the valid range

func (EcatHeader) ExtractLength

func (e EcatHeader) ExtractLength() uint16

ExtractLength returns the length value from the EtherCAT header.

Returns:

  • uint16: Length value from the EtherCAT header

func (EcatHeader) Uint16

func (e EcatHeader) Uint16() uint16

Uint16 returns the uint16 representation of the EtherCAT header.

Returns:

  • uint16: Uint16 representation of the EtherCAT header

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL