mirror of
https://github.com/0xFEEDC0DE64/arduino-esp32.git
synced 2025-06-25 09:51:33 +02:00
Cleanup arduino useless bullshit
This commit is contained in:
@ -24,7 +24,9 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "esp32-hal.h"
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
//#include "esp32-hal.h"
|
||||
|
||||
typedef enum {
|
||||
ADC_0db,
|
||||
|
@ -45,6 +45,14 @@ uint32_t getApbFrequency(); // In Hz
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef F_CPU
|
||||
#if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4
|
||||
#define F_CPU (CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ * 1000000U)
|
||||
#elif CONFIG_IDF_TARGET_ESP32S2
|
||||
#define F_CPU (CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ * 1000000U)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define clockCyclesPerMicrosecond() ( (long int)getCpuFrequencyMhz() )
|
||||
#define clockCyclesToMicroseconds(a) ( (a) / clockCyclesPerMicrosecond() )
|
||||
#define microsecondsToClockCycles(a) ( (a) * clockCyclesPerMicrosecond() )
|
||||
|
@ -24,9 +24,6 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "esp32-hal.h"
|
||||
#include "driver/gpio.h"
|
||||
|
||||
void dacWrite(uint8_t pin, uint8_t value);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -12,6 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "esp32-hal.h"
|
||||
#include "esp32-hal-gpio.h"
|
||||
#include "pins_arduino.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
|
@ -24,7 +24,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "esp32-hal.h"
|
||||
#include "stdint.h"
|
||||
#include "soc/soc_caps.h"
|
||||
|
||||
#if (CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3)
|
||||
|
@ -12,13 +12,15 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "esp32-hal-i2c.h"
|
||||
#include "esp32-hal.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "freertos/semphr.h"
|
||||
#include "freertos/event_groups.h"
|
||||
#include "driver/periph_ctrl.h"
|
||||
#include "esp_private/periph_ctrl.h"
|
||||
#include "soc/i2c_reg.h"
|
||||
#include "soc/i2c_struct.h"
|
||||
#include "soc/dport_reg.h"
|
||||
@ -27,6 +29,7 @@
|
||||
#include "esp32-hal-log.h"
|
||||
#include "esp32-hal-gpio.h"
|
||||
#include "esp32-hal-matrix.h"
|
||||
#include "esp32-hal-misc.h"
|
||||
|
||||
#include "esp_system.h"
|
||||
#ifdef ESP_IDF_VERSION_MAJOR // IDF 4+
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
#include "esp32-hal-matrix.h"
|
||||
#include "esp_attr.h"
|
||||
#include "esp32-hal.h"
|
||||
|
||||
#include "esp_system.h"
|
||||
#ifdef ESP_IDF_VERSION_MAJOR // IDF 4+
|
||||
|
@ -20,7 +20,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "esp32-hal.h"
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "soc/gpio_sig_map.h"
|
||||
|
||||
void pinMatrixOutAttach(uint8_t pin, uint8_t function, bool invertOut, bool invertEnable);
|
||||
|
@ -13,6 +13,8 @@
|
||||
// limitations under the License.
|
||||
|
||||
#include "sdkconfig.h"
|
||||
#include "esp32-hal-misc.h"
|
||||
#include "esp32-hal.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "esp_attr.h"
|
||||
@ -29,7 +31,6 @@
|
||||
#include "soc/rtc_cntl_reg.h"
|
||||
#include "soc/apb_ctrl_reg.h"
|
||||
#include "esp_task_wdt.h"
|
||||
#include "esp32-hal.h"
|
||||
|
||||
#include "esp_system.h"
|
||||
#ifdef ESP_IDF_VERSION_MAJOR // IDF 4+
|
||||
|
8
cores/esp32/esp32-hal-misc.h
Normal file
8
cores/esp32/esp32-hal-misc.h
Normal file
@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void yield(void);
|
||||
|
||||
unsigned long micros();
|
||||
void delayMicroseconds(uint32_t us);
|
@ -14,6 +14,9 @@
|
||||
|
||||
#include "esp32-hal.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#if CONFIG_SPIRAM_SUPPORT || CONFIG_SPIRAM
|
||||
#include "soc/efuse_reg.h"
|
||||
#include "esp_heap_caps.h"
|
||||
|
@ -12,6 +12,8 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "esp32-hal-spi.h"
|
||||
#include "esp32-hal.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
|
@ -12,6 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "esp32-hal.h"
|
||||
#include "esp32-hal-touch.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
|
@ -24,7 +24,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "esp32-hal.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* Set cycles that measurement operation takes
|
||||
|
@ -20,29 +20,21 @@
|
||||
#ifndef HAL_ESP32_HAL_H_
|
||||
#define HAL_ESP32_HAL_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_system.h"
|
||||
#include "esp_sleep.h"
|
||||
//#include <stdint.h>
|
||||
//#include <stdbool.h>
|
||||
//#include <stdio.h>
|
||||
//#include <stdlib.h>
|
||||
//#include <stdarg.h>
|
||||
//#include <inttypes.h>
|
||||
//#include <string.h>
|
||||
//#include <math.h>
|
||||
//#include "sdkconfig.h"
|
||||
//#include "esp_system.h"
|
||||
//#include "esp_sleep.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef F_CPU
|
||||
#if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4
|
||||
#define F_CPU (CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ * 1000000U)
|
||||
#elif CONFIG_IDF_TARGET_ESP32S2
|
||||
#define F_CPU (CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ * 1000000U)
|
||||
#endif
|
||||
#endif
|
||||
//#ifdef __cplusplus
|
||||
//extern "C" {
|
||||
//#endif
|
||||
|
||||
#if CONFIG_ARDUINO_ISR_IRAM
|
||||
#define ARDUINO_ISR_ATTR IRAM_ATTR
|
||||
@ -52,36 +44,32 @@ extern "C" {
|
||||
#define ARDUINO_ISR_FLAG (0)
|
||||
#endif
|
||||
|
||||
//forward declaration from freertos/portmacro.h
|
||||
void vPortYield(void);
|
||||
void yield(void);
|
||||
#define optimistic_yield(u)
|
||||
////forward declaration from freertos/portmacro.h
|
||||
//void vPortYield(void);
|
||||
//#define optimistic_yield(u)
|
||||
|
||||
#define ESP_REG(addr) *((volatile uint32_t *)(addr))
|
||||
#define NOP() asm volatile ("nop")
|
||||
|
||||
//#include "esp32-hal-log.h"
|
||||
//#include "esp32-hal-matrix.h"
|
||||
//#include "esp32-hal-gpio.h"
|
||||
//#include "esp32-hal-touch.h"
|
||||
//#include "esp32-hal-dac.h"
|
||||
//#include "esp32-hal-adc.h"
|
||||
//#include "esp32-hal-spi.h"
|
||||
//#include "esp32-hal-i2c.h"
|
||||
//#include "esp32-hal-ledc.h"
|
||||
//#include "esp32-hal-rmt.h"
|
||||
//#include "esp32-hal-sigmadelta.h"
|
||||
//#include "esp32-hal-psram.h"
|
||||
//#include "esp32-hal-cpu.h"
|
||||
////#include "esp32-hal-log.h"
|
||||
////#include "esp32-hal-matrix.h"
|
||||
////#include "esp32-hal-gpio.h"
|
||||
////#include "esp32-hal-touch.h"
|
||||
////#include "esp32-hal-dac.h"
|
||||
////#include "esp32-hal-adc.h"
|
||||
////#include "esp32-hal-spi.h"
|
||||
////#include "esp32-hal-i2c.h"
|
||||
////#include "esp32-hal-ledc.h"
|
||||
////#include "esp32-hal-rmt.h"
|
||||
////#include "esp32-hal-sigmadelta.h"
|
||||
////#include "esp32-hal-psram.h"
|
||||
////#include "esp32-hal-cpu.h"
|
||||
|
||||
//returns chip temperature in Celsius
|
||||
float temperatureRead();
|
||||
////returns chip temperature in Celsius
|
||||
//float temperatureRead();
|
||||
|
||||
unsigned long micros();
|
||||
void delayMicroseconds(uint32_t us);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
//#ifdef __cplusplus
|
||||
//}
|
||||
//#endif
|
||||
|
||||
#endif /* HAL_ESP32_HAL_H_ */
|
||||
|
@ -25,10 +25,11 @@
|
||||
#ifndef TwoWire_h
|
||||
#define TwoWire_h
|
||||
|
||||
#include <esp32-hal.h>
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/queue.h"
|
||||
#include <string>
|
||||
#include "esp32-hal-i2c.h"
|
||||
|
||||
#define STICKBREAKER 'V1.1.0'
|
||||
|
Reference in New Issue
Block a user