Luc 93312ff8b5
Idf 5.1.4/Arduino 3.0.4 porting for esp32 (#1046)
* Update WebSocket library
* Update SSDP library
* Update TFT_eSPI library
* Update EspLuaEngine library
* Update SDFat library
* Change to pioarduino
* Make ESP3DMessageFIFO and ESP3DMessage  more thread safe
* Fix sanity checks for BT
* Add some C6 support
* Refactor ethernet code
* Split Ethernet Sta / WiFi sta ESP Commands  and settings
* Simplify wait and wdtFeed code
* Set C3 with 4MB by default in platformio.ini
* Apply Disable brown out only on ESP32 to avoid crash e.g:ESP32S3
* Add missing entries in platformio.ini
2024-09-05 16:27:47 +08:00

56 lines
2.0 KiB
C++

/**
* Copyright (c) 2011-2020 Bill Greiman
* This file is part of the SdFat library for SD memory cards.
*
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include "SysCall.h"
#if 0 // defined(__AVR_ATmega328P__) && !ENABLE_ARDUINO_FEATURES
#include <avr/interrupt.h>
// ISR for timer 2 Compare A interrupt
volatile uint16_t timer2 = 0;
ISR(TIMER2_COMPA_vect) {
timer2++;
}
SdMillis_t SysCall::curTimeMS() {
if (TIMSK2 != (1 << OCIE2A)) {
// use system clock (clkI/O).
ASSR &= ~(1 << AS2);
// Clear Timer on Compare Match (CTC) mode
TCCR2A = (1 << WGM21);
// Only need 64x prescale bits in TCCR2B
TCCR2B = (1 << CS22);
// set TOP so timer period is 1 ms.
#if F_CPU/64000 > 250
#error F_CPU too large.
#endif // F_CPU/64000 > 250
OCR2A = F_CPU/64000UL - 1;
// Enable interrupt.
TIMSK2 = (1 << OCIE2A);
}
cli();
uint16_t rtn = timer2;
sei();
return rtn;
}
#endif // defined(__AVR_ATmega328P__) && !ENABLE_ARDUINO_FEATURES