109 lines
3.6 KiB
C
109 lines
3.6 KiB
C
/**
|
|
* @file nms_can.h
|
|
*
|
|
* @copyright Nehemis SARL reserves all rights even in the event of industrial
|
|
* property rights. We reserve all rights of disposal such as
|
|
* copying and passing on to third parties.
|
|
*
|
|
* @brief CANOpen files abstracted for furthur use in the project.
|
|
*
|
|
*/
|
|
|
|
#ifndef NMS_CAN_H_
|
|
#define NMS_CAN_H_
|
|
|
|
/******************************************************************************
|
|
* Include Header Files
|
|
******************************************************************************/
|
|
#include "nms_types.h"
|
|
#include "co_datatype.h"
|
|
#include "co_nmt.h"
|
|
///******************************************************************************
|
|
// * Macro constant declarations
|
|
// ******************************************************************************/
|
|
//#define NMS_CANOPEN_BITRATE 250u
|
|
///******************************************************************************
|
|
// * Extern Function Declarations
|
|
// ******************************************************************************/
|
|
/**
|
|
* @brief Initializes the CAN controller and CANopen stack.
|
|
*/
|
|
void NmsCanInit(void);
|
|
|
|
/**
|
|
* @brief Runs the CAN communication tasks.
|
|
*
|
|
* @param canLine_u8 Can line selected.
|
|
*/
|
|
void NmsCanRun(void);
|
|
|
|
/**
|
|
* @brief Retrieves a 8-bit object from the CANopen object dictionary.
|
|
*
|
|
* @param index_u16 The object dictionary index.
|
|
* subIndex_u8 The sub-index of the object.
|
|
* pObj_pu8 Pointer to store the retrieved object value.
|
|
* canLine_u8 Can line selected.
|
|
*
|
|
* @return Error code. (NMS_ERR_NONE if successful, or an error code).
|
|
*/
|
|
uint32 NmsCanGetObj_u8(uint16 index_u16, uint8 subIndex_u8, uint8 *pObj_pu8);
|
|
|
|
/**
|
|
* @brief Retrieves a 32-bit object from the CANopen object dictionary.
|
|
*
|
|
* @param index_u16 The object dictionary index.
|
|
* subIndex_u8 The sub-index of the object.
|
|
* pObj_pu8 Pointer to store the retrieved object value.
|
|
*
|
|
* @return Error code. (NMS_ERR_NONE if successful, or an error code).
|
|
*/
|
|
uint32 NmsCanGetObj_u32(uint16 index_u16, uint8 subIndex_u8, uint32 *pObj_pu32);
|
|
|
|
/**
|
|
* @brief Retrieves a float object from the CANopen object dictionary.
|
|
*
|
|
* @param index_u16 The object dictionary index.
|
|
* subIndex_u8 The sub-index of the object.
|
|
* pObj_f32 Pointer to store the retrieved object value.
|
|
*
|
|
* @return Error code. (NMS_ERR_NONE if successful, or an error code).
|
|
*/
|
|
uint32 NmsCanGetObj_f32(uint16 index_u16, uint8 subIndex_u8, float32 *pObj_pf32);
|
|
|
|
/**
|
|
* @brief Puts a 8-bit object in the CANopen object dictionary.
|
|
*
|
|
* @param index_u16 The object dictionary index.
|
|
* subIndex_u8 The sub-index of the object.
|
|
* newVal_u32 The new value to be set.
|
|
*
|
|
* @return Error code. (NMS_ERR_NONE if successful, or an error code).
|
|
*/
|
|
uint32 NmsCanPutObj_u8(uint16 index_u16, uint8 subIndex_u8, uint8 newVal_u8);
|
|
|
|
/**
|
|
* @brief Puts a 32-bit object in the CANopen object dictionary.
|
|
*
|
|
* @param index_u16 The object dictionary index.
|
|
* subIndex_u8 The sub-index of the object.
|
|
* newVal_u32 The new value to be set.
|
|
*
|
|
* @return Error code. (NMS_ERR_NONE if successful, or an error code).
|
|
*/
|
|
uint32 NmsCanPutObj_u32(uint16 index_u16, uint8 subIndex_u8, uint32 newVal_u32);
|
|
|
|
/**
|
|
* @brief Puts a float object in the CANopen object dictionary.
|
|
*
|
|
* @param index_u16 The object dictionary index.
|
|
* subIndex_u8 The sub-index of the object.
|
|
* newVal_u32 The new value to be set.
|
|
*
|
|
* @return Error code. (NMS_ERR_NONE if successful, or an error code).
|
|
*/
|
|
uint32 NmsCanPutObj_f32(uint16 index_u16, uint8 subIndex_u8, uint32 newVal_u32);
|
|
|
|
|
|
#endif /* NMS_CAN_H_ */
|