新板子修改IO口
This commit is contained in:
parent
416a4b5730
commit
c78198c985
28
main/main.c
28
main/main.c
@ -61,6 +61,7 @@ static EventGroupHandle_t s_wifi_event_group;
|
|||||||
* - we failed to connect after the maximum amount of retries */
|
* - we failed to connect after the maximum amount of retries */
|
||||||
#define WIFI_CONNECTED_BIT BIT0
|
#define WIFI_CONNECTED_BIT BIT0
|
||||||
#define WIFI_FAIL_BIT BIT1
|
#define WIFI_FAIL_BIT BIT1
|
||||||
|
#define GPIO_4G_PWR GPIO_NUM_4
|
||||||
|
|
||||||
static const char *TAG = "main";
|
static const char *TAG = "main";
|
||||||
|
|
||||||
@ -69,7 +70,7 @@ static int s_retry_num = 0;
|
|||||||
extern void wifi_init_softap(void);
|
extern void wifi_init_softap(void);
|
||||||
|
|
||||||
void ads1220_init(void);
|
void ads1220_init(void);
|
||||||
|
void PWR_4G_Init(void);
|
||||||
extern void can_init(void);
|
extern void can_init(void);
|
||||||
extern void FLOW_init();
|
extern void FLOW_init();
|
||||||
extern void DEPTH_init();
|
extern void DEPTH_init();
|
||||||
@ -85,7 +86,8 @@ void app_main(void)
|
|||||||
{
|
{
|
||||||
// Initialize NVS
|
// Initialize NVS
|
||||||
esp_err_t ret = nvs_flash_init();
|
esp_err_t ret = nvs_flash_init();
|
||||||
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
|
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND)
|
||||||
|
{
|
||||||
ESP_ERROR_CHECK(nvs_flash_erase());
|
ESP_ERROR_CHECK(nvs_flash_erase());
|
||||||
ret = nvs_flash_init();
|
ret = nvs_flash_init();
|
||||||
}
|
}
|
||||||
@ -98,7 +100,7 @@ void app_main(void)
|
|||||||
wifi_init_softap();
|
wifi_init_softap();
|
||||||
// wifi_init_sta();
|
// wifi_init_sta();
|
||||||
// can_init();
|
// can_init();
|
||||||
|
PWR_4G_Init();
|
||||||
ModBusTCPSlave_init();
|
ModBusTCPSlave_init();
|
||||||
ads1220_task_start(); // test succeed
|
ads1220_task_start(); // test succeed
|
||||||
BL0939_init(); // test succeed
|
BL0939_init(); // test succeed
|
||||||
@ -106,3 +108,23 @@ void app_main(void)
|
|||||||
FLOW_init();
|
FLOW_init();
|
||||||
uart0_modbus_slave_init();
|
uart0_modbus_slave_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PWR_4G_Init(void)
|
||||||
|
{
|
||||||
|
// zero-initialize the config structure.
|
||||||
|
gpio_config_t io_conf = {};
|
||||||
|
// disable interrupt
|
||||||
|
io_conf.intr_type = GPIO_INTR_DISABLE;
|
||||||
|
// set as output mode
|
||||||
|
io_conf.mode = GPIO_MODE_OUTPUT;
|
||||||
|
// bit mask of the pins that you want to set,e.g.GPIO18/19
|
||||||
|
io_conf.pin_bit_mask = GPIO_4G_PWR;
|
||||||
|
// disable pull-down mode
|
||||||
|
io_conf.pull_down_en = 0;
|
||||||
|
// disable pull-up mode
|
||||||
|
io_conf.pull_up_en = 0;
|
||||||
|
// configure GPIO with the given settings
|
||||||
|
gpio_config(&io_conf);
|
||||||
|
|
||||||
|
gpio_set_level(GPIO_4G_PWR, 0);
|
||||||
|
}
|
@ -390,7 +390,6 @@ extern int flow_rem[2];
|
|||||||
void ads1220_task(void)
|
void ads1220_task(void)
|
||||||
{
|
{
|
||||||
uint32_t io_num;
|
uint32_t io_num;
|
||||||
u32 data;
|
|
||||||
static uint32_t ad_flow_tick = 10;
|
static uint32_t ad_flow_tick = 10;
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
@ -34,7 +34,7 @@ static uint32_t cap_val_end_of_flow1 = 0;
|
|||||||
static uint32_t cap_val_begin_of_flow2 = 0;
|
static uint32_t cap_val_begin_of_flow2 = 0;
|
||||||
static uint32_t cap_val_end_of_flow2 = 0;
|
static uint32_t cap_val_end_of_flow2 = 0;
|
||||||
|
|
||||||
static xQueueHandle cap_queue;
|
// static xQueueHandle cap_queue;
|
||||||
extern uint32_t rtc_clk_apb_freq;
|
extern uint32_t rtc_clk_apb_freq;
|
||||||
uint32_t volatile t15_ccr[2];
|
uint32_t volatile t15_ccr[2];
|
||||||
uint16_t volatile t15_ccr_times[2];
|
uint16_t volatile t15_ccr_times[2];
|
||||||
|
Loading…
Reference in New Issue
Block a user