add a .clang-format file (#9154)

This commit is contained in:
Jorropo
2026-01-03 21:19:24 +01:00
committed by GitHub
parent abab6ce815
commit 0d11331d18
771 changed files with 77752 additions and 83184 deletions

View File

@@ -7,34 +7,33 @@
#include "graphics/TFTDisplay.h"
// Heltec tracker specific init
void lateInitVariant()
{
// LOG_DEBUG("Heltec tracker initVariant");
void lateInitVariant() {
// LOG_DEBUG("Heltec tracker initVariant");
#ifndef MESHTASTIC_EXCLUDE_GPS
GpioVirtPin *virtGpsEnable = gps ? gps->enablePin : new GpioVirtPin();
GpioVirtPin *virtGpsEnable = gps ? gps->enablePin : new GpioVirtPin();
#else
GpioVirtPin *virtGpsEnable = new GpioVirtPin();
GpioVirtPin *virtGpsEnable = new GpioVirtPin();
#endif
#ifndef MESHTASTIC_EXCLUDE_SCREEN
// On this board we are actually using the backlightEnable signal to already be controlling a physical enable to the
// display controller. But we'd _ALSO_ like to have that signal drive a virtual GPIO. So nest it as needed.
GpioVirtPin *virtScreenEnable = new GpioVirtPin();
if (TFTDisplay::backlightEnable) {
GpioPin *physScreenEnable = TFTDisplay::backlightEnable;
GpioPin *splitter = new GpioSplitter(virtScreenEnable, physScreenEnable);
TFTDisplay::backlightEnable = splitter;
// On this board we are actually using the backlightEnable signal to already be controlling a physical enable to the
// display controller. But we'd _ALSO_ like to have that signal drive a virtual GPIO. So nest it as needed.
GpioVirtPin *virtScreenEnable = new GpioVirtPin();
if (TFTDisplay::backlightEnable) {
GpioPin *physScreenEnable = TFTDisplay::backlightEnable;
GpioPin *splitter = new GpioSplitter(virtScreenEnable, physScreenEnable);
TFTDisplay::backlightEnable = splitter;
// Assume screen is initially powered
splitter->set(true);
}
// Assume screen is initially powered
splitter->set(true);
}
#endif
#if defined(VEXT_ENABLE) && (!defined(MESHTASTIC_EXCLUDE_GPS) || !defined(MESHTASTIC_EXCLUDE_SCREEN))
// If either the GPS or the screen is on, turn on the external power regulator
GpioPin *hwEnable = new GpioHwPin(VEXT_ENABLE);
new GpioBinaryTransformer(virtGpsEnable, virtScreenEnable, hwEnable, GpioBinaryTransformer::Or);
// If either the GPS or the screen is on, turn on the external power regulator
GpioPin *hwEnable = new GpioHwPin(VEXT_ENABLE);
new GpioBinaryTransformer(virtGpsEnable, virtScreenEnable, hwEnable, GpioBinaryTransformer::Or);
#endif
}

View File

@@ -8,21 +8,19 @@
CSE_CST328 tsPanel = CSE_CST328(EINK_WIDTH, EINK_HEIGHT, &Wire, CST328_PIN_RST, CST328_PIN_INT);
bool readTouch(int16_t *x, int16_t *y)
{
if (tsPanel.getTouches()) {
*x = tsPanel.getPoint(0).x;
*y = tsPanel.getPoint(0).y;
return true;
}
return false;
bool readTouch(int16_t *x, int16_t *y) {
if (tsPanel.getTouches()) {
*x = tsPanel.getPoint(0).x;
*y = tsPanel.getPoint(0).y;
return true;
}
return false;
}
// T-Deck Pro specific init
void lateInitVariant()
{
tsPanel.begin();
touchScreenImpl1 = new TouchScreenImpl1(EINK_WIDTH, EINK_HEIGHT, readTouch);
touchScreenImpl1->init();
void lateInitVariant() {
tsPanel.begin();
touchScreenImpl1 = new TouchScreenImpl1(EINK_WIDTH, EINK_HEIGHT, readTouch);
touchScreenImpl1->init();
}
#endif

View File

@@ -8,20 +8,19 @@ DriverPins PinsAudioBoardES8311;
AudioBoard board(AudioDriverES8311, PinsAudioBoardES8311);
// TLora Pager specific init
void lateInitVariant()
{
// AudioDriverLogger.begin(Serial, AudioDriverLogLevel::Debug);
// I2C: function, scl, sda
PinsAudioBoardES8311.addI2C(PinFunction::CODEC, Wire);
// I2S: function, mclk, bck, ws, data_out, data_in
PinsAudioBoardES8311.addI2S(PinFunction::CODEC, DAC_I2S_MCLK, DAC_I2S_BCK, DAC_I2S_WS, DAC_I2S_DOUT, DAC_I2S_DIN);
void lateInitVariant() {
// AudioDriverLogger.begin(Serial, AudioDriverLogLevel::Debug);
// I2C: function, scl, sda
PinsAudioBoardES8311.addI2C(PinFunction::CODEC, Wire);
// I2S: function, mclk, bck, ws, data_out, data_in
PinsAudioBoardES8311.addI2S(PinFunction::CODEC, DAC_I2S_MCLK, DAC_I2S_BCK, DAC_I2S_WS, DAC_I2S_DOUT, DAC_I2S_DIN);
// configure codec
CodecConfig cfg;
cfg.input_device = ADC_INPUT_LINE1;
cfg.output_device = DAC_OUTPUT_ALL;
cfg.i2s.bits = BIT_LENGTH_16BITS;
cfg.i2s.rate = RATE_44K;
board.begin(cfg);
// configure codec
CodecConfig cfg;
cfg.input_device = ADC_INPUT_LINE1;
cfg.output_device = DAC_OUTPUT_ALL;
cfg.i2s.bits = BIT_LENGTH_16BITS;
cfg.i2s.rate = RATE_44K;
board.begin(cfg);
}
#endif

View File

@@ -10,34 +10,32 @@ TouchDrvCSTXXX tsPanel;
static constexpr uint8_t PossibleAddresses[2] = {CST328_ADDR, CST226SE_ADDR_ALT};
uint8_t i2cAddress = 0;
bool readTouch(int16_t *x, int16_t *y)
{
int16_t x_array[1], y_array[1];
uint8_t touched = tsPanel.getPoint(x_array, y_array, 1);
if (touched > 0) {
*y = x_array[0];
*x = (TFT_WIDTH - y_array[0]);
// Check bounds
if (*x < 0 || *x >= TFT_WIDTH || *y < 0 || *y >= TFT_HEIGHT) {
return false;
}
return true; // Valid touch detected
bool readTouch(int16_t *x, int16_t *y) {
int16_t x_array[1], y_array[1];
uint8_t touched = tsPanel.getPoint(x_array, y_array, 1);
if (touched > 0) {
*y = x_array[0];
*x = (TFT_WIDTH - y_array[0]);
// Check bounds
if (*x < 0 || *x >= TFT_WIDTH || *y < 0 || *y >= TFT_HEIGHT) {
return false;
}
return false; // No valid touch data
return true; // Valid touch detected
}
return false; // No valid touch data
}
void lateInitVariant()
{
tsPanel.setTouchDrvModel(TouchDrv_CST226);
for (uint8_t addr : PossibleAddresses) {
if (tsPanel.begin(Wire, addr, I2C_SDA, I2C_SCL)) {
i2cAddress = addr;
LOG_DEBUG("CST226SE init OK at address 0x%02X", addr);
touchScreenImpl1 = new TouchScreenImpl1(TFT_WIDTH, TFT_HEIGHT, readTouch);
touchScreenImpl1->init();
return;
}
void lateInitVariant() {
tsPanel.setTouchDrvModel(TouchDrv_CST226);
for (uint8_t addr : PossibleAddresses) {
if (tsPanel.begin(Wire, addr, I2C_SDA, I2C_SCL)) {
i2cAddress = addr;
LOG_DEBUG("CST226SE init OK at address 0x%02X", addr);
touchScreenImpl1 = new TouchScreenImpl1(TFT_WIDTH, TFT_HEIGHT, readTouch);
touchScreenImpl1->init();
return;
}
LOG_ERROR("CST226SE init failed at all known addresses");
}
LOG_ERROR("CST226SE init failed at all known addresses");
}
#endif