├── images ├── web-ui.png ├── dongle-back.jpeg ├── dongle-front.jpeg ├── dongle-battery.jpeg ├── dongle-racket.jpeg └── particle-xenon-sensor.jpeg ├── tinyml-tennis-classifier ├── lib │ ├── ei-tennis-sensor-arduino-1.0.3 │ │ ├── src │ │ │ ├── edge-impulse-sdk │ │ │ │ ├── CMSIS │ │ │ │ │ ├── sources.txt │ │ │ │ │ ├── DSP │ │ │ │ │ │ ├── Source │ │ │ │ │ │ │ ├── CommonTables │ │ │ │ │ │ │ │ └── CommonTablesF16.c │ │ │ │ │ │ │ ├── TransformFunctions │ │ │ │ │ │ │ │ └── TransformFunctionsF16.c │ │ │ │ │ │ │ ├── BasicMathFunctions │ │ │ │ │ │ │ │ └── BasicMathFunctionsF16.c │ │ │ │ │ │ │ ├── ControllerFunctions │ │ │ │ │ │ │ │ ├── arm_pid_reset_q15.c │ │ │ │ │ │ │ │ ├── arm_pid_reset_q31.c │ │ │ │ │ │ │ │ └── arm_pid_reset_f32.c │ │ │ │ │ │ │ ├── SupportFunctions │ │ │ │ │ │ │ │ ├── arm_merge_sort_init_f32.c │ │ │ │ │ │ │ │ └── arm_sort_init_f32.c │ │ │ │ │ │ │ ├── StatisticsFunctions │ │ │ │ │ │ │ │ ├── arm_entropy_f64.c │ │ │ │ │ │ │ │ ├── arm_logsumexp_dot_prod_f32.c │ │ │ │ │ │ │ │ └── arm_kullback_leibler_f64.c │ │ │ │ │ │ │ ├── DistanceFunctions │ │ │ │ │ │ │ │ ├── arm_cosine_distance_f32.c │ │ │ │ │ │ │ │ ├── arm_hamming_distance.c │ │ │ │ │ │ │ │ ├── arm_russellrao_distance.c │ │ │ │ │ │ │ │ ├── arm_jaccard_distance.c │ │ │ │ │ │ │ │ ├── arm_boolean_distance.c │ │ │ │ │ │ │ │ ├── arm_kulsinski_distance.c │ │ │ │ │ │ │ │ ├── arm_sokalsneath_distance.c │ │ │ │ │ │ │ │ ├── arm_yule_distance.c │ │ │ │ │ │ │ │ ├── arm_rogerstanimoto_distance.c │ │ │ │ │ │ │ │ ├── arm_sokalmichener_distance.c │ │ │ │ │ │ │ │ └── arm_correlation_distance_f32.c │ │ │ │ │ │ │ ├── MatrixFunctions │ │ │ │ │ │ │ │ ├── arm_mat_init_q15.c │ │ │ │ │ │ │ │ ├── arm_mat_init_q31.c │ │ │ │ │ │ │ │ └── arm_mat_init_f32.c │ │ │ │ │ │ │ └── FilteringFunctions │ │ │ │ │ │ │ │ ├── arm_fir_lattice_init_q15.c │ │ │ │ │ │ │ │ ├── arm_fir_lattice_init_q31.c │ │ │ │ │ │ │ │ └── arm_fir_lattice_init_f32.c │ │ │ │ │ │ ├── Include │ │ │ │ │ │ │ └── arm_const_structs_f16.h │ │ │ │ │ │ └── PrivateInclude │ │ │ │ │ │ │ └── arm_vec_fft.h │ │ │ │ │ ├── NN │ │ │ │ │ │ ├── Source │ │ │ │ │ │ │ ├── ReshapeFunctions │ │ │ │ │ │ │ │ └── arm_reshape_s8.c │ │ │ │ │ │ │ ├── ActivationFunctions │ │ │ │ │ │ │ │ └── arm_relu6_s8.c │ │ │ │ │ │ │ ├── ConcatenationFunctions │ │ │ │ │ │ │ │ ├── arm_concatenation_s8_w.c │ │ │ │ │ │ │ │ ├── arm_concatenation_s8_x.c │ │ │ │ │ │ │ │ ├── arm_concatenation_s8_z.c │ │ │ │ │ │ │ │ └── arm_concatenation_s8_y.c │ │ │ │ │ │ │ ├── SoftmaxFunctions │ │ │ │ │ │ │ │ └── arm_softmax_with_batch_q7.c │ │ │ │ │ │ │ └── NNSupportFunctions │ │ │ │ │ │ │ │ ├── arm_nn_accumulate_q7_to_q15.c │ │ │ │ │ │ │ │ └── arm_nn_add_q7.c │ │ │ │ │ │ └── Include │ │ │ │ │ │ │ └── arm_nn_tables.h │ │ │ │ │ └── Core │ │ │ │ │ │ └── Include │ │ │ │ │ │ └── cmsis_version.h │ │ │ │ ├── .gitignore │ │ │ │ ├── .mbedignore │ │ │ │ ├── dsp │ │ │ │ │ ├── kissfft │ │ │ │ │ │ ├── README.md │ │ │ │ │ │ ├── LICENSE │ │ │ │ │ │ └── kiss_fftr.h │ │ │ │ │ ├── dct │ │ │ │ │ │ ├── README.md │ │ │ │ │ │ ├── LICENSE │ │ │ │ │ │ └── fast-dct-fft.h │ │ │ │ │ ├── memory.cpp │ │ │ │ │ ├── spectral │ │ │ │ │ │ └── spectral.hpp │ │ │ │ │ ├── speechpy │ │ │ │ │ │ └── speechpy.hpp │ │ │ │ │ └── returntypes.hpp │ │ │ │ ├── classifier │ │ │ │ │ ├── ei_run_classifier_image.h │ │ │ │ │ ├── ei_model_types.h │ │ │ │ │ ├── ei_classifier_config.h │ │ │ │ │ └── ei_classifier_types.h │ │ │ │ ├── LICENSE │ │ │ │ ├── sources.txt │ │ │ │ ├── README.md │ │ │ │ ├── tensorflow │ │ │ │ │ └── lite │ │ │ │ │ │ ├── string_type.h │ │ │ │ │ │ ├── micro │ │ │ │ │ │ ├── testing │ │ │ │ │ │ │ └── test_conv_model.h │ │ │ │ │ │ ├── kernels │ │ │ │ │ │ │ ├── ethosu.cpp │ │ │ │ │ │ │ ├── micro_utils.h │ │ │ │ │ │ │ ├── activation_utils.h │ │ │ │ │ │ │ ├── floor.cpp │ │ │ │ │ │ │ └── neg.cpp │ │ │ │ │ │ ├── micro_time.h │ │ │ │ │ │ ├── debug_log.h │ │ │ │ │ │ ├── micro_error_reporter.h │ │ │ │ │ │ ├── micro_optional_debug_tools.h │ │ │ │ │ │ ├── compatibility.h │ │ │ │ │ │ ├── micro_string.h │ │ │ │ │ │ ├── micro_error_reporter.cpp │ │ │ │ │ │ ├── all_ops_resolver.h │ │ │ │ │ │ ├── micro_profiler.cpp │ │ │ │ │ │ ├── memory_helpers.h │ │ │ │ │ │ ├── memory_planner │ │ │ │ │ │ │ ├── linear_memory_planner.h │ │ │ │ │ │ │ └── linear_memory_planner.cpp │ │ │ │ │ │ └── micro_time.cpp │ │ │ │ │ │ ├── core │ │ │ │ │ │ └── api │ │ │ │ │ │ │ ├── tensor_utils.h │ │ │ │ │ │ │ ├── error_reporter.cpp │ │ │ │ │ │ │ ├── tensor_utils.cpp │ │ │ │ │ │ │ ├── op_resolver.h │ │ │ │ │ │ │ └── error_reporter.h │ │ │ │ │ │ ├── kernels │ │ │ │ │ │ ├── internal │ │ │ │ │ │ │ ├── max.h │ │ │ │ │ │ │ ├── min.h │ │ │ │ │ │ │ ├── reference │ │ │ │ │ │ │ │ ├── neg.h │ │ │ │ │ │ │ │ ├── ceil.h │ │ │ │ │ │ │ │ ├── floor.h │ │ │ │ │ │ │ │ ├── round.h │ │ │ │ │ │ │ │ └── quantize.h │ │ │ │ │ │ │ ├── cppmath.h │ │ │ │ │ │ │ ├── optimized │ │ │ │ │ │ │ │ └── neon_check.h │ │ │ │ │ │ │ └── tensor_ctypes.h │ │ │ │ │ │ └── op_macros.h │ │ │ │ │ │ └── version.h │ │ │ │ └── porting │ │ │ │ │ └── arduino │ │ │ │ │ ├── debug_log.cpp │ │ │ │ │ └── ei_classifier_porting.cpp │ │ │ ├── tflite-model │ │ │ │ ├── tflite-trained.cpp │ │ │ │ └── tflite-resolver.h │ │ │ ├── model-parameters │ │ │ │ └── dsp_blocks.h │ │ │ └── tennis-sensor_inference.h │ │ └── library.properties │ └── README ├── .gitignore ├── .vscode │ └── extensions.json ├── test │ └── README ├── platformio.ini └── include │ └── README ├── tinyml-tennis-collector ├── .gitignore ├── .vscode │ └── extensions.json ├── test │ └── README ├── platformio.ini ├── lib │ └── README └── include │ └── README ├── nrf52-zephyr-ble-data-collector ├── .gitignore ├── flash.sh ├── zephyr │ ├── CMakeLists.txt │ ├── nrf52840dongle_nrf52840.overlay │ └── prj.conf ├── platformio.ini ├── test │ └── README ├── src │ ├── gatt_nus_service.h │ ├── state.c │ └── state.h ├── lib │ └── README └── include │ └── README ├── .gitignore └── web-bluetooth-bridge-ui ├── index.html └── package.json /images/web-ui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvarowolfx/tinyml-smart-tennis-sensor/HEAD/images/web-ui.png -------------------------------------------------------------------------------- /images/dongle-back.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvarowolfx/tinyml-smart-tennis-sensor/HEAD/images/dongle-back.jpeg -------------------------------------------------------------------------------- /images/dongle-front.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvarowolfx/tinyml-smart-tennis-sensor/HEAD/images/dongle-front.jpeg -------------------------------------------------------------------------------- /images/dongle-battery.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvarowolfx/tinyml-smart-tennis-sensor/HEAD/images/dongle-battery.jpeg -------------------------------------------------------------------------------- /images/dongle-racket.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvarowolfx/tinyml-smart-tennis-sensor/HEAD/images/dongle-racket.jpeg -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/sources.txt: -------------------------------------------------------------------------------- 1 | Created by update_tflite.sh 2 | -------------------------------------------------------------------------------- /images/particle-xenon-sensor.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvarowolfx/tinyml-smart-tennis-sensor/HEAD/images/particle-xenon-sensor.jpeg -------------------------------------------------------------------------------- /tinyml-tennis-collector/.gitignore: -------------------------------------------------------------------------------- 1 | .pio 2 | .vscode/.browse.c_cpp.db* 3 | .vscode/c_cpp_properties.json 4 | .vscode/launch.json 5 | .vscode/ipch 6 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/.gitignore: -------------------------------------------------------------------------------- 1 | .pio 2 | .vscode/.browse.c_cpp.db* 3 | .vscode/c_cpp_properties.json 4 | .vscode/launch.json 5 | .vscode/ipch 6 | -------------------------------------------------------------------------------- /nrf52-zephyr-ble-data-collector/.gitignore: -------------------------------------------------------------------------------- 1 | .pio 2 | .vscode/.browse.c_cpp.db* 3 | .vscode/c_cpp_properties.json 4 | .vscode/launch.json 5 | .vscode/ipch 6 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/.gitignore: -------------------------------------------------------------------------------- 1 | utensor/CTestTestfile.cmake 2 | utensor/cmake_install.cmake 3 | utensor/CMakeFiles/ 4 | utensor/Makefile 5 | utensor/CMakeCache.txt 6 | utensor.lib 7 | utensor/libutensor.a 8 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=827846 3 | // for the documentation about the extensions.json format 4 | "recommendations": [ 5 | "platformio.platformio-ide" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /tinyml-tennis-collector/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=827846 3 | // for the documentation about the extensions.json format 4 | "recommendations": [ 5 | "platformio.platformio-ide" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/.mbedignore: -------------------------------------------------------------------------------- 1 | utensor/CMakeFiles/ 2 | tensorflow/lite/micro/mbed/ 3 | porting/arduino/ 4 | porting/ecm3532/ 5 | porting/posix/ 6 | porting/silabs/ 7 | porting/stm32-cubeai/ 8 | classifier/ei_run_classifier_c* 9 | -------------------------------------------------------------------------------- /nrf52-zephyr-ble-data-collector/flash.sh: -------------------------------------------------------------------------------- 1 | # Convert hex to package 2 | nrfutil pkg generate --hw-version 52 --sd-req=0x00 --application .pio/build/nrf52840dongle/firmware.hex --application-version 1 firmware.zip 3 | 4 | # Send to device via DFU 5 | nrfutil dfu usb-serial -pkg firmware.zip -p $1 6 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/dsp/kissfft/README.md: -------------------------------------------------------------------------------- 1 | # KissFFT 2 | 3 | Software FFT library used for devices that do not have hardware accelerated RFFT, or where we want to use mixed-radix FFT. Based off of https://github.com/mborgerding/kissfft. 4 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/classifier/ei_run_classifier_image.h: -------------------------------------------------------------------------------- 1 | #ifndef _EDGE_IMPULSE_RUN_CLASSIFIER_IMAGE_H_ 2 | #define _EDGE_IMPULSE_RUN_CLASSIFIER_IMAGE_H_ 3 | 4 | #include "ei_run_classifier.h" 5 | 6 | 7 | 8 | #endif // _EDGE_IMPULSE_RUN_CLASSIFIER_IMAGE_H_ 9 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/dsp/dct/README.md: -------------------------------------------------------------------------------- 1 | # Fast discrete cosine transform algorithms (C) 2 | 3 | DCT type 2 and type 3 algorithms based on https://www.nayuki.io/page/fast-discrete-cosine-transform-algorithms. These are modified to use KissFFT or hardware accelerated RFFT support with CMSIS-DSP. 4 | -------------------------------------------------------------------------------- /nrf52-zephyr-ble-data-collector/zephyr/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.13.1) 2 | 3 | set(DTC_OVERLAY_FILE ./nrf52840dongle_nrf52840.overlay) 4 | 5 | include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) 6 | project(tinyml-tennis-sensor) 7 | 8 | FILE(GLOB app_sources ../src/*.c*) 9 | target_sources(app PRIVATE ${app_sources}) 10 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/dsp/kissfft/LICENSE: -------------------------------------------------------------------------------- 1 | Revised BSD License, see COPYING for verbiage. 2 | Basically, "free to use&change, give credit where due, no guarantees" 3 | Note this license is compatible with GPL at one end of the spectrum and closed, commercial software at 4 | the other end. See http://www.fsf.org/licensing/licenses 5 | -------------------------------------------------------------------------------- /nrf52-zephyr-ble-data-collector/zephyr/nrf52840dongle_nrf52840.overlay: -------------------------------------------------------------------------------- 1 | &i2c1 { 2 | compatible = "nordic,nrf-twi"; 3 | status = "okay"; 4 | sda-pin = <29>; 5 | scl-pin = <31>; 6 | 7 | mpu6050@68 { 8 | compatible = "invensense,mpu6050"; 9 | reg = <0x68>; 10 | status = "okay"; 11 | label = "MPU6050"; 12 | int-gpios = <&gpio0 10 GPIO_ACTIVE_HIGH>; 13 | }; 14 | }; 15 | 16 | &spi1 { 17 | status = "disabled"; 18 | }; -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .pio 2 | .vscode/.browse.c_cpp.db* 3 | .vscode/c_cpp_properties.json 4 | .vscode/launch.json 5 | .vscode/extensions.json 6 | .vscode/ipch 7 | 8 | # Test projects 9 | src_old 10 | #tinyml-tennis-collector 11 | prj-microbit.conf 12 | 13 | # Do not include Edge Impulse exported lib 14 | nrf52-zephyr-edge-impulse-classifier/lib/ei-tennis-sensor 15 | 16 | # Web interface 17 | */node_modules 18 | */dist 19 | */.cache 20 | 21 | # Creds 22 | keys.md 23 | 24 | # compiled firmware 25 | firmware.zip 26 | -------------------------------------------------------------------------------- /nrf52-zephyr-ble-data-collector/platformio.ini: -------------------------------------------------------------------------------- 1 | [platformio] 2 | default_envs = particle_xenon 3 | 4 | [env:nrf52840dongle] 5 | platform = nordicnrf52 6 | board = nrf52840_dk 7 | framework = zephyr 8 | board_build.zephyr.variant = nrf52840dongle_nrf52840 9 | monitor_port=/dev/tty.usbmodemFA7CC205D7A91 10 | 11 | [env:particle_xenon] 12 | platform = nordicnrf52 13 | board = nrf52840_dk 14 | board_build.zephyr.variant = particle_xenon 15 | framework = zephyr 16 | upload_protocol = cmsis-dap 17 | monitor_port=/dev/tty.usbmodem145301 18 | monitor_speed=115200 19 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/test/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for PlatformIO Unit Testing and project tests. 3 | 4 | Unit Testing is a software testing method by which individual units of 5 | source code, sets of one or more MCU program modules together with associated 6 | control data, usage procedures, and operating procedures, are tested to 7 | determine whether they are fit for use. Unit testing finds problems early 8 | in the development cycle. 9 | 10 | More information about PlatformIO Unit Testing: 11 | - https://docs.platformio.org/page/plus/unit-testing.html 12 | -------------------------------------------------------------------------------- /tinyml-tennis-collector/test/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for PlatformIO Unit Testing and project tests. 3 | 4 | Unit Testing is a software testing method by which individual units of 5 | source code, sets of one or more MCU program modules together with associated 6 | control data, usage procedures, and operating procedures, are tested to 7 | determine whether they are fit for use. Unit testing finds problems early 8 | in the development cycle. 9 | 10 | More information about PlatformIO Unit Testing: 11 | - https://docs.platformio.org/page/plus/unit-testing.html 12 | -------------------------------------------------------------------------------- /nrf52-zephyr-ble-data-collector/test/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for PlatformIO Unit Testing and project tests. 3 | 4 | Unit Testing is a software testing method by which individual units of 5 | source code, sets of one or more MCU program modules together with associated 6 | control data, usage procedures, and operating procedures, are tested to 7 | determine whether they are fit for use. Unit testing finds problems early 8 | in the development cycle. 9 | 10 | More information about PlatformIO Unit Testing: 11 | - https://docs.platformio.org/page/plus/unit-testing.html 12 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/LICENSE: -------------------------------------------------------------------------------- 1 | Unless specifically indicated otherwise in a file, files are licensed under the Apache 2.0 license, as can be found in: LICENSE-apache-2.0.txt 2 | 3 | Folders containing files under different permissive license than Apache 2.0 are listed below. Each folder contains its own license specified for its files. 4 | 5 | * CMSIS - Apache 2.0 6 | * dsp/kissfft - BSD-3-Clause 7 | * dsp/dct - MIT 8 | * tensorflow - Apache 2.0 9 | * third_party/flatbuffers - Apache 2.0 10 | * third_party/gemmlowp - Apache 2.0 11 | * utensor - Apache 2.0 12 | -------------------------------------------------------------------------------- /nrf52-zephyr-ble-data-collector/src/gatt_nus_service.h: -------------------------------------------------------------------------------- 1 | #ifndef __GATT_NUS_SERVICE_H__ 2 | #define __GATT_NUS_SERVICE_H__ 3 | 4 | #include 5 | 6 | #define BT_NUS_SERVICE_UUID BT_UUID_DECLARE_128(BT_UUID_128_ENCODE(0x6E400001, 0xB5A3, 0xF393, 0xE0A9, 0xE50E24DCCA9E)) 7 | #define BT_RX_CHARACTERISTIC_UUID BT_UUID_DECLARE_128(BT_UUID_128_ENCODE(0x6E400002, 0xB5A3, 0xF393, 0xE0A9, 0xE50E24DCCA9E)) 8 | #define BT_TX_CHARACTERISTIC_UUID BT_UUID_DECLARE_128(BT_UUID_128_ENCODE(0x6E400003, 0xB5A3, 0xF393, 0xE0A9, 0xE50E24DCCA9E)) 9 | 10 | void gatt_nus_service_init(void); 11 | void gatt_nus_service_data_notify(); 12 | 13 | #endif -------------------------------------------------------------------------------- /web-bluetooth-bridge-ui/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | TinyML Tennis Capture 4 | 5 | 6 | 10 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /tinyml-tennis-collector/platformio.ini: -------------------------------------------------------------------------------- 1 | ; PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter 4 | ; Upload options: custom upload port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; Advanced options: extra scripting 7 | ; 8 | ; Please visit documentation for the other options and examples 9 | ; https://docs.platformio.org/page/projectconf.html 10 | 11 | [env:particle_xenon] 12 | platform = nordicnrf52 13 | board = particle_xenon 14 | framework = arduino 15 | upload_protocol = nrfutil 16 | monitor_speed = 115200 17 | lib_deps = 18 | Adafruit MPU6050 19 | Adafruit Unified Sensor 20 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/sources.txt: -------------------------------------------------------------------------------- 1 | tensorflow and third_party folders based on: https://github.com/tensorflow/tensorflow/#c903b4607821a03c36c17b0befa2535c7dd0e066 2 | TensorFlow source was prepared using `make -f tensorflow/lite/micro/tools/make/Makefile generate_projects` 3 | The folders were taken from `tensorflow/lite/micro/tools/make/gen/osx_x86_64/prj/hello_world/make` 4 | These files and directories were then deleted: 5 | - `tensorflow/lite/micro/debug_log.cc` 6 | - `tensorflow/lite/micro/examples/hello_world` 7 | CMSIS-DSP based on: https://github.com/ARM-software/CMSIS_5/tree/4d378e81968c6bec5441a42885b24db7cf189bca 8 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/library.properties: -------------------------------------------------------------------------------- 1 | name=tennis-sensor Inferencing - Edge Impulse 2 | version=1.0.3 3 | author=EdgeImpulse Inc. 4 | maintainer=EdgeImpulse Inc. 5 | sentence=Arduino library for running machine learning models 6 | paragraph=This library contains the signal processing code and machine learning models to classify real-world data for tennis-sensor. It has examples for the accelerometer and microphone on the Arduino Nano 33 BLE Sense, but should run on most Arduino boards with an ARM core and at least 64K of RAM. 7 | category=Data processing 8 | url=https://www.edgeimpulse.com 9 | depends=Arduino_LSM9DS1, PDM -------------------------------------------------------------------------------- /web-bluetooth-bridge-ui/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tinyml-tennis-collector", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "npx parcel index.html", 8 | "test": "echo \"Error: no test specified\" && exit 1" 9 | }, 10 | "keywords": [], 11 | "author": "", 12 | "license": "MIT", 13 | "devDependencies": { 14 | "parcel-bundler": "^1.12.4", 15 | "parcel-plugin-static-files-copy": "^2.3.1" 16 | }, 17 | "dependencies": { 18 | "@visx/curve": "^1.0.0", 19 | "@visx/gradient": "^1.0.0", 20 | "@visx/scale": "^1.0.0", 21 | "@visx/shape": "^1.0.0", 22 | "babel-polyfill": "^6.26.0", 23 | "chart.js": "^2.9.3", 24 | "react": "^16.13.1", 25 | "react-chartjs-2": "^2.10.0", 26 | "react-dom": "^16.13.1" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/platformio.ini: -------------------------------------------------------------------------------- 1 | ; PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter 4 | ; Upload options: custom upload port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; Advanced options: extra scripting 7 | ; 8 | ; Please visit documentation for the other options and examples 9 | ; https://docs.platformio.org/page/projectconf.html 10 | [platformio] 11 | default_envs = particle_xenon 12 | 13 | [env:adafruit_metro_nrf52840] 14 | platform = nordicnrf52 15 | board = adafruit_feather_nrf52840 16 | framework = arduino 17 | lib_deps = 18 | Adafruit MPU6050 19 | Adafruit Unified Sensor 20 | 21 | [env:particle_xenon] 22 | platform = nordicnrf52 23 | board = particle_xenon 24 | framework = arduino 25 | upload_protocol = nrfutil 26 | lib_deps = 27 | Adafruit MPU6050 28 | Adafruit Unified Sensor -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/README.md: -------------------------------------------------------------------------------- 1 | # Edge Impulse DSP and Inferencing SDK 2 | 3 | Portable library for digital signal processing and machine learning inferencing. This repository contains the device implementation in C++ for both processing and learning blocks in [Edge Impulse](https://www.edgeimpulse.com). 4 | 5 | [Documentation](https://docs.edgeimpulse.com/reference#inferencing-sdk) 6 | 7 | ## Develop locally 8 | 9 | If you want to develop locally the easiest is to grab the [example-standalone-inferencing](https://github.com/edgeimpulse/example-standalone-inferencing) (Desktop) or [example-standalone-inferencing-mbed](https://github.com/edgeimpulse/example-standalone-inferencing-mbed) (ST IoT Discovery Kit, f.e. to test CMSIS-DSP / CMSIS-NN integration) example applications, add your Edge Impulse project (use the C++ Library export option), then symlink this repository in. 10 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/string_type.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | // Abstract string. We don't want even absl at this level. 16 | #ifndef TENSORFLOW_LITE_STRING_TYPE_H_ 17 | #define TENSORFLOW_LITE_STRING_TYPE_H_ 18 | 19 | #include 20 | 21 | namespace tflite { 22 | 23 | using std::string; 24 | 25 | } // namespace tflite 26 | 27 | #endif // TENSORFLOW_LITE_STRING_TYPE_H_ 28 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/micro/testing/test_conv_model.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #ifndef TENSORFLOW_LITE_MICRO_TESTING_TEST_CONV_MODEL_H_ 17 | #define TENSORFLOW_LITE_MICRO_TESTING_TEST_CONV_MODEL_H_ 18 | 19 | // See generate_test_models.py for updating the contents of this model: 20 | extern const unsigned char kTestConvModelData[]; 21 | extern const unsigned int kTestConvModelDataSize; 22 | 23 | #endif // TENSORFLOW_LITE_MICRO_TESTING_TEST_CONV_MODEL_H_ 24 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/core/api/tensor_utils.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #ifndef TENSORFLOW_LITE_CORE_API_TENSOR_UTILS_H_ 17 | #define TENSORFLOW_LITE_CORE_API_TENSOR_UTILS_H_ 18 | 19 | #include "edge-impulse-sdk/tensorflow/lite/c/common.h" 20 | 21 | namespace tflite { 22 | 23 | // Resets a variable tensor to the default value. 24 | TfLiteStatus ResetVariableTensor(TfLiteTensor* tensor); 25 | 26 | } // namespace tflite 27 | 28 | #endif // TENSORFLOW_LITE_CORE_API_TENSOR_UTILS_H_ 29 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for project specific (private) libraries. 3 | PlatformIO will compile them to static libraries and link into executable file. 4 | 5 | The source code of each library should be placed in a an own separate directory 6 | ("lib/your_library_name/[here are source files]"). 7 | 8 | For example, see a structure of the following two libraries `Foo` and `Bar`: 9 | 10 | |--lib 11 | | | 12 | | |--Bar 13 | | | |--docs 14 | | | |--examples 15 | | | |--src 16 | | | |- Bar.c 17 | | | |- Bar.h 18 | | | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html 19 | | | 20 | | |--Foo 21 | | | |- Foo.c 22 | | | |- Foo.h 23 | | | 24 | | |- README --> THIS FILE 25 | | 26 | |- platformio.ini 27 | |--src 28 | |- main.c 29 | 30 | and a contents of `src/main.c`: 31 | ``` 32 | #include 33 | #include 34 | 35 | int main (void) 36 | { 37 | ... 38 | } 39 | 40 | ``` 41 | 42 | PlatformIO Library Dependency Finder will find automatically dependent 43 | libraries scanning project source files. 44 | 45 | More information about PlatformIO Library Dependency Finder 46 | - https://docs.platformio.org/page/librarymanager/ldf.html 47 | -------------------------------------------------------------------------------- /tinyml-tennis-collector/lib/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for project specific (private) libraries. 3 | PlatformIO will compile them to static libraries and link into executable file. 4 | 5 | The source code of each library should be placed in a an own separate directory 6 | ("lib/your_library_name/[here are source files]"). 7 | 8 | For example, see a structure of the following two libraries `Foo` and `Bar`: 9 | 10 | |--lib 11 | | | 12 | | |--Bar 13 | | | |--docs 14 | | | |--examples 15 | | | |--src 16 | | | |- Bar.c 17 | | | |- Bar.h 18 | | | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html 19 | | | 20 | | |--Foo 21 | | | |- Foo.c 22 | | | |- Foo.h 23 | | | 24 | | |- README --> THIS FILE 25 | | 26 | |- platformio.ini 27 | |--src 28 | |- main.c 29 | 30 | and a contents of `src/main.c`: 31 | ``` 32 | #include 33 | #include 34 | 35 | int main (void) 36 | { 37 | ... 38 | } 39 | 40 | ``` 41 | 42 | PlatformIO Library Dependency Finder will find automatically dependent 43 | libraries scanning project source files. 44 | 45 | More information about PlatformIO Library Dependency Finder 46 | - https://docs.platformio.org/page/librarymanager/ldf.html 47 | -------------------------------------------------------------------------------- /nrf52-zephyr-ble-data-collector/lib/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for project specific (private) libraries. 3 | PlatformIO will compile them to static libraries and link into executable file. 4 | 5 | The source code of each library should be placed in a an own separate directory 6 | ("lib/your_library_name/[here are source files]"). 7 | 8 | For example, see a structure of the following two libraries `Foo` and `Bar`: 9 | 10 | |--lib 11 | | | 12 | | |--Bar 13 | | | |--docs 14 | | | |--examples 15 | | | |--src 16 | | | |- Bar.c 17 | | | |- Bar.h 18 | | | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html 19 | | | 20 | | |--Foo 21 | | | |- Foo.c 22 | | | |- Foo.h 23 | | | 24 | | |- README --> THIS FILE 25 | | 26 | |- platformio.ini 27 | |--src 28 | |- main.c 29 | 30 | and a contents of `src/main.c`: 31 | ``` 32 | #include 33 | #include 34 | 35 | int main (void) 36 | { 37 | ... 38 | } 39 | 40 | ``` 41 | 42 | PlatformIO Library Dependency Finder will find automatically dependent 43 | libraries scanning project source files. 44 | 45 | More information about PlatformIO Library Dependency Finder 46 | - https://docs.platformio.org/page/librarymanager/ldf.html 47 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/tflite-model/tflite-trained.cpp: -------------------------------------------------------------------------------- 1 | /* Generated by Edge Impulse 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | 22 | // Empty on purpose 23 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/ethosu.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | // 17 | // This is a stub file for non-Ethos platforms 18 | // 19 | #include "edge-impulse-sdk/tensorflow/lite/c/common.h" 20 | 21 | namespace tflite { 22 | namespace ops { 23 | namespace micro { 24 | namespace custom { 25 | TfLiteRegistration* Register_ETHOSU() { return nullptr; } 26 | 27 | const char* GetString_ETHOSU() { return ""; } 28 | 29 | } // namespace custom 30 | } // namespace micro 31 | } // namespace ops 32 | } // namespace tflite 33 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/dsp/dct/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018 Project Nayuki. (MIT License) 2 | https://www.nayuki.io/page/fast-discrete-cosine-transform-algorithms 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of 5 | this software and associated documentation files (the "Software"), to deal in 6 | the Software without restriction, including without limitation the rights to 7 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 8 | the Software, and to permit persons to whom the Software is furnished to do so, 9 | subject to the following conditions: 10 | - The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | - The Software is provided "as is", without warranty of any kind, express or 13 | implied, including but not limited to the warranties of merchantability, 14 | fitness for a particular purpose and noninfringement. In no event shall the 15 | authors or copyright holders be liable for any claim, damages or other 16 | liability, whether in an action of contract, tort or otherwise, arising from, 17 | out of or in connection with the Software or the use or other dealings in the 18 | Software. 19 | -------------------------------------------------------------------------------- /nrf52-zephyr-ble-data-collector/zephyr/prj.conf: -------------------------------------------------------------------------------- 1 | CONFIG_GPIO=y 2 | CONFIG_JSON_LIBRARY=y 3 | CONFIG_SETTINGS=y 4 | #CONFIG_BOARD_HAS_NRF5_BOOTLOADER=y 5 | 6 | # PWM 7 | CONFIG_PWM=y 8 | CONFIG_PWM_NRF5_SW=n 9 | CONFIG_PWM_NRFX=y 10 | #CONFIG_PWM_0=y 11 | 12 | # MPU6050 13 | CONFIG_I2C=y 14 | CONFIG_SENSOR=y 15 | CONFIG_MPU6050=y 16 | CONFIG_MPU6050_TRIGGER_NONE=y 17 | 18 | # Memory 19 | CONFIG_HEAP_MEM_POOL_SIZE=4096 20 | CONFIG_INIT_STACKS=y 21 | CONFIG_ISR_STACK_SIZE=2048 22 | CONFIG_MAIN_STACK_SIZE=2048 23 | CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 24 | 25 | # USB 26 | # CONFIG_STDOUT_CONSOLE=y 27 | CONFIG_GPIO=y 28 | CONFIG_USB=y 29 | CONFIG_USB_DEVICE_STACK=y 30 | CONFIG_USB_DEVICE_PRODUCT="Zephyr CDC ACM sample" 31 | 32 | # Enable Logs 33 | CONFIG_PRINTK=y 34 | CONFIG_LOG_PRINTK=y 35 | CONFIG_LOG_BACKEND_UART=y 36 | CONFIG_UART_INTERRUPT_DRIVEN=y 37 | CONFIG_UART_LINE_CTRL=y 38 | CONFIG_USB_UART_CONSOLE=y 39 | CONFIG_UART_CONSOLE_ON_DEV_NAME="CDC_ACM_0" 40 | #CONFIG_USB_UART_DTR_WAIT=y 41 | 42 | # BT 43 | CONFIG_BT=y 44 | CONFIG_BT_DEBUG_LOG=y 45 | CONFIG_BT_DEVICE_NAME="Tennis Sensor" 46 | CONFIG_BT_GATT_DIS=y 47 | CONFIG_BT_PERIPHERAL=y 48 | CONFIG_BT_DEVICE_APPEARANCE=833 49 | CONFIG_BT_SETTINGS=y 50 | CONFIG_BT_DEVICE_NAME_DYNAMIC=y 51 | CONFIG_BT_DEVICE_NAME_MAX=65 52 | CONFIG_BT_ATT_PREPARE_COUNT=5 53 | CONFIG_BT_SMP=y 54 | 55 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/kernels/internal/max.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_MAX_H_ 16 | #define TENSORFLOW_LITE_KERNELS_INTERNAL_MAX_H_ 17 | 18 | #include 19 | 20 | namespace tflite { 21 | 22 | #if defined(TF_LITE_USE_GLOBAL_MAX) || defined(__ZEPHYR__) 23 | inline float TfLiteMax(const float& x, const float& y) { 24 | return std::max(x, y); 25 | } 26 | #else 27 | template 28 | inline T TfLiteMax(const T& x, const T& y) { 29 | return std::fmax(x, y); 30 | } 31 | #endif 32 | 33 | } // namespace tflite 34 | 35 | #endif // TENSORFLOW_LITE_KERNELS_INTERNAL_MAX_H_ 36 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/kernels/internal/min.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_MIN_H_ 16 | #define TENSORFLOW_LITE_KERNELS_INTERNAL_MIN_H_ 17 | 18 | #include 19 | 20 | namespace tflite { 21 | 22 | #if defined(TF_LITE_USE_GLOBAL_MIN) || defined(__ZEPHYR__) 23 | inline float TfLiteMin(const float& x, const float& y) { 24 | return std::min(x, y); 25 | } 26 | #else 27 | template 28 | inline T TfLiteMin(const T& x, const T& y) { 29 | return std::fmin(x, y); 30 | } 31 | #endif 32 | 33 | } // namespace tflite 34 | 35 | #endif // TENSORFLOW_LITE_KERNELS_INTERNAL_MIN_H_ 36 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/micro/micro_time.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_MICRO_MICRO_TIME_H_ 16 | #define TENSORFLOW_LITE_MICRO_MICRO_TIME_H_ 17 | 18 | #include 19 | 20 | namespace tflite { 21 | 22 | // These functions should be implemented by each target platform, and provide an 23 | // accurate tick count along with how many ticks there are per second. 24 | int32_t ticks_per_second(); 25 | 26 | // Return time in ticks. The meaning of a tick varies per platform. 27 | int32_t GetCurrentTimeTicks(); 28 | 29 | } // namespace tflite 30 | 31 | #endif // TENSORFLOW_LITE_MICRO_MICRO_TIME_H_ 32 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/micro/debug_log.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_MICRO_DEBUG_LOG_H_ 16 | #define TENSORFLOW_LITE_MICRO_DEBUG_LOG_H_ 17 | 18 | // This function should be implemented by each target platform, and provide a 19 | // way for strings to be output to some text stream. For more information, see 20 | // tensorflow/lite/micro/debug_log.cc. 21 | #if defined(__cplusplus) && EI_C_LINKAGE == 1 22 | extern "C" void DebugLog(const char* s); 23 | #else 24 | void DebugLog(const char* s); 25 | #endif // defined(__cplusplus) && EI_C_LINKAGE == 1 26 | 27 | #endif // TENSORFLOW_LITE_MICRO_DEBUG_LOG_H_ 28 | 29 | -------------------------------------------------------------------------------- /nrf52-zephyr-ble-data-collector/src/state.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "state.h" 7 | 8 | static struct ble_reading current_ble_reading = {}; 9 | 10 | static bool is_transmiting = false; 11 | static int transmissions = 0; 12 | 13 | void start_transmission() 14 | { 15 | is_transmiting = true; 16 | transmissions = 0; 17 | } 18 | 19 | void stop_transmission() 20 | { 21 | is_transmiting = false; 22 | transmissions = DATA_POINTS_PER_WINDOW; 23 | } 24 | 25 | void increment_transmissions() 26 | { 27 | transmissions++; 28 | if (transmissions > DATA_POINTS_PER_WINDOW) 29 | { 30 | is_transmiting = false; 31 | } 32 | } 33 | 34 | bool is_transmitting() 35 | { 36 | return is_transmiting; 37 | //return true; 38 | } 39 | 40 | bool should_transmit() 41 | { 42 | return transmissions <= DATA_POINTS_PER_WINDOW; 43 | //return true; 44 | } 45 | 46 | void update_sensor(struct acc_reading reading, int pos) 47 | { 48 | current_ble_reading.ax = reading.ax; 49 | current_ble_reading.ay = reading.ay; 50 | current_ble_reading.az = reading.az; 51 | current_ble_reading.gx = reading.gx; 52 | current_ble_reading.gy = reading.gy; 53 | current_ble_reading.gz = reading.gz; 54 | current_ble_reading.pos = pos; 55 | } 56 | 57 | struct ble_reading get_ble_reading() 58 | { 59 | return current_ble_reading; 60 | } 61 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/dsp/memory.cpp: -------------------------------------------------------------------------------- 1 | /* Edge Impulse inferencing library 2 | * Copyright (c) 2020 EdgeImpulse Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | */ 22 | 23 | #include "memory.hpp" 24 | 25 | size_t ei_memory_in_use = 0; 26 | size_t ei_memory_peak_use = 0; 27 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/version.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_VERSION_H_ 16 | #define TENSORFLOW_LITE_VERSION_H_ 17 | 18 | #include "edge-impulse-sdk/tensorflow/core/public/version.h" 19 | 20 | // The version number of the Schema. Ideally all changes will be backward 21 | // compatible. If that ever changes, we must ensure that version is the first 22 | // entry in the new tflite root so that we can see that version is not 1. 23 | #define TFLITE_SCHEMA_VERSION (3) 24 | 25 | // TensorFlow Lite Runtime version. 26 | // This value is currently shared with that of TensorFlow. 27 | #define TFLITE_VERSION_STRING TF_VERSION_STRING 28 | 29 | #endif // TENSORFLOW_LITE_VERSION_H_ 30 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/dsp/kissfft/kiss_fftr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2004, Mark Borgerding. All rights reserved. 3 | * This file is part of KISS FFT - https://github.com/mborgerding/kissfft 4 | * 5 | * SPDX-License-Identifier: BSD-3-Clause 6 | * See COPYING file for more information. 7 | */ 8 | 9 | #ifndef KISS_FTR_H 10 | #define KISS_FTR_H 11 | 12 | #include "kiss_fft.h" 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | 18 | /* 19 | 20 | Real optimized version can save about 45% cpu time vs. complex fft of a real seq. 21 | 22 | 23 | 24 | */ 25 | 26 | typedef struct kiss_fftr_state *kiss_fftr_cfg; 27 | 28 | 29 | kiss_fftr_cfg kiss_fftr_alloc(int nfft,int inverse_fft,void * mem, size_t * lenmem, size_t * memallocated = NULL); 30 | /* 31 | nfft must be even 32 | 33 | If you don't care to allocate space, use mem = lenmem = NULL 34 | */ 35 | 36 | 37 | void kiss_fftr(kiss_fftr_cfg cfg,const kiss_fft_scalar *timedata,kiss_fft_cpx *freqdata); 38 | /* 39 | input timedata has nfft scalar points 40 | output freqdata has nfft/2+1 complex points 41 | */ 42 | 43 | void kiss_fftri(kiss_fftr_cfg cfg,const kiss_fft_cpx *freqdata,kiss_fft_scalar *timedata); 44 | /* 45 | input freqdata has nfft/2+1 complex points 46 | output timedata has nfft scalar points 47 | */ 48 | 49 | #define kiss_fftr_free KISS_FFT_FREE 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | #endif 55 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/micro/micro_error_reporter.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_MICRO_MICRO_ERROR_REPORTER_H_ 16 | #define TENSORFLOW_LITE_MICRO_MICRO_ERROR_REPORTER_H_ 17 | 18 | #include 19 | 20 | #include "edge-impulse-sdk/tensorflow/lite/core/api/error_reporter.h" 21 | #include "edge-impulse-sdk/tensorflow/lite/micro/compatibility.h" 22 | 23 | namespace tflite { 24 | 25 | class MicroErrorReporter : public ErrorReporter { 26 | public: 27 | ~MicroErrorReporter() override {} 28 | int Report(const char* format, va_list args) override; 29 | 30 | private: 31 | TF_LITE_REMOVE_VIRTUAL_DELETE 32 | }; 33 | 34 | } // namespace tflite 35 | 36 | #endif // TENSORFLOW_LITE_MICRO_MICRO_ERROR_REPORTER_H_ 37 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/DSP/Source/CommonTables/CommonTablesF16.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: CommonTables.c 6 | * Description: Combination of all common table source files. 7 | * 8 | * $Date: 08. January 2020 9 | * $Revision: V1.1.0 10 | * 11 | * Target Processor: Cortex-M cores 12 | * -------------------------------------------------------------------- */ 13 | /* 14 | * Copyright (C) 2019-2020 ARM Limited or its affiliates. All rights reserved. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * 18 | * Licensed under the Apache License, Version 2.0 (the License); you may 19 | * not use this file except in compliance with the License. 20 | * You may obtain a copy of the License at 21 | * 22 | * www.apache.org/licenses/LICENSE-2.0 23 | * 24 | * Unless required by applicable law or agreed to in writing, software 25 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 26 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | * See the License for the specific language governing permissions and 28 | * limitations under the License. 29 | */ 30 | 31 | #include "arm_common_tables_f16.c" 32 | #include "arm_const_structs_f16.c" 33 | #include "arm_mve_tables_f16.c" 34 | 35 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 36 | -------------------------------------------------------------------------------- /nrf52-zephyr-ble-data-collector/src/state.h: -------------------------------------------------------------------------------- 1 | #ifndef __STATE_H__ 2 | #define __STATE_H__ 3 | 4 | #include 5 | #include 6 | 7 | #define DATA_POINTS_PER_WINDOW 60 8 | #define TX_SLEEP_TIME K_MSEC(16) 9 | 10 | struct acc_reading 11 | { 12 | //void *fifo_reserved; /* 1st word reserved for use by fifo */ 13 | double ax; 14 | double ay; 15 | double az; 16 | double gx; 17 | double gy; 18 | double gz; 19 | }; 20 | 21 | struct ble_reading 22 | { 23 | double ax; 24 | double ay; 25 | double az; 26 | double gx; 27 | double gy; 28 | double gz; 29 | int pos; 30 | }; 31 | 32 | #define acc_reading_size_t sizeof(struct acc_reading) 33 | #define reading_size_t sizeof(struct ble_reading) 34 | 35 | #ifdef CONFIG_JSON_LIBRARY 36 | static const struct json_obj_descr ble_reading_descr[] = { 37 | JSON_OBJ_DESCR_PRIM(struct ble_reading, ax, JSON_TOK_NUMBER), 38 | JSON_OBJ_DESCR_PRIM(struct ble_reading, ay, JSON_TOK_NUMBER), 39 | JSON_OBJ_DESCR_PRIM(struct ble_reading, az, JSON_TOK_NUMBER), 40 | JSON_OBJ_DESCR_PRIM(struct ble_reading, gx, JSON_TOK_NUMBER), 41 | JSON_OBJ_DESCR_PRIM(struct ble_reading, gy, JSON_TOK_NUMBER), 42 | JSON_OBJ_DESCR_PRIM(struct ble_reading, gz, JSON_TOK_NUMBER), 43 | }; 44 | #endif 45 | 46 | void update_sensor(struct acc_reading reading, int pos); 47 | 48 | void start_transmission(); 49 | void stop_transmission(); 50 | 51 | void increment_transmissions(); 52 | bool is_transmitting(); 53 | bool should_transmit(); 54 | struct ble_reading get_ble_reading(); 55 | 56 | #endif -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/dsp/spectral/spectral.hpp: -------------------------------------------------------------------------------- 1 | /* Edge Impulse inferencing library 2 | * Copyright (c) 2020 EdgeImpulse Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | */ 22 | 23 | #ifndef _EIDSP_SPECTRAL_SPECTRAL_H_ 24 | #define _EIDSP_SPECTRAL_SPECTRAL_H_ 25 | 26 | #include "../config.hpp" 27 | #include "processing.hpp" 28 | #include "feature.hpp" 29 | 30 | #endif // _EIDSP_SPECTRAL_SPECTRAL_H_ 31 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/core/api/error_reporter.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #include "edge-impulse-sdk/tensorflow/lite/core/api/error_reporter.h" 16 | #include 17 | 18 | namespace tflite { 19 | 20 | int ErrorReporter::Report(const char* format, ...) { 21 | va_list args; 22 | va_start(args, format); 23 | int code = Report(format, args); 24 | va_end(args); 25 | return code; 26 | } 27 | 28 | // TODO(aselle): Make the name of ReportError on context the same, so 29 | // we can use the ensure functions w/o a context and w/ a reporter. 30 | int ErrorReporter::ReportError(void*, const char* format, ...) { 31 | va_list args; 32 | va_start(args, format); 33 | int code = Report(format, args); 34 | va_end(args); 35 | return code; 36 | } 37 | 38 | } // namespace tflite 39 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/micro_utils.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | Licensed under the Apache License, Version 2.0 (the "License"); 3 | you may not use this file except in compliance with the License. 4 | You may obtain a copy of the License at 5 | http://www.apache.org/licenses/LICENSE-2.0 6 | Unless required by applicable law or agreed to in writing, software 7 | distributed under the License is distributed on an "AS IS" BASIS, 8 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | See the License for the specific language governing permissions and 10 | limitations under the License. 11 | ==============================================================================*/ 12 | #ifndef TENSORFLOW_LITE_MICRO_KERNELS_MICRO_UTILS_H_ 13 | #define TENSORFLOW_LITE_MICRO_KERNELS_MICRO_UTILS_H_ 14 | namespace tflite { 15 | namespace ops { 16 | namespace micro { 17 | 18 | // Same as gtl::Greater but defined here to reduce dependencies and 19 | // binary size for micro environment. 20 | struct Greater { 21 | template 22 | bool operator()(const T& x, const T& y) const { 23 | return x > y; 24 | } 25 | }; 26 | 27 | struct Less { 28 | template 29 | bool operator()(const T& x, const T& y) const { 30 | return x < y; 31 | } 32 | }; 33 | 34 | } // namespace micro 35 | } // namespace ops 36 | } // namespace tflite 37 | #endif // TENSORFLOW_LITE_MICRO_KERNELS_MICRO_UTILS_H_ 38 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/include/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for project header files. 3 | 4 | A header file is a file containing C declarations and macro definitions 5 | to be shared between several project source files. You request the use of a 6 | header file in your project source file (C, C++, etc) located in `src` folder 7 | by including it, with the C preprocessing directive `#include'. 8 | 9 | ```src/main.c 10 | 11 | #include "header.h" 12 | 13 | int main (void) 14 | { 15 | ... 16 | } 17 | ``` 18 | 19 | Including a header file produces the same results as copying the header file 20 | into each source file that needs it. Such copying would be time-consuming 21 | and error-prone. With a header file, the related declarations appear 22 | in only one place. If they need to be changed, they can be changed in one 23 | place, and programs that include the header file will automatically use the 24 | new version when next recompiled. The header file eliminates the labor of 25 | finding and changing all the copies as well as the risk that a failure to 26 | find one copy will result in inconsistencies within a program. 27 | 28 | In C, the usual convention is to give header files names that end with `.h'. 29 | It is most portable to use only letters, digits, dashes, and underscores in 30 | header file names, and at most one dot. 31 | 32 | Read more about using header files in official GCC documentation: 33 | 34 | * Include Syntax 35 | * Include Operation 36 | * Once-Only Headers 37 | * Computed Includes 38 | 39 | https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html 40 | -------------------------------------------------------------------------------- /tinyml-tennis-collector/include/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for project header files. 3 | 4 | A header file is a file containing C declarations and macro definitions 5 | to be shared between several project source files. You request the use of a 6 | header file in your project source file (C, C++, etc) located in `src` folder 7 | by including it, with the C preprocessing directive `#include'. 8 | 9 | ```src/main.c 10 | 11 | #include "header.h" 12 | 13 | int main (void) 14 | { 15 | ... 16 | } 17 | ``` 18 | 19 | Including a header file produces the same results as copying the header file 20 | into each source file that needs it. Such copying would be time-consuming 21 | and error-prone. With a header file, the related declarations appear 22 | in only one place. If they need to be changed, they can be changed in one 23 | place, and programs that include the header file will automatically use the 24 | new version when next recompiled. The header file eliminates the labor of 25 | finding and changing all the copies as well as the risk that a failure to 26 | find one copy will result in inconsistencies within a program. 27 | 28 | In C, the usual convention is to give header files names that end with `.h'. 29 | It is most portable to use only letters, digits, dashes, and underscores in 30 | header file names, and at most one dot. 31 | 32 | Read more about using header files in official GCC documentation: 33 | 34 | * Include Syntax 35 | * Include Operation 36 | * Once-Only Headers 37 | * Computed Includes 38 | 39 | https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html 40 | -------------------------------------------------------------------------------- /nrf52-zephyr-ble-data-collector/include/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for project header files. 3 | 4 | A header file is a file containing C declarations and macro definitions 5 | to be shared between several project source files. You request the use of a 6 | header file in your project source file (C, C++, etc) located in `src` folder 7 | by including it, with the C preprocessing directive `#include'. 8 | 9 | ```src/main.c 10 | 11 | #include "header.h" 12 | 13 | int main (void) 14 | { 15 | ... 16 | } 17 | ``` 18 | 19 | Including a header file produces the same results as copying the header file 20 | into each source file that needs it. Such copying would be time-consuming 21 | and error-prone. With a header file, the related declarations appear 22 | in only one place. If they need to be changed, they can be changed in one 23 | place, and programs that include the header file will automatically use the 24 | new version when next recompiled. The header file eliminates the labor of 25 | finding and changing all the copies as well as the risk that a failure to 26 | find one copy will result in inconsistencies within a program. 27 | 28 | In C, the usual convention is to give header files names that end with `.h'. 29 | It is most portable to use only letters, digits, dashes, and underscores in 30 | header file names, and at most one dot. 31 | 32 | Read more about using header files in official GCC documentation: 33 | 34 | * Include Syntax 35 | * Include Operation 36 | * Once-Only Headers 37 | * Computed Includes 38 | 39 | https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html 40 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/dsp/speechpy/speechpy.hpp: -------------------------------------------------------------------------------- 1 | /* Edge Impulse inferencing library 2 | * Copyright (c) 2020 EdgeImpulse Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | */ 22 | 23 | #ifndef _EIDSP_SPEECHPY_SPEECHPY_H_ 24 | #define _EIDSP_SPEECHPY_SPEECHPY_H_ 25 | 26 | #include "../config.hpp" 27 | #include "feature.hpp" 28 | #include "functions.hpp" 29 | #include "processing.hpp" 30 | 31 | #endif // _EIDSP_SPEECHPY_SPEECHPY_H_ 32 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/TransformFunctionsF16.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: TransformFunctionsF16.c 6 | * Description: Combination of all transform function f16 source files. 7 | * 8 | * $Date: 20. April 2020 9 | * $Revision: V1.0.0 10 | * 11 | * Target Processor: Cortex-M cores 12 | * -------------------------------------------------------------------- */ 13 | /* 14 | * Copyright (C) 2019 ARM Limited or its affiliates. All rights reserved. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * 18 | * Licensed under the Apache License, Version 2.0 (the License); you may 19 | * not use this file except in compliance with the License. 20 | * You may obtain a copy of the License at 21 | * 22 | * www.apache.org/licenses/LICENSE-2.0 23 | * 24 | * Unless required by applicable law or agreed to in writing, software 25 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 26 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | * See the License for the specific language governing permissions and 28 | * limitations under the License. 29 | */ 30 | 31 | #include "arm_cfft_f16.c" 32 | #include "arm_cfft_init_f16.c" 33 | #include "arm_cfft_radix2_f16.c" 34 | #include "arm_cfft_radix4_f16.c" 35 | 36 | 37 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 38 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/kernels/internal/reference/neg.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_NEG_H_ 16 | #define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_NEG_H_ 17 | 18 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/types.h" 19 | 20 | namespace tflite { 21 | 22 | namespace reference_ops { 23 | 24 | template 25 | inline void Negate(const RuntimeShape& input_shape, const T* input_data, 26 | const RuntimeShape& output_shape, T* output_data) { 27 | const int flat_size = MatchingFlatSize(input_shape, output_shape); 28 | 29 | for (int i = 0; i < flat_size; ++i) { 30 | output_data[i] = -input_data[i]; 31 | } 32 | } 33 | 34 | } // namespace reference_ops 35 | } // namespace tflite 36 | 37 | #endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_NEG_H_ 38 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/kernels/internal/reference/ceil.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_CEIL_H_ 16 | #define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_CEIL_H_ 17 | 18 | #include 19 | 20 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/types.h" 21 | 22 | namespace tflite { 23 | 24 | namespace reference_ops { 25 | 26 | inline void Ceil(const RuntimeShape& input_shape, const float* input_data, 27 | const RuntimeShape& output_shape, float* output_data) { 28 | const int flat_size = MatchingFlatSize(input_shape, output_shape); 29 | 30 | for (int i = 0; i < flat_size; ++i) { 31 | output_data[i] = std::ceil(input_data[i]); 32 | } 33 | } 34 | 35 | } // namespace reference_ops 36 | } // namespace tflite 37 | #endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_CEIL_H_ 38 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/micro/micro_optional_debug_tools.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | // Optional debugging functionality. For small sized binaries, these are not 16 | // needed. 17 | #ifndef TENSORFLOW_LITE_MICRO_MICRO_OPTIONAL_DEBUG_TOOLS_H_ 18 | #define TENSORFLOW_LITE_MICRO_MICRO_OPTIONAL_DEBUG_TOOLS_H_ 19 | 20 | #include "edge-impulse-sdk/tensorflow/lite/micro/micro_interpreter.h" 21 | 22 | namespace tflite { 23 | // Helper function to print model flatbuffer data. This function is not called 24 | // by default. Hence it's not linked in to the final binary code. 25 | void PrintModelData(const Model* model, ErrorReporter* error_reporter); 26 | // Prints a dump of what tensors and what nodes are in the interpreter. 27 | void PrintInterpreterState(MicroInterpreter* interpreter); 28 | } // namespace tflite 29 | 30 | #endif // TENSORFLOW_LITE_MICRO_MICRO_OPTIONAL_DEBUG_TOOLS_H_ 31 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/tflite-model/tflite-resolver.h: -------------------------------------------------------------------------------- 1 | /* Generated by Edge Impulse 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | 22 | #ifndef _EI_CLASSIFIER_TFLITE_RESOLVER_H_ 23 | #define _EI_CLASSIFIER_TFLITE_RESOLVER_H_ 24 | 25 | #include "edge-impulse-sdk/tensorflow/lite/micro/kernels/micro_ops.h" 26 | 27 | #define EI_TFLITE_RESOLVER static tflite::MicroMutableOpResolver<2> resolver; \ 28 | resolver.AddFullyConnected(); \ 29 | resolver.AddSoftmax(); 30 | 31 | #endif // _EI_CLASSIFIER_TFLITE_RESOLVER_H_ 32 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/micro/compatibility.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_MICRO_COMPATIBILITY_H_ 16 | #define TENSORFLOW_LITE_MICRO_COMPATIBILITY_H_ 17 | 18 | // C++ will automatically create class-specific delete operators for virtual 19 | // objects, which by default call the global delete function. For embedded 20 | // applications we want to avoid this, and won't be calling new/delete on these 21 | // objects, so we need to override the default implementation with one that does 22 | // nothing to avoid linking in ::delete(). 23 | // This macro needs to be included in all subclasses of a virtual base class in 24 | // the private section. 25 | #ifdef TF_LITE_STATIC_MEMORY 26 | #define TF_LITE_REMOVE_VIRTUAL_DELETE \ 27 | void operator delete(void* p) {} 28 | #else 29 | #define TF_LITE_REMOVE_VIRTUAL_DELETE 30 | #endif 31 | 32 | #endif // TENSORFLOW_LITE_MICRO_COMPATIBILITY_H_ 33 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/kernels/internal/reference/floor.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_FLOOR_H_ 16 | #define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_FLOOR_H_ 17 | 18 | #include 19 | 20 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/types.h" 21 | 22 | namespace tflite { 23 | 24 | namespace reference_ops { 25 | 26 | inline void Floor(const RuntimeShape& input_shape, const float* input_data, 27 | const RuntimeShape& output_shape, float* output_data) { 28 | const int flat_size = MatchingFlatSize(input_shape, output_shape); 29 | 30 | for (int i = 0; i < flat_size; i++) { 31 | int offset = i; 32 | output_data[offset] = std::floor(input_data[offset]); 33 | } 34 | } 35 | 36 | } // namespace reference_ops 37 | } // namespace tflite 38 | 39 | #endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_FLOOR_H_ 40 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/DSP/Source/BasicMathFunctions/BasicMathFunctionsF16.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: BasicMathFunctionsF16.c 6 | * Description: Combination of all basic math function f16 source files. 7 | * 8 | * $Date: 20. April 2020 9 | * $Revision: V1.1.0 10 | * 11 | * Target Processor: Cortex-M cores 12 | * -------------------------------------------------------------------- */ 13 | /* 14 | * Copyright (C) 2019-2020 ARM Limited or its affiliates. All rights reserved. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * 18 | * Licensed under the Apache License, Version 2.0 (the License); you may 19 | * not use this file except in compliance with the License. 20 | * You may obtain a copy of the License at 21 | * 22 | * www.apache.org/licenses/LICENSE-2.0 23 | * 24 | * Unless required by applicable law or agreed to in writing, software 25 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 26 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | * See the License for the specific language governing permissions and 28 | * limitations under the License. 29 | */ 30 | 31 | #include "arm_abs_f16.c" 32 | #include "arm_add_f16.c" 33 | #include "arm_dot_prod_f16.c" 34 | #include "arm_mult_f16.c" 35 | #include "arm_negate_f16.c" 36 | #include "arm_offset_f16.c" 37 | #include "arm_scale_f16.c" 38 | #include "arm_sub_f16.c" 39 | 40 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 41 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/micro/micro_string.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_MICRO_MICRO_STRING_H_ 16 | #define TENSORFLOW_LITE_MICRO_MICRO_STRING_H_ 17 | 18 | #include 19 | 20 | // Implements simple string formatting for numeric types. Returns the number of 21 | // bytes written to output. 22 | extern "C" { 23 | // Functionally equivalent to vsnprintf, trimmed down for TFLite Micro. 24 | // MicroSnprintf() is implemented using MicroVsnprintf(). 25 | int MicroVsnprintf(char* output, int len, const char* format, va_list args); 26 | // Functionally equavalent to snprintf, trimmed down for TFLite Micro. 27 | // For example, MicroSnprintf(buffer, 10, "int %d", 10) will put the string 28 | // "int 10" in the buffer. 29 | // Floating point values are logged in exponent notation (1.XXX*2^N). 30 | int MicroSnprintf(char* output, int len, const char* format, ...); 31 | } 32 | 33 | #endif // TENSORFLOW_LITE_MICRO_MICRO_STRING_H_ 34 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/kernels/internal/cppmath.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_CPPMATH_H_ 16 | #define TENSORFLOW_LITE_KERNELS_INTERNAL_CPPMATH_H_ 17 | 18 | #include 19 | 20 | namespace tflite { 21 | 22 | #if defined(TF_LITE_USE_GLOBAL_CMATH_FUNCTIONS) || \ 23 | (defined(__ANDROID__) && !defined(__NDK_MAJOR__)) || defined(ARDUINO) || \ 24 | defined(__ZEPHYR__) 25 | #define TF_LITE_GLOBAL_STD_PREFIX 26 | #else 27 | #define TF_LITE_GLOBAL_STD_PREFIX std 28 | #endif 29 | 30 | #define DECLARE_STD_GLOBAL_SWITCH1(tf_name, std_name) \ 31 | template \ 32 | inline T tf_name(const T x) { \ 33 | return TF_LITE_GLOBAL_STD_PREFIX::std_name(x); \ 34 | } 35 | 36 | DECLARE_STD_GLOBAL_SWITCH1(TfLiteRound, round); 37 | 38 | } // namespace tflite 39 | 40 | #endif // TENSORFLOW_LITE_KERNELS_INTERNAL_CPPMATH_H_ 41 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/micro/micro_error_reporter.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #include "edge-impulse-sdk/tensorflow/lite/micro/micro_error_reporter.h" 17 | 18 | #include 19 | 20 | #ifndef TF_LITE_STRIP_ERROR_STRINGS 21 | #include "edge-impulse-sdk/tensorflow/lite/micro/debug_log.h" 22 | #include "edge-impulse-sdk/tensorflow/lite/micro/micro_string.h" 23 | #endif 24 | 25 | namespace tflite { 26 | 27 | int MicroErrorReporter::Report(const char* format, va_list args) { 28 | #ifndef TF_LITE_STRIP_ERROR_STRINGS 29 | // Only pulling in the implementation of this function for builds where we 30 | // expect to make use of it to be extra cautious about not increasing the code 31 | // size. 32 | static constexpr int kMaxLogLen = 256; 33 | char log_buffer[kMaxLogLen]; 34 | MicroVsnprintf(log_buffer, kMaxLogLen, format, args); 35 | DebugLog(log_buffer); 36 | DebugLog("\r\n"); 37 | #endif 38 | return 0; 39 | } 40 | 41 | } // namespace tflite 42 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/classifier/ei_model_types.h: -------------------------------------------------------------------------------- 1 | /* Edge Impulse inferencing library 2 | * Copyright (c) 2020 EdgeImpulse Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | */ 22 | 23 | #ifndef _EDGE_IMPULSE_MODEL_TYPES_H_ 24 | #define _EDGE_IMPULSE_MODEL_TYPES_H_ 25 | 26 | #include 27 | #include "edge-impulse-sdk/dsp/numpy.hpp" 28 | 29 | typedef struct { 30 | size_t n_output_features; 31 | int (*extract_fn)(ei::signal_t *signal, ei::matrix_t *output_matrix, void *config); 32 | void *config; 33 | } ei_model_dsp_t; 34 | 35 | #endif // _EDGE_IMPULSE_MODEL_TYPES_H_ 36 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/micro/all_ops_resolver.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | Licensed under the Apache License, Version 2.0 (the "License"); 3 | you may not use this file except in compliance with the License. 4 | You may obtain a copy of the License at 5 | http://www.apache.org/licenses/LICENSE-2.0 6 | Unless required by applicable law or agreed to in writing, software 7 | distributed under the License is distributed on an "AS IS" BASIS, 8 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | See the License for the specific language governing permissions and 10 | limitations under the License. 11 | ==============================================================================*/ 12 | #ifndef TENSORFLOW_LITE_MICRO_ALL_OPS_RESOLVER_H_ 13 | #define TENSORFLOW_LITE_MICRO_ALL_OPS_RESOLVER_H_ 14 | 15 | #include "edge-impulse-sdk/tensorflow/lite/micro/compatibility.h" 16 | #include "edge-impulse-sdk/tensorflow/lite/micro/micro_mutable_op_resolver.h" 17 | 18 | namespace tflite { 19 | 20 | // The magic number in the template parameter is the maximum number of ops that 21 | // can be added to AllOpsResolver. It can be increased if needed. And most 22 | // applications that care about the memory footprint will want to directly use 23 | // MicroMutableOpResolver and have an application specific template parameter. 24 | // The examples directory has sample code for this. 25 | class AllOpsResolver : public MicroMutableOpResolver<128> { 26 | public: 27 | AllOpsResolver(); 28 | 29 | private: 30 | TF_LITE_REMOVE_VIRTUAL_DELETE 31 | }; 32 | 33 | } // namespace tflite 34 | 35 | #endif // TENSORFLOW_LITE_MICRO_ALL_OPS_RESOLVER_H_ 36 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/dsp/dct/fast-dct-fft.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Fast discrete cosine transform algorithms (C) 3 | * 4 | * Copyright (c) 2018 Project Nayuki. (MIT License) 5 | * https://www.nayuki.io/page/fast-discrete-cosine-transform-algorithms 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | * this software and associated documentation files (the "Software"), to deal in 9 | * the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | * the Software, and to permit persons to whom the Software is furnished to do so, 12 | * subject to the following conditions: 13 | * - The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * - The Software is provided "as is", without warranty of any kind, express or 16 | * implied, including but not limited to the warranties of merchantability, 17 | * fitness for a particular purpose and noninfringement. In no event shall the 18 | * authors or copyright holders be liable for any claim, damages or other 19 | * liability, whether in an action of contract, tort or otherwise, arising from, 20 | * out of or in connection with the Software or the use or other dealings in the 21 | * Software. 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | #include 28 | #include "../kissfft/kiss_fft.h" 29 | 30 | namespace ei { 31 | namespace dct { 32 | 33 | int transform(float vector[], size_t len); 34 | int inverse_transform(float vector[], size_t len); 35 | 36 | } // namespace dct 37 | } // namespace ei 38 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/kernels/internal/optimized/neon_check.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_NEON_CHECK_H_ 16 | #define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_NEON_CHECK_H_ 17 | 18 | #if defined(__ARM_NEON__) || defined(__ARM_NEON) 19 | #define USE_NEON 20 | #include 21 | #endif 22 | 23 | #if defined __GNUC__ && defined __SSE4_1__ && !defined TF_LITE_DISABLE_X86_NEON 24 | #define USE_NEON 25 | #include "NEON_2_SSE.h" 26 | #endif 27 | 28 | // NEON_OR_PORTABLE(SomeFunc, args) calls NeonSomeFunc(args) if USE_NEON is 29 | // defined, PortableSomeFunc(args) otherwise. 30 | #ifdef USE_NEON 31 | // Always use Neon code 32 | #define NEON_OR_PORTABLE(funcname, ...) Neon##funcname(__VA_ARGS__) 33 | 34 | #else 35 | // No NEON available: Use Portable code 36 | #define NEON_OR_PORTABLE(funcname, ...) Portable##funcname(__VA_ARGS__) 37 | 38 | #endif // defined(USE_NEON) 39 | 40 | #endif // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_NEON_CHECK_H_ 41 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/porting/arduino/debug_log.cpp: -------------------------------------------------------------------------------- 1 | /* Edge Impulse inferencing library 2 | * Copyright (c) 2020 EdgeImpulse Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | */ 22 | 23 | #include "edge-impulse-sdk/tensorflow/lite/micro/debug_log.h" 24 | #include "../ei_classifier_porting.h" 25 | #include 26 | #include 27 | 28 | // On mbed platforms, we set up a serial port and write to it for debug logging. 29 | #if defined(__cplusplus) && EI_C_LINKAGE == 1 30 | extern "C" 31 | #endif // defined(__cplusplus) && EI_C_LINKAGE == 1 32 | void DebugLog(const char* s) { 33 | ei_printf("%s", s); 34 | } 35 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/model-parameters/dsp_blocks.h: -------------------------------------------------------------------------------- 1 | /* Generated by Edge Impulse 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | 22 | #ifndef _EI_CLASSIFIER_DSP_BLOCKS_H_ 23 | #define _EI_CLASSIFIER_DSP_BLOCKS_H_ 24 | 25 | #include "model-parameters/model_metadata.h" 26 | #include "edge-impulse-sdk/classifier/ei_run_dsp.h" 27 | #include "edge-impulse-sdk/classifier/ei_model_types.h" 28 | 29 | const size_t ei_dsp_blocks_size = 1; 30 | ei_model_dsp_t ei_dsp_blocks[ei_dsp_blocks_size] = { 31 | { // DSP block 14 32 | 66, 33 | &extract_spectral_analysis_features, 34 | (void*)&ei_dsp_config_14 35 | } 36 | }; 37 | 38 | #endif // _EI_CLASSIFIER_DSP_BLOCKS_H_ -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/micro/micro_profiler.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #include "edge-impulse-sdk/tensorflow/lite/micro/micro_profiler.h" 17 | 18 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/compatibility.h" 19 | #include "edge-impulse-sdk/tensorflow/lite/micro/micro_time.h" 20 | 21 | namespace tflite { 22 | 23 | MicroProfiler::MicroProfiler(tflite::ErrorReporter* reporter) 24 | : reporter_(reporter) {} 25 | 26 | uint32_t MicroProfiler::BeginEvent(const char* tag, EventType event_type, 27 | int64_t event_metadata1, 28 | int64_t event_metadata2) { 29 | start_time_ = GetCurrentTimeTicks(); 30 | TFLITE_DCHECK(tag != nullptr); 31 | event_tag_ = tag; 32 | return 0; 33 | } 34 | 35 | void MicroProfiler::EndEvent(uint32_t event_handle) { 36 | int32_t end_time = GetCurrentTimeTicks(); 37 | TF_LITE_REPORT_ERROR(reporter_, "%s took %d cycles\n", event_tag_, 38 | end_time - start_time_); 39 | } 40 | 41 | } // namespace tflite 42 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/NN/Source/ReshapeFunctions/arm_reshape_s8.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2019 Arm Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | /* ---------------------------------------------------------------------- 20 | * Project: CMSIS NN Library 21 | * Title: arm_reshape_s8.c 22 | * Description: Reshape a s8 vector 23 | * 24 | * $Date: September 2019 25 | * $Revision: V.1.0.0 26 | * 27 | * Target Processor: Cortex-M cores 28 | * 29 | * -------------------------------------------------------------------- */ 30 | 31 | #include "edge-impulse-sdk/CMSIS/NN/Include/arm_nnfunctions.h" 32 | 33 | /** 34 | * @ingroup groupNN 35 | */ 36 | 37 | /** 38 | * @addtogroup Reshape 39 | * @{ 40 | */ 41 | 42 | /** 43 | * Basic s8 reshape function. 44 | * 45 | * Refer header file for details. 46 | * 47 | */ 48 | 49 | void arm_reshape_s8(const int8_t *input, 50 | int8_t *output, 51 | const uint32_t total_size) 52 | { 53 | memcpy(output, input, total_size); 54 | } 55 | 56 | /** 57 | * @} end of Reshape group 58 | */ 59 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/Core/Include/cmsis_version.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file cmsis_version.h 3 | * @brief CMSIS Core(M) Version definitions 4 | * @version V5.0.4 5 | * @date 23. July 2019 6 | ******************************************************************************/ 7 | /* 8 | * Copyright (c) 2009-2019 ARM Limited. All rights reserved. 9 | * 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the License); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #if defined ( __ICCARM__ ) 26 | #pragma system_include /* treat file as system include file for MISRA check */ 27 | #elif defined (__clang__) 28 | #pragma clang system_header /* treat file as system include file */ 29 | #endif 30 | 31 | #ifndef __CMSIS_VERSION_H 32 | #define __CMSIS_VERSION_H 33 | 34 | /* CMSIS Version definitions */ 35 | #define __CM_CMSIS_VERSION_MAIN ( 5U) /*!< [31:16] CMSIS Core(M) main version */ 36 | #define __CM_CMSIS_VERSION_SUB ( 4U) /*!< [15:0] CMSIS Core(M) sub version */ 37 | #define __CM_CMSIS_VERSION ((__CM_CMSIS_VERSION_MAIN << 16U) | \ 38 | __CM_CMSIS_VERSION_SUB ) /*!< CMSIS Core(M) version number */ 39 | #endif 40 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/NN/Source/ActivationFunctions/arm_relu6_s8.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2019 Arm Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | /* ---------------------------------------------------------------------- 20 | * Project: CMSIS NN Library 21 | * Title: arm_relu6_s8.c 22 | * Description: Basic s8 version of ReLU6 23 | * 24 | * $Date: Spetember 2019 25 | * $Revision: V.1.0.0 26 | * 27 | * Target Processor: Cortex-M cores 28 | * 29 | * -------------------------------------------------------------------- */ 30 | 31 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 32 | #include "edge-impulse-sdk/CMSIS/NN/Include/arm_nnfunctions.h" 33 | 34 | /** 35 | * @ingroup groupNN 36 | */ 37 | 38 | /** 39 | * @addtogroup Acti 40 | * @{ 41 | */ 42 | 43 | /* 44 | * Basic ReLU6 function 45 | * 46 | * Refer to header file for details. 47 | * 48 | */ 49 | 50 | void arm_relu6_s8(q7_t *data, uint16_t size) 51 | { 52 | int32_t i; 53 | 54 | for (i = 0; i < size; i++) 55 | { 56 | int32_t ip = data[i]; 57 | 58 | ip = MAX(ip, 0); 59 | data[i] = MIN(ip, 6); 60 | } 61 | } 62 | 63 | /** 64 | * @} end of Acti group 65 | */ 66 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/core/api/tensor_utils.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #include "edge-impulse-sdk/tensorflow/lite/core/api/tensor_utils.h" 17 | 18 | #include 19 | 20 | #include "edge-impulse-sdk/tensorflow/lite/c/common.h" 21 | 22 | namespace tflite { 23 | 24 | TfLiteStatus ResetVariableTensor(TfLiteTensor* tensor) { 25 | if (!tensor->is_variable) { 26 | return kTfLiteOk; 27 | } 28 | // TODO(b/115961645): Implement - If a variable tensor has a buffer, reset it 29 | // to the value of the buffer. 30 | int value = 0; 31 | if (tensor->type == kTfLiteInt8) { 32 | value = tensor->params.zero_point; 33 | } 34 | // TODO(b/139446230): Provide a platform header to better handle these 35 | // specific scenarios. 36 | #if __ANDROID__ || defined(__x86_64__) || defined(__i386__) || \ 37 | defined(__i386) || defined(__x86__) || defined(__X86__) || \ 38 | defined(_X86_) || defined(_M_IX86) || defined(_M_X64) 39 | memset(tensor->data.raw, value, tensor->bytes); 40 | #else 41 | char* raw_ptr = tensor->data.raw; 42 | for (size_t i = 0; i < tensor->bytes; ++i) { 43 | *raw_ptr = value; 44 | raw_ptr++; 45 | } 46 | #endif 47 | return kTfLiteOk; 48 | } 49 | 50 | } // namespace tflite 51 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/kernels/internal/tensor_ctypes.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_TENSOR_CTYPES_H_ 16 | #define TENSORFLOW_LITE_KERNELS_INTERNAL_TENSOR_CTYPES_H_ 17 | 18 | #include "edge-impulse-sdk/tensorflow/lite/c/common.h" 19 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/types.h" 20 | 21 | namespace tflite { 22 | 23 | template 24 | inline T* GetTensorData(TfLiteTensor* tensor) { 25 | return tensor != nullptr ? reinterpret_cast(tensor->data.raw) : nullptr; 26 | } 27 | 28 | template 29 | inline const T* GetTensorData(const TfLiteTensor* tensor) { 30 | return tensor != nullptr ? reinterpret_cast(tensor->data.raw) 31 | : nullptr; 32 | } 33 | 34 | inline RuntimeShape GetTensorShape(const TfLiteTensor* tensor) { 35 | if (tensor == nullptr) { 36 | return RuntimeShape(); 37 | } 38 | 39 | TfLiteIntArray* dims = tensor->dims; 40 | const int dims_size = dims->size; 41 | const int32_t* dims_data = reinterpret_cast(dims->data); 42 | return RuntimeShape(dims_size, dims_data); 43 | } 44 | 45 | } // namespace tflite 46 | 47 | #endif // TENSORFLOW_LITE_KERNELS_INTERNAL_TENSOR_CTYPES_H_ 48 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/dsp/returntypes.hpp: -------------------------------------------------------------------------------- 1 | /* Edge Impulse inferencing library 2 | * Copyright (c) 2020 EdgeImpulse Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | */ 22 | 23 | #ifndef _EIDSP_RETURN_TYPES_H_ 24 | #define _EIDSP_RETURN_TYPES_H_ 25 | 26 | #include 27 | 28 | namespace ei { 29 | 30 | typedef enum { 31 | EIDSP_OK = 0, 32 | EIDSP_OUT_OF_MEM = -1002, 33 | EIDSP_SIGNAL_SIZE_MISMATCH = -1003, 34 | EIDSP_MATRIX_SIZE_MISMATCH = -1004, 35 | EIDSP_DCT_ERROR = -1005, 36 | EIDSP_INPUT_MATRIX_EMPTY = -1006, 37 | EIDSP_BUFFER_SIZE_MISMATCH = -1007, 38 | EIDSP_PARAMETER_INVALID = -1008, 39 | EIDSP_UNEXPECTED_NEXT_OFFSET = -1009, 40 | EIDSP_OUT_OF_BOUNDS = -1010, 41 | EIDSP_UNSUPPORTED_FILTER_CONFIG = -1011, 42 | EIDSP_NARROWING = -1012 43 | } EIDSP_RETURN_T; 44 | 45 | } // namespace ei 46 | 47 | #endif // _EIDSP_RETURN_TYPES_H_ 48 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/DSP/Source/ControllerFunctions/arm_pid_reset_q15.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: arm_pid_reset_q15.c 6 | * Description: Q15 PID Control reset function 7 | * 8 | * $Date: 18. March 2019 9 | * $Revision: V1.6.0 10 | * 11 | * Target Processor: Cortex-M cores 12 | * -------------------------------------------------------------------- */ 13 | /* 14 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * 18 | * Licensed under the Apache License, Version 2.0 (the License); you may 19 | * not use this file except in compliance with the License. 20 | * You may obtain a copy of the License at 21 | * 22 | * www.apache.org/licenses/LICENSE-2.0 23 | * 24 | * Unless required by applicable law or agreed to in writing, software 25 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 26 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | * See the License for the specific language governing permissions and 28 | * limitations under the License. 29 | */ 30 | 31 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 32 | 33 | /** 34 | @addtogroup PID 35 | @{ 36 | */ 37 | 38 | /** 39 | @brief Reset function for the Q15 PID Control. 40 | @param[in,out] S points to an instance of the Q15 PID structure 41 | @return none 42 | 43 | @par Details 44 | The function resets the state buffer to zeros. 45 | */ 46 | 47 | void arm_pid_reset_q15( 48 | arm_pid_instance_q15 * S) 49 | { 50 | /* Reset state to zero, The size will be always 3 samples */ 51 | memset(S->state, 0, 3U * sizeof(q15_t)); 52 | } 53 | 54 | /** 55 | @} end of PID group 56 | */ 57 | 58 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 59 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/DSP/Source/ControllerFunctions/arm_pid_reset_q31.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: arm_pid_reset_q31.c 6 | * Description: Q31 PID Control reset function 7 | * 8 | * $Date: 18. March 2019 9 | * $Revision: V1.6.0 10 | * 11 | * Target Processor: Cortex-M cores 12 | * -------------------------------------------------------------------- */ 13 | /* 14 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * 18 | * Licensed under the Apache License, Version 2.0 (the License); you may 19 | * not use this file except in compliance with the License. 20 | * You may obtain a copy of the License at 21 | * 22 | * www.apache.org/licenses/LICENSE-2.0 23 | * 24 | * Unless required by applicable law or agreed to in writing, software 25 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 26 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | * See the License for the specific language governing permissions and 28 | * limitations under the License. 29 | */ 30 | 31 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 32 | 33 | /** 34 | @addtogroup PID 35 | @{ 36 | */ 37 | 38 | /** 39 | @brief Reset function for the Q31 PID Control. 40 | @param[in,out] S points to an instance of the Q31 PID structure 41 | @return none 42 | 43 | @par Details 44 | The function resets the state buffer to zeros. 45 | */ 46 | 47 | void arm_pid_reset_q31( 48 | arm_pid_instance_q31 * S) 49 | { 50 | /* Reset state to zero, The size will be always 3 samples */ 51 | memset(S->state, 0, 3U * sizeof(q31_t)); 52 | } 53 | 54 | /** 55 | @} end of PID group 56 | */ 57 | 58 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 59 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/DSP/Source/SupportFunctions/arm_merge_sort_init_f32.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: arm_merge_sort_init_f32.c 6 | * Description: Floating point merge sort initialization function 7 | * 8 | * $Date: 2019 9 | * $Revision: V1.6.0 10 | * 11 | * Target Processor: Cortex-M and Cortex-A cores 12 | * -------------------------------------------------------------------- */ 13 | /* 14 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * 18 | * Licensed under the Apache License, Version 2.0 (the License); you may 19 | * not use this file except in compliance with the License. 20 | * You may obtain a copy of the License at 21 | * 22 | * www.apache.org/licenses/LICENSE-2.0 23 | * 24 | * Unless required by applicable law or agreed to in writing, software 25 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 26 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | * See the License for the specific language governing permissions and 28 | * limitations under the License. 29 | */ 30 | 31 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 32 | 33 | /** 34 | @ingroup groupSupport 35 | */ 36 | 37 | /** 38 | @addtogroup Sorting 39 | @{ 40 | */ 41 | 42 | 43 | /** 44 | * @param[in,out] S points to an instance of the sorting structure. 45 | * @param[in] dir Sorting order. 46 | * @param[in] buffer Working buffer. 47 | */ 48 | void arm_merge_sort_init_f32(arm_merge_sort_instance_f32 * S, arm_sort_dir dir, float32_t * buffer) 49 | { 50 | S->dir = dir; 51 | S->buffer = buffer; 52 | } 53 | /** 54 | @} end of Sorting group 55 | */ 56 | 57 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 58 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/tennis-sensor_inference.h: -------------------------------------------------------------------------------- 1 | /* Edge Impulse ingestion SDK 2 | * Copyright (c) 2020 EdgeImpulse Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | */ 22 | 23 | #ifndef _INFERENCE_H 24 | #define _INFERENCE_H 25 | 26 | // Undefine min/max macros as these conflict with C++ std min/max functions 27 | // these are often included by Arduino cores 28 | #include 29 | #ifdef min 30 | #undef min 31 | #endif // min 32 | #ifdef max 33 | #undef max 34 | #endif // max 35 | // Similar the ESP32 seems to define this, which is also used as an enum value in TFLite 36 | #ifdef DEFAULT 37 | #undef DEFAULT 38 | #endif // DEFAULT 39 | 40 | /* Includes ---------------------------------------------------------------- */ 41 | #include "edge-impulse-sdk/classifier/ei_run_classifier.h" 42 | #include "edge-impulse-sdk/dsp/numpy.hpp" 43 | #include "model-parameters/model_metadata.h" 44 | 45 | extern void ei_printf(const char *format, ...); 46 | 47 | #endif // _INFERENCE_H 48 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/DSP/Source/ControllerFunctions/arm_pid_reset_f32.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: arm_pid_reset_f32.c 6 | * Description: Floating-point PID Control reset function 7 | * 8 | * $Date: 18. March 2019 9 | * $Revision: V1.6.0 10 | * 11 | * Target Processor: Cortex-M cores 12 | * -------------------------------------------------------------------- */ 13 | /* 14 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * 18 | * Licensed under the Apache License, Version 2.0 (the License); you may 19 | * not use this file except in compliance with the License. 20 | * You may obtain a copy of the License at 21 | * 22 | * www.apache.org/licenses/LICENSE-2.0 23 | * 24 | * Unless required by applicable law or agreed to in writing, software 25 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 26 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | * See the License for the specific language governing permissions and 28 | * limitations under the License. 29 | */ 30 | 31 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 32 | 33 | /** 34 | @addtogroup PID 35 | @{ 36 | */ 37 | 38 | /** 39 | @brief Reset function for the floating-point PID Control. 40 | @param[in,out] S points to an instance of the floating-point PID structure 41 | @return none 42 | 43 | @par Details 44 | The function resets the state buffer to zeros. 45 | */ 46 | 47 | void arm_pid_reset_f32( 48 | arm_pid_instance_f32 * S) 49 | { 50 | /* Reset state to zero, The size will be always 3 samples */ 51 | memset(S->state, 0, 3U * sizeof(float32_t)); 52 | } 53 | 54 | /** 55 | @} end of PID group 56 | */ 57 | 58 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 59 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/DSP/Source/SupportFunctions/arm_sort_init_f32.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: arm_sort_init_f32.c 6 | * Description: Floating point sort initialization function 7 | * 8 | * $Date: 2019 9 | * $Revision: V1.6.0 10 | * 11 | * Target Processor: Cortex-M and Cortex-A cores 12 | * -------------------------------------------------------------------- */ 13 | /* 14 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * 18 | * Licensed under the Apache License, Version 2.0 (the License); you may 19 | * not use this file except in compliance with the License. 20 | * You may obtain a copy of the License at 21 | * 22 | * www.apache.org/licenses/LICENSE-2.0 23 | * 24 | * Unless required by applicable law or agreed to in writing, software 25 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 26 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | * See the License for the specific language governing permissions and 28 | * limitations under the License. 29 | */ 30 | 31 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 32 | #include "edge-impulse-sdk/CMSIS/DSP/PrivateInclude/arm_sorting.h" 33 | 34 | /** 35 | @ingroup groupSupport 36 | */ 37 | 38 | /** 39 | @addtogroup Sorting 40 | @{ 41 | */ 42 | 43 | 44 | /** 45 | * @param[in,out] S points to an instance of the sorting structure. 46 | * @param[in] alg Selected algorithm. 47 | * @param[in] dir Sorting order. 48 | */ 49 | void arm_sort_init_f32(arm_sort_instance_f32 * S, arm_sort_alg alg, arm_sort_dir dir) 50 | { 51 | S->alg = alg; 52 | S->dir = dir; 53 | } 54 | 55 | /** 56 | @} end of Sorting group 57 | */ 58 | 59 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 60 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/NN/Include/arm_nn_tables.h: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS NN Library 3 | * Title: arm_nn_tables.h 4 | * Description: Extern declaration for NN tables 5 | * 6 | * $Date: 17. January 2018 7 | * $Revision: V.1.0.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2018 Arm Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #ifndef _ARM_NN_TABLES_H 30 | #define _ARM_NN_TABLES_H 31 | 32 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 33 | 34 | /** 35 | * @brief tables for various activation functions 36 | * 37 | */ 38 | 39 | extern const q15_t sigmoidTable_q15[256]; 40 | extern const q7_t sigmoidTable_q7[256]; 41 | 42 | extern const q7_t tanhTable_q7[256]; 43 | extern const q15_t tanhTable_q15[256]; 44 | 45 | /** 46 | * @brief 2-way tables for various activation functions 47 | * 48 | * 2-way table, H table for value larger than 1/4 49 | * L table for value smaller than 1/4, H table for remaining 50 | * We have this only for the q15_t version. It does not make 51 | * sense to have it for q7_t type 52 | */ 53 | extern const q15_t sigmoidHTable_q15[192]; 54 | extern const q15_t sigmoidLTable_q15[128]; 55 | 56 | #endif /* ARM_NN_TABLES_H */ 57 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/classifier/ei_classifier_config.h: -------------------------------------------------------------------------------- 1 | /* Edge Impulse inferencing library 2 | * Copyright (c) 2020 EdgeImpulse Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | */ 22 | 23 | #ifndef _EI_CLASSIFIER_CONFIG_H_ 24 | #define _EI_CLASSIFIER_CONFIG_H_ 25 | 26 | #ifndef EI_CLASSIFIER_TFLITE_ENABLE_CMSIS_NN 27 | #if defined(__MBED__) 28 | #include "mbed.h" 29 | #if (MBED_VERSION < MBED_ENCODE_VERSION(5, 7, 0)) 30 | #define EI_CLASSIFIER_TFLITE_ENABLE_CMSIS_NN 0 31 | #else 32 | #define EI_CLASSIFIER_TFLITE_ENABLE_CMSIS_NN 1 33 | #endif // Mbed OS 5.7 version check 34 | #elif defined(__TARGET_CPU_CORTEX_M0) || defined(__TARGET_CPU_CORTEX_M0PLUS) || defined(__TARGET_CPU_CORTEX_M3) || defined(__TARGET_CPU_CORTEX_M4) || defined(__TARGET_CPU_CORTEX_M7) 35 | #define EI_CLASSIFIER_TFLITE_ENABLE_CMSIS_NN 1 36 | #else 37 | #define EI_CLASSIFIER_TFLITE_ENABLE_CMSIS_NN 0 38 | #endif 39 | #endif // EI_CLASSIFIER_TFLITE_ENABLE_CMSIS_NN 40 | 41 | #endif // _EI_CLASSIFIER_CONFIG_H_ 42 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/kernels/internal/reference/round.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_ROUND_H_ 16 | #define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_ROUND_H_ 17 | 18 | #include 19 | 20 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/types.h" 21 | 22 | namespace tflite { 23 | 24 | namespace reference_ops { 25 | 26 | inline float RoundToNearest(float value) { 27 | auto floor_val = std::floor(value); 28 | auto diff = value - floor_val; 29 | if ((diff < 0.5f) || 30 | ((diff == 0.5f) && (static_cast(floor_val) % 2 == 0))) { 31 | return floor_val; 32 | } else { 33 | return floor_val = floor_val + 1.0f; 34 | } 35 | } 36 | 37 | inline void Round(const RuntimeShape& input_shape, const float* input_data, 38 | const RuntimeShape& output_shape, float* output_data) { 39 | const int flat_size = MatchingFlatSize(input_shape, output_shape); 40 | for (int i = 0; i < flat_size; ++i) { 41 | // Note that this implementation matches that of tensorFlow tf.round 42 | // and corresponds to the bankers rounding method. 43 | // cfenv (for fesetround) is not yet supported universally on Android, so 44 | // using a work around. 45 | output_data[i] = RoundToNearest(input_data[i]); 46 | } 47 | } 48 | 49 | } // namespace reference_ops 50 | } // namespace tflite 51 | #endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_ROUND_H_ 52 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/micro/memory_helpers.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_MICRO_MEMORY_HELPERS_H_ 16 | #define TENSORFLOW_LITE_MICRO_MEMORY_HELPERS_H_ 17 | 18 | #include 19 | #include 20 | 21 | #include "edge-impulse-sdk/tensorflow/lite/c/common.h" 22 | #include "edge-impulse-sdk/tensorflow/lite/core/api/error_reporter.h" 23 | #include "edge-impulse-sdk/tensorflow/lite/schema/schema_generated.h" 24 | 25 | namespace tflite { 26 | 27 | // Returns the next pointer address aligned to the given alignment. 28 | uint8_t* AlignPointerUp(uint8_t* data, size_t alignment); 29 | 30 | // Returns the previous pointer address aligned to the given alignment. 31 | uint8_t* AlignPointerDown(uint8_t* data, size_t alignment); 32 | 33 | // Returns an increased size that's a multiple of alignment. 34 | size_t AlignSizeUp(size_t size, size_t alignment); 35 | 36 | // Returns size in bytes for a given TfLiteType. 37 | TfLiteStatus TfLiteTypeSizeOf(TfLiteType type, size_t* size, 38 | ErrorReporter* reporter); 39 | 40 | // How many bytes are needed to hold a tensor's contents. 41 | TfLiteStatus BytesRequiredForTensor(const tflite::Tensor& flatbuffer_tensor, 42 | size_t* bytes, size_t* type_size, 43 | ErrorReporter* error_reporter); 44 | 45 | } // namespace tflite 46 | 47 | #endif // TENSORFLOW_LITE_MICRO_MEMORY_HELPERS_H_ 48 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/classifier/ei_classifier_types.h: -------------------------------------------------------------------------------- 1 | /* Edge Impulse inferencing library 2 | * Copyright (c) 2020 EdgeImpulse Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | */ 22 | 23 | #ifndef _EDGE_IMPULSE_RUN_CLASSIFIER_TYPES_H_ 24 | #define _EDGE_IMPULSE_RUN_CLASSIFIER_TYPES_H_ 25 | 26 | #include 27 | #include "model-parameters/model_metadata.h" 28 | 29 | typedef struct { 30 | const char *label; 31 | float value; 32 | } ei_impulse_result_classification_t; 33 | 34 | typedef struct { 35 | int sampling; 36 | int dsp; 37 | int classification; 38 | int anomaly; 39 | } ei_impulse_result_timing_t; 40 | 41 | typedef struct { 42 | ei_impulse_result_classification_t classification[EI_CLASSIFIER_LABEL_COUNT]; 43 | float anomaly; 44 | ei_impulse_result_timing_t timing; 45 | } ei_impulse_result_t; 46 | 47 | typedef struct { 48 | uint32_t buf_idx; 49 | float running_sum; 50 | float maf_buffer[EI_CLASSIFIER_SLICES_PER_MODEL_WINDOW >> 1]; 51 | }ei_impulse_maf; 52 | 53 | #endif // _EDGE_IMPULSE_RUN_CLASSIFIER_TYPES_H_ 54 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/micro/memory_planner/linear_memory_planner.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #ifndef TENSORFLOW_LITE_MICRO_MEMORY_PLANNER_LINEAR_MEMORY_PLANNER_H_ 17 | #define TENSORFLOW_LITE_MICRO_MEMORY_PLANNER_LINEAR_MEMORY_PLANNER_H_ 18 | 19 | #include "edge-impulse-sdk/tensorflow/lite/micro/compatibility.h" 20 | #include "edge-impulse-sdk/tensorflow/lite/micro/memory_planner/memory_planner.h" 21 | 22 | namespace tflite { 23 | 24 | // The simplest possible memory planner that just lays out all buffers at 25 | // increasing offsets without trying to reuse memory. 26 | class LinearMemoryPlanner : public MemoryPlanner { 27 | public: 28 | LinearMemoryPlanner(); 29 | ~LinearMemoryPlanner() override; 30 | 31 | TfLiteStatus AddBuffer(tflite::ErrorReporter* error_reporter, int size, 32 | int first_time_used, int last_time_used) override; 33 | 34 | size_t GetMaximumMemorySize() override; 35 | int GetBufferCount() override; 36 | TfLiteStatus GetOffsetForBuffer(tflite::ErrorReporter* error_reporter, 37 | int buffer_index, int* offset) override; 38 | 39 | private: 40 | static constexpr int kMaxBufferCount = 1024; 41 | size_t buffer_offsets_[kMaxBufferCount]; 42 | int current_buffer_count_; 43 | size_t next_free_offset_; 44 | 45 | TF_LITE_REMOVE_VIRTUAL_DELETE 46 | }; 47 | 48 | } // namespace tflite 49 | 50 | #endif // TENSORFLOW_LITE_MICRO_MEMORY_PLANNER_LINEAR_MEMORY_PLANNER_H_ 51 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/DSP/Source/StatisticsFunctions/arm_entropy_f64.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: arm_logsumexp_f64.c 6 | * Description: LogSumExp 7 | * 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2020 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 30 | #include 31 | #include 32 | 33 | /** 34 | * @addtogroup groupStats 35 | * @{ 36 | */ 37 | 38 | /** 39 | * @brief Entropy 40 | * 41 | * @param[in] pSrcA Array of input values. 42 | * @param[in] blockSize Number of samples in the input array. 43 | * @return Entropy -Sum(p ln p) 44 | * 45 | */ 46 | 47 | float64_t arm_entropy_f64(const float64_t * pSrcA, uint32_t blockSize) 48 | { 49 | const float64_t *pIn; 50 | uint32_t blkCnt; 51 | float64_t accum, p; 52 | 53 | pIn = pSrcA; 54 | blkCnt = blockSize; 55 | 56 | accum = 0.0f; 57 | 58 | while(blkCnt > 0) 59 | { 60 | p = *pIn++; 61 | 62 | accum += p * log(p); 63 | 64 | blkCnt--; 65 | 66 | } 67 | 68 | return(-accum); 69 | } 70 | 71 | /** 72 | * @} end of groupStats group 73 | */ 74 | 75 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 76 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_cosine_distance_f32.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | 4 | /* ---------------------------------------------------------------------- 5 | * Project: CMSIS DSP Library 6 | * Title: arm_cosine_distance_f32.c 7 | * Description: Cosine distance between two vectors 8 | * 9 | * 10 | * Target Processor: Cortex-M cores 11 | * -------------------------------------------------------------------- */ 12 | /* 13 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 14 | * 15 | * SPDX-License-Identifier: Apache-2.0 16 | * 17 | * Licensed under the Apache License, Version 2.0 (the License); you may 18 | * not use this file except in compliance with the License. 19 | * You may obtain a copy of the License at 20 | * 21 | * www.apache.org/licenses/LICENSE-2.0 22 | * 23 | * Unless required by applicable law or agreed to in writing, software 24 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 25 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 26 | * See the License for the specific language governing permissions and 27 | * limitations under the License. 28 | */ 29 | 30 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 31 | #include 32 | #include 33 | 34 | 35 | /** 36 | @addtogroup FloatDist 37 | @{ 38 | */ 39 | 40 | 41 | 42 | /** 43 | * @brief Cosine distance between two vectors 44 | * 45 | * @param[in] pA First vector 46 | * @param[in] pB Second vector 47 | * @param[in] blockSize vector length 48 | * @return distance 49 | * 50 | */ 51 | 52 | float32_t arm_cosine_distance_f32(const float32_t *pA,const float32_t *pB, uint32_t blockSize) 53 | { 54 | float32_t pwra,pwrb,dot,tmp; 55 | 56 | arm_power_f32(pA, blockSize, &pwra); 57 | arm_power_f32(pB, blockSize, &pwrb); 58 | 59 | arm_dot_prod_f32(pA,pB,blockSize,&dot); 60 | 61 | arm_sqrt_f32(pwra * pwrb, &tmp); 62 | return(1.0f - dot / tmp); 63 | 64 | } 65 | 66 | 67 | 68 | /** 69 | * @} end of FloatDist group 70 | */ 71 | 72 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 73 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/NN/Source/ConcatenationFunctions/arm_concatenation_s8_w.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2019 Arm Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | /* ---------------------------------------------------------------------- 20 | * Project: CMSIS NN Library 21 | * Title: arm_concatenation_s8_w.c 22 | * Description: s8 version of concatenation along the W axis 23 | * 24 | * $Date: October 2019 25 | * $Revision: V.1.0.0 26 | * 27 | * Target Processor: Cortex-M cores 28 | * 29 | * -------------------------------------------------------------------- */ 30 | 31 | #include "edge-impulse-sdk/CMSIS/NN/Include/arm_nnfunctions.h" 32 | 33 | /** 34 | * @ingroup groupNN 35 | */ 36 | 37 | /** 38 | * @addtogroup Concatenation 39 | * @{ 40 | */ 41 | 42 | /* 43 | * s8 version of concatenation along the W axis 44 | * 45 | * Refer to header file for details. 46 | * 47 | */ 48 | void arm_concatenation_s8_w(const int8_t *input, 49 | const uint16_t input_x, 50 | const uint16_t input_y, 51 | const uint16_t input_z, 52 | const uint16_t input_w, 53 | int8_t *output, 54 | const uint32_t offset_w) 55 | { 56 | const uint32_t input_copy_size = input_x * input_y * input_z * input_w; 57 | 58 | output += offset_w * (input_x * input_y * input_z); 59 | 60 | memcpy(output, input, input_copy_size); 61 | } 62 | 63 | /** 64 | * @} end of Concatenation group 65 | */ 66 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/micro/micro_time.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | // Reference implementation of timer functions. Platforms are not required to 17 | // implement these timer methods, but they are required to enable profiling. 18 | 19 | // On platforms that have a POSIX stack or C library, it can be written using 20 | // methods from or clock() from . 21 | 22 | // To add an equivalent function for your own platform, create your own 23 | // implementation file, and place it in a subfolder with named after the OS 24 | // you're targeting. For example, see the Cortex M bare metal version in 25 | // tensorflow/lite/micro/bluepill/micro_time.cc or the mbed one on 26 | // tensorflow/lite/micro/mbed/micro_time.cc. 27 | 28 | #include "edge-impulse-sdk/tensorflow/lite/micro/micro_time.h" 29 | 30 | namespace tflite { 31 | 32 | // Reference implementation of the ticks_per_second() function that's required 33 | // for a platform to support Tensorflow Lite for Microcontrollers profiling. 34 | // This returns 0 by default because timing is an optional feature that builds 35 | // without errors on platforms that do not need it. 36 | int32_t ticks_per_second() { return 0; } 37 | 38 | // Reference implementation of the GetCurrentTimeTicks() function that's 39 | // required for a platform to support Tensorflow Lite for Microcontrollers 40 | // profiling. This returns 0 by default because timing is an optional feature 41 | // that builds without errors on platforms that do not need it. 42 | int32_t GetCurrentTimeTicks() { return 0; } 43 | 44 | } // namespace tflite 45 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/DSP/Source/MatrixFunctions/arm_mat_init_q15.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: arm_mat_init_q15.c 6 | * Description: Q15 matrix initialization 7 | * 8 | * $Date: 18. March 2019 9 | * $Revision: V1.6.0 10 | * 11 | * Target Processor: Cortex-M cores 12 | * -------------------------------------------------------------------- */ 13 | /* 14 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * 18 | * Licensed under the Apache License, Version 2.0 (the License); you may 19 | * not use this file except in compliance with the License. 20 | * You may obtain a copy of the License at 21 | * 22 | * www.apache.org/licenses/LICENSE-2.0 23 | * 24 | * Unless required by applicable law or agreed to in writing, software 25 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 26 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | * See the License for the specific language governing permissions and 28 | * limitations under the License. 29 | */ 30 | 31 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 32 | 33 | /** 34 | @ingroup groupMatrix 35 | */ 36 | 37 | /** 38 | @addtogroup MatrixInit 39 | @{ 40 | */ 41 | 42 | /** 43 | @brief Q15 matrix initialization. 44 | @param[in,out] S points to an instance of the floating-point matrix structure 45 | @param[in] nRows number of rows in the matrix 46 | @param[in] nColumns number of columns in the matrix 47 | @param[in] pData points to the matrix data array 48 | @return none 49 | */ 50 | 51 | void arm_mat_init_q15( 52 | arm_matrix_instance_q15 * S, 53 | uint16_t nRows, 54 | uint16_t nColumns, 55 | q15_t * pData) 56 | { 57 | /* Assign Number of Rows */ 58 | S->numRows = nRows; 59 | 60 | /* Assign Number of Columns */ 61 | S->numCols = nColumns; 62 | 63 | /* Assign Data pointer */ 64 | S->pData = pData; 65 | } 66 | 67 | /** 68 | @} end of MatrixInit group 69 | */ 70 | 71 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 72 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/activation_utils.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #ifndef TENSORFLOW_LITE_MICRO_KERNELS_ACTIVATION_UTILS_H_ 17 | #define TENSORFLOW_LITE_MICRO_KERNELS_ACTIVATION_UTILS_H_ 18 | 19 | #include 20 | #include 21 | 22 | #include "edge-impulse-sdk/tensorflow/lite/c/builtin_op_data.h" 23 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/cppmath.h" 24 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/max.h" 25 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/min.h" 26 | 27 | namespace tflite { 28 | namespace ops { 29 | namespace micro { 30 | 31 | // Returns the floating point value for a fused activation: 32 | inline float ActivationValFloat(TfLiteFusedActivation act, float a) { 33 | switch (act) { 34 | case kTfLiteActNone: 35 | return a; 36 | case kTfLiteActRelu: 37 | return TfLiteMax(0.0f, a); 38 | case kTfLiteActReluN1To1: 39 | return TfLiteMax(-1.0f, TfLiteMin(a, 1.0f)); 40 | case kTfLiteActRelu6: 41 | return TfLiteMax(0.0f, TfLiteMin(a, 6.0f)); 42 | case kTfLiteActTanh: 43 | return std::tanh(a); 44 | case kTfLiteActSignBit: 45 | return std::signbit(a); 46 | case kTfLiteActSigmoid: 47 | return 1.0f / (1.0f + std::exp(-a)); 48 | } 49 | return 0.0f; // To indicate an unsupported activation (i.e. when a new fused 50 | // activation is added to the enum and not handled here). 51 | } 52 | 53 | } // namespace micro 54 | } // namespace ops 55 | } // namespace tflite 56 | 57 | #endif // TENSORFLOW_LITE_MICRO_KERNELS_ACTIVATION_UTILS_H_ 58 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/DSP/Include/arm_const_structs_f16.h: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_const_structs_f16.h 4 | * Description: Constant structs that are initialized for user convenience. 5 | * For example, some can be given as arguments to the arm_cfft_f16() function. 6 | * 7 | * $Date: 20. April 2020 8 | * $Revision: V.1.5.1 9 | * 10 | * Target Processor: Cortex-M cores 11 | * -------------------------------------------------------------------- */ 12 | /* 13 | * Copyright (C) 2010-2020 ARM Limited or its affiliates. All rights reserved. 14 | * 15 | * SPDX-License-Identifier: Apache-2.0 16 | * 17 | * Licensed under the Apache License, Version 2.0 (the License); you may 18 | * not use this file except in compliance with the License. 19 | * You may obtain a copy of the License at 20 | * 21 | * www.apache.org/licenses/LICENSE-2.0 22 | * 23 | * Unless required by applicable law or agreed to in writing, software 24 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 25 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 26 | * See the License for the specific language governing permissions and 27 | * limitations under the License. 28 | */ 29 | 30 | #ifndef _ARM_CONST_STRUCTS_F16_H 31 | #define _ARM_CONST_STRUCTS_F16_H 32 | 33 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math_f16.h" 34 | #include "arm_common_tables_f16.h" 35 | 36 | #ifdef __cplusplus 37 | extern "C" 38 | { 39 | #endif 40 | 41 | #if !defined(__CC_ARM) && defined(ARM_FLOAT16_SUPPORTED) 42 | extern const arm_cfft_instance_f16 arm_cfft_sR_f16_len16; 43 | extern const arm_cfft_instance_f16 arm_cfft_sR_f16_len32; 44 | extern const arm_cfft_instance_f16 arm_cfft_sR_f16_len64; 45 | extern const arm_cfft_instance_f16 arm_cfft_sR_f16_len128; 46 | extern const arm_cfft_instance_f16 arm_cfft_sR_f16_len256; 47 | extern const arm_cfft_instance_f16 arm_cfft_sR_f16_len512; 48 | extern const arm_cfft_instance_f16 arm_cfft_sR_f16_len1024; 49 | extern const arm_cfft_instance_f16 arm_cfft_sR_f16_len2048; 50 | extern const arm_cfft_instance_f16 arm_cfft_sR_f16_len4096; 51 | #endif 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_hamming_distance.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | 4 | /* ---------------------------------------------------------------------- 5 | * Project: CMSIS DSP Library 6 | * Title: arm_hamming_distance.c 7 | * Description: Hamming distance between two vectors 8 | * 9 | * 10 | * Target Processor: Cortex-M cores 11 | * -------------------------------------------------------------------- */ 12 | /* 13 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 14 | * 15 | * SPDX-License-Identifier: Apache-2.0 16 | * 17 | * Licensed under the Apache License, Version 2.0 (the License); you may 18 | * not use this file except in compliance with the License. 19 | * You may obtain a copy of the License at 20 | * 21 | * www.apache.org/licenses/LICENSE-2.0 22 | * 23 | * Unless required by applicable law or agreed to in writing, software 24 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 25 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 26 | * See the License for the specific language governing permissions and 27 | * limitations under the License. 28 | */ 29 | 30 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 31 | #include 32 | #include 33 | 34 | 35 | extern void arm_boolean_distance_TF_FT(const uint32_t *pA 36 | , const uint32_t *pB 37 | , uint32_t numberOfBools 38 | , uint32_t *cTF 39 | , uint32_t *cFT 40 | ); 41 | 42 | /** 43 | @addtogroup BoolDist 44 | @{ 45 | */ 46 | 47 | 48 | /** 49 | * @brief Hamming distance between two vectors 50 | * 51 | * @param[in] pA First vector of packed booleans 52 | * @param[in] pB Second vector of packed booleans 53 | * @param[in] numberOfBools Number of booleans 54 | * @return distance 55 | * 56 | */ 57 | 58 | float32_t arm_hamming_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools) 59 | { 60 | uint32_t ctf=0,cft=0; 61 | 62 | arm_boolean_distance_TF_FT(pA, pB, numberOfBools, &ctf, &cft); 63 | 64 | return(1.0*(ctf + cft) / numberOfBools); 65 | } 66 | 67 | 68 | /** 69 | * @} end of BoolDist group 70 | */ 71 | 72 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 73 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/micro/memory_planner/linear_memory_planner.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #include "edge-impulse-sdk/tensorflow/lite/micro/memory_planner/linear_memory_planner.h" 17 | 18 | namespace tflite { 19 | 20 | LinearMemoryPlanner::LinearMemoryPlanner() 21 | : current_buffer_count_(0), next_free_offset_(0) {} 22 | LinearMemoryPlanner::~LinearMemoryPlanner() {} 23 | 24 | TfLiteStatus LinearMemoryPlanner::AddBuffer( 25 | tflite::ErrorReporter* error_reporter, int size, int first_time_used, 26 | int last_time_used) { 27 | if (current_buffer_count_ >= kMaxBufferCount) { 28 | TF_LITE_REPORT_ERROR(error_reporter, "Too many buffers (max is %d)", 29 | kMaxBufferCount); 30 | return kTfLiteError; 31 | } 32 | buffer_offsets_[current_buffer_count_] = next_free_offset_; 33 | next_free_offset_ += size; 34 | ++current_buffer_count_; 35 | return kTfLiteOk; 36 | } 37 | 38 | size_t LinearMemoryPlanner::GetMaximumMemorySize() { return next_free_offset_; } 39 | 40 | int LinearMemoryPlanner::GetBufferCount() { return current_buffer_count_; } 41 | 42 | TfLiteStatus LinearMemoryPlanner::GetOffsetForBuffer( 43 | tflite::ErrorReporter* error_reporter, int buffer_index, int* offset) { 44 | if ((buffer_index < 0) || (buffer_index >= current_buffer_count_)) { 45 | TF_LITE_REPORT_ERROR(error_reporter, 46 | "buffer index %d is outside range 0 to %d", 47 | buffer_index, current_buffer_count_); 48 | return kTfLiteError; 49 | } 50 | *offset = buffer_offsets_[buffer_index]; 51 | return kTfLiteOk; 52 | } 53 | 54 | } // namespace tflite 55 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/DSP/PrivateInclude/arm_vec_fft.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * @file arm_vec_fft.h 3 | * @brief Private header file for CMSIS DSP Library 4 | * @version V1.7.0 5 | * @date 07. January 2020 6 | ******************************************************************************/ 7 | /* 8 | * Copyright (c) 2010-2020 Arm Limited or its affiliates. All rights reserved. 9 | * 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the License); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #ifndef _ARM_VEC_FFT_H_ 26 | #define _ARM_VEC_FFT_H_ 27 | 28 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 29 | #include "arm_helium_utils.h" 30 | 31 | #ifdef __cplusplus 32 | extern "C" 33 | { 34 | #endif 35 | 36 | #if (defined(ARM_MATH_MVEF) || defined(ARM_MATH_MVEI) || defined(ARM_MATH_HELIUM)) && !defined(ARM_MATH_AUTOVECTORIZE) 37 | 38 | #define MVE_CMPLX_ADD_A_ixB(A, B) vcaddq_rot90(A,B) 39 | #define MVE_CMPLX_SUB_A_ixB(A,B) vcaddq_rot270(A,B) 40 | #define MVE_CMPLX_MULT_FLT_AxB(A,B) vcmlaq_rot90(vcmulq(A, B), A, B) 41 | #define MVE_CMPLX_MULT_FLT_Conj_AxB(A,B) vcmlaq_rot270(vcmulq(A, B), A, B) 42 | 43 | #define MVE_CMPLX_MULT_FX_AxB(A,B) vqdmladhxq(vqdmlsdhq((__typeof(A))vuninitializedq_s32(), A, B), A, B); 44 | #define MVE_CMPLX_MULT_FX_AxConjB(A,B) vqdmladhq(vqdmlsdhxq((__typeof(A))vuninitializedq_s32(), A, B), A, B); 45 | 46 | #define MVE_CMPLX_ADD_FX_A_ixB(A, B) vhcaddq_rot90(A,B) 47 | #define MVE_CMPLX_SUB_FX_A_ixB(A,B) vhcaddq_rot270(A,B) 48 | 49 | 50 | #endif /* (defined(ARM_MATH_MVEF) || defined(ARM_MATH_HELIUM)) && !defined(ARM_MATH_AUTOVECTORIZE)*/ 51 | 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | 57 | 58 | #endif /* _ARM_VEC_FFT_H_ */ 59 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_russellrao_distance.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | 4 | /* ---------------------------------------------------------------------- 5 | * Project: CMSIS DSP Library 6 | * Title: arm_russellrao_distance.c 7 | * Description: Russell-Rao distance between two vectors 8 | * 9 | * 10 | * Target Processor: Cortex-M cores 11 | * -------------------------------------------------------------------- */ 12 | /* 13 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 14 | * 15 | * SPDX-License-Identifier: Apache-2.0 16 | * 17 | * Licensed under the Apache License, Version 2.0 (the License); you may 18 | * not use this file except in compliance with the License. 19 | * You may obtain a copy of the License at 20 | * 21 | * www.apache.org/licenses/LICENSE-2.0 22 | * 23 | * Unless required by applicable law or agreed to in writing, software 24 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 25 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 26 | * See the License for the specific language governing permissions and 27 | * limitations under the License. 28 | */ 29 | 30 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 31 | #include 32 | #include 33 | 34 | 35 | 36 | extern void arm_boolean_distance_TT(const uint32_t *pA 37 | , const uint32_t *pB 38 | , uint32_t numberOfBools 39 | , uint32_t *cTT 40 | ); 41 | 42 | 43 | /** 44 | @addtogroup BoolDist 45 | @{ 46 | */ 47 | 48 | /** 49 | * @brief Russell-Rao distance between two vectors 50 | * 51 | * @param[in] pA First vector of packed booleans 52 | * @param[in] pB Second vector of packed booleans 53 | * @param[in] numberOfBools Number of booleans 54 | * @return distance 55 | * 56 | */ 57 | 58 | float32_t arm_russellrao_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools) 59 | { 60 | uint32_t ctt=0; 61 | 62 | 63 | arm_boolean_distance_TT(pA, pB, numberOfBools, &ctt); 64 | 65 | 66 | return(1.0*(numberOfBools - ctt) / ((float32_t)numberOfBools)); 67 | } 68 | 69 | 70 | /** 71 | * @} end of BoolDist group 72 | */ 73 | 74 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 75 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/DSP/Source/MatrixFunctions/arm_mat_init_q31.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: arm_mat_init_q31.c 6 | * Description: Q31 matrix initialization 7 | * 8 | * $Date: 18. March 2019 9 | * $Revision: V1.6.0 10 | * 11 | * Target Processor: Cortex-M cores 12 | * -------------------------------------------------------------------- */ 13 | /* 14 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * 18 | * Licensed under the Apache License, Version 2.0 (the License); you may 19 | * not use this file except in compliance with the License. 20 | * You may obtain a copy of the License at 21 | * 22 | * www.apache.org/licenses/LICENSE-2.0 23 | * 24 | * Unless required by applicable law or agreed to in writing, software 25 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 26 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | * See the License for the specific language governing permissions and 28 | * limitations under the License. 29 | */ 30 | 31 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 32 | 33 | /** 34 | @ingroup groupMatrix 35 | */ 36 | 37 | /** 38 | @defgroup MatrixInit Matrix Initialization 39 | 40 | */ 41 | 42 | /** 43 | @addtogroup MatrixInit 44 | @{ 45 | */ 46 | 47 | /** 48 | @brief Q31 matrix initialization. 49 | @param[in,out] S points to an instance of the Q31 matrix structure 50 | @param[in] nRows number of rows in the matrix 51 | @param[in] nColumns number of columns in the matrix 52 | @param[in] pData points to the matrix data array 53 | @return none 54 | */ 55 | 56 | void arm_mat_init_q31( 57 | arm_matrix_instance_q31 * S, 58 | uint16_t nRows, 59 | uint16_t nColumns, 60 | q31_t * pData) 61 | { 62 | /* Assign Number of Rows */ 63 | S->numRows = nRows; 64 | 65 | /* Assign Number of Columns */ 66 | S->numCols = nColumns; 67 | 68 | /* Assign Data pointer */ 69 | S->pData = pData; 70 | } 71 | 72 | /** 73 | @} end of MatrixInit group 74 | */ 75 | 76 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 77 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/DSP/Source/StatisticsFunctions/arm_logsumexp_dot_prod_f32.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: arm_logsumexp_f32.c 6 | * Description: LogSumExp 7 | * 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 30 | #include 31 | #include 32 | 33 | 34 | /** 35 | * @addtogroup groupStats 36 | * @{ 37 | */ 38 | 39 | 40 | /** 41 | * @brief Dot product with log arithmetic 42 | * 43 | * Vectors are containing the log of the samples 44 | * 45 | * @param[in] *pSrcA points to the first input vector 46 | * @param[in] *pSrcB points to the second input vector 47 | * @param[in] blockSize number of samples in each vector 48 | * @param[in] *pTmpBuffer temporary buffer of length blockSize 49 | * @return The log of the dot product. 50 | * 51 | */ 52 | 53 | 54 | float32_t arm_logsumexp_dot_prod_f32(const float32_t * pSrcA, 55 | const float32_t * pSrcB, 56 | uint32_t blockSize, 57 | float32_t *pTmpBuffer) 58 | { 59 | float32_t result; 60 | arm_add_f32((float32_t*)pSrcA, (float32_t*)pSrcB, pTmpBuffer, blockSize); 61 | 62 | result = arm_logsumexp_f32(pTmpBuffer, blockSize); 63 | return(result); 64 | } 65 | 66 | /** 67 | * @} end of groupStats group 68 | */ 69 | 70 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 71 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/floor.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/reference/floor.h" 17 | 18 | #include "edge-impulse-sdk/tensorflow/lite/c/common.h" 19 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/tensor_ctypes.h" 20 | #include "edge-impulse-sdk/tensorflow/lite/kernels/kernel_util.h" 21 | 22 | namespace tflite { 23 | namespace ops { 24 | namespace micro { 25 | namespace floor { 26 | 27 | constexpr int kInputTensor = 0; 28 | constexpr int kOutputTensor = 0; 29 | 30 | TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { 31 | const TfLiteTensor* input = GetInput(context, node, kInputTensor); 32 | TF_LITE_ENSURE_TYPES_EQ(context, input->type, kTfLiteFloat32); 33 | TfLiteTensor* output = GetOutput(context, node, kOutputTensor); 34 | reference_ops::Floor(GetTensorShape(input), GetTensorData(input), 35 | GetTensorShape(output), GetTensorData(output)); 36 | return kTfLiteOk; 37 | } 38 | } // namespace floor 39 | 40 | TfLiteRegistration* Register_FLOOR() { 41 | static TfLiteRegistration r = {/*init=*/nullptr, 42 | /*free=*/nullptr, 43 | /*prepare=*/nullptr, 44 | /*invoke=*/floor::Eval, 45 | /*profiling_string=*/nullptr, 46 | /*builtin_code=*/0, 47 | /*custom_name=*/nullptr, 48 | /*version=*/0}; 49 | return &r; 50 | } 51 | 52 | } // namespace micro 53 | } // namespace ops 54 | } // namespace tflite 55 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_jaccard_distance.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | 4 | /* ---------------------------------------------------------------------- 5 | * Project: CMSIS DSP Library 6 | * Title: arm_jaccard_distance.c 7 | * Description: Jaccard distance between two vectors 8 | * 9 | * 10 | * Target Processor: Cortex-M cores 11 | * -------------------------------------------------------------------- */ 12 | /* 13 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 14 | * 15 | * SPDX-License-Identifier: Apache-2.0 16 | * 17 | * Licensed under the Apache License, Version 2.0 (the License); you may 18 | * not use this file except in compliance with the License. 19 | * You may obtain a copy of the License at 20 | * 21 | * www.apache.org/licenses/LICENSE-2.0 22 | * 23 | * Unless required by applicable law or agreed to in writing, software 24 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 25 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 26 | * See the License for the specific language governing permissions and 27 | * limitations under the License. 28 | */ 29 | 30 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 31 | #include 32 | #include 33 | 34 | 35 | 36 | extern void arm_boolean_distance_TT_TF_FT(const uint32_t *pA 37 | , const uint32_t *pB 38 | , uint32_t numberOfBools 39 | , uint32_t *cTT 40 | , uint32_t *cTF 41 | , uint32_t *cFT 42 | ); 43 | 44 | 45 | /** 46 | @addtogroup BoolDist 47 | @{ 48 | */ 49 | 50 | /** 51 | * @brief Jaccard distance between two vectors 52 | * 53 | * @param[in] pA First vector of packed booleans 54 | * @param[in] pB Second vector of packed booleans 55 | * @param[in] numberOfBools Number of booleans 56 | * @return distance 57 | * 58 | */ 59 | 60 | float32_t arm_jaccard_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools) 61 | { 62 | uint32_t ctt=0,ctf=0,cft=0; 63 | 64 | arm_boolean_distance_TT_TF_FT(pA, pB, numberOfBools, &ctt, &ctf, &cft); 65 | 66 | return(1.0*(ctf + cft) / (ctt + cft + ctf)); 67 | } 68 | 69 | 70 | /** 71 | * @} end of BoolDist group 72 | */ 73 | 74 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 75 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/kernels/op_macros.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_KERNELS_OP_MACROS_H_ 16 | #define TENSORFLOW_LITE_KERNELS_OP_MACROS_H_ 17 | 18 | // If we're on a platform without standard IO functions, fall back to a 19 | // non-portable function. 20 | #ifdef TF_LITE_MCU_DEBUG_LOG 21 | 22 | #include "edge-impulse-sdk/tensorflow/lite/micro/debug_log.h" 23 | 24 | #define DEBUG_LOG(x) \ 25 | do { \ 26 | DebugLog(x); \ 27 | } while (0) 28 | 29 | inline void InfiniteLoop() { 30 | DEBUG_LOG("HALTED\n"); 31 | while (1) { 32 | } 33 | } 34 | 35 | #define TFLITE_ABORT InfiniteLoop(); 36 | 37 | #else // TF_LITE_MCU_DEBUG_LOG 38 | 39 | #include 40 | #include 41 | 42 | #define DEBUG_LOG(x) \ 43 | do { \ 44 | fprintf(stderr, "%s", (x)); \ 45 | } while (0) 46 | 47 | #define TFLITE_ABORT abort() 48 | 49 | #endif // TF_LITE_MCU_DEBUG_LOG 50 | 51 | #ifdef NDEBUG 52 | #define TFLITE_ASSERT_FALSE (static_cast(0)) 53 | #else 54 | #define TFLITE_ASSERT_FALSE TFLITE_ABORT 55 | #endif 56 | 57 | #define TF_LITE_FATAL(msg) \ 58 | do { \ 59 | DEBUG_LOG(msg); \ 60 | DEBUG_LOG("\nFATAL\n"); \ 61 | TFLITE_ABORT; \ 62 | } while (0) 63 | 64 | #define TF_LITE_ASSERT(x) \ 65 | do { \ 66 | if (!(x)) TF_LITE_FATAL(#x); \ 67 | } while (0) 68 | 69 | #define TF_LITE_ASSERT_EQ(x, y) \ 70 | do { \ 71 | if ((x) != (y)) TF_LITE_FATAL(#x " didn't equal " #y); \ 72 | } while (0) 73 | 74 | #endif // TENSORFLOW_LITE_KERNELS_OP_MACROS_H_ 75 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_boolean_distance.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | 4 | /* ---------------------------------------------------------------------- 5 | * Project: CMSIS DSP Library 6 | * Title: arm_svm_linear_init_f32.c 7 | * Description: SVM Linear Instance Initialization 8 | * 9 | * 10 | * Target Processor: Cortex-M cores 11 | * -------------------------------------------------------------------- */ 12 | /* 13 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 14 | * 15 | * SPDX-License-Identifier: Apache-2.0 16 | * 17 | * Licensed under the Apache License, Version 2.0 (the License); you may 18 | * not use this file except in compliance with the License. 19 | * You may obtain a copy of the License at 20 | * 21 | * www.apache.org/licenses/LICENSE-2.0 22 | * 23 | * Unless required by applicable law or agreed to in writing, software 24 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 25 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 26 | * See the License for the specific language governing permissions and 27 | * limitations under the License. 28 | */ 29 | 30 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 31 | #include 32 | #include 33 | 34 | 35 | 36 | 37 | #if defined(ARM_MATH_NEON) 38 | 39 | #include "NEMath.h" 40 | 41 | #endif 42 | 43 | 44 | #define TT 45 | #define TF 46 | #define FT 47 | #define EXT _TT_TF_FT 48 | #include "edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_boolean_distance_template.h" 49 | 50 | #undef TT 51 | #undef FF 52 | #undef TF 53 | #undef FT 54 | #undef EXT 55 | #define TF 56 | #define FT 57 | #define EXT _TF_FT 58 | #include "edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_boolean_distance_template.h" 59 | 60 | #undef TT 61 | #undef FF 62 | #undef TF 63 | #undef FT 64 | #undef EXT 65 | #define TT 66 | #define FF 67 | #define TF 68 | #define FT 69 | #define EXT _TT_FF_TF_FT 70 | #include "edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_boolean_distance_template.h" 71 | 72 | #undef TT 73 | #undef FF 74 | #undef TF 75 | #undef FT 76 | #undef EXT 77 | #define TT 78 | #define EXT _TT 79 | #include "edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_boolean_distance_template.h" 80 | 81 | 82 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 83 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/NN/Source/ConcatenationFunctions/arm_concatenation_s8_x.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2019 Arm Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | /* ---------------------------------------------------------------------- 20 | * Project: CMSIS NN Library 21 | * Title: arm_concatenation_s8_x.c 22 | * Description: s8 version of concatenation along the X axis 23 | * 24 | * $Date: October 2019 25 | * $Revision: V.1.0.0 26 | * 27 | * Target Processor: Cortex-M cores 28 | * 29 | * -------------------------------------------------------------------- */ 30 | 31 | #include "edge-impulse-sdk/CMSIS/NN/Include/arm_nnfunctions.h" 32 | 33 | /** 34 | * @ingroup groupNN 35 | */ 36 | 37 | /** 38 | * @addtogroup Concatenation 39 | * @{ 40 | */ 41 | 42 | /* 43 | * s8 version of concatenation along the X axis 44 | * 45 | * Refer to header file for details. 46 | * 47 | */ 48 | void arm_concatenation_s8_x(const int8_t *input, 49 | const uint16_t input_x, 50 | const uint16_t input_y, 51 | const uint16_t input_z, 52 | const uint16_t input_w, 53 | int8_t *output, 54 | const uint16_t output_x, 55 | const uint32_t offset_x) 56 | { 57 | const uint32_t num_iterations = input_y * input_z * input_w; 58 | 59 | output += offset_x; 60 | 61 | uint32_t i; 62 | 63 | // Copy per row 64 | for (i = 0; i < num_iterations; ++i) 65 | { 66 | memcpy(output, input, input_x); 67 | input += input_x; 68 | output += output_x; 69 | } 70 | } 71 | 72 | /** 73 | * @} end of Concatenation group 74 | */ 75 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/core/api/op_resolver.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_CORE_API_OP_RESOLVER_H_ 16 | #define TENSORFLOW_LITE_CORE_API_OP_RESOLVER_H_ 17 | 18 | #include "edge-impulse-sdk/tensorflow/lite/c/common.h" 19 | #include "edge-impulse-sdk/tensorflow/lite/core/api/error_reporter.h" 20 | #include "edge-impulse-sdk/tensorflow/lite/schema/schema_generated.h" 21 | 22 | namespace tflite { 23 | 24 | /// Abstract interface that returns TfLiteRegistrations given op codes or custom 25 | /// op names. This is the mechanism that ops being referenced in the flatbuffer 26 | /// model are mapped to executable function pointers (TfLiteRegistrations). 27 | class OpResolver { 28 | public: 29 | /// Finds the op registration for a builtin operator by enum code. 30 | virtual const TfLiteRegistration* FindOp(tflite::BuiltinOperator op, 31 | int version) const = 0; 32 | /// Finds the op registration of a custom operator by op name. 33 | virtual const TfLiteRegistration* FindOp(const char* op, 34 | int version) const = 0; 35 | virtual ~OpResolver() {} 36 | }; 37 | 38 | // Handles the logic for converting between an OperatorCode structure extracted 39 | // from a flatbuffer and information about a registered operator 40 | // implementation. 41 | TfLiteStatus GetRegistrationFromOpCode(const OperatorCode* opcode, 42 | const OpResolver& op_resolver, 43 | ErrorReporter* error_reporter, 44 | const TfLiteRegistration** registration); 45 | 46 | } // namespace tflite 47 | 48 | #endif // TENSORFLOW_LITE_CORE_API_OP_RESOLVER_H_ 49 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_kulsinski_distance.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | 4 | /* ---------------------------------------------------------------------- 5 | * Project: CMSIS DSP Library 6 | * Title: arm_kulsinski_distance.c 7 | * Description: Kulsinski distance between two vectors 8 | * 9 | * 10 | * Target Processor: Cortex-M cores 11 | * -------------------------------------------------------------------- */ 12 | /* 13 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 14 | * 15 | * SPDX-License-Identifier: Apache-2.0 16 | * 17 | * Licensed under the Apache License, Version 2.0 (the License); you may 18 | * not use this file except in compliance with the License. 19 | * You may obtain a copy of the License at 20 | * 21 | * www.apache.org/licenses/LICENSE-2.0 22 | * 23 | * Unless required by applicable law or agreed to in writing, software 24 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 25 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 26 | * See the License for the specific language governing permissions and 27 | * limitations under the License. 28 | */ 29 | 30 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 31 | #include 32 | #include 33 | 34 | 35 | 36 | extern void arm_boolean_distance_TT_TF_FT(const uint32_t *pA 37 | , const uint32_t *pB 38 | , uint32_t numberOfBools 39 | , uint32_t *cTT 40 | , uint32_t *cTF 41 | , uint32_t *cFT 42 | ); 43 | 44 | 45 | /** 46 | @addtogroup BoolDist 47 | @{ 48 | */ 49 | 50 | 51 | /** 52 | * @brief Kulsinski distance between two vectors 53 | * 54 | * @param[in] pA First vector of packed booleans 55 | * @param[in] pB Second vector of packed booleans 56 | * @param[in] numberOfBools Number of booleans 57 | * @return distance 58 | * 59 | */ 60 | 61 | float32_t arm_kulsinski_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools) 62 | { 63 | uint32_t ctt=0,ctf=0,cft=0; 64 | 65 | arm_boolean_distance_TT_TF_FT(pA, pB, numberOfBools, &ctt, &ctf, &cft); 66 | 67 | return(1.0*(ctf + cft - ctt + numberOfBools) / (cft + ctf + numberOfBools)); 68 | } 69 | 70 | 71 | /** 72 | * @} end of BoolDist group 73 | */ 74 | 75 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 76 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_sokalsneath_distance.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | 4 | /* ---------------------------------------------------------------------- 5 | * Project: CMSIS DSP Library 6 | * Title: arm_sokalsneath_distance.c 7 | * Description: Sokal-Sneath distance between two vectors 8 | * 9 | * 10 | * Target Processor: Cortex-M cores 11 | * -------------------------------------------------------------------- */ 12 | /* 13 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 14 | * 15 | * SPDX-License-Identifier: Apache-2.0 16 | * 17 | * Licensed under the Apache License, Version 2.0 (the License); you may 18 | * not use this file except in compliance with the License. 19 | * You may obtain a copy of the License at 20 | * 21 | * www.apache.org/licenses/LICENSE-2.0 22 | * 23 | * Unless required by applicable law or agreed to in writing, software 24 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 25 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 26 | * See the License for the specific language governing permissions and 27 | * limitations under the License. 28 | */ 29 | 30 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 31 | #include 32 | #include 33 | 34 | 35 | extern void arm_boolean_distance_TT_TF_FT(const uint32_t *pA 36 | , const uint32_t *pB 37 | , uint32_t numberOfBools 38 | , uint32_t *cTT 39 | , uint32_t *cTF 40 | , uint32_t *cFT 41 | ); 42 | 43 | 44 | /** 45 | @addtogroup BoolDist 46 | @{ 47 | */ 48 | 49 | /** 50 | * @brief Sokal-Sneath distance between two vectors 51 | * 52 | * @param[in] pA First vector of packed booleans 53 | * @param[in] pB Second vector of packed booleans 54 | * @param[in] numberOfBools Number of booleans 55 | * @return distance 56 | * 57 | */ 58 | 59 | float32_t arm_sokalsneath_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools) 60 | { 61 | uint32_t ctt=0,cft=0,ctf=0; 62 | float32_t r; 63 | 64 | arm_boolean_distance_TT_TF_FT(pA, pB, numberOfBools, &ctt, &ctf, &cft); 65 | 66 | r = 2.0*(ctf + cft); 67 | 68 | return(r / (r + ctt)); 69 | } 70 | 71 | 72 | /** 73 | * @} end of BoolDist group 74 | */ 75 | 76 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 77 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_yule_distance.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | 4 | /* ---------------------------------------------------------------------- 5 | * Project: CMSIS DSP Library 6 | * Title: arm_yule_distance.c 7 | * Description: Yule distance between two vectors 8 | * 9 | * 10 | * Target Processor: Cortex-M cores 11 | * -------------------------------------------------------------------- */ 12 | /* 13 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 14 | * 15 | * SPDX-License-Identifier: Apache-2.0 16 | * 17 | * Licensed under the Apache License, Version 2.0 (the License); you may 18 | * not use this file except in compliance with the License. 19 | * You may obtain a copy of the License at 20 | * 21 | * www.apache.org/licenses/LICENSE-2.0 22 | * 23 | * Unless required by applicable law or agreed to in writing, software 24 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 25 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 26 | * See the License for the specific language governing permissions and 27 | * limitations under the License. 28 | */ 29 | 30 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 31 | #include 32 | #include 33 | 34 | 35 | extern void arm_boolean_distance_TT_FF_TF_FT(const uint32_t *pA 36 | , const uint32_t *pB 37 | , uint32_t numberOfBools 38 | , uint32_t *cTT 39 | , uint32_t *cFF 40 | , uint32_t *cTF 41 | , uint32_t *cFT 42 | ); 43 | 44 | /** 45 | @addtogroup BoolDist 46 | @{ 47 | */ 48 | 49 | 50 | /** 51 | * @brief Yule distance between two vectors 52 | * 53 | * @param[in] pA First vector of packed booleans 54 | * @param[in] pB Second vector of packed booleans 55 | * @param[in] numberOfBools Number of booleans 56 | * @return distance 57 | * 58 | */ 59 | 60 | float32_t arm_yule_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools) 61 | { 62 | uint32_t ctt=0,cff=0,ctf=0,cft=0,r; 63 | 64 | arm_boolean_distance_TT_FF_TF_FT(pA, pB, numberOfBools, &ctt,&cff, &ctf, &cft); 65 | 66 | r = 2*(ctf * cft); 67 | 68 | return(1.0*r / (r/2.0 + ctt * cff)); 69 | } 70 | 71 | 72 | /** 73 | * @} end of BoolDist group 74 | */ 75 | 76 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 77 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/DSP/Source/StatisticsFunctions/arm_kullback_leibler_f64.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: arm_logsumexp_f64.c 6 | * Description: LogSumExp 7 | * 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2020 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 30 | #include 31 | #include 32 | 33 | /** 34 | * @addtogroup groupStats 35 | * @{ 36 | */ 37 | 38 | /** 39 | * @brief Kullback-Leibler 40 | * 41 | * @param[in] *pSrcA points to an array of input values for probaility distribution A. 42 | * @param[in] *pSrcB points to an array of input values for probaility distribution B. 43 | * @param[in] blockSize number of samples in the input array. 44 | * @return Kullback-Leibler divergence D(A || B) 45 | * 46 | */ 47 | 48 | float64_t arm_kullback_leibler_f64(const float64_t * pSrcA, const float64_t * pSrcB, uint32_t blockSize) 49 | { 50 | const float64_t *pInA, *pInB; 51 | uint32_t blkCnt; 52 | float64_t accum, pA,pB; 53 | 54 | pInA = pSrcA; 55 | pInB = pSrcB; 56 | blkCnt = blockSize; 57 | 58 | accum = 0.0f; 59 | 60 | while(blkCnt > 0) 61 | { 62 | pA = *pInA++; 63 | pB = *pInB++; 64 | 65 | accum += pA * log(pB / pA); 66 | 67 | blkCnt--; 68 | } 69 | 70 | return(-accum); 71 | } 72 | 73 | /** 74 | * @} end of groupStats group 75 | */ 76 | 77 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 78 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_rogerstanimoto_distance.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | 4 | /* ---------------------------------------------------------------------- 5 | * Project: CMSIS DSP Library 6 | * Title: arm_rogerstanimoto_distance.c 7 | * Description: Roger Stanimoto distance between two vectors 8 | * 9 | * 10 | * Target Processor: Cortex-M cores 11 | * -------------------------------------------------------------------- */ 12 | /* 13 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 14 | * 15 | * SPDX-License-Identifier: Apache-2.0 16 | * 17 | * Licensed under the Apache License, Version 2.0 (the License); you may 18 | * not use this file except in compliance with the License. 19 | * You may obtain a copy of the License at 20 | * 21 | * www.apache.org/licenses/LICENSE-2.0 22 | * 23 | * Unless required by applicable law or agreed to in writing, software 24 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 25 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 26 | * See the License for the specific language governing permissions and 27 | * limitations under the License. 28 | */ 29 | 30 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 31 | #include 32 | #include 33 | 34 | 35 | 36 | extern void arm_boolean_distance_TT_FF_TF_FT(const uint32_t *pA 37 | , const uint32_t *pB 38 | , uint32_t numberOfBools 39 | , uint32_t *cTT 40 | , uint32_t *cFF 41 | , uint32_t *cTF 42 | , uint32_t *cFT 43 | ); 44 | 45 | 46 | /** 47 | @addtogroup BoolDist 48 | @{ 49 | */ 50 | 51 | /** 52 | * @brief Roger Stanimoto distance between two vectors 53 | * 54 | * @param[in] pA First vector of packed booleans 55 | * @param[in] pB Second vector of packed booleans 56 | * @param[in] numberOfBools Number of booleans 57 | * @return distance 58 | * 59 | */ 60 | 61 | float32_t arm_rogerstanimoto_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools) 62 | { 63 | uint32_t ctt=0,cff=0,ctf=0,cft=0,r; 64 | 65 | arm_boolean_distance_TT_FF_TF_FT(pA, pB, numberOfBools, &ctt,&cff, &ctf, &cft); 66 | 67 | r = 2*(ctf + cft); 68 | 69 | return(1.0*r / (r + ctt + cff)); 70 | } 71 | 72 | 73 | /** 74 | * @} end of BoolDist group 75 | */ 76 | 77 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 78 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/NN/Source/ConcatenationFunctions/arm_concatenation_s8_z.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2019 Arm Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | /* ---------------------------------------------------------------------- 20 | * Project: CMSIS NN Library 21 | * Title: arm_concatenation_s8_z.c 22 | * Description: s8 version of concatenation along the Z axis 23 | * 24 | * $Date: October 2019 25 | * $Revision: V.1.0.0 26 | * 27 | * Target Processor: Cortex-M cores 28 | * 29 | * -------------------------------------------------------------------- */ 30 | 31 | #include "edge-impulse-sdk/CMSIS/NN/Include/arm_nnfunctions.h" 32 | 33 | /** 34 | * @ingroup groupNN 35 | */ 36 | 37 | /** 38 | * @addtogroup Concatenation 39 | * @{ 40 | */ 41 | 42 | /* 43 | * s8 version of concatenation along the Z axis 44 | * 45 | * Refer to header file for details. 46 | * 47 | */ 48 | void arm_concatenation_s8_z(const int8_t *input, 49 | const uint16_t input_x, 50 | const uint16_t input_y, 51 | const uint16_t input_z, 52 | const uint16_t input_w, 53 | int8_t *output, 54 | const uint16_t output_z, 55 | const uint32_t offset_z) 56 | { 57 | const uint32_t input_copy_size = input_x * input_y * input_z; 58 | const uint32_t output_stride = input_x * input_y * output_z; 59 | 60 | output += offset_z * (input_x * input_y); 61 | 62 | uint32_t i; 63 | 64 | for (i = 0; i < input_w; ++i) 65 | { 66 | memcpy(output, input, input_copy_size); 67 | input += input_copy_size; 68 | output += output_stride; 69 | } 70 | } 71 | 72 | /** 73 | * @} end of Concatenation group 74 | */ 75 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/kernels/internal/reference/quantize.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_QUANTIZE_H_ 16 | #define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_QUANTIZE_H_ 17 | 18 | #include 19 | #include 20 | 21 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/common.h" 22 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/compatibility.h" 23 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/cppmath.h" 24 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/types.h" 25 | 26 | namespace tflite { 27 | 28 | namespace reference_ops { 29 | 30 | template 31 | inline void AffineQuantize(const tflite::QuantizationParams& op_params, 32 | const RuntimeShape& input_shape, 33 | const InputT* input_data, 34 | const RuntimeShape& output_shape, 35 | OutputT* output_data) { 36 | const int32 zero_point = op_params.zero_point; 37 | const double scale = op_params.scale; 38 | const int flat_size = MatchingFlatSize(input_shape, output_shape); 39 | static constexpr int32 min_val = std::numeric_limits::min(); 40 | static constexpr int32 max_val = std::numeric_limits::max(); 41 | 42 | for (int i = 0; i < flat_size; i++) { 43 | const InputT val = input_data[i]; 44 | int32 unclamped = 45 | static_cast(TfLiteRound(val / static_cast(scale))) + 46 | zero_point; 47 | int32 clamped = std::min(std::max(unclamped, min_val), max_val); 48 | output_data[i] = clamped; 49 | } 50 | } 51 | 52 | } // namespace reference_ops 53 | 54 | } // namespace tflite 55 | #endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_QUANTIZE_H_ 56 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_sokalmichener_distance.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | 4 | /* ---------------------------------------------------------------------- 5 | * Project: CMSIS DSP Library 6 | * Title: arm_sokalmichener_distance.c 7 | * Description: Sokal-Michener distance between two vectors 8 | * 9 | * 10 | * Target Processor: Cortex-M cores 11 | * -------------------------------------------------------------------- */ 12 | /* 13 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 14 | * 15 | * SPDX-License-Identifier: Apache-2.0 16 | * 17 | * Licensed under the Apache License, Version 2.0 (the License); you may 18 | * not use this file except in compliance with the License. 19 | * You may obtain a copy of the License at 20 | * 21 | * www.apache.org/licenses/LICENSE-2.0 22 | * 23 | * Unless required by applicable law or agreed to in writing, software 24 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 25 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 26 | * See the License for the specific language governing permissions and 27 | * limitations under the License. 28 | */ 29 | 30 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 31 | #include 32 | #include 33 | 34 | 35 | extern void arm_boolean_distance_TT_FF_TF_FT(const uint32_t *pA 36 | , const uint32_t *pB 37 | , uint32_t numberOfBools 38 | , uint32_t *cTT 39 | , uint32_t *cFF 40 | , uint32_t *cTF 41 | , uint32_t *cFT 42 | ); 43 | 44 | 45 | /** 46 | @addtogroup BoolDist 47 | @{ 48 | */ 49 | 50 | /** 51 | * @brief Sokal-Michener distance between two vectors 52 | * 53 | * @param[in] pA First vector of packed booleans 54 | * @param[in] pB Second vector of packed booleans 55 | * @param[in] numberOfBools Number of booleans 56 | * @return distance 57 | * 58 | */ 59 | 60 | float32_t arm_sokalmichener_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools) 61 | { 62 | uint32_t ctt=0,cff=0,cft=0,ctf=0; 63 | float32_t r,s; 64 | 65 | arm_boolean_distance_TT_FF_TF_FT(pA, pB, numberOfBools, &ctt, &cff, &ctf, &cft); 66 | 67 | r = 2.0*(ctf + cft); 68 | s = 1.0*(cff + ctt); 69 | 70 | return(r / (s+r)); 71 | } 72 | 73 | 74 | /** 75 | * @} end of BoolDist group 76 | */ 77 | 78 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 79 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/NN/Source/SoftmaxFunctions/arm_softmax_with_batch_q7.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2019 Arm Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | /* ---------------------------------------------------------------------- 20 | * Project: CMSIS NN Library 21 | * Title: arm_softmax_with_batch_q7.c 22 | * Description: Q7 softmax function 23 | * 24 | * $Date: 05. August 2019 25 | * $Revision: V.1.0.0 26 | * 27 | * Target Processor: Cortex-M and Cortex-A cores 28 | * 29 | * -------------------------------------------------------------------- */ 30 | 31 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 32 | #include "edge-impulse-sdk/CMSIS/NN/Include/arm_nnfunctions.h" 33 | 34 | /** 35 | * @ingroup groupNN 36 | */ 37 | 38 | /** 39 | * @addtogroup Softmax 40 | * @{ 41 | */ 42 | 43 | /** 44 | * @brief Q7 softmax function with batch parameter 45 | * @param[in] vec_in pointer to input vector 46 | * @param[in] nb_batches number of batches 47 | * @param[in] dim_vec input vector dimention 48 | * @param[out] p_out pointer to output vector 49 | * 50 | * @details 51 | * 52 | * Here, instead of typical natural logarithm e based softmax, we use 53 | * 2-based softmax here, i.e.,: 54 | * 55 | * y_i = 2^(x_i) / sum(2^x_j) 56 | * 57 | * The relative output will be different here. 58 | * But mathematically, the gradient will be the same 59 | * with a log(2) scaling factor. 60 | * 61 | */ 62 | 63 | void arm_softmax_with_batch_q7(const q7_t * vec_in, const uint16_t nb_batches,const uint16_t dim_vec, q7_t * p_out ) 64 | { 65 | for(int i=0; i> 2; 48 | q31_t in; 49 | 50 | while (cnt > 0l) 51 | { 52 | q31_t value = arm_nn_read_q7x4_ia(&pV); 53 | v1 = __SXTB16(__ROR(value, 8)); 54 | v2 = __SXTB16(value); 55 | #ifndef ARM_MATH_BIG_ENDIAN 56 | 57 | vo2 = __PKHTB(v1, v2, 16); 58 | vo1 = __PKHBT(v2, v1, 16); 59 | 60 | #else 61 | 62 | vo1 = __PKHTB(v1, v2, 16); 63 | vo2 = __PKHBT(v2, v1, 16); 64 | 65 | #endif 66 | 67 | in = arm_nn_read_q15x2(pCnt); 68 | write_q15x2_ia(&pCnt, __QADD16(vo1, in)); 69 | 70 | in = arm_nn_read_q15x2(pCnt); 71 | write_q15x2_ia(&pCnt, __QADD16(vo2, in)); 72 | 73 | cnt--; 74 | } 75 | cnt = length & 0x3; 76 | while (cnt > 0l) 77 | { 78 | *pCnt++ += *pV++; 79 | cnt--; 80 | } 81 | } 82 | 83 | /** 84 | * @} end of NNBasicMath group 85 | */ 86 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/core/api/error_reporter.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_CORE_API_ERROR_REPORTER_H_ 16 | #define TENSORFLOW_LITE_CORE_API_ERROR_REPORTER_H_ 17 | 18 | #include 19 | 20 | namespace tflite { 21 | 22 | /// A functor that reports error to supporting system. Invoked similar to 23 | /// printf. 24 | /// 25 | /// Usage: 26 | /// ErrorReporter foo; 27 | /// foo.Report("test %d", 5); 28 | /// or 29 | /// va_list args; 30 | /// foo.Report("test %d", args); // where args is va_list 31 | /// 32 | /// Subclass ErrorReporter to provide another reporting destination. 33 | /// For example, if you have a GUI program, you might redirect to a buffer 34 | /// that drives a GUI error log box. 35 | class ErrorReporter { 36 | public: 37 | virtual ~ErrorReporter() {} 38 | virtual int Report(const char* format, va_list args) = 0; 39 | int Report(const char* format, ...); 40 | int ReportError(void*, const char* format, ...); 41 | }; 42 | 43 | } // namespace tflite 44 | 45 | // You should not make bare calls to the error reporter, instead use the 46 | // TF_LITE_REPORT_ERROR macro, since this allows message strings to be 47 | // stripped when the binary size has to be optimized. If you are looking to 48 | // reduce binary size, define TF_LITE_STRIP_ERROR_STRINGS when compiling and 49 | // every call will be stubbed out, taking no memory. 50 | #ifndef TF_LITE_STRIP_ERROR_STRINGS 51 | #define TF_LITE_REPORT_ERROR(reporter, ...) \ 52 | do { \ 53 | static_cast(reporter)->Report(__VA_ARGS__); \ 54 | } while (false) 55 | #else // TF_LITE_STRIP_ERROR_STRINGS 56 | #define TF_LITE_REPORT_ERROR(reporter, ...) 57 | #endif // TF_LITE_STRIP_ERROR_STRINGS 58 | 59 | #endif // TENSORFLOW_LITE_CORE_API_ERROR_REPORTER_H_ 60 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/DSP/Source/FilteringFunctions/arm_fir_lattice_init_q15.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: arm_fir_lattice_init_q15.c 6 | * Description: Q15 FIR Lattice filter initialization function 7 | * 8 | * $Date: 18. March 2019 9 | * $Revision: V1.6.0 10 | * 11 | * Target Processor: Cortex-M cores 12 | * -------------------------------------------------------------------- */ 13 | /* 14 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * 18 | * Licensed under the Apache License, Version 2.0 (the License); you may 19 | * not use this file except in compliance with the License. 20 | * You may obtain a copy of the License at 21 | * 22 | * www.apache.org/licenses/LICENSE-2.0 23 | * 24 | * Unless required by applicable law or agreed to in writing, software 25 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 26 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | * See the License for the specific language governing permissions and 28 | * limitations under the License. 29 | */ 30 | 31 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 32 | 33 | /** 34 | @ingroup groupFilters 35 | */ 36 | 37 | /** 38 | @addtogroup FIR_Lattice 39 | @{ 40 | */ 41 | 42 | /** 43 | @brief Initialization function for the Q15 FIR lattice filter. 44 | @param[in] S points to an instance of the Q15 FIR lattice structure 45 | @param[in] numStages number of filter stages 46 | @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages 47 | @param[in] pState points to the state buffer. The array is of length numStages 48 | @return none 49 | */ 50 | 51 | void arm_fir_lattice_init_q15( 52 | arm_fir_lattice_instance_q15 * S, 53 | uint16_t numStages, 54 | const q15_t * pCoeffs, 55 | q15_t * pState) 56 | { 57 | /* Assign filter taps */ 58 | S->numStages = numStages; 59 | 60 | /* Assign coefficient pointer */ 61 | S->pCoeffs = pCoeffs; 62 | 63 | /* Clear state buffer and size is always numStages */ 64 | memset(pState, 0, (numStages) * sizeof(q15_t)); 65 | 66 | /* Assign state pointer */ 67 | S->pState = pState; 68 | } 69 | 70 | /** 71 | @} end of FIR_Lattice group 72 | */ 73 | 74 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 75 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/DSP/Source/FilteringFunctions/arm_fir_lattice_init_q31.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: arm_fir_lattice_init_q31.c 6 | * Description: Q31 FIR lattice filter initialization function 7 | * 8 | * $Date: 18. March 2019 9 | * $Revision: V1.6.0 10 | * 11 | * Target Processor: Cortex-M cores 12 | * -------------------------------------------------------------------- */ 13 | /* 14 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * 18 | * Licensed under the Apache License, Version 2.0 (the License); you may 19 | * not use this file except in compliance with the License. 20 | * You may obtain a copy of the License at 21 | * 22 | * www.apache.org/licenses/LICENSE-2.0 23 | * 24 | * Unless required by applicable law or agreed to in writing, software 25 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 26 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | * See the License for the specific language governing permissions and 28 | * limitations under the License. 29 | */ 30 | 31 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 32 | 33 | /** 34 | @ingroup groupFilters 35 | */ 36 | 37 | /** 38 | @addtogroup FIR_Lattice 39 | @{ 40 | */ 41 | 42 | /** 43 | @brief Initialization function for the Q31 FIR lattice filter. 44 | @param[in] S points to an instance of the Q31 FIR lattice structure 45 | @param[in] numStages number of filter stages 46 | @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages 47 | @param[in] pState points to the state buffer. The array is of length numStages 48 | @return none 49 | */ 50 | 51 | void arm_fir_lattice_init_q31( 52 | arm_fir_lattice_instance_q31 * S, 53 | uint16_t numStages, 54 | const q31_t * pCoeffs, 55 | q31_t * pState) 56 | { 57 | /* Assign filter taps */ 58 | S->numStages = numStages; 59 | 60 | /* Assign coefficient pointer */ 61 | S->pCoeffs = pCoeffs; 62 | 63 | /* Clear state buffer and size is always numStages */ 64 | memset(pState, 0, (numStages) * sizeof(q31_t)); 65 | 66 | /* Assign state pointer */ 67 | S->pState = pState; 68 | } 69 | 70 | /** 71 | @} end of FIR_Lattice group 72 | */ 73 | 74 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 75 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_correlation_distance_f32.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | 4 | /* ---------------------------------------------------------------------- 5 | * Project: CMSIS DSP Library 6 | * Title: arm_correlation_distance_f32.c 7 | * Description: Correlation distance between two vectors 8 | * 9 | * 10 | * Target Processor: Cortex-M cores 11 | * -------------------------------------------------------------------- */ 12 | /* 13 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 14 | * 15 | * SPDX-License-Identifier: Apache-2.0 16 | * 17 | * Licensed under the Apache License, Version 2.0 (the License); you may 18 | * not use this file except in compliance with the License. 19 | * You may obtain a copy of the License at 20 | * 21 | * www.apache.org/licenses/LICENSE-2.0 22 | * 23 | * Unless required by applicable law or agreed to in writing, software 24 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 25 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 26 | * See the License for the specific language governing permissions and 27 | * limitations under the License. 28 | */ 29 | 30 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 31 | #include 32 | #include 33 | 34 | 35 | 36 | /** 37 | @addtogroup FloatDist 38 | @{ 39 | */ 40 | 41 | 42 | /** 43 | * @brief Correlation distance between two vectors 44 | * 45 | * The input vectors are modified in place ! 46 | * 47 | * @param[in] pA First vector 48 | * @param[in] pB Second vector 49 | * @param[in] blockSize vector length 50 | * @return distance 51 | * 52 | */ 53 | 54 | float32_t arm_correlation_distance_f32(float32_t *pA,float32_t *pB, uint32_t blockSize) 55 | { 56 | float32_t ma,mb,pwra,pwrb,dot,tmp; 57 | 58 | arm_mean_f32(pA, blockSize, &ma); 59 | arm_mean_f32(pB, blockSize, &mb); 60 | 61 | arm_offset_f32(pA, -ma, pA, blockSize); 62 | arm_offset_f32(pB, -mb, pB, blockSize); 63 | 64 | arm_power_f32(pA, blockSize, &pwra); 65 | arm_power_f32(pB, blockSize, &pwrb); 66 | 67 | arm_dot_prod_f32(pA,pB,blockSize,&dot); 68 | 69 | dot = dot / blockSize; 70 | pwra = pwra / blockSize; 71 | pwrb = pwrb / blockSize; 72 | 73 | arm_sqrt_f32(pwra * pwrb,&tmp); 74 | 75 | return(1.0f - dot / tmp); 76 | 77 | 78 | } 79 | 80 | 81 | 82 | /** 83 | * @} end of FloatDist group 84 | */ 85 | 86 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 87 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/DSP/Source/MatrixFunctions/arm_mat_init_f32.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: arm_mat_init_f32.c 6 | * Description: Floating-point matrix initialization 7 | * 8 | * $Date: 18. March 2019 9 | * $Revision: V1.6.0 10 | * 11 | * Target Processor: Cortex-M cores 12 | * -------------------------------------------------------------------- */ 13 | /* 14 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * 18 | * Licensed under the Apache License, Version 2.0 (the License); you may 19 | * not use this file except in compliance with the License. 20 | * You may obtain a copy of the License at 21 | * 22 | * www.apache.org/licenses/LICENSE-2.0 23 | * 24 | * Unless required by applicable law or agreed to in writing, software 25 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 26 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | * See the License for the specific language governing permissions and 28 | * limitations under the License. 29 | */ 30 | 31 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 32 | 33 | /** 34 | @ingroup groupMatrix 35 | */ 36 | 37 | /** 38 | @defgroup MatrixInit Matrix Initialization 39 | 40 | Initializes the underlying matrix data structure. 41 | The functions set the numRows, 42 | numCols, and pData fields 43 | of the matrix data structure. 44 | */ 45 | 46 | /** 47 | @addtogroup MatrixInit 48 | @{ 49 | */ 50 | 51 | /** 52 | @brief Floating-point matrix initialization. 53 | @param[in,out] S points to an instance of the floating-point matrix structure 54 | @param[in] nRows number of rows in the matrix 55 | @param[in] nColumns number of columns in the matrix 56 | @param[in] pData points to the matrix data array 57 | @return none 58 | */ 59 | 60 | void arm_mat_init_f32( 61 | arm_matrix_instance_f32 * S, 62 | uint16_t nRows, 63 | uint16_t nColumns, 64 | float32_t * pData) 65 | { 66 | /* Assign Number of Rows */ 67 | S->numRows = nRows; 68 | 69 | /* Assign Number of Columns */ 70 | S->numCols = nColumns; 71 | 72 | /* Assign Data pointer */ 73 | S->pData = pData; 74 | } 75 | 76 | /** 77 | @} end of MatrixInit group 78 | */ 79 | 80 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 81 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/porting/arduino/ei_classifier_porting.cpp: -------------------------------------------------------------------------------- 1 | /* Edge Impulse inferencing library 2 | * Copyright (c) 2020 EdgeImpulse Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | */ 22 | 23 | #if defined(ARDUINO) 24 | 25 | #include 26 | #include 27 | #include "../ei_classifier_porting.h" 28 | 29 | #define EI_WEAK_FN __attribute__((weak)) 30 | 31 | EI_WEAK_FN EI_IMPULSE_ERROR ei_run_impulse_check_canceled() 32 | { 33 | return EI_IMPULSE_OK; 34 | } 35 | 36 | EI_WEAK_FN EI_IMPULSE_ERROR ei_sleep(int32_t time_ms) 37 | { 38 | delay(time_ms); 39 | return EI_IMPULSE_OK; 40 | } 41 | 42 | uint64_t ei_read_timer_ms() 43 | { 44 | return millis(); 45 | } 46 | 47 | uint64_t ei_read_timer_us() 48 | { 49 | return micros(); 50 | } 51 | 52 | /** 53 | * Printf function uses vsnprintf and output using Arduino Serial 54 | */ 55 | __attribute__((weak)) void ei_printf(const char *format, ...) 56 | { 57 | static char print_buf[1024] = {0}; 58 | 59 | va_list args; 60 | va_start(args, format); 61 | int r = vsnprintf(print_buf, sizeof(print_buf), format, args); 62 | va_end(args); 63 | 64 | if (r > 0) 65 | { 66 | Serial.print(print_buf); 67 | } 68 | } 69 | 70 | __attribute__((weak)) void ei_printf_float(float f) 71 | { 72 | ei_printf("%f", f); 73 | } 74 | 75 | #if defined(__cplusplus) && EI_C_LINKAGE == 1 76 | extern "C" 77 | #endif 78 | __attribute__((weak)) void 79 | DebugLog(const char *s) 80 | { 81 | ei_printf("%s", s); 82 | } 83 | 84 | #endif // defined(ARDUINO) 85 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/DSP/Source/FilteringFunctions/arm_fir_lattice_init_f32.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: arm_fir_lattice_init_f32.c 6 | * Description: Floating-point FIR Lattice filter initialization function 7 | * 8 | * $Date: 18. March 2019 9 | * $Revision: V1.6.0 10 | * 11 | * Target Processor: Cortex-M cores 12 | * -------------------------------------------------------------------- */ 13 | /* 14 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * 18 | * Licensed under the Apache License, Version 2.0 (the License); you may 19 | * not use this file except in compliance with the License. 20 | * You may obtain a copy of the License at 21 | * 22 | * www.apache.org/licenses/LICENSE-2.0 23 | * 24 | * Unless required by applicable law or agreed to in writing, software 25 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 26 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | * See the License for the specific language governing permissions and 28 | * limitations under the License. 29 | */ 30 | 31 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 32 | 33 | /** 34 | @ingroup groupFilters 35 | */ 36 | 37 | /** 38 | @addtogroup FIR_Lattice 39 | @{ 40 | */ 41 | 42 | /** 43 | @brief Initialization function for the floating-point FIR lattice filter. 44 | @param[in] S points to an instance of the floating-point FIR lattice structure 45 | @param[in] numStages number of filter stages 46 | @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages 47 | @param[in] pState points to the state buffer. The array is of length numStages 48 | @return none 49 | */ 50 | 51 | void arm_fir_lattice_init_f32( 52 | arm_fir_lattice_instance_f32 * S, 53 | uint16_t numStages, 54 | const float32_t * pCoeffs, 55 | float32_t * pState) 56 | { 57 | /* Assign filter taps */ 58 | S->numStages = numStages; 59 | 60 | /* Assign coefficient pointer */ 61 | S->pCoeffs = pCoeffs; 62 | 63 | /* Clear state buffer and size is always numStages */ 64 | memset(pState, 0, (numStages) * sizeof(float32_t)); 65 | 66 | /* Assign state pointer */ 67 | S->pState = pState; 68 | } 69 | 70 | /** 71 | @} end of FIR_Lattice group 72 | */ 73 | 74 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 75 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/CMSIS/NN/Source/NNSupportFunctions/arm_nn_add_q7.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2018 Arm Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | /* ---------------------------------------------------------------------- 20 | * Project: CMSIS NN Library 21 | * Title: arm_nn_add_q7.c 22 | * Description: Non saturating addition of elements of a q7 vector. 23 | * 24 | * $Date: July 2019 25 | * $Revision: V.1.0.0 26 | * 27 | * Target Processor: Cortex-M cores 28 | * 29 | * -------------------------------------------------------------------- */ 30 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 31 | #include "edge-impulse-sdk/CMSIS/NN/Include/arm_nnfunctions.h" 32 | 33 | /** 34 | * @ingroup groupSupport 35 | */ 36 | 37 | /** 38 | * @addtogroup NNBasicMath 39 | * @{ 40 | */ 41 | 42 | void arm_nn_add_q7(const q7_t *input, q31_t *output, uint32_t block_size) 43 | { 44 | uint32_t block_count; 45 | q31_t result = 0; 46 | #if defined(ARM_MATH_DSP) 47 | /* Loop unrolling: Compute 4 outputs at a time */ 48 | block_count = block_size >> 2U; 49 | 50 | while (block_count > 0U) 51 | { 52 | const int32_t mult_q15x2 = (1UL << 16) | 1UL; 53 | q31_t in_q7x4 = arm_nn_read_q7x4_ia(&input); 54 | q31_t temp_q15x2 = __SXTAB16(__SXTB16(in_q7x4), __ROR(in_q7x4, 8)); 55 | 56 | result = __SMLAD(temp_q15x2, mult_q15x2, result); 57 | 58 | /* Decrement loop counter */ 59 | block_count--; 60 | } 61 | 62 | /* Loop unrolling: Compute remaining outputs */ 63 | block_count = block_size & 0x3; 64 | #else 65 | block_count = block_size; 66 | #endif 67 | while (block_count > 0U) 68 | { 69 | /* Add and store result in destination buffer. */ 70 | result += *input++; 71 | 72 | /* Decrement loop counter */ 73 | block_count--; 74 | } 75 | 76 | *output = result; 77 | } 78 | 79 | /** 80 | * @} end of NNBasicMath group 81 | */ 82 | -------------------------------------------------------------------------------- /tinyml-tennis-classifier/lib/ei-tennis-sensor-arduino-1.0.3/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/neg.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/reference/neg.h" 17 | 18 | #include "edge-impulse-sdk/tensorflow/lite/c/common.h" 19 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/tensor_ctypes.h" 20 | #include "edge-impulse-sdk/tensorflow/lite/kernels/kernel_util.h" 21 | 22 | namespace tflite { 23 | namespace ops { 24 | namespace micro { 25 | namespace neg { 26 | 27 | constexpr int kInputTensor = 0; 28 | constexpr int kOutputTensor = 0; 29 | 30 | TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { 31 | const TfLiteTensor* input = GetInput(context, node, kInputTensor); 32 | TfLiteTensor* output = GetOutput(context, node, kOutputTensor); 33 | switch (input->type) { 34 | // TODO(wangtz): handle for kTfLiteInt8 35 | case kTfLiteFloat32: 36 | reference_ops::Negate(GetTensorShape(input), GetTensorData(input), 37 | GetTensorShape(output), 38 | GetTensorData(output)); 39 | break; 40 | default: 41 | TF_LITE_KERNEL_LOG(context, "Type %s (%d) not supported.", 42 | TfLiteTypeGetName(input->type), input->type); 43 | return kTfLiteError; 44 | } 45 | return kTfLiteOk; 46 | } 47 | 48 | } // namespace neg 49 | 50 | TfLiteRegistration* Register_NEG() { 51 | static TfLiteRegistration r = {/*init=*/nullptr, 52 | /*free=*/nullptr, 53 | /*prepare=*/nullptr, 54 | /*invoke=*/neg::Eval, 55 | /*profiling_string=*/nullptr, 56 | /*builtin_code=*/0, 57 | /*custom_name=*/nullptr, 58 | /*version=*/0}; 59 | return &r; 60 | } 61 | 62 | } // namespace micro 63 | } // namespace ops 64 | } // namespace tflite 65 | --------------------------------------------------------------------------------