PyEval_ThreadsInitialized() and PyEval_InitThreads() are deprecated and break the build, adding a version check to ignore if we are compiling with a newer Python version.
PWM outputs on P9_28 and P9_42 are part of the ECAP hardware block. This causes 'ecap' to be in the path instead of 'pwm'. For example:
`/sys/devices/platform/ocp/48300000.epwmss/48300100.ecap/pwm/pwmchip0/pwm0`
is one character longer than:
`/sys/devices/platform/ocp/48302000.epwmss/48302200.pwm/pwm/pwmchip4/pwm0`
Thus the index in pwm_path must be adjusted for the ecap_path_udev path. This fixes issue #342
Building with GCC 10.2.1 fails due linking errors caused by having multiple
definitions of the variables defined in the source/constants.h header file.
Fix this by moving the variables definition to the source/constants.c file,
to avoid the variables to be defined each time that the header is included.
While being there, use a single variable instead of having one for each
object that is added to the module.
CFLAGS is only -Wall now. -Werror has been removed to the build will no longer fail on warnings. Therefore, there is no need to suppress certain warnings.
In issue #335, @mvduin noted that it is a poor idea to have compilation fail on warnings because a newer compiler version may add new warnings and as a result break compilation.
Debian 10 (Buster) has gcc 8.2 which warns about:
cast between incompatible function types from ‘PyObject * (*)(PyObject *, PyObject *, PyObject *)’
The solution is to cast to '(PyCFunction)(void *)'
Debian 10 (Buster) has gcc 8.2 which warns about:
source/c_pwm.c:459:65: error: argument to ‘sizeof’ in ‘strncpy’ call is the same expression as the source; did you mean to use the size of the destination? [-Werror=sizeof-pointer-memaccess]
source/c_pwm.c:396:43: error: ‘%s’ directive output may be truncated writing up to 199 bytes into a region of size 100 [-Werror=format-truncation=]
Debian 10 (Buster) has gcc 8.2 which warns about:
cast between incompatible function types from ‘PyObject * (*)(PyObject *, PyObject *, PyObject *)’
The solution is to cast to '(PyCFunction)(void *)'
Debian 10 (Buster) has gcc 8.2 which warns about:
error: ‘%s’ directive output may be truncated writing up to 19 bytes into a region of size between 10 and 59 [-Werror=format-truncation=]
snprintf(path, sizeof(path), "%s/%s/state", ocp_dir, pinmux_dir);
Debian 10 (Buster) has gcc 8.2 which warns about:
cast between incompatible function types from ‘PyObject * (*)(PyObject *, PyObject *, PyObject *)’
The solution is to cast to '(PyCFunction)(void *)'