Skip to content

Commit 3a5d23d

Browse files
committed
Fix warning about casting incompatible function types #308
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 *)'
1 parent 9298393 commit 3a5d23d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

source/py_pwm.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,10 @@ static PyObject *py_set_frequency(__attribute__ ((unused)) PyObject *self, PyObj
215215
static const char moduledocstring[] = "PWM functionality of a BeagleBone using Python";
216216

217217
PyMethodDef pwm_methods[] = {
218-
{"start", (PyCFunction)py_start_channel, METH_VARARGS | METH_KEYWORDS, "Set up and start the PWM channel. channel can be in the form of 'P8_10', or 'EHRPWM2A'"},
219-
{"stop", (PyCFunction)py_stop_channel, METH_VARARGS | METH_KEYWORDS, "Stop the PWM channel. channel can be in the form of 'P8_10', or 'EHRPWM2A'"},
220-
{ "set_duty_cycle", (PyCFunction)py_set_duty_cycle, METH_VARARGS | METH_KEYWORDS, "Change the duty cycle\ndutycycle - between 0.0 and 100.0" },
221-
{ "set_frequency", (PyCFunction)py_set_frequency, METH_VARARGS | METH_KEYWORDS, "Change the frequency\nfrequency - frequency in Hz (freq > 0.0)" },
218+
{"start", (PyCFunction)(void *)py_start_channel, METH_VARARGS | METH_KEYWORDS, "Set up and start the PWM channel. channel can be in the form of 'P8_10', or 'EHRPWM2A'"},
219+
{"stop", (PyCFunction)(void *)py_stop_channel, METH_VARARGS | METH_KEYWORDS, "Stop the PWM channel. channel can be in the form of 'P8_10', or 'EHRPWM2A'"},
220+
{ "set_duty_cycle", (PyCFunction)(void *)py_set_duty_cycle, METH_VARARGS | METH_KEYWORDS, "Change the duty cycle\ndutycycle - between 0.0 and 100.0" },
221+
{ "set_frequency", (PyCFunction)(void *)py_set_frequency, METH_VARARGS | METH_KEYWORDS, "Change the frequency\nfrequency - frequency in Hz (freq > 0.0)" },
222222
{"cleanup", py_cleanup, METH_VARARGS, "Clean up by resetting all GPIO channels that have been used by this program to INPUT with no pullup/pulldown and no event detection"},
223223
//{"setwarnings", py_setwarnings, METH_VARARGS, "Enable or disable warning messages"},
224224
{NULL, NULL, 0, NULL}

0 commit comments

Comments
 (0)