mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-26 17:46:14 +01:00
compiles on esp32-s3
This commit is contained in:
parent
4931c5ed75
commit
e7ed9ffbde
|
@ -83,18 +83,26 @@ int DCCTimer::freeMemory() {
|
|||
#include <soc/sens_struct.h>
|
||||
#undef ADC_INPUT_MAX_VALUE
|
||||
#define ADC_INPUT_MAX_VALUE 4095 // 12 bit ADC
|
||||
|
||||
#ifdef ARDUINO_ESP32S3_DEV
|
||||
#define pinToADC1Channel(X) (adc1_channel_t)((X)-1)
|
||||
#define MY_SAR_REG sar_meas1_ctrl2
|
||||
#else
|
||||
#define pinToADC1Channel(X) (adc1_channel_t)(((X) > 35) ? (X)-36 : (X)-28)
|
||||
#define MY_SAR_REG sar_meas_start1
|
||||
#endif
|
||||
|
||||
int IRAM_ATTR local_adc1_get_raw(int channel) {
|
||||
uint16_t adc_value;
|
||||
SENS.sar_meas_start1.sar1_en_pad = (1 << channel); // only one channel is selected
|
||||
SENS.MY_SAR_REG.sar1_en_pad = (1 << channel); // only one channel is selected
|
||||
while (SENS.sar_slave_addr1.meas_status != 0);
|
||||
SENS.sar_meas_start1.meas1_start_sar = 0;
|
||||
SENS.sar_meas_start1.meas1_start_sar = 1;
|
||||
while (SENS.sar_meas_start1.meas1_done_sar == 0);
|
||||
adc_value = SENS.sar_meas_start1.meas1_data_sar;
|
||||
SENS.MY_SAR_REG.meas1_start_sar = 0;
|
||||
SENS.MY_SAR_REG.meas1_start_sar = 1;
|
||||
while (SENS.MY_SAR_REG.meas1_done_sar == 0);
|
||||
adc_value = SENS.MY_SAR_REG.meas1_data_sar;
|
||||
return adc_value;
|
||||
}
|
||||
#undef MY_SAR_REG
|
||||
|
||||
#include "DCCTimer.h"
|
||||
INTERRUPT_CALLBACK interruptHandler=0;
|
||||
|
|
|
@ -221,13 +221,20 @@ bool TrackManager::setTrackMode(byte trackToSet, TRACK_MODE mode, int16_t dcAddr
|
|||
gpio_reset_pin((gpio_num_t)p.invpin);
|
||||
}
|
||||
#ifdef BOOSTER_INPUT
|
||||
|
||||
#ifdef ARDUINO_ESP32S3_DEV
|
||||
#define LOOP_IDX SIG_IN_FUNC212_IDX //pads 208 to 212 available as loopback
|
||||
#else
|
||||
#define LOOP_IDX SIG_IN_FUNC228_IDX //pads 224 to 228 available as loopback
|
||||
#endif
|
||||
|
||||
if (mode & TRACK_MODE_BOOST) {
|
||||
//DIAG(F("Track=%c mode boost pin %d"),trackToSet+'A', p.pin);
|
||||
pinMode(BOOSTER_INPUT, INPUT);
|
||||
gpio_matrix_in(26, SIG_IN_FUNC228_IDX, false); //pads 224 to 228 available as loopback
|
||||
gpio_matrix_out(p.pin, SIG_IN_FUNC228_IDX, false, false);
|
||||
gpio_matrix_in(26, LOOP_IDX, false);
|
||||
gpio_matrix_out(p.pin, LOOP_IDX, false, false);
|
||||
if (p.invpin != UNUSED_PIN) {
|
||||
gpio_matrix_out(p.invpin, SIG_IN_FUNC228_IDX, true /*inverted*/, false);
|
||||
gpio_matrix_out(p.invpin, LOOP_IDX, true /*inverted*/, false);
|
||||
}
|
||||
} else // elseif clause continues
|
||||
#endif
|
||||
|
|
|
@ -39,9 +39,15 @@
|
|||
#include "soc/timer_group_reg.h"
|
||||
void feedTheDog0(){
|
||||
// feed dog 0
|
||||
#ifdef ARDUINO_ESP32S3_DEV
|
||||
TIMERG0.wdtwprotect.wdt_wkey=0x50D83AA1; //MWDT_LL_WKEY_VALUE? write enable
|
||||
TIMERG0.wdtfeed.wdt_feed=1; // feed dog
|
||||
TIMERG0.wdtwprotect.wdt_wkey=0; // write protect
|
||||
#else
|
||||
TIMERG0.wdt_wprotect=TIMG_WDT_WKEY_VALUE; // write enable
|
||||
TIMERG0.wdt_feed=1; // feed dog
|
||||
TIMERG0.wdt_wprotect=0; // write protect
|
||||
#endif
|
||||
// feed dog 1
|
||||
//TIMERG1.wdt_wprotect=TIMG_WDT_WKEY_VALUE; // write enable
|
||||
//TIMERG1.wdt_feed=1; // feed dog
|
||||
|
|
Loading…
Reference in New Issue
Block a user