Quick simple question.
By default in the SDK are certain pins assigned with their correct PIN Function with output by default or is each pin unassigned and in order to use it as an Input or output you must call
PIN_FUNC_SELECT then call
gpio_output_set to say if the pin is used for Input or output.
I guess I'm looking for clarification of the technical defaults of the chip.
If I use PIN_FUNC_SELECT, Is a call for GPIO_OUTPUT_SET required to make the pin an output or is that default by PIN_FUNC_SELECT, I only need to call it to set it to be an input.
Why wouldn't I need to call PIN_FUNC_SELECT, are there any circumstances other then just having the pin nonused / floating?
The main reason why I am asking is that I have two projects side by side running the same code but for some reason the output is showing 1v on my Oscilloscope and on my other project, again running the same code is showing 3.3v on my Osciloscope for the GPIO output, I'm stumped.
Thanks for the clarification.
-Agent.
Code: Select all
#include "ets_sys.h"
#include "osapi.h"
#include "gpio.h"
#include "os_type.h"
#include "ip_addr.h"
#include "mem.h"
#include "user_interface.h"
#include "lwip/stats.h"
#include "espconn.h"
#include "c_types.h"
#include "../library/uart.h"
#include "../library/gpio16.h"
#include "../library/common.h"
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
#define user_procTaskPrio 0
#define user_procTaskQueueLen 1
os_event_t user_procTaskQueue[user_procTaskQueueLen];
void ICACHE_FLASH_ATTR sdk_init_done_cb(void)
{
os_printf("[%s] initializing ESP8266!\r\n", __func__);
gpio_output_set(0, 0, (1 << 15), 0); //Set GPIO as Output
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDO_U, FUNC_GPIO15);
os_printf("on");
gpio_output_set((1 << 15), 0, 0, 0);
delay_5seconds();
os_printf("off");
gpio_output_set(0, (1 << 15), 0, 0);
}
void ICACHE_FLASH_ATTR user_init()
{
//void uart0_tx_buffer(uint8 *buf, uint16 len)
uart_div_modify(0, UART_CLK_FREQ / 115200);
wifi_set_opmode(0);
wifi_set_sleep_type( NONE_SLEEP_T );
ETS_GPIO_INTR_DISABLE();// Disable gpio interrupts
gpio_init();
//Start os task
system_init_done_cb(sdk_init_done_cb);
//system_os_task(loop, user_procTaskPrio, user_procTaskQueue, user_procTaskQueueLen); //Task to Signal for later
}