forked from espressif/arduino-esp32
v2.0.0 Add support for ESP32S2 and update ESP-IDF to 4.4 (#4996)
This is very much still work in progress and much more will change before the final 2.0.0 Some APIs have changed. New libraries have been added. LittleFS included. Co-authored-by: Seon Rozenblum <seonr@3sprockets.com> Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com> Co-authored-by: geeksville <kevinh@geeksville.com> Co-authored-by: Mike Dunston <m_dunston@comcast.net> Co-authored-by: Unexpected Maker <seon@unexpectedmaker.com> Co-authored-by: Seon Rozenblum <seonr@3sprockets.com> Co-authored-by: microDev <70126934+microDev1@users.noreply.github.com> Co-authored-by: tobozo <tobozo@users.noreply.github.com> Co-authored-by: bobobo1618 <bobobo1618@users.noreply.github.com> Co-authored-by: lorol <lorolouis@gmail.com> Co-authored-by: geeksville <kevinh@geeksville.com> Co-authored-by: Limor "Ladyada" Fried <limor@ladyada.net> Co-authored-by: Sweety <switi.mhaiske@espressif.com> Co-authored-by: Loick MAHIEUX <loick111@gmail.com> Co-authored-by: Larry Bernstone <lbernstone@gmail.com> Co-authored-by: Valerii Koval <valeros@users.noreply.github.com> Co-authored-by: 快乐的我531 <2302004040@qq.com> Co-authored-by: chegewara <imperiaonline4@gmail.com> Co-authored-by: Clemens Kirchgatterer <clemens@1541.org> Co-authored-by: Aron Rubin <aronrubin@gmail.com> Co-authored-by: Pete Lewis <601236+lewispg228@users.noreply.github.com>
This commit is contained in:
@ -0,0 +1,47 @@
|
||||
// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef _dsps_d_gen_H_
|
||||
#define _dsps_d_gen_H_
|
||||
#include "dsp_err.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief delta function
|
||||
*
|
||||
* The function generate delta function.
|
||||
* output[i]=0, if i=[0..N)
|
||||
* output[i]=1, if i=pos, pos: [0..N-1)
|
||||
* The implementation use ANSI C and could be compiled and run on any platform
|
||||
*
|
||||
* @param output: output array.
|
||||
* @param len: length of the input signal
|
||||
* @param pos: delta function position
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* - One of the error codes from DSP library
|
||||
*/
|
||||
esp_err_t dsps_d_gen_f32(float *output, int len, int pos);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _dsps_d_gen_H_
|
@ -0,0 +1,48 @@
|
||||
// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef _dsps_h_gen_H_
|
||||
#define _dsps_h_gen_H_
|
||||
#include "dsp_err.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Heviside function
|
||||
*
|
||||
* The Heviside function.
|
||||
* output[i]=0, if i=[0..pos)
|
||||
* output[i]=1, if i=[pos..N)
|
||||
* The implementation use ANSI C and could be compiled and run on any platform
|
||||
*
|
||||
* @param output: output array.
|
||||
* @param len: length of the input signal
|
||||
* @param pos: heviside function position
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* - One of the error codes from DSP library
|
||||
*/
|
||||
|
||||
esp_err_t dsps_h_gen_f32(float *output, int len, int pos);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _dsps_h_gen_H_
|
@ -0,0 +1,51 @@
|
||||
// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef _dsps_sfdr_H_
|
||||
#define _dsps_sfdr_H_
|
||||
|
||||
|
||||
#include "dsp_err.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief SFDR
|
||||
*
|
||||
* The function calculates Spurious-Free Dynamic Range.
|
||||
* The function makes FFT of the input, then search a spectrum maximum, and then compare
|
||||
* maximum value with all others. Result calculated as minimum value.
|
||||
* This function have to be used for debug and unit tests only. It's not optimized for real-time processing.
|
||||
* The implementation use ANSI C and could be compiled and run on any platform
|
||||
*
|
||||
* @param[in] input: input array.
|
||||
* @param len: length of the input signal
|
||||
* @param use_dc: this parameter define will be DC value used for calculation or not.
|
||||
* 0 - SNR will not include DC power
|
||||
* 1 - SNR will include DC power
|
||||
*
|
||||
* @return
|
||||
* - SFDR in DB
|
||||
*/
|
||||
float dsps_sfdr_f32(const float *input, int32_t len, int8_t use_dc);
|
||||
float dsps_sfdr_fc32(const float *input, int32_t len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _dsps_sfdr_H_
|
@ -0,0 +1,51 @@
|
||||
// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef _DSP_SNR_H_
|
||||
#define _DSP_SNR_H_
|
||||
|
||||
#include "dsp_err.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief SNR
|
||||
*
|
||||
* The function calculates signal to noise ration in case if signal is sine tone.
|
||||
* The function makes FFT of the input, then search a spectrum maximum, and then calculated
|
||||
* SNR as sum of all harmonics to the maximum value.
|
||||
* This function have to be used for debug and unit tests only. It's not optimized for real-time processing.
|
||||
* The implementation use ANSI C and could be compiled and run on any platform
|
||||
*
|
||||
* @param input: input array.
|
||||
* @param len: length of the input signal
|
||||
* @param use_dc: this parameter define will be DC value used for calculation or not.
|
||||
* 0 - SNR will not include DC power
|
||||
* 1 - SNR will include DC power
|
||||
*
|
||||
* @return
|
||||
* - SNR in dB
|
||||
*/
|
||||
float dsps_snr_f32(const float *input, int32_t len, uint8_t use_dc);
|
||||
float dsps_snr_fc32(const float *input, int32_t len);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _DSP_SNR_H_
|
@ -0,0 +1,48 @@
|
||||
// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef _dsps_tone_gen_H_
|
||||
#define _dsps_tone_gen_H_
|
||||
#include "dsp_err.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief tone
|
||||
*
|
||||
* The function generate a tone signal.
|
||||
* x[i]=A*sin(2*PI*i + ph/180*PI)
|
||||
* The implementation use ANSI C and could be compiled and run on any platform
|
||||
*
|
||||
* @param output: output array.
|
||||
* @param len: length of the input signal
|
||||
* @param Ampl: amplitude
|
||||
* @param freq: Naiquist frequency -1..1
|
||||
* @param phase: phase in degree
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* - One of the error codes from DSP library
|
||||
*/
|
||||
esp_err_t dsps_tone_gen_f32(float *output, int len, float Ampl, float freq, float phase);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _dsps_tone_gen_H_
|
@ -0,0 +1,64 @@
|
||||
// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef _dsps_view_H_
|
||||
#define _dsps_view_H_
|
||||
|
||||
#include "dsp_err.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/**@{*/
|
||||
/**
|
||||
* @brief plot view
|
||||
*
|
||||
* Generic view function.
|
||||
* This function takes input samples and show then in console view as a plot.
|
||||
* The main purpose to give and draft debug information to the DSP developer.
|
||||
*
|
||||
* @param[in] data: array with input samples.
|
||||
* @param len: length of the input array
|
||||
* @param width: plot width in symbols
|
||||
* @param height: plot height in lines
|
||||
* @param min: minimum value that will be limited by Axis Y.
|
||||
* @param max: maximum value that will be limited by Axis Y.
|
||||
* @param view_char: character to draw the plot calues ('.' or '|' etc)
|
||||
*
|
||||
*/
|
||||
void dsps_view(const float *data, int32_t len, int width, int height, float min, float max, char view_char);
|
||||
void dsps_view_s16(const int16_t *data, int32_t len, int width, int height, float min, float max, char view_char);
|
||||
/**@}*/
|
||||
|
||||
/**
|
||||
* @brief spectrum view
|
||||
*
|
||||
* The view function to show spectrum values in 64x10 screen.
|
||||
* The function based on dsps_view.
|
||||
*
|
||||
* @param[in] data: array with input samples.
|
||||
* @param len: length of the input array
|
||||
* @param min: minimum value that will be limited by Axis Y.
|
||||
* @param max: maximum value that will be limited by Axis Y.
|
||||
*
|
||||
*/
|
||||
void dsps_view_spectrum(const float *data, int32_t len, float min, float max);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _dsps_view_H_
|
Reference in New Issue
Block a user