123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- #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 "hal/ws2812.h"
- #include "user_config.h"
- static const char* TAG = "main.c";
- #define DEBOUNCEDELAY 10
- #define SHDN_MUX PERIPHS_IO_MUX_GPIO4_U
- #define PBA_MUX PERIPHS_IO_MUX_GPIO5_U
- #define PBB_MUX PERIPHS_IO_MUX_GPIO2_U
- #define STATLED_MUX PERIPHS_IO_MUX_GPIO2_U
- #define SHDN_FUNC FUNC_GPIO4
- #define PBA_FUNC FUNC_GPIO5
- #define PBB_FUNC FUNC_GPIO2
- #define STATLED_FUNC FUNC_GPIO0
- #define SHDN 4
- #define PBA 5
- #define PBB 2
- #define STATLED 0
- void ICACHE_FLASH_ATTR app_init(void)
- {
- uart_init(BIT_RATE_115200, BIT_RATE_115200, DISABLE_UART1);
- ESP_LOGI(TAG, "Starting LSM6DS3 Demo\n");
- ESP_LOGI(TAG, "WiFi Testing \n");
-
- {
- 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);
-
-
-
-
- system_soft_wdt_feed();
- }
-
- {
- ESP_LOGI(TAG, "Setting WS2812B");
- PIN_FUNC_SELECT(STATLED_MUX, STATLED_FUNC);
- gpio_output_set(BIT(SHDN), BIT(STATLED), (BIT(SHDN)|BIT(STATLED)), (BIT(PBA)|BIT(PBB)));
- WS2812_SetColor(WS2812_ORANGE, WS2812_PULSE);
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- }
- void user_init(void)
- {
- wifi_set_opmode(STATION_MODE);
- wifi_station_ap_number_set(5);
- system_init_done_cb(app_init);
- }
|