Improve parsing of gpio option.

This commit is contained in:
David Betz 2015-01-27 21:49:45 -05:00
parent 0f6f058d9f
commit c396afe80b
1 changed files with 10 additions and 7 deletions

View File

@ -74,15 +74,18 @@ int use_reset_method(char* method)
char *token; char *token;
token = strtok(method, ","); token = strtok(method, ",");
token = strtok(NULL, ",");
if (token) if (token)
{ {
propellerResetGpioPin = atoi(token); token = strtok(NULL, ",");
} if (token)
token = strtok(NULL, ","); {
if (token) propellerResetGpioPin = atoi(token);
{ }
propellerResetGpioLevel = atoi(token); token = strtok(NULL, ",");
if (token)
{
propellerResetGpioLevel = atoi(token);
}
} }
printf ("Using GPIO pin %d as Propeller reset ", propellerResetGpioPin); printf ("Using GPIO pin %d as Propeller reset ", propellerResetGpioPin);