Lely core libraries
2.2.5
|
#include "nmt_hb.h"
#include "co.h"
#include <lely/co/dev.h>
#include <lely/util/diag.h>
#include <assert.h>
#include <stdlib.h>
Go to the source code of this file.
Data Structures | |
struct | __co_nmt_hb |
A CANopen NMT heartbeat consumer. More... | |
Functions | |
static int | co_nmt_hb_recv (const struct can_msg *msg, void *data) |
The CAN receive callback function for a heartbeat consumer. More... | |
static int | co_nmt_hb_timer (const struct timespec *tp, void *data) |
The CAN timer callback function for a heartbeat consumer. More... | |
co_nmt_hb_t * | co_nmt_hb_create (can_net_t *net, co_nmt_t *nmt) |
Creates a new CANopen NMT heartbeat consumer service. More... | |
void | co_nmt_hb_destroy (co_nmt_hb_t *hb) |
Destroys a CANopen NMT heartbeat consumer service. More... | |
void | co_nmt_hb_set_1016 (co_nmt_hb_t *hb, co_unsigned8_t id, co_unsigned16_t ms) |
Processes the value of CANopen object 1016 (Consumer heartbeat time) for the specified heartbeat consumer. More... | |
void | co_nmt_hb_set_st (co_nmt_hb_t *hb, co_unsigned8_t st) |
Sets the expected state of a remote NMT node. More... | |
This file is part of the CANopen library; it contains the implementation of the NMT heartbeat consumer functions.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Definition in file nmt_hb.c.
|
static |
The CAN receive callback function for a heartbeat consumer.
|
static |
The CAN timer callback function for a heartbeat consumer.
co_nmt_hb_t* co_nmt_hb_create | ( | can_net_t * | net, |
co_nmt_t * | nmt | ||
) |
Creates a new CANopen NMT heartbeat consumer service.
net | a pointer to a CAN network. |
nmt | a pointer to an NMT master/slave service. |
void co_nmt_hb_destroy | ( | co_nmt_hb_t * | hb | ) |
Destroys a CANopen NMT heartbeat consumer service.
void co_nmt_hb_set_1016 | ( | co_nmt_hb_t * | hb, |
co_unsigned8_t | id, | ||
co_unsigned16_t | ms | ||
) |
Processes the value of CANopen object 1016 (Consumer heartbeat time) for the specified heartbeat consumer.
If the node-ID is valid and the heartbeat time is non-zero, the heartbeat consumer is activated. Note that this only activates the CAN frame receiver for heartbeat messages. The CAN timer for heartbeat events is not activated until the first heartbeat message is received or co_nmt_hb_set_st() is invoked.
hb | a pointer to a heartbeat consumer service. |
id | the node-ID. |
ms | the heartbeat time (in milliseconds). |
void co_nmt_hb_set_st | ( | co_nmt_hb_t * | hb, |
co_unsigned8_t | st | ||
) |
Sets the expected state of a remote NMT node.
If the heartbeat consumer is active, invocation of this function is equivalent to reception of a heartbeat message with the specified state and will (re)activate the CAN timer for heartbeat events.
hb | a pointer to a heartbeat consumer service. |
st | the state of the node (excluding the toggle bit). |