Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small fixes #4

Merged
merged 3 commits into from
Dec 22, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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