mirror of
https://github.com/0xFEEDC0DE64/arduino-esp32.git
synced 2025-06-25 18:01:33 +02:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
9a7946e685 | |||
566b69eda3 | |||
e544e67838 | |||
b0582e1ec8 | |||
a539257a38 | |||
70656aa129 |
@ -157,6 +157,9 @@ esp32wrover.menu.PartitionScheme.minimal.build.partitions=minimal
|
|||||||
esp32wrover.menu.PartitionScheme.no_ota=No OTA (Large APP)
|
esp32wrover.menu.PartitionScheme.no_ota=No OTA (Large APP)
|
||||||
esp32wrover.menu.PartitionScheme.no_ota.build.partitions=no_ota
|
esp32wrover.menu.PartitionScheme.no_ota.build.partitions=no_ota
|
||||||
esp32wrover.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
|
esp32wrover.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
|
||||||
|
esp32wrover.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA)
|
||||||
|
esp32wrover.menu.PartitionScheme.huge_app.build.partitions=huge_app
|
||||||
|
esp32wrover.menu.PartitionScheme.huge_app.upload.maximum_size=3145728
|
||||||
esp32wrover.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (Large APPS with OTA)
|
esp32wrover.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (Large APPS with OTA)
|
||||||
esp32wrover.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs
|
esp32wrover.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs
|
||||||
esp32wrover.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080
|
esp32wrover.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080
|
||||||
|
@ -1609,6 +1609,9 @@ i2c_err_t i2cFlush(i2c_t * i2c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
i2c_err_t i2cWrite(i2c_t * i2c, uint16_t address, uint8_t* buff, uint16_t size, bool sendStop, uint16_t timeOutMillis){
|
i2c_err_t i2cWrite(i2c_t * i2c, uint16_t address, uint8_t* buff, uint16_t size, bool sendStop, uint16_t timeOutMillis){
|
||||||
|
if((i2c==NULL)||((size>0)&&(buff==NULL))) { // need to have location to store requested data
|
||||||
|
return I2C_ERROR_DEV;
|
||||||
|
}
|
||||||
i2c_err_t last_error = i2cAddQueueWrite(i2c, address, buff, size, sendStop, NULL);
|
i2c_err_t last_error = i2cAddQueueWrite(i2c, address, buff, size, sendStop, NULL);
|
||||||
|
|
||||||
if(last_error == I2C_ERROR_OK) { //queued
|
if(last_error == I2C_ERROR_OK) { //queued
|
||||||
@ -1628,6 +1631,9 @@ i2c_err_t i2cWrite(i2c_t * i2c, uint16_t address, uint8_t* buff, uint16_t size,
|
|||||||
}
|
}
|
||||||
|
|
||||||
i2c_err_t i2cRead(i2c_t * i2c, uint16_t address, uint8_t* buff, uint16_t size, bool sendStop, uint16_t timeOutMillis, uint32_t *readCount){
|
i2c_err_t i2cRead(i2c_t * i2c, uint16_t address, uint8_t* buff, uint16_t size, bool sendStop, uint16_t timeOutMillis, uint32_t *readCount){
|
||||||
|
if((size == 0)||(i2c == NULL)||(buff==NULL)){ // hardware will hang if no data requested on READ
|
||||||
|
return I2C_ERROR_DEV;
|
||||||
|
}
|
||||||
i2c_err_t last_error=i2cAddQueueRead(i2c, address, buff, size, sendStop, NULL);
|
i2c_err_t last_error=i2cAddQueueRead(i2c, address, buff, size, sendStop, NULL);
|
||||||
|
|
||||||
if(last_error == I2C_ERROR_OK) { //queued
|
if(last_error == I2C_ERROR_OK) { //queued
|
||||||
|
@ -481,7 +481,7 @@ int log_printf(const char *format, ...)
|
|||||||
vsnprintf(temp, len+1, format, arg);
|
vsnprintf(temp, len+1, format, arg);
|
||||||
#if !CONFIG_DISABLE_HAL_LOCKS
|
#if !CONFIG_DISABLE_HAL_LOCKS
|
||||||
if(_uart_bus_array[s_uart_debug_nr].lock){
|
if(_uart_bus_array[s_uart_debug_nr].lock){
|
||||||
while (xSemaphoreTake(_uart_bus_array[s_uart_debug_nr].lock, portMAX_DELAY) != pdPASS);
|
xSemaphoreTake(_uart_bus_array[s_uart_debug_nr].lock, portMAX_DELAY);
|
||||||
ets_printf("%s", temp);
|
ets_printf("%s", temp);
|
||||||
xSemaphoreGive(_uart_bus_array[s_uart_debug_nr].lock);
|
xSemaphoreGive(_uart_bus_array[s_uart_debug_nr].lock);
|
||||||
} else {
|
} else {
|
||||||
@ -491,7 +491,7 @@ int log_printf(const char *format, ...)
|
|||||||
ets_printf("%s", temp);
|
ets_printf("%s", temp);
|
||||||
#endif
|
#endif
|
||||||
va_end(arg);
|
va_end(arg);
|
||||||
if(len > sizeof(loc_buf)){
|
if(len >= sizeof(loc_buf)){
|
||||||
free(temp);
|
free(temp);
|
||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
|
71
libraries/ESP32/examples/I2S/HiFreq_ADC/HiFreq_ADC.ino
Normal file
71
libraries/ESP32/examples/I2S/HiFreq_ADC/HiFreq_ADC.ino
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
* This is an example to read analog data at high frequency using the I2S peripheral
|
||||||
|
* Run a wire between pins 27 & 32
|
||||||
|
* The readings from the device will be 12bit (0-4096)
|
||||||
|
*/
|
||||||
|
#include <driver/i2s.h>
|
||||||
|
|
||||||
|
#define I2S_SAMPLE_RATE 78125
|
||||||
|
#define ADC_INPUT ADC1_CHANNEL_4 //pin 32
|
||||||
|
#define OUTPUT_PIN 27
|
||||||
|
#define OUTPUT_VALUE 3800
|
||||||
|
#define READ_DELAY 10000 //microseconds
|
||||||
|
|
||||||
|
void i2sInit()
|
||||||
|
{
|
||||||
|
i2s_config_t i2s_config = {
|
||||||
|
.mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_RX | I2S_MODE_ADC_BUILT_IN),
|
||||||
|
.sample_rate = I2S_SAMPLE_RATE, // The format of the signal using ADC_BUILT_IN
|
||||||
|
.bits_per_sample = I2S_BITS_PER_SAMPLE_16BIT, // is fixed at 12bit, stereo, MSB
|
||||||
|
.channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT,
|
||||||
|
.communication_format = I2S_COMM_FORMAT_I2S_MSB,
|
||||||
|
.intr_alloc_flags = ESP_INTR_FLAG_LEVEL1,
|
||||||
|
.dma_buf_count = 4,
|
||||||
|
.dma_buf_len = 8,
|
||||||
|
.use_apll = false,
|
||||||
|
.tx_desc_auto_clear = false,
|
||||||
|
.fixed_mclk = 0
|
||||||
|
};
|
||||||
|
i2s_driver_install(I2S_NUM_0, &i2s_config, 0, NULL);
|
||||||
|
i2s_set_adc_mode(ADC_UNIT_1, ADC_INPUT);
|
||||||
|
i2s_adc_enable(I2S_NUM_0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void reader(void *pvParameters) {
|
||||||
|
uint32_t read_counter = 0;
|
||||||
|
uint64_t read_sum = 0;
|
||||||
|
while(1){
|
||||||
|
size_t bytes_read = 0;
|
||||||
|
uint16_t buffer = 0;
|
||||||
|
i2s_read(I2S_NUM_0, &buffer, sizeof(buffer), &bytes_read, portMAX_DELAY);
|
||||||
|
buffer = ~buffer; // The data is inverted
|
||||||
|
//Serial.println(buffer % 0x1000);
|
||||||
|
read_sum += buffer % 0x1000; // The 4 high bits are the channel
|
||||||
|
read_counter++;
|
||||||
|
if (bytes_read != sizeof(buffer)) Serial.println("buffer empty!");
|
||||||
|
if (read_counter == I2S_SAMPLE_RATE) {
|
||||||
|
Serial.printf("avg: %d\n", read_sum/I2S_SAMPLE_RATE);
|
||||||
|
read_counter = 0;
|
||||||
|
read_sum = 0;
|
||||||
|
i2s_adc_disable(I2S_NUM_0);
|
||||||
|
delay(READ_DELAY);
|
||||||
|
i2s_adc_enable(I2S_NUM_0);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(115200);
|
||||||
|
// Put a signal out on pin
|
||||||
|
uint32_t freq = ledcSetup(0, I2S_SAMPLE_RATE, 10);
|
||||||
|
Serial.printf("Output frequency: %d\n", freq);
|
||||||
|
ledcWrite(0, OUTPUT_VALUE/4);
|
||||||
|
ledcAttachPin(OUTPUT_PIN, 0);
|
||||||
|
// Initialize the I2S peripheral
|
||||||
|
i2sInit();
|
||||||
|
// Create a task that will read the data
|
||||||
|
xTaskCreatePinnedToCore(reader, "ADC_reader", 2048, NULL, 1, NULL, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {}
|
@ -35,7 +35,7 @@ compiler.S.flags=-c -g3 -x assembler-with-cpp -MMD -mlongcalls
|
|||||||
|
|
||||||
compiler.c.elf.cmd=xtensa-esp32-elf-gcc
|
compiler.c.elf.cmd=xtensa-esp32-elf-gcc
|
||||||
compiler.c.elf.flags=-nostdlib "-L{compiler.sdk.path}/lib" "-L{compiler.sdk.path}/ld" -T esp32_out.ld -T esp32.common.ld -T esp32.rom.ld -T esp32.peripherals.ld -T esp32.rom.spiram_incompatible_fns.ld -u ld_include_panic_highint_hdl -u call_user_start_cpu0 -Wl,--gc-sections -Wl,-static -Wl,--undefined=uxTopUsedPriority -u __cxa_guard_dummy -u __cxx_fatal_exception
|
compiler.c.elf.flags=-nostdlib "-L{compiler.sdk.path}/lib" "-L{compiler.sdk.path}/ld" -T esp32_out.ld -T esp32.common.ld -T esp32.rom.ld -T esp32.peripherals.ld -T esp32.rom.spiram_incompatible_fns.ld -u ld_include_panic_highint_hdl -u call_user_start_cpu0 -Wl,--gc-sections -Wl,-static -Wl,--undefined=uxTopUsedPriority -u __cxa_guard_dummy -u __cxx_fatal_exception
|
||||||
compiler.c.elf.libs=-lgcc -lopenssl -lbtdm_app -lfatfs -lwps -lcoexist -lwear_levelling -lesp_http_client -lprotobuf-c -lhal -lnewlib -ldriver -lbootloader_support -lpp -lfreemodbus -lmesh -lsmartconfig -ljsmn -lwpa -lethernet -lphy -lfrmn -lapp_trace -lfr_coefficients -lconsole -lulp -lwpa_supplicant -lfreertos -lbt -lmicro-ecc -lesp32-camera -lcxx -lxtensa-debug-module -ltcp_transport -lmdns -lvfs -lmtmn -lesp_ringbuf -lsoc -lcore -lfb_gfx -lsdmmc -llibsodium -lcoap -ltcpip_adapter -lprotocomm -lesp_event -limage_util -lc_nano -lesp-tls -lasio -lrtc -lspi_flash -lwpa2 -lwifi_provisioning -lesp32 -lface_recognition -lapp_update -lnghttp -llib -lspiffs -lface_detection -lunity -lesp_https_server -lespnow -lnvs_flash -lesp_adc_cal -llog -ldl_lib -lsmartconfig_ack -lexpat -lfd_coefficients -lm -lmqtt -lc -lheap -lmbedtls -llwip -lnet80211 -lesp_http_server -lpthread -ljson -lesp_https_ota -lstdc++
|
compiler.c.elf.libs=-lgcc -lopenssl -lbtdm_app -lfatfs -lwps -lcoexist -lwear_levelling -lesp_http_client -lprotobuf-c -lhal -lnewlib -ldriver -lbootloader_support -lpp -lfreemodbus -lmesh -lsmartconfig -ljsmn -lwpa -lethernet -lphy -lfrmn -lapp_trace -lfr_coefficients -lconsole -lulp -lwpa_supplicant -lfreertos -lbt -lmicro-ecc -lesp32-camera -lcxx -lxtensa-debug-module -ltcp_transport -lmdns -lvfs -lmtmn -lesp_ringbuf -lsoc -lcore -lfb_gfx -lsdmmc -llibsodium -lcoap -ltcpip_adapter -lprotocomm -lesp_event -limage_util -lc_nano -lesp-tls -lasio -lrtc -lspi_flash -lwpa2 -lwifi_provisioning -lesp32 -lface_recognition -lapp_update -lnghttp -lspiffs -lface_detection -lunity -lesp_https_server -lespnow -lnvs_flash -lesp_adc_cal -llog -ldl_lib -lsmartconfig_ack -lexpat -lfd_coefficients -lm -lmqtt -lc -lheap -lmbedtls -llwip -lnet80211 -lesp_http_server -lpthread -ljson -lesp_https_ota -lstdc++
|
||||||
|
|
||||||
compiler.as.cmd=xtensa-esp32-elf-as
|
compiler.as.cmd=xtensa-esp32-elf-as
|
||||||
|
|
||||||
|
@ -48,6 +48,7 @@ platformio ci --board esp32dev libraries/WiFi/examples/WiFiClient && \
|
|||||||
platformio ci --board esp32dev libraries/WiFiClientSecure/examples/WiFiClientSecure && \
|
platformio ci --board esp32dev libraries/WiFiClientSecure/examples/WiFiClientSecure && \
|
||||||
platformio ci --board esp32dev libraries/BluetoothSerial/examples/SerialToSerialBT && \
|
platformio ci --board esp32dev libraries/BluetoothSerial/examples/SerialToSerialBT && \
|
||||||
platformio ci --board esp32dev libraries/BLE/examples/BLE_server && \
|
platformio ci --board esp32dev libraries/BLE/examples/BLE_server && \
|
||||||
platformio ci --board esp32dev libraries/AzureIoT/examples/GetStarted
|
platformio ci --board esp32dev libraries/AzureIoT/examples/GetStarted && \
|
||||||
|
platformio ci --board esp32dev libraries/ESP32/examples/Camera/CameraWebServer --project-option="board_build.partitions = huge_app.csv"
|
||||||
if [ $? -ne 0 ]; then exit 1; fi
|
if [ $? -ne 0 ]; then exit 1; fi
|
||||||
echo -e "travis_fold:end:platformio_test"
|
echo -e "travis_fold:end:platformio_test"
|
||||||
|
@ -163,7 +163,7 @@ env.Append(
|
|||||||
],
|
],
|
||||||
|
|
||||||
LIBS=[
|
LIBS=[
|
||||||
"-lgcc", "-lopenssl", "-lbtdm_app", "-lfatfs", "-lwps", "-lcoexist", "-lwear_levelling", "-lesp_http_client", "-lprotobuf-c", "-lhal", "-lnewlib", "-ldriver", "-lbootloader_support", "-lpp", "-lfreemodbus", "-lmesh", "-lsmartconfig", "-ljsmn", "-lwpa", "-lethernet", "-lphy", "-lfrmn", "-lapp_trace", "-lfr_coefficients", "-lconsole", "-lulp", "-lwpa_supplicant", "-lfreertos", "-lbt", "-lmicro-ecc", "-lesp32-camera", "-lcxx", "-lxtensa-debug-module", "-ltcp_transport", "-lmdns", "-lvfs", "-lmtmn", "-lesp_ringbuf", "-lsoc", "-lcore", "-lfb_gfx", "-lsdmmc", "-llibsodium", "-lcoap", "-ltcpip_adapter", "-lprotocomm", "-lesp_event", "-limage_util", "-lc_nano", "-lesp-tls", "-lasio", "-lrtc", "-lspi_flash", "-lwpa2", "-lwifi_provisioning", "-lesp32", "-lface_recognition", "-lapp_update", "-lnghttp", "-llib", "-lspiffs", "-lface_detection", "-lunity", "-lesp_https_server", "-lespnow", "-lnvs_flash", "-lesp_adc_cal", "-llog", "-ldl_lib", "-lsmartconfig_ack", "-lexpat", "-lfd_coefficients", "-lm", "-lmqtt", "-lc", "-lheap", "-lmbedtls", "-llwip", "-lnet80211", "-lesp_http_server", "-lpthread", "-ljson", "-lesp_https_ota", "-lstdc++"
|
"-lgcc", "-lopenssl", "-lbtdm_app", "-lfatfs", "-lwps", "-lcoexist", "-lwear_levelling", "-lesp_http_client", "-lprotobuf-c", "-lhal", "-lnewlib", "-ldriver", "-lbootloader_support", "-lpp", "-lfreemodbus", "-lmesh", "-lsmartconfig", "-ljsmn", "-lwpa", "-lethernet", "-lphy", "-lfrmn", "-lapp_trace", "-lfr_coefficients", "-lconsole", "-lulp", "-lwpa_supplicant", "-lfreertos", "-lbt", "-lmicro-ecc", "-lesp32-camera", "-lcxx", "-lxtensa-debug-module", "-ltcp_transport", "-lmdns", "-lvfs", "-lmtmn", "-lesp_ringbuf", "-lsoc", "-lcore", "-lfb_gfx", "-lsdmmc", "-llibsodium", "-lcoap", "-ltcpip_adapter", "-lprotocomm", "-lesp_event", "-limage_util", "-lc_nano", "-lesp-tls", "-lasio", "-lrtc", "-lspi_flash", "-lwpa2", "-lwifi_provisioning", "-lesp32", "-lface_recognition", "-lapp_update", "-lnghttp", "-lspiffs", "-lface_detection", "-lunity", "-lesp_https_server", "-lespnow", "-lnvs_flash", "-lesp_adc_cal", "-llog", "-ldl_lib", "-lsmartconfig_ack", "-lexpat", "-lfd_coefficients", "-lm", "-lmqtt", "-lc", "-lheap", "-lmbedtls", "-llwip", "-lnet80211", "-lesp_http_server", "-lpthread", "-ljson", "-lesp_https_ota", "-lstdc++"
|
||||||
],
|
],
|
||||||
|
|
||||||
LIBSOURCE_DIRS=[
|
LIBSOURCE_DIRS=[
|
||||||
@ -209,7 +209,7 @@ env.Prepend(LIBS=libs)
|
|||||||
#
|
#
|
||||||
|
|
||||||
fwpartitions_dir = join(FRAMEWORK_DIR, "tools", "partitions")
|
fwpartitions_dir = join(FRAMEWORK_DIR, "tools", "partitions")
|
||||||
partitions_csv = env.BoardConfig().get("build.partitions", "huge_app.csv")
|
partitions_csv = env.BoardConfig().get("build.partitions", "default.csv")
|
||||||
env.Replace(
|
env.Replace(
|
||||||
PARTITIONS_TABLE_CSV=abspath(
|
PARTITIONS_TABLE_CSV=abspath(
|
||||||
join(fwpartitions_dir, partitions_csv) if isfile(
|
join(fwpartitions_dir, partitions_csv) if isfile(
|
||||||
|
@ -1 +0,0 @@
|
|||||||
!<arch>
|
|
Reference in New Issue
Block a user