2021-10-27 05:43:28 -03:00
|
|
|
/*
|
|
|
|
* This file is free software: you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This file is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
* See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <AP_HAL/AP_HAL.h>
|
|
|
|
#include <AP_HAL_ESP32/HAL_ESP32_Class.h>
|
2024-01-06 22:03:31 -04:00
|
|
|
#include <AP_Math/div1000.h>
|
2021-10-27 05:43:28 -03:00
|
|
|
#include "SdCard.h"
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "esp_timer.h"
|
|
|
|
|
|
|
|
namespace AP_HAL
|
|
|
|
{
|
|
|
|
|
|
|
|
void panic(const char *errormsg, ...)
|
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
va_start(ap, errormsg);
|
|
|
|
vprintf(errormsg, ap);
|
|
|
|
va_end(ap);
|
|
|
|
|
|
|
|
while (1) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t micros()
|
|
|
|
{
|
|
|
|
return micros64();
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t millis()
|
|
|
|
{
|
|
|
|
return millis64();
|
|
|
|
}
|
|
|
|
|
|
|
|
uint64_t micros64()
|
|
|
|
{
|
|
|
|
return esp_timer_get_time();
|
|
|
|
}
|
|
|
|
|
|
|
|
uint64_t millis64()
|
|
|
|
{
|
2024-01-06 22:03:31 -04:00
|
|
|
return uint64_div1000(micros64());
|
2021-10-27 05:43:28 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace AP_HAL
|
|
|
|
|
2023-11-23 21:56:04 -04:00
|
|
|
static HAL_ESP32 hal_esp32;
|
|
|
|
|
2021-10-27 05:43:28 -03:00
|
|
|
const AP_HAL::HAL& AP_HAL::get_HAL()
|
|
|
|
{
|
2023-11-23 21:56:04 -04:00
|
|
|
return hal_esp32;
|
|
|
|
}
|
|
|
|
|
|
|
|
AP_HAL::HAL& AP_HAL::get_HAL_mutable()
|
|
|
|
{
|
|
|
|
return hal_esp32;
|
2021-10-27 05:43:28 -03:00
|
|
|
}
|