mirror of
https://github.com/justcallmekoko/ESP32Marauder.git
synced 2025-12-23 07:29:14 -08:00
Add XIAO-ESP32-S3 Board Support (WIP)
looking to cleanup certain things with config to allow easier customization of the build when used with the flipper zero
This commit is contained in:
@@ -5,7 +5,7 @@ BatteryInterface::BatteryInterface() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BatteryInterface::main(uint32_t currentTime) {
|
void BatteryInterface::main(uint32_t currentTime) {
|
||||||
#ifndef MARAUDER_FLIPPER
|
#ifndef MARAUDER_FLIPPER || XIAO_ESP32_S3
|
||||||
if (currentTime != 0) {
|
if (currentTime != 0) {
|
||||||
if (currentTime - initTime >= 3000) {
|
if (currentTime - initTime >= 3000) {
|
||||||
//Serial.println("Checking Battery Level");
|
//Serial.println("Checking Battery Level");
|
||||||
@@ -22,14 +22,14 @@ void BatteryInterface::main(uint32_t currentTime) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BatteryInterface::RunSetup() {
|
void BatteryInterface::RunSetup() {
|
||||||
#ifndef MARAUDER_FLIPPER
|
#ifndef MARAUDER_FLIPPER || XIAO_ESP32_S3
|
||||||
Wire.begin(I2C_SDA, I2C_SCL);
|
Wire.begin(I2C_SDA, I2C_SCL);
|
||||||
this->initTime = millis();
|
this->initTime = millis();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t BatteryInterface::getBatteryLevel() {
|
int8_t BatteryInterface::getBatteryLevel() {
|
||||||
#ifndef MARAUDER_FLIPPER
|
#ifndef MARAUDER_FLIPPER || XIAO_ESP32_S3
|
||||||
Wire.beginTransmission(IP5306_ADDR);
|
Wire.beginTransmission(IP5306_ADDR);
|
||||||
Wire.write(0x78);
|
Wire.write(0x78);
|
||||||
if (Wire.endTransmission(false) == 0 &&
|
if (Wire.endTransmission(false) == 0 &&
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
#include "configs.h"
|
#include "configs.h"
|
||||||
|
|
||||||
#ifndef MARAUDER_FLIPPER
|
#ifndef MARAUDER_FLIPPER || XIAO_ESP32_S3
|
||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ void TemperatureInterface::RunSetup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint8_t TemperatureInterface::getCurrentTemp() {
|
uint8_t TemperatureInterface::getCurrentTemp() {
|
||||||
#ifndef MARAUDER_FLIPPER
|
#ifndef MARAUDER_FLIPPER || XIAO_ESP32_S3
|
||||||
return ((temprature_sens_read() - 32) / 1.8);
|
return ((temprature_sens_read() - 32) / 1.8);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#define MARAUDER_FLIPPER
|
#define MARAUDER_FLIPPER
|
||||||
//#define ESP32_LDDB
|
//#define ESP32_LDDB
|
||||||
//#define MARAUDER_DEV_BOARD_PRO
|
//#define MARAUDER_DEV_BOARD_PRO
|
||||||
|
//#define XIAO_ESP32_S3
|
||||||
|
|
||||||
#define MARAUDER_VERSION "v0.10.7"
|
#define MARAUDER_VERSION "v0.10.7"
|
||||||
|
|
||||||
@@ -478,6 +479,13 @@
|
|||||||
#ifdef MARAUDER_DEV_BOARD_PRO
|
#ifdef MARAUDER_DEV_BOARD_PRO
|
||||||
#define SD_CS 4
|
#define SD_CS 4
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef XIAO_ESP32_S3
|
||||||
|
#define SD_CS 3
|
||||||
|
// Override RX1+TX1 pins
|
||||||
|
#define XIAO_RX1 1
|
||||||
|
#define XIAO_TX1 2
|
||||||
|
#endif
|
||||||
//// END SD DEFINITIONS
|
//// END SD DEFINITIONS
|
||||||
|
|
||||||
//// SCREEN STUFF
|
//// SCREEN STUFF
|
||||||
@@ -513,6 +521,10 @@
|
|||||||
#define HAS_BT
|
#define HAS_BT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef XIAO_ESP32_S3
|
||||||
|
#define HAS_BT
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef HAS_SCREEN
|
#ifndef HAS_SCREEN
|
||||||
#define TFT_WHITE 0
|
#define TFT_WHITE 0
|
||||||
#define TFT_CYAN 0
|
#define TFT_CYAN 0
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ https://www.online-utility.org/image/convert/to/XBM
|
|||||||
#include "CommandLine.h"
|
#include "CommandLine.h"
|
||||||
#include "lang_var.h"
|
#include "lang_var.h"
|
||||||
#include "flipperLED.h"
|
#include "flipperLED.h"
|
||||||
|
#include "xiaoLED.h"
|
||||||
|
|
||||||
#ifdef HAS_SCREEN
|
#ifdef HAS_SCREEN
|
||||||
#include "Display.h"
|
#include "Display.h"
|
||||||
@@ -74,6 +75,7 @@ EspInterface esp_obj;
|
|||||||
Settings settings_obj;
|
Settings settings_obj;
|
||||||
CommandLine cli_obj;
|
CommandLine cli_obj;
|
||||||
flipperLED flipper_led;
|
flipperLED flipper_led;
|
||||||
|
xiaoLED xiao_led;
|
||||||
|
|
||||||
#ifdef HAS_SCREEN
|
#ifdef HAS_SCREEN
|
||||||
Display display_obj;
|
Display display_obj;
|
||||||
@@ -214,6 +216,10 @@ void setup()
|
|||||||
flipper_led.RunSetup();
|
flipper_led.RunSetup();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef XIAO_ESP32_S3
|
||||||
|
xiao_led.runSetup();
|
||||||
|
#endif
|
||||||
|
|
||||||
//Serial.println("This is a test Channel: " + (String)settings_obj.loadSetting<uint8_t>("Channel"));
|
//Serial.println("This is a test Channel: " + (String)settings_obj.loadSetting<uint8_t>("Channel"));
|
||||||
//if (settings_obj.loadSetting<bool>( "Force PMKID"))
|
//if (settings_obj.loadSetting<bool>( "Force PMKID"))
|
||||||
// Serial.println("This is a test Force PMKID: true");
|
// Serial.println("This is a test Force PMKID: true");
|
||||||
@@ -253,7 +259,7 @@ void setup()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Temperature stuff
|
// Temperature stuff
|
||||||
#ifndef MARAUDER_FLIPPER
|
#ifndef MARAUDER_FLIPPER || XIAO_ESP32_S3
|
||||||
temp_obj.RunSetup();
|
temp_obj.RunSetup();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -261,7 +267,7 @@ void setup()
|
|||||||
display_obj.tft.println(F(text_table0[6]));
|
display_obj.tft.println(F(text_table0[6]));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MARAUDER_FLIPPER
|
#ifndef MARAUDER_FLIPPER || XIAO_ESP32_S3
|
||||||
battery_obj.battery_level = battery_obj.getBatteryLevel();
|
battery_obj.battery_level = battery_obj.getBatteryLevel();
|
||||||
|
|
||||||
// if (battery_obj.i2c_supported) {
|
// if (battery_obj.i2c_supported) {
|
||||||
@@ -272,7 +278,7 @@ void setup()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Do some LED stuff
|
// Do some LED stuff
|
||||||
#ifndef MARAUDER_FLIPPER
|
#ifndef MARAUDER_FLIPPER || XIAO_ESP32_S3
|
||||||
led_obj.RunSetup();
|
led_obj.RunSetup();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -335,7 +341,7 @@ void loop()
|
|||||||
sd_obj.main();
|
sd_obj.main();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MARAUDER_FLIPPER
|
#ifndef MARAUDER_FLIPPER || XIAO_ESP32_S3
|
||||||
battery_obj.main(currentTime);
|
battery_obj.main(currentTime);
|
||||||
temp_obj.main(currentTime);
|
temp_obj.main(currentTime);
|
||||||
#endif
|
#endif
|
||||||
@@ -347,7 +353,7 @@ void loop()
|
|||||||
#endif
|
#endif
|
||||||
//cli_obj.main(currentTime);
|
//cli_obj.main(currentTime);
|
||||||
}
|
}
|
||||||
#ifndef MARAUDER_FLIPPER
|
#ifndef MARAUDER_FLIPPER || XIAO_ESP32_S3
|
||||||
led_obj.main(currentTime);
|
led_obj.main(currentTime);
|
||||||
#endif
|
#endif
|
||||||
if (wifi_scan_obj.currentScanMode == OTA_UPDATE)
|
if (wifi_scan_obj.currentScanMode == OTA_UPDATE)
|
||||||
@@ -370,7 +376,7 @@ void loop()
|
|||||||
display_obj.main(wifi_scan_obj.currentScanMode);
|
display_obj.main(wifi_scan_obj.currentScanMode);
|
||||||
menu_function_obj.main(currentTime);
|
menu_function_obj.main(currentTime);
|
||||||
#endif
|
#endif
|
||||||
#ifndef MARAUDER_FLIPPER
|
#ifndef MARAUDER_FLIPPER || XIAO_ESP32_S3
|
||||||
led_obj.main(currentTime);
|
led_obj.main(currentTime);
|
||||||
#endif
|
#endif
|
||||||
//cli_obj.main(currentTime);
|
//cli_obj.main(currentTime);
|
||||||
|
|||||||
47
esp32_marauder/xiaoLED.cpp
Normal file
47
esp32_marauder/xiaoLED.cpp
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
#include "xiaoLED.h"
|
||||||
|
|
||||||
|
void xiaoLED::RunSetup() {
|
||||||
|
pinMode(XIAO_LED_PIN, OUTPUT);
|
||||||
|
|
||||||
|
if (!settings_obj.loadSetting<bool>("EnableLED")) {
|
||||||
|
digitalWrite(XIAO_LED_PIN, HIGH);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
delay(50);
|
||||||
|
|
||||||
|
digitalWrite(XIAO_LED_PIN, LOW);
|
||||||
|
delay(500);
|
||||||
|
digitalWrite(XIAO_LED_PIN, HIGH);
|
||||||
|
digitalWrite(XIAO_LED_PIN, LOW);
|
||||||
|
delay(500);
|
||||||
|
digitalWrite(XIAO_LED_PIN, HIGH);
|
||||||
|
digitalWrite(XIAO_LED_PIN, LOW);
|
||||||
|
delay(500);
|
||||||
|
digitalWrite(XIAO_LED_PIN, HIGH);
|
||||||
|
}
|
||||||
|
|
||||||
|
void xiaoLED::attackLED() {
|
||||||
|
if (!settings_obj.loadSetting<bool>("EnableLED"))
|
||||||
|
return;
|
||||||
|
|
||||||
|
digitalWrite(XIAO_LED_PIN, HIGH);
|
||||||
|
delay(10);
|
||||||
|
digitalWrite(XIAO_LED_PIN, LOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
void xiaoLED::sniffLED() {
|
||||||
|
if (!settings_obj.loadSetting<bool>("EnableLED"))
|
||||||
|
return;
|
||||||
|
|
||||||
|
digitalWrite(XIAO_LED_PIN, HIGH);
|
||||||
|
delay(10);
|
||||||
|
digitalWrite(XIAO_LED_PIN, LOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
void xiaoLED::offLED() {
|
||||||
|
if (!settings_obj.loadSetting<bool>("EnableLED"))
|
||||||
|
return;
|
||||||
|
|
||||||
|
digitalWrite(XIAO_LED_PIN, HIGH);
|
||||||
|
}
|
||||||
24
esp32_marauder/xiaoLED.h
Normal file
24
esp32_marauder/xiaoLED.h
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#ifndef xiaoLED_H
|
||||||
|
#define xiaoLED_H
|
||||||
|
|
||||||
|
#include "configs.h"
|
||||||
|
#include "settings.h"
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
#ifdef XIAO_ESP32_S3
|
||||||
|
#define XIAO_LED_PIN 21
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern Settings settings_obj;
|
||||||
|
|
||||||
|
class xiaoLED {
|
||||||
|
|
||||||
|
public:
|
||||||
|
void RunSetup();
|
||||||
|
void attackLED();
|
||||||
|
void sniffLED();
|
||||||
|
void offLED();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* xiaoLED_H */
|
||||||
Reference in New Issue
Block a user