⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mlss.h

📁 CanOpen的源代码
💻 H
字号:
/**************************************************************************
MODULE:    MLSS
CONTAINS:  MicroCANopen - Support for MicroLSS - Layer Setting Services
COPYRIGHT: Embedded Systems Academy, Inc. 2002-2007.
           All rights reserved. www.microcanopen.com
           This software was written in accordance to the guidelines at
           www.esacademy.com/software/softwarestyleguide.pdf
DISCLAIM:  Read and understand our disclaimer before using this code!
           www.esacademy.com/disclaim.htm
LICENSE:   THIS IS THE EDUCATIONAL VERSION OF MICROCANOPEN
           See file license_educational.txt or
           www.microcanopen.com/license_educational.txt
           A commercial MicroCANopen license is available at
           www.CANopenStore.com
VERSION:   3.30, ESA 30-JAN-07
           $LastChangedDate: 2006-03-29 00:44:08 -0800 (Wed, 29 Mar 2006) $
           $LastChangedRevision: 86 $
***************************************************************************/ 

#ifndef _LSS_H
#define _LSS_H

#include "mco.h"


// LSS CAN bps values
#define LSS_BPS_125  4
#define LSS_BPS_250  3
#define LSS_BPS_500  2
#define LSS_BPS_800  1
#define LSS_BPS_1000 0


// COB-ID for LSS reception (slave) or transmission (master)
#define LSS_MASTER_ID    2021

// COB-ID for LSS transmission (slave) or reception (master)
#define LSS_SLAVE_ID     2020

// Doing LSS in stopped state
#define NMTSTATE_LSS 0xF0

// LSS Command Specifiers
#define LSS_SWMOD_GLOB      4
#define LSS_SWMOD_RESP     68
#define LSS_CONF_NID       17
#define LSS_STOR_CONF      23
#define LSS_ID_SLAVE       79
#define LSS_ID_NCONF_SLAVE 80
#define LSS_MICROLSS       129

// Offsets into NVOL memory
#define NVOL_LSSENA 0
#define NVOL_LSSNID 1
#define NVOL_LSSBPS 2
#define NVOL_LSSCHK 3

// LSS Enabled value
#define NVOL_LSSENA_VAL 0x5A

/*************************************************************************
Function Prototypes
*************************************************************************/

/****************************************************************
DOES:    Process all LSS messages. 
RETURNS: 
*****************************************************************/
void LSS_HandleMsg (
  UNSIGNED8 Len,
  UNSIGNED8 *pDat
  );

/****************************************************************
DOES:    Check and update LSS status
RETURNS: FALSE: LSS is finished for this node
         TRUE:  Otherwise (LSS is still in process)
*****************************************************************/
UNSIGNED8 LSS_DoLSS (
  void
  );

/****************************************************************
DOES:    Initialize LSS mechanism (variables etc.)
GLOBALS: Sets lss_active status flag to TRUE
         Sets gCCOConfig.nmt_state to NMT_STATE_LSS
RETURNS: -
*****************************************************************/
void LSS_Init(
  UNSIGNED8 node_id // current node id or zero if none
  );


/****************************************************************
DOES:    LSS Load Configuration Command
RETURNS: Retrieves the current configuration stored in memory.
         Node ID is set to zero, if no configuration found
*****************************************************************/
void LSS_LoadConfiguration (
  UNSIGNED16 *Baudrate,  // returns CAN baudrate in kbit (1000,800,500,250,125,50,25 or 10)
  UNSIGNED8 *Node_ID    // returns CANopen node ID (0-127)
  );

#endif  // if _LSS_H

/*******************************************************************************
END OF FILE
*******************************************************************************/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -