Skip to content

Commit

Permalink
Fixed some stuff, now working
Browse files Browse the repository at this point in the history
  • Loading branch information
jvandenbroek committed Mar 22, 2015
1 parent 1520ce3 commit 6fc77d9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Telnet into the module and issue commands prefixed by +++AT to escape each comma
+++AT FLASH # print current flash settings
+++AT FLASH <1|0> # 1: The changed UART settings (++AT BAUD ...) are saved ( Default after boot), 0= no save to flash.
+++AT RESET # software reset the unit
+++AT GPIO2 <1|0> # set GPIO2 pin HIGH or LOW (1/0)
+++AT GPIO2 <1|0> # set GPIO2 pin HIGH or LOW (1/0)
```
Upon success, all commands send back "OK" as their final output. Note that passwords may not contain spaces.

Expand Down
14 changes: 11 additions & 3 deletions user/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ void config_execute(void) {
#ifdef CONFIG_PARSE_TEST_UNIT
#endif


bool doflash = true;

char *my_strdup(char *str) {
Expand Down Expand Up @@ -180,20 +181,27 @@ void config_cmd_reset(serverConnData *conn, uint8_t argc, char *argv[]) {
}

void config_cmd_gpio2(serverConnData *conn, uint8_t argc, char *argv[]) {
// Initialize the GPIO subsystem.
gpio_init();
//Set GPIO2 to output mode
PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO2_U, FUNC_GPIO2);
//Set GPIO2 high
//gpio_output_set(BIT2, 0, BIT2, 0);

if (argc == 0)
espbuffsentprintf(conn, "Use 0 for HIGH or 1 for LOW as argument.\r\n"MSG_OK);
else {
uint32_t gpio = atoi(argv[1]);
if ((gpio != 0)||(gpio != 1)) {
espbuffsentstring(conn, MSG_ERROR);
} else {
if ((gpio == 0)||(gpio == 1)) {
if (gpio == 0) {
gpio_output_set(0, BIT2, BIT2, 0);
}
if (gpio == 1) {
gpio_output_set(BIT2, 0, BIT2, 0);
}
espbuffsentstring(conn, MSG_OK);
} else {
espbuffsentstring(conn, MSG_ERROR);
}
}
}
Expand Down

0 comments on commit 6fc77d9

Please sign in to comment.