123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- /* main.c -- MQTT client example
- *
- * Copyright (c) 2014-2015, Tuan PM <tuanpm at live dot com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Redis nor the names of its contributors may be used
- * to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
- #include "esp_common.h"
- #include "driver/uart.h"
- #include "driver/spi_interface.h"
- #include "gpio.h"
- #include "log/esp_log.h"
- #include "gdbstub/gdbstub.h"
- #include "hal/lsm6ds3.h"
- #include "hal/max17043.h"
- #include "hal/lps25hb.h"
- #include "user_config.h"
- static const char* TAG = "main.c";
- void wifi_handle_event_cb(System_Event_t *evt)
- {
- switch(evt->event)
- {
- case EVENT_STAMODE_CONNECTED:
- break;
- case EVENT_STAMODE_DISCONNECTED:
- break;
- case EVENT_STAMODE_AUTHMODE_CHANGE:
- break;
- case EVENT_STAMODE_GOT_IP:
- break;
- case EVENT_SOFTAPMODE_PROBEREQRECVED:
- break;
- case EVENT_SOFTAPMODE_STACONNECTED:
- break;
- case EVENT_SOFTAPMODE_STADISCONNECTED:
- break;
- default:
- break;
- }
- }
- void ICACHE_FLASH_ATTR app_init(void)
- {
- uart_init(BIT_RATE_115200, BIT_RATE_115200);
- ESP_LOGI(TAG, "Starting LSM6DS3 Demo\n");
- while(true)
- {
- LSM6DS3_Enable_I2C_Bridge(1);
- uint16_t x = max17043_getVoltage();
- ESP_LOGI(TAG, "MAX17043 Voltage %d", x);
- uint8_t y;
- LPS25HB_Get_DeviceID(&y);
- ESP_LOGI(TAG, "DEVICEID %x", y);
- // uint8_t i;
- // for(i=0;i<8;i++)
- // ESP_LOGI(TAG, "RX SPI Value: %x", data[i]);
- os_delay_us(1000000);
- system_soft_wdt_feed();
- }
- // wifi_set_opmode(STATION_MODE);
- // wifi_station_ap_number_set(MAX_APS);
- // wifi_station_set_auto_connect(true);
- //
- // wifi_station_get_ap_info()
- // wifi_station_ap_change()
- // wifi_staiton_get_current_ap_id()
- // wifi_set_sleep_type(MODEM_SLEEP_T);
- // wifi_enable_gpio_wakeup()
- //
- // if (wifi_station_get_config())
- // os_printf("zero wifi_config\n");
- // else
- // os_printf("there is a stored config");
- }
- void user_init(void)
- {
- system_init_done_cb(app_init);
- }
|