Lely core libraries 2.3.4
|
This header file is part of the CANopen library; it contains the emergency (EMCY) object declarations. More...
Go to the source code of this file.
Typedefs | |
typedef void | co_emcy_ind_t(co_emcy_t *emcy, co_unsigned8_t id, co_unsigned16_t eec, co_unsigned8_t er, co_unsigned8_t msef[5], void *data) |
The type of a CANopen EMCY indication function, invoked when an EMCY message is received. | |
Functions | |
co_emcy_t * | co_emcy_create (can_net_t *net, co_dev_t *dev) |
Creates a new CANopen EMCY producer/consumer service. | |
void | co_emcy_destroy (co_emcy_t *emcy) |
Destroys a CANopen EMCY producer/consumer service. | |
int | co_emcy_start (co_emcy_t *emcy) |
Starts an EMCY service. | |
void | co_emcy_stop (co_emcy_t *emcy) |
Stops an EMCY service. | |
int | co_emcy_is_stopped (const co_emcy_t *emcy) |
Retuns 1 if the specified EMCY service is stopped, and 0 if not. | |
can_net_t * | co_emcy_get_net (const co_emcy_t *emcy) |
Returns a pointer to the CAN network of an EMCY producer/consumer service. | |
co_dev_t * | co_emcy_get_dev (const co_emcy_t *emcy) |
Returns a pointer to the CANopen device of an EMCY producer/consumer service. | |
int | co_emcy_push (co_emcy_t *emcy, co_unsigned16_t eec, co_unsigned8_t er, const co_unsigned8_t msef[5]) |
Pushes a CANopen EMCY message to the stack and broadcasts it if the EMCY producer service is active. | |
int | co_emcy_pop (co_emcy_t *emcy, co_unsigned16_t *peec, co_unsigned8_t *per) |
Pops the most recent CANopen EMCY message from the stack and broadcasts an 'error reset' message if the EMCY producer service is active. | |
void | co_emcy_peek (const co_emcy_t *emcy, co_unsigned16_t *peec, co_unsigned8_t *per) |
Retrieves, but does not pop, the most recent CANopen EMCY message from the stack. | |
int | co_emcy_remove (co_emcy_t *emcy, size_t n) |
Pops a CANopen EMCY message from the stack, even if it is not the most recent message, and broadcasts an 'error reset' message if the EMCY producer service is active. | |
ssize_t | co_emcy_find (const co_emcy_t *emcy, co_unsigned16_t eec) |
Finds a CANopen EMCY message in the stack. | |
int | co_emcy_clear (co_emcy_t *emcy) |
Clears the CANopen EMCY message stack and broadcasts the 'error reset/no error' message if the EMCY producer service is active. | |
void | co_emcy_get_ind (const co_emcy_t *emcy, co_emcy_ind_t **pind, void **pdata) |
Retrieves the indication function invoked when a CANopen EMCY message is received. | |
void | co_emcy_set_ind (co_emcy_t *emcy, co_emcy_ind_t *ind, void *data) |
Sets the indication function invoked when a CANopen EMCY message is received. | |
This header file is part of the CANopen library; it contains the emergency (EMCY) object declarations.
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 emcy.h.
typedef void co_emcy_ind_t(co_emcy_t *emcy, co_unsigned8_t id, co_unsigned16_t eec, co_unsigned8_t er, co_unsigned8_t msef[5], void *data) |
The type of a CANopen EMCY indication function, invoked when an EMCY message is received.
emcy | a pointer to an EMCY consumer service. |
id | the node-ID of the producer. |
eec | the emergency error code. |
er | the error register. |
msef | the manufacturer-specific error code. |
data | a pointer to user-specified data. |
Creates a new CANopen EMCY producer/consumer service.
The service is started as if by co_emcy_start().
net | a pointer to a CAN network. |
dev | a pointer to a CANopen device. |
void co_emcy_destroy | ( | co_emcy_t * | emcy | ) |
Destroys a CANopen EMCY producer/consumer service.
int co_emcy_start | ( | co_emcy_t * | emcy | ) |
Starts an EMCY service.
void co_emcy_stop | ( | co_emcy_t * | emcy | ) |
int co_emcy_is_stopped | ( | const co_emcy_t * | emcy | ) |
Retuns 1 if the specified EMCY service is stopped, and 0 if not.
int co_emcy_push | ( | co_emcy_t * | emcy, |
co_unsigned16_t | eec, | ||
co_unsigned8_t | er, | ||
const co_unsigned8_t | msef[5] | ||
) |
Pushes a CANopen EMCY message to the stack and broadcasts it if the EMCY producer service is active.
emcy | a pointer to an EMCY producer service. |
eec | the emergency error code. |
er | the error register. |
msef | the manufacturer-specific error code (can be NULL). |
int co_emcy_pop | ( | co_emcy_t * | emcy, |
co_unsigned16_t * | peec, | ||
co_unsigned8_t * | per | ||
) |
Pops the most recent CANopen EMCY message from the stack and broadcasts an 'error reset' message if the EMCY producer service is active.
emcy | a pointer to an EMCY producer service. |
peec | the address at which to store the emergency error code (can be NULL). |
per | the address at which to store the error register (can be NULL). |
void co_emcy_peek | ( | const co_emcy_t * | emcy, |
co_unsigned16_t * | peec, | ||
co_unsigned8_t * | per | ||
) |
Retrieves, but does not pop, the most recent CANopen EMCY message from the stack.
emcy | a pointer to an EMCY producer service. |
peec | the address at which to store the emergency error code (can be NULL). |
per | the address at which to store the error register (can be NULL). |
int co_emcy_remove | ( | co_emcy_t * | emcy, |
size_t | n | ||
) |
Pops a CANopen EMCY message from the stack, even if it is not the most recent message, and broadcasts an 'error reset' message if the EMCY producer service is active.
emcy | a pointer to an EMCY producer service. |
n | the index of the message to be popped, where 0 is the most recent message. |
Finds a CANopen EMCY message in the stack.
This function returns the index of the first matching message in LIFO order.
emcy | a pointer to an EMCY consumer service. |
eec | the emergency error code of the message to be found. |
int co_emcy_clear | ( | co_emcy_t * | emcy | ) |
Clears the CANopen EMCY message stack and broadcasts the 'error reset/no error' message if the EMCY producer service is active.
void co_emcy_get_ind | ( | const co_emcy_t * | emcy, |
co_emcy_ind_t ** | pind, | ||
void ** | pdata | ||
) |
Retrieves the indication function invoked when a CANopen EMCY message is received.
emcy | a pointer to an EMCY consumer service. |
pind | the address at which to store a pointer to the indication function (can be NULL). |
pdata | the address at which to store a pointer to user-specified data (can be NULL). |
void co_emcy_set_ind | ( | co_emcy_t * | emcy, |
co_emcy_ind_t * | ind, | ||
void * | data | ||
) |
Sets the indication function invoked when a CANopen EMCY message is received.
emcy | a pointer to an EMCY consumer service. |
ind | a pointer to the function to be invoked. |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to func. |