
#ifndef ETHERCAT_SLAVE_CIA402_H
#define ETHERCAT_SLAVE_CIA402_H

#include "../ethercat_types.h"
#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

#ifndef DYNAMIC_LOAD

cia402_state_t CiA402_ParseState(uint16_t statusword);

uint16_t CiA402_GetEnableCommand(uint16_t statusword);

int      CiA402_SetMode(uint16_t master, uint16_t slave, int8_t mode);

int8_t   CiA402_GetMode(uint16_t master, uint16_t slave);

uint16_t CiA402_ReadStatusWord(uint16_t master, uint16_t slave);

int      CiA402_WriteControlWord(uint16_t master, uint16_t slave, uint16_t cw);

int      CiA402_Enable(uint16_t master, uint16_t slave, int max_retries);

int      CiA402_FaultReset(uint16_t master, uint16_t slave);

#endif

#ifdef __cplusplus
}
#endif

#endif
