Skip to content

Commit

Permalink
Merge pull request #4 from johnhowe/master
Browse files Browse the repository at this point in the history
Small fixes
  • Loading branch information
alvarop committed Dec 22, 2015
2 parents c32fc4c + 69b0ec9 commit 755837b
Show file tree
Hide file tree
Showing 2 changed files with 163 additions and 163 deletions.
20 changes: 10 additions & 10 deletions fw/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ static void i2cCmd(uint8_t argc, char *argv[]) {
uint8_t addr = strtoul(argv[I2C_ADDR_OFFSET], NULL, 16);
uint8_t rLen = strtoul(argv[I2C_RLEN_OFFSET], NULL, 10);
uint8_t wLen = argc - I2C_WBUFF_OFFSET;

if(wLen > sizeof(wBuff)) {
printf("ERR: I2C Not enough space in wBuff\n");
break;
Expand Down Expand Up @@ -298,9 +298,9 @@ static void spiSetCSCmd(uint8_t arcg, char *argv[]) {
} while(0);
}

//
//
// Set/get GPIO pins
//
//
static void gpioCmd(uint8_t argc, char *argv[]) {
if(argc > 2) {
do {
Expand All @@ -322,15 +322,15 @@ static void gpioCmd(uint8_t argc, char *argv[]) {

if(argc == 3) {
int32_t value = gpioGet(GPIOx, pin);

if (value < 0) {
printf("ERR\n");
} else {
printf("OK %ld\n", value);
}
} else {
int32_t rval = gpioSet(GPIOx, pin, (argv[3][0] != '0'));

if (rval < 0) {
printf("ERR\n");
} else {
Expand All @@ -344,7 +344,7 @@ static void gpioCmd(uint8_t argc, char *argv[]) {
}

//
// Configure GPIO pins as input/output(open drain or push-pull)
// Configure GPIO pins as input/output(open drain or push-pull)
// and set pull-up/down resistors
//
static void gpioCfgCmd(uint8_t argc, char *argv[]) {
Expand Down Expand Up @@ -376,7 +376,7 @@ static void gpioCfgCmd(uint8_t argc, char *argv[]) {
if (strcmp("outpp", argv[3]) == 0) {
gpioSettings.GPIO_Mode = GPIO_Mode_OUT;
gpioSettings.GPIO_OType = GPIO_OType_PP;
} else if (strcmp("outpp", argv[3]) == 0) {
} else if (strcmp("outod", argv[3]) == 0) {
gpioSettings.GPIO_Mode = GPIO_Mode_OUT;
gpioSettings.GPIO_OType = GPIO_OType_OD;
} else if (strcmp("analog", argv[3]) == 0) {
Expand All @@ -396,7 +396,7 @@ static void gpioCfgCmd(uint8_t argc, char *argv[]) {
gpioSettings.GPIO_PuPd = GPIO_PuPd_DOWN;
}
}

GPIO_Init(GPIOx, &gpioSettings);

printf("OK\n");
Expand Down Expand Up @@ -432,7 +432,7 @@ static void pwmCmd(uint8_t argc, char *argv[]) {

static void snCmd(uint8_t argc, char *argv[]) {
printf("OK ");

// Print 96-bit serial number
for(uint8_t byte = 0; byte < 12; byte++) {
printf("%02X ", uid[byte]);
Expand Down Expand Up @@ -478,7 +478,7 @@ void consoleProcess() {
argv[argc] = strtok(cmdBuff, " ");

// Get arguments (if any)
while ((argv[argc] != NULL) && (argc < sizeof(argv)/sizeof(char *))){
while ((argc < sizeof(argv)/sizeof(char *)) && (argv[argc] != NULL)){
argc++;
argv[argc] = strtok(NULL, " ");
}
Expand Down
Loading

0 comments on commit 755837b

Please sign in to comment.