python: Throw exception if mraa_init() fails
Signed-off-by: Henry Bruce <henry.bruce@intel.com>
This commit is contained in:
committed by
Brendan Le Foll
parent
51c60a0ac4
commit
076a648ef9
@@ -158,8 +158,10 @@ class Spi;
|
|||||||
PyEval_InitThreads();
|
PyEval_InitThreads();
|
||||||
// Add mraa_init() to the module initialisation process and set isr function
|
// Add mraa_init() to the module initialisation process and set isr function
|
||||||
mraa_result_t res = mraa_init();
|
mraa_result_t res = mraa_init();
|
||||||
if (res == MRAA_SUCCESS || res == MRAA_ERROR_PLATFORM_ALREADY_INITIALISED) {
|
if (res == MRAA_SUCCESS) {
|
||||||
lang_func->python_isr = &mraa_python_isr;
|
lang_func->python_isr = &mraa_python_isr;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
SWIG_Error(SWIG_RuntimeError, "mraa_init() failed");
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|||||||
Reference in New Issue
Block a user