Change analogWrite to ledcWrite, configuration improvements

This commit is contained in:
2026-01-28 15:46:37 +01:00
parent 107339b3d3
commit 564ed20720
11 changed files with 340 additions and 304 deletions

View File

@@ -1,5 +1,7 @@
#pragma once
#include <Arduino.h>
#include "Nmea2kTwai.h"
#include "N2kDeviceList.h"
#define STRINGIFY_IMPL(x) #x
#define STRINGIFY(x) STRINGIFY_IMPL(x)
@@ -40,11 +42,23 @@
#define KEY_6 GPIO_NUM_10 // D7
#define KEY_DST GPIO_NUM_17 // D8
// LEDC / PWM channels
#define LEDC_BUZZER 0
#define LEDC_LED_A 1
#define LEDC_LED_B 2
#define LEDC_LED_C 3
#define LEDC_RGBLED_R 4
#define LEDC_RGBLED_G 5
#define LEDC_RGBLED_B 6
#define LEDC_BASE_FREQ 5000
#define LEDC_RES_BUZZER 8 // 8bit: 0..255
#define LEDC_RES_LED 12 // 12bit: 0..4095
// #define LEDC_TIMER_8_BIT 8
// Buzzer
#define BUZZER GPIO_NUM_43 // TX
#define LEDC_CHANNEL 0
#define LEDC_TIMER_8_BIT 8
#define LEDC_BASE_FREQ 5000
// LEDS
#define LED_A GPIO_NUM_3 // A2
@@ -99,13 +113,17 @@ struct ButtonEvent {
ButtonPressType pressType;
};
extern Nmea2kTwai &NMEA2000;
extern tN2kDeviceList *pN2kDeviceList;
extern char globalmode;
extern uint64_t chipid;
extern uint8_t led_brightness;
extern uint8_t rgb_brightness;
extern int16_t led_brightness;
extern int16_t rgb_brightness;
extern uint8_t keycode[6];
extern uint8_t longcode[6];
extern float temp;
extern float hum;
String uptime_with_unit();