api: Now returns MRAA_SUCCESS if platform is already initialized
To ensure backwards comptability MRAA_ERROR_PLATFORM_ALREADY_INITIALISED remains as member of mraa_result_t but now has same code as MRAA_SUCCESS Signed-off-by: Henry Bruce <henry.bruce@intel.com>
This commit is contained in:
committed by
Brendan Le Foll
parent
85a848960a
commit
51c60a0ac4
@@ -64,9 +64,7 @@ typedef unsigned int mraa_boolean_t;
|
|||||||
*
|
*
|
||||||
* Detects running platform and attempts to use included pinmap, this is run on
|
* Detects running platform and attempts to use included pinmap, this is run on
|
||||||
* module/library init/load but is handy to rerun to check board initialised
|
* module/library init/load but is handy to rerun to check board initialised
|
||||||
* correctly. MRAA_SUCCESS inidicates correct (first time) initialisation
|
* correctly. MRAA_SUCCESS inidicates correct initialisation.
|
||||||
* whilst MRAA_ERROR_PLATFORM_ALREADY_INITIALISED indicates the board is
|
|
||||||
* already initialised correctly
|
|
||||||
*
|
*
|
||||||
* @return Result of operation
|
* @return Result of operation
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -46,9 +46,7 @@ namespace mraa
|
|||||||
*
|
*
|
||||||
* Detects running platform and attempts to use included pinmap, this is run on
|
* Detects running platform and attempts to use included pinmap, this is run on
|
||||||
* module/library init/load but is handy to rerun to check board initialised
|
* module/library init/load but is handy to rerun to check board initialised
|
||||||
* correctly. MRAA_SUCCESS inidicates correct (first time) initialisation
|
* correctly. mraa::SUCCESS inidicates correct initialisation.
|
||||||
* whilst MRAA_ERROR_PLATFORM_ALREADY_INITIALISED indicates the board is
|
|
||||||
* already initialised correctly
|
|
||||||
*
|
*
|
||||||
* @return Result of operation
|
* @return Result of operation
|
||||||
*/
|
*/
|
||||||
@@ -260,7 +258,7 @@ isSubPlatformId(int pin_or_bus_id)
|
|||||||
*
|
*
|
||||||
* @return int sub platform pin or bus number
|
* @return int sub platform pin or bus number
|
||||||
*/
|
*/
|
||||||
inline int
|
inline int
|
||||||
getSubPlatformId(int pin_or_bus_index)
|
getSubPlatformId(int pin_or_bus_index)
|
||||||
{
|
{
|
||||||
return mraa_get_sub_platform_id(pin_or_bus_index);
|
return mraa_get_sub_platform_id(pin_or_bus_index);
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ typedef enum {
|
|||||||
MRAA_ERROR_NO_DATA_AVAILABLE = 9, /**< No data available */
|
MRAA_ERROR_NO_DATA_AVAILABLE = 9, /**< No data available */
|
||||||
MRAA_ERROR_INVALID_PLATFORM = 10, /**< Platform not recognised */
|
MRAA_ERROR_INVALID_PLATFORM = 10, /**< Platform not recognised */
|
||||||
MRAA_ERROR_PLATFORM_NOT_INITIALISED = 11, /**< Board information not initialised */
|
MRAA_ERROR_PLATFORM_NOT_INITIALISED = 11, /**< Board information not initialised */
|
||||||
MRAA_ERROR_PLATFORM_ALREADY_INITIALISED = 12, /**< Board is already initialised */
|
MRAA_ERROR_PLATFORM_ALREADY_INITIALISED = 0, /**< Board is already initialised, same as MRAA_SUCESS */
|
||||||
|
|
||||||
MRAA_ERROR_UNSPECIFIED = 99 /**< Unknown Error */
|
MRAA_ERROR_UNSPECIFIED = 99 /**< Unknown Error */
|
||||||
} mraa_result_t;
|
} mraa_result_t;
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ typedef enum {
|
|||||||
ERROR_NO_DATA_AVAILABLE = 9, /**< No data available */
|
ERROR_NO_DATA_AVAILABLE = 9, /**< No data available */
|
||||||
ERROR_INVALID_PLATFORM = 10, /**< Platform not recognised */
|
ERROR_INVALID_PLATFORM = 10, /**< Platform not recognised */
|
||||||
ERROR_PLATFORM_NOT_INITIALISED = 11, /**< Board information not initialised */
|
ERROR_PLATFORM_NOT_INITIALISED = 11, /**< Board information not initialised */
|
||||||
ERROR_PLATFORM_ALREADY_INITIALISED = 12, /**< Board is already initialised */
|
ERROR_PLATFORM_ALREADY_INITIALISED = 0, /**< Board is already initialised, same as SUCCESS */
|
||||||
|
|
||||||
ERROR_UNSPECIFIED = 99 /**< Unknown Error */
|
ERROR_UNSPECIFIED = 99 /**< Unknown Error */
|
||||||
} Result;
|
} Result;
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ mraa_result_t __attribute__((constructor))
|
|||||||
mraa_init()
|
mraa_init()
|
||||||
{
|
{
|
||||||
if (plat != NULL) {
|
if (plat != NULL) {
|
||||||
return MRAA_ERROR_PLATFORM_ALREADY_INITIALISED;
|
return MRAA_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
uid_t proc_euid = geteuid();
|
uid_t proc_euid = geteuid();
|
||||||
@@ -320,9 +320,6 @@ mraa_result_print(mraa_result_t result)
|
|||||||
case MRAA_ERROR_PLATFORM_NOT_INITIALISED:
|
case MRAA_ERROR_PLATFORM_NOT_INITIALISED:
|
||||||
fprintf(stdout, "MRAA: Platform not initialised.\n");
|
fprintf(stdout, "MRAA: Platform not initialised.\n");
|
||||||
break;
|
break;
|
||||||
case MRAA_ERROR_PLATFORM_ALREADY_INITIALISED:
|
|
||||||
fprintf(stdout, "MRAA: Platform already initialised.\n");
|
|
||||||
break;
|
|
||||||
case MRAA_ERROR_UNSPECIFIED:
|
case MRAA_ERROR_UNSPECIFIED:
|
||||||
fprintf(stdout, "MRAA: Unspecified Error.\n");
|
fprintf(stdout, "MRAA: Unspecified Error.\n");
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user