-
Notifications
You must be signed in to change notification settings - Fork 17
/
jsd_el3104.h
59 lines (50 loc) · 1.46 KB
/
jsd_el3104.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef JSD_EL3104_H
#define JSD_EL3104_H
#ifdef __cplusplus
extern "C" {
#endif
#include "jsd/jsd.h"
/**
* @brief Single channel of TxPDO data struct
*
* Note: Struct order matters and must be packed.
*/
typedef struct __attribute__((__packed__)) {
uint16_t flags;
int16_t value;
} jsd_el3104_txpdo_channel_t;
/**
* @brief TxPDO struct used to read device data in SOEM IOmap
*
* Note: Struct order matters and must be packed.
*/
typedef struct __attribute__((__packed__)) {
jsd_el3104_txpdo_channel_t channel[JSD_EL3104_NUM_CHANNELS];
} jsd_el3104_txpdo_t;
/** @brief Initializes el3104 and registers the PO2SO function
*
* @param self pointer JSD context
* @param slave_id index of device on EtherCAT bus
* @return true on success, false on failure
*/
bool jsd_el3104_init(jsd_t* self, uint16_t slave_id);
/**
* @brief Configuration function called by SOEM upon a PreOp to SafeOp state
* transition that (re)configures EL3104 device settings
*
* @param ecx_context SOEM context pointer
* @param slave_id index of device on EtherCAT bus
* @return 1 on success, 0 on failure
*/
int jsd_el3104_PO2SO_config(ecx_contextt* ecx_context, uint16_t slave_id);
/**
* @brief Checks whether a product code is compatible with EL3104.
*
* @param product_code The product code to be checked
* @return True if the product code is compatible, false otherwise.
*/
bool jsd_el3104_product_code_is_compatible(uint32_t product_code);
#ifdef __cplusplus
}
#endif
#endif