nmt

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StateInitializing   uint8 = 0
	StatePreOperational uint8 = 127
	StateOperational    uint8 = 5
	StateStopped        uint8 = 4
	StateUnknown        uint8 = 255
)

Possible NMT states

View Source
const (
	ResetNot  uint8 = 0
	ResetComm uint8 = 1
	ResetApp  uint8 = 2
	ResetQuit uint8 = 3
)

Global node state to be used

View Source
const ServiceId = 0
View Source
const (
	StartupToOperational uint16 = 0x0100
)

Variables

View Source
var CommandDescription = map[Command]string{
	CommandEnterOperational:    "ENTER-OPERATIONAL",
	CommandEnterStopped:        "ENTER-STOPPED",
	CommandEnterPreOperational: "ENTER-PREOPERATIONAL",
	CommandResetNode:           "RESET-NODE",
	CommandResetCommunication:  "RESET-COMMUNICATION",
}

Functions

This section is empty.

Types

type Command

type Command uint8

Available NMT commands They can be broadcasted to all nodes or to individual nodes

const (
	CommandEmpty               Command = 0
	CommandEnterOperational    Command = 1
	CommandEnterStopped        Command = 2
	CommandEnterPreOperational Command = 128
	CommandResetNode           Command = 129
	CommandResetCommunication  Command = 130
)

type NMT

type NMT struct {
	*canopen.BusManager
	// contains filtered or unexported fields
}

NMT object for processing NMT behaviour, slave or master

func NewNMT

func NewNMT(
	bm *canopen.BusManager,
	emergency *emergency.EMCY,
	nodeId uint8,
	control uint16,
	firstHbTimeMs uint16,
	canIdNmtTx uint16,
	canIdNmtRx uint16,
	canIdHbTx uint16,
	entry1017 *od.Entry,
) (*NMT, error)

func (*NMT) GetInternalState

func (nmt *NMT) GetInternalState() uint8

Get a NMT state

func (*NMT) Handle

func (nmt *NMT) Handle(frame canopen.Frame)

Handle NMT related RX CAN frames

func (*NMT) Process

func (nmt *NMT) Process(internalState *uint8, timeDifferenceUs uint32, timerNextUs *uint32) uint8

Process NMT state machine and TX CAN frames It returns a computed global state request for the node This should be called periodically

func (*NMT) SendCommand

func (nmt *NMT) SendCommand(command Command, nodeId uint8) error

Send an NMT command to the network

func (*NMT) SendInternalCommand

func (nmt *NMT) SendInternalCommand(command uint8)

Send NMT command to self, don't send on network

Jump to

Keyboard shortcuts

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