Advertisement

通过shm_open函数实现共享内存的无亲缘过程间通信示例

阅读量:

头文件

对存储于共享内存中的数据结构进行定义,并制定相关的宏定义

复制代码
    #include <unistd.h>
    #include <stdint.h>
    struct shm_ect_data {		/* struct stored in shared memory */
    
    int32_t targetPosition;   //电机的目标位置
    int32_t targetVelocity;  //电机当前运行速度
    int8_t opModeSet;         //电机运行模式的设定值,默认位置模式
    int8_t opmode;            //驱动器当前运行模式
    int32_t currentVelocity;  //电机当前运行速度
    int32_t currentPosition;  //电机当前位置
    uint16_t status;          //驱动器状态字
    
    bool powerBusy;       //使能标志位
    bool resetBusy;       //复位标志位
    bool quickStopBusy;   //急停标志位
    bool homeBusy;        //回零标志位
    bo

全部评论 (0)

还没有任何评论哟~