Post links and attach files for documentation here, also chat about these docs freely

User avatar
By reaper7
#827 I started playing with sdk today.
First I tried to do my own AT commands, natural thing was to control GPIO via AT but it does not work... (in my case it is GPIO2)

maybe someone will find a solution :)
User avatar
By rudi
#829
reaper7 wrote:I started playing with sdk today.
First I tried to do my own AT commands, natural thing was to control GPIO via AT but it does not work... (in my case it is GPIO2)

maybe someone will find a solution :)


have you done successfull the at command leasson? ;-)
this is a good way to think in in the coder ..
i have wrote a help define's for the commands and admin pass and system user groups for later services ect like a little terminal app.
settings welcome and status messages ect. to store this i will write over SPI to the flash or EEPROM ...
the AT Command for switching is my way too just in time, next step is by webserver over wifi and sort out the incommings messages and call submenues ect..
have a look to the "+++" try to find out in AT-Demo - this will idle the CIPSEND transparent mode - ;-).. search in project by stríngvalues= +++
try to search the LED Funtion in eagle_soc.h - there is no entry only in this file ;-)

best wishes!
;-)
rudi
User avatar
By rudi
#830 Found this:
in eagle_soc.h

Sorry for push

in eagle_soc.h example:
Code: Select all#define PERIPHS_IO_MUX_GPIO0_U      (PERIPHS_IO_MUX + 0x34)      // a part off adress
#define FUNC_GPIO0                     0      // this must be the last bit of the valued adress
..


The Base Adress of this Peripheral is defined at top

Code: Select all
#define PERIPHS_IO_MUX         0x60000800            // this is fine..
..



so the adress of

Code: Select all
GPIO0 =  0x60000800 + 0x34      0

yours
GPIO2 = 0x60000800  + 0x38      0
btw
U1_TXD_BK            2
U0_TXD_BK            4



this sound is good..

i search this way because then is lighter to define own name's for the Bit and can set faster by setting directly over the adress

i try more.

best wishes!
rudi
;-)
User avatar
By reaper7
#833
have you done successfull the at command leasson? ;-)
this is a good way to think in in the coder ..

yes - it was a simple.

inside user_main.c I added:
Code: Select all#include "gpio.h"
..
..
gpio_init();


inside at_baseCmd.h I added 2 commands:
Code: Select allvoid at_exeCmdGL(uint8_t id);   //GPIO LOW
void at_exeCmdGH(uint8_t id);  //GPIO HIGH


inside at_baseCmd.c I added:
Code: Select allvoid ICACHE_FLASH_ATTR
at_exeCmdGL(uint8_t id)
{
  GPIO_OUTPUT_SET(BIT2, 0)
  at_backOk;
}

void ICACHE_FLASH_ATTR
at_exeCmdGL(uint8_t id)
{
  GPIO_OUTPUT_SET(BIT2, 1)
  at_backOk;
}


inside at_cmd.h I added:
Code: Select all//#define at_cmdNum   19
#define at_cmdNum   21
..
..
  {"+GL", 3, NULL, NULL, NULL, at_exeCmdGL},
  {"+GH", 3, NULL, NULL, NULL, at_exeCmdGH},
..