Skip to content

Commit

Permalink
Fix deprecation of the 'DEF' statement
Browse files Browse the repository at this point in the history
  • Loading branch information
bnjmnp committed Jul 7, 2024
1 parent 91281dd commit 84eb0b6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
7 changes: 4 additions & 3 deletions src/pysoem/cpysoem.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t, u

cdef extern from "ethercat.h":

DEF EC_MAXBUF = 16
DEF EC_MAXMBX = 1486
DEF EC_BUFSIZE = 1518
cdef enum:
EC_MAXBUF = 16
EC_MAXMBX = 1486
EC_BUFSIZE = 1518

ec_adaptert* ec_find_adapters()

Expand Down
24 changes: 14 additions & 10 deletions src/pysoem/pysoem.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -141,20 +141,22 @@ class Master(CdefMaster):
pass


cdef enum:
EC_MAXSLAVE = 200
EC_MAXGROUP = 1
EC_MAXEEPBITMAP = 128
EC_MAXEEPBUF = EC_MAXEEPBITMAP * 32
EC_MAXMAPT = 8
EC_IOMAPSIZE = 4096

cdef class CdefMaster:
"""Representing a logical EtherCAT master device.
Please do not use this class directly, but the class Master instead.
Master is a typical Python object, with all it's benefits over
cdef classes. For example you can add new attributes dynamically.
"""
DEF EC_MAXSLAVE = 200
DEF EC_MAXGROUP = 1
DEF EC_MAXEEPBITMAP = 128
DEF EC_MAXEEPBUF = EC_MAXEEPBITMAP * 32
DEF EC_MAXMAPT = 8
DEF EC_IOMAPSIZE = 4096


cdef cpysoem.ec_slavet _ec_slave[EC_MAXSLAVE]
cdef int _ec_slavecount
cdef cpysoem.ec_groupt _ec_group[EC_MAXGROUP]
Expand Down Expand Up @@ -604,6 +606,11 @@ class SiiOffset:
MBX_PROTO = 0x001C


cdef enum:
EC_TIMEOUTRXM = 700000
STATIC_SDO_READ_BUFFER_SIZE = 256


cdef class CdefSlave:
"""Represents a slave device
Expand All @@ -612,9 +619,6 @@ cdef class CdefSlave:
obtained by slaves list
"""

DEF EC_TIMEOUTRXM = 700000
DEF STATIC_SDO_READ_BUFFER_SIZE = 256

cdef cpysoem.ecx_contextt* _ecx_contextt
cdef cpysoem.ec_slavet* _ec_slave
cdef CdefMasterSettings* _the_masters_settings
Expand Down

0 comments on commit 84eb0b6

Please sign in to comment.