├── .DS_Store ├── .gitignore ├── README.md ├── deprecated ├── examples │ ├── 2.0 │ │ └── Networking │ │ │ └── WiFi │ │ │ └── WifiScannerExample │ │ │ └── WifiScannerExample.ino │ ├── Apple_vs_Orange │ │ ├── Apple_vs_Orange.ino │ │ └── camera_pins.h │ ├── ArrayExample │ │ └── ArrayExample.ino │ ├── DataStructures │ │ ├── LongShortTermVotingExample │ │ │ └── LongShortTermVotingExample.ino │ │ ├── NdQueueExample │ │ │ └── NdQueueExample.ino │ │ ├── QueueExample │ │ │ └── QueueExample.ino │ │ └── VotingExample │ │ │ └── VotingExample.ino │ ├── ESP32CameraNaiveMotionDetection │ │ ├── ESP32CameraNaiveMotionDetection.ino │ │ └── camera_pins.h │ ├── EloquentArrayExample.ino │ ├── EloquentEEValueExample.ino │ ├── EloquentLoggingExample.ino │ ├── EloquentPinExample.ino │ ├── EloquentTimeUtilsExample.ino │ ├── HandwrittenDigitClassificationExample │ │ └── HandwrittenDigitClassificationExample.ino │ ├── HashMapExample │ │ └── HashMapExample.ino │ ├── MicromlColorIdentificationAttinyExample │ │ └── MicromlColorIdentificationAttinyExample.ino │ ├── MicromlColorIdentificationExample │ │ └── MicromlColorIdentificationExample.ino │ ├── MicromlGestureIdentificationExample │ │ ├── MicromlGestureIdentificationExample.ino │ │ ├── ble_sense.h │ │ ├── gestures_formatted │ │ │ ├── left.csv │ │ │ ├── punch.csv │ │ │ └── up.csv │ │ ├── imu_6050.h │ │ └── imu_9250.h │ ├── MicromlIrisExample │ │ ├── MicromlIrisExample.ino │ │ ├── iris.h │ │ └── iris_attiny.h │ ├── MicromlMorseIdentificationExample │ │ └── MicromlMorseIdentificationExample.ino │ ├── MicromlWakeWordIdentificationExample │ │ └── MicromlWakeWordIdentificationExample.ino │ ├── MicromlWifiIndoorPositioningExample │ │ └── MicromlWifiIndoorPositioningExample.ino │ ├── TheUltimateGuideToWifiIndoorPositioningExample │ │ ├── CollectData.h │ │ ├── GetPosition.h │ │ └── TheUltimateGuideToWifiIndoorPositioningExample.ino │ ├── ThermalCameraToAsciiArtExample │ │ ├── EloquentAsciiArt.h │ │ ├── EloquentMLX90640.h │ │ └── ThermalCameraToAsciiArtExample.ino │ ├── Vision │ │ ├── MotionDetection │ │ │ ├── .DS_Store │ │ │ └── MotionDetectionRGBExample │ │ │ │ ├── MotionDetectionRGBExample.ino │ │ │ │ └── stream_captures.py │ │ └── Processing │ │ │ ├── RGBHistogramExample │ │ │ └── RGBHistogramExample.ino │ │ │ └── YUVHistogramExample │ │ │ └── YUVHistogramExample.ino │ └── exampleInputStream.ino └── src │ ├── EloquentArduino.h │ ├── data_structures │ ├── Array.h │ ├── Counter.h │ ├── FSM.h │ ├── HashMap.h │ ├── PackedBitArray.h │ ├── PersistentInt16.h │ ├── PersistentInt32.h │ └── Queue.h │ ├── dev │ ├── await.h │ ├── black_magic.h │ ├── logging.h │ ├── print_utils.h │ ├── retry.h │ └── voltage.h │ ├── eloquentarduino │ ├── .DS_Store │ ├── data_structures │ │ ├── LongShortTermVoting.h │ │ ├── NdQueue.h │ │ ├── Queue.h │ │ ├── VariableWatcher.h │ │ └── Voting.h │ ├── io │ │ ├── Printer.h │ │ ├── print.h │ │ └── serial_print.h │ ├── modules │ │ ├── DS3231.h │ │ └── Wisol.h │ └── vision │ │ ├── camera │ │ ├── ESP32Camera.h │ │ ├── ESP32CameraHTTPVideoStreamingServer.h │ │ └── pins.h │ │ ├── io │ │ ├── decoders │ │ │ ├── Blue565RandomAccessDecoder.h │ │ │ ├── GrayscaleRandomAccessDecoder.h │ │ │ ├── Green565RandomAccessDecoder.h │ │ │ ├── RGB565RandomAccessDecoder.h │ │ │ ├── RandomAccessDecoder.h │ │ │ └── Red565RandomAccessDecoder.h │ │ └── writers │ │ │ └── JpegWriter.h │ │ └── processing │ │ ├── ColorHistogram.h │ │ ├── MotionDetector.h │ │ ├── RGBHistogram.h │ │ ├── YUVHistogram.h │ │ └── downscaling │ │ ├── Center.h │ │ ├── Core.h │ │ ├── Downscaler.h │ │ ├── FullAverage.h │ │ └── Strategy.h │ ├── io │ ├── InputStream │ │ ├── AnalogPinInputStream.h │ │ ├── ArrayInputStream.h │ │ ├── AssignableInputStream.h │ │ ├── AtLeast.h │ │ ├── Average.h │ │ ├── Baseline.h │ │ ├── Constrain.h │ │ ├── Derivative.h │ │ ├── EWMA.h │ │ ├── InputStream.h │ │ ├── Map.h │ │ ├── Round.h │ │ └── Transformer.h │ ├── Pin │ │ ├── AnalogIn.h │ │ ├── AnalogOut.h │ │ ├── DigitalIn.h │ │ ├── DigitalOut.h │ │ └── Pin.h │ └── Spiffs │ │ ├── Dir.h │ │ └── File.h │ └── modules │ ├── DS3231.h │ └── Wisol.h ├── disabled └── vision_qr_quirc │ ├── decode.c │ ├── identify.c │ ├── quirc.c │ ├── quirc.h │ ├── quirc_internal.h │ └── version_db.c ├── examples ├── CameraMotionDetection │ ├── CameraCaptureExample │ │ └── CameraCaptureExample.ino │ ├── CameraMotionCaptureExample │ │ └── CameraMotionCaptureExample.ino │ ├── CameraMotionDetectionExample │ │ └── CameraMotionDetectionExample.ino │ └── CameraMotionToTelegramExample │ │ └── CameraMotionToTelegramExample.ino ├── CameraWebServerExample │ └── CameraWebServerExample.ino ├── EdgeImpulse │ └── EdgeImpulseExample │ │ └── EdgeImpulseExample.ino ├── IndoorPositioning │ └── WiFiScannerExample │ │ └── WiFiScannerExample.ino ├── Telegram │ ├── CameraMotionToTelegramExample │ │ └── CameraMotionToTelegramExample.ino │ ├── SendJpegExample │ │ └── SendJpegExample.ino │ └── SendMessageExample │ │ └── SendMessageExample.ino └── VL53L5CX │ └── VL53L5cxCapture │ └── VL53L5cxCapture.ino ├── keywords.txt ├── library.json ├── library.properties ├── publish └── src ├── .DS_Store ├── eloquent.h └── eloquent ├── .DS_Store ├── apps └── telegram │ └── bot │ ├── BaseTelegramBot.h │ ├── Errors.h │ ├── wifi.h │ └── witnessmenow │ ├── TelegramCertificate.h │ ├── UniversalTelegramBot.cpp │ └── UniversalTelegramBot.h ├── collections └── circular_buffer.h ├── fs └── spiffs.h ├── graphics ├── .DS_Store └── colormaps │ ├── accent.h │ ├── accent_r.h │ ├── afmhot.h │ ├── afmhot_r.h │ ├── autumn.h │ ├── autumn_r.h │ ├── binary.h │ ├── binary_r.h │ ├── blues.h │ ├── blues_r.h │ ├── bone.h │ ├── bone_r.h │ ├── brbg.h │ ├── brbg_r.h │ ├── brg.h │ ├── brg_r.h │ ├── bugn.h │ ├── bugn_r.h │ ├── bupu.h │ ├── bupu_r.h │ ├── bwr.h │ ├── bwr_r.h │ ├── cividis.h │ ├── cividis_r.h │ ├── cmrmap.h │ ├── cmrmap_r.h │ ├── cool.h │ ├── cool_r.h │ ├── coolwarm.h │ ├── coolwarm_r.h │ ├── copper.h │ ├── copper_r.h │ ├── cubehelix.h │ ├── cubehelix_r.h │ ├── dark2.h │ ├── dark2_r.h │ ├── flag.h │ ├── flag_r.h │ ├── gist_earth.h │ ├── gist_earth_r.h │ ├── gist_gray.h │ ├── gist_gray_r.h │ ├── gist_heat.h │ ├── gist_heat_r.h │ ├── gist_ncar.h │ ├── gist_ncar_r.h │ ├── gist_rainbow.h │ ├── gist_rainbow_r.h │ ├── gist_stern.h │ ├── gist_stern_r.h │ ├── gist_yarg.h │ ├── gist_yarg_r.h │ ├── gnbu.h │ ├── gnbu_r.h │ ├── gnuplot.h │ ├── gnuplot2.h │ ├── gnuplot2_r.h │ ├── gnuplot_r.h │ ├── gray.h │ ├── gray_r.h │ ├── greens.h │ ├── greens_r.h │ ├── greys.h │ ├── greys_r.h │ ├── hot.h │ ├── hot_r.h │ ├── hsv.h │ ├── hsv_r.h │ ├── inferno.h │ ├── inferno_r.h │ ├── jet.h │ ├── jet_r.h │ ├── magma.h │ ├── magma_r.h │ ├── nipy_spectral.h │ ├── nipy_spectral_r.h │ ├── ocean.h │ ├── ocean_r.h │ ├── oranges.h │ ├── oranges_r.h │ ├── orrd.h │ ├── orrd_r.h │ ├── paired.h │ ├── paired_r.h │ ├── pastel1.h │ ├── pastel1_r.h │ ├── pastel2.h │ ├── pastel2_r.h │ ├── pink.h │ ├── pink_r.h │ ├── piyg.h │ ├── piyg_r.h │ ├── plasma.h │ ├── plasma_r.h │ ├── prgn.h │ ├── prgn_r.h │ ├── prism.h │ ├── prism_r.h │ ├── pubu.h │ ├── pubu_r.h │ ├── pubugn.h │ ├── pubugn_r.h │ ├── puor.h │ ├── puor_r.h │ ├── purd.h │ ├── purd_r.h │ ├── purples.h │ ├── purples_r.h │ ├── rainbow.h │ ├── rainbow_r.h │ ├── rdbu.h │ ├── rdbu_r.h │ ├── rdgy.h │ ├── rdgy_r.h │ ├── rdpu.h │ ├── rdpu_r.h │ ├── rdylbu.h │ ├── rdylbu_r.h │ ├── rdylgn.h │ ├── rdylgn_r.h │ ├── reds.h │ ├── reds_r.h │ ├── seismic.h │ ├── seismic_r.h │ ├── set1.h │ ├── set1_r.h │ ├── set2.h │ ├── set2_r.h │ ├── set3.h │ ├── set3_r.h │ ├── spectral.h │ ├── spectral_r.h │ ├── spring.h │ ├── spring_r.h │ ├── summer.h │ ├── summer_r.h │ ├── tab10.h │ ├── tab10_r.h │ ├── tab20.h │ ├── tab20_r.h │ ├── tab20b.h │ ├── tab20b_r.h │ ├── tab20c.h │ ├── tab20c_r.h │ ├── terrain.h │ ├── terrain_r.h │ ├── turbo.h │ ├── turbo_r.h │ ├── twilight.h │ ├── twilight_r.h │ ├── twilight_shifted.h │ ├── twilight_shifted_r.h │ ├── viridis.h │ ├── viridis_r.h │ ├── winter.h │ ├── winter_r.h │ ├── wistia.h │ ├── wistia_r.h │ ├── ylgn.h │ ├── ylgn_r.h │ ├── ylgnbu.h │ ├── ylgnbu_r.h │ ├── ylorbr.h │ ├── ylorbr_r.h │ ├── ylorrd.h │ └── ylorrd_r.h ├── io ├── json.h └── json │ └── JsonEncoder.h ├── macros.h ├── math.h ├── modules ├── VL53L5CX.h └── vl53l5cx │ ├── 4x4.h │ └── 8x8.h ├── networking ├── wifi.h └── wifi │ └── WifiScanner.h ├── perf.h ├── print.h ├── tinyml ├── edgeimpulse.h ├── edgeimpulse │ └── impulse.h └── voting │ └── quorum.h ├── utils.h └── vision ├── .DS_Store ├── camera ├── .DS_Store ├── BaseCamera.h ├── Errors.h ├── aithinker.h ├── decoders.h ├── esp32.h ├── esp32 │ ├── .DS_Store │ ├── BaseEsp32Camera.h │ ├── aithinker │ │ ├── gray │ │ │ ├── 96x96.h │ │ │ ├── hd.h │ │ │ ├── hvga.h │ │ │ ├── qcif.h │ │ │ ├── qqvga.h │ │ │ ├── qvga.h │ │ │ ├── uxga.h │ │ │ └── vga.h │ │ ├── jpeg.h │ │ └── jpeg │ │ │ ├── qqvga.h │ │ │ ├── qvga.h │ │ │ └── vga.h │ ├── eye │ │ └── gray │ │ │ ├── 96x96.h │ │ │ ├── hd.h │ │ │ ├── hvga.h │ │ │ ├── qcif.h │ │ │ ├── qqvga.h │ │ │ ├── qvga.h │ │ │ ├── uxga.h │ │ │ └── vga.h │ ├── m5 │ │ └── gray │ │ │ ├── 96x96.h │ │ │ ├── hd.h │ │ │ ├── hvga.h │ │ │ ├── qcif.h │ │ │ ├── qqvga.h │ │ │ ├── qvga.h │ │ │ ├── uxga.h │ │ │ └── vga.h │ ├── m5wide │ │ ├── .DS_Store │ │ ├── gray │ │ │ ├── 96x96.h │ │ │ ├── hd.h │ │ │ ├── hvga.h │ │ │ ├── qcif.h │ │ │ ├── qqvga.h │ │ │ ├── qvga.h │ │ │ ├── uxga.h │ │ │ └── vga.h │ │ ├── jpeg.h │ │ ├── jpeg │ │ │ ├── qqvga.h │ │ │ ├── qvga.h │ │ │ └── vga.h │ │ └── m5wide.h │ ├── pins │ │ ├── aithinker.h │ │ ├── eye.h │ │ ├── m5stack.h │ │ ├── m5wide.h │ │ └── wrover.h │ ├── webserver.h │ └── wrover │ │ └── gray │ │ ├── 96x96.h │ │ ├── hd.h │ │ ├── hvga.h │ │ ├── qcif.h │ │ ├── qqvga.h │ │ ├── qvga.h │ │ ├── uxga.h │ │ └── vga.h ├── esp32_sensor_config.h ├── eye.h ├── m5stack.h ├── m5wide.h ├── ov767x │ ├── BaseOV767x.h │ └── gray │ │ ├── cif.h │ │ ├── qcif.h │ │ ├── qqvga.h │ │ ├── qvga.h │ │ └── vga.h ├── portenta.h └── wrover.h ├── features └── LocalBinaryPattern.h ├── image.h ├── image ├── BaseImage.h ├── gray │ ├── cif.h │ ├── custom.h │ ├── hd.h │ ├── hvga.h │ ├── qcif.h │ ├── qqvga.h │ ├── qvga.h │ ├── uxga.h │ ├── vga.h │ └── x96x96.h └── rgb565.h ├── jpeg.h ├── jpeg ├── JpegBuilder.h ├── JpegEncoder.h └── bitbank2 │ ├── BitBankJpegEncoder.h │ ├── definitions.h │ └── jpeg.inl ├── motion.h ├── motion ├── BaseMotionDetector.h └── naive.h ├── transform.h └── transform └── gray ├── BilinearResize.h └── NearestResize.h /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eloquentarduino/EloquentArduino/15983e68cf82c54afadaf2b6c8fdc95cad268489/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | __src 2 | _src 3 | __examples 4 | __ignore 5 | src/.vscode 6 | node_modules 7 | yarn-error.log 8 | *.patch 9 | model.h 10 | tensorflow 11 | .idea/ 12 | deprecated/examples/.idea/ 13 | deprecated/examples/Vision/Processing/RGBHistogramExample/main.cpp 14 | deprecated/examples/Vision/Processing/RGBHistogramExample/a.out 15 | disabled -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # EloquentArduino library 2 | 3 | This library contains source code and examples from the [eloquentarduino blog](https://eloquentarduino.github.io/), 4 | covering very different topics: 5 | 6 | - data structures 7 | - image / camera processing 8 | - print utilities 9 | - ...other miscellaneous 10 | 11 | You can install this library either by cloning the repo or directly from the Arduino IDE Library Manager. 12 | 13 | If you're interested in TinyML, I suggest you check out the [EloquentTinyML library](https://github.com/eloquentarduino/EloquentTinyML). -------------------------------------------------------------------------------- /deprecated/examples/2.0/Networking/WiFi/WifiScannerExample/WifiScannerExample.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include "eloquent.h" 3 | #include "eloquent/networking/wifi/WifiScanner.h" 4 | 5 | 6 | String location; 7 | 8 | 9 | void setup() { 10 | Serial.begin(115200); 11 | delay(2000); 12 | Serial.println("Instructions:"); 13 | Serial.println("\tEnter the name of the location to start scanning"); 14 | Serial.println("\tEnter 'stop' to stop scanning"); 15 | } 16 | 17 | void loop() { 18 | // await user to input his current location or "stop" to abort scanning 19 | if (Serial.available()) { 20 | location = Serial.readStringUntil('\n'); 21 | } 22 | 23 | // if a location is set, perform scan 24 | if (location != "" && location != "stop") { 25 | // expected line format is `$location : $access_points_as_json` 26 | Serial.print(location); 27 | Serial.print(": "); 28 | wifiScanner.scan(); 29 | wifiScanner.printAsJson(Serial); 30 | delay(3000); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /deprecated/examples/DataStructures/LongShortTermVotingExample/LongShortTermVotingExample.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | 6 | using namespace Eloquent::DataStructures; 7 | 8 | 9 | test(not_enough_votes) { 10 | LongShortTermVoting<3, 3> voting(2, 2); 11 | 12 | voting.vote(1); 13 | 14 | assertFalse(voting.agree()); 15 | } 16 | 17 | test(no_short_term_quorum) { 18 | LongShortTermVoting<3, 3> voting(2, 2); 19 | 20 | voting.vote(1); 21 | voting.vote(2); 22 | voting.vote(3); 23 | 24 | assertFalse(voting.agree()); 25 | } 26 | 27 | test(no_long_term_quorum) { 28 | LongShortTermVoting<3, 3> voting(2, 2); 29 | 30 | voting.vote(1); 31 | voting.vote(1); 32 | voting.vote(2); 33 | 34 | assertFalse(voting.agree()); 35 | } 36 | 37 | test(quorum) { 38 | LongShortTermVoting<3, 3> voting(2, 2); 39 | 40 | // 1st long term vote 41 | voting.vote(1); 42 | voting.vote(1); 43 | voting.vote(2); 44 | // 2nd long term vote 45 | // now votes become [1, 2, 1] 46 | voting.vote(1); 47 | // 3rd long term voting 48 | // now votes become [2, 1, 1] 49 | voting.vote(1); 50 | 51 | assertTrue(voting.agree()); 52 | assertEqual(voting.decision(), 1); 53 | } 54 | 55 | 56 | void setup() { 57 | Serial.begin(115200); 58 | } 59 | 60 | 61 | void loop() { 62 | Test::run(); 63 | } -------------------------------------------------------------------------------- /deprecated/examples/DataStructures/QueueExample/QueueExample.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | 6 | using namespace Eloquent::DataStructures; 7 | 8 | 9 | test(append_one) { 10 | float x = 1; 11 | Queue<5> queue; 12 | 13 | queue.append(x); 14 | 15 | assertEqual(queue.X[0], x); 16 | } 17 | 18 | test(append_two) { 19 | float x1 = 1; 20 | float x2 = 2; 21 | Queue<5> queue; 22 | 23 | queue.append(x1); 24 | queue.append(x2); 25 | 26 | assertEqual(queue.X[0], x1); 27 | assertEqual(queue.X[1], x2); 28 | } 29 | 30 | test(append_overflow) { 31 | float x1 = 1; 32 | float x2 = 2; 33 | float x3 = 3; 34 | 35 | Queue<2> queue; 36 | 37 | queue.append(x1); 38 | queue.append(x2); 39 | queue.append(x3); 40 | 41 | assertEqual(queue.X[0], x2); 42 | assertEqual(queue.X[1], x3); 43 | } 44 | 45 | 46 | void setup() { 47 | Serial.begin(115200); 48 | } 49 | 50 | 51 | void loop() { 52 | Test::run(); 53 | } -------------------------------------------------------------------------------- /deprecated/examples/DataStructures/VotingExample/VotingExample.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | 6 | using namespace Eloquent::DataStructures; 7 | 8 | 9 | test(not_enough_votes) { 10 | Voting<5> voting; 11 | 12 | voting.vote(1); 13 | 14 | assertFalse(voting.agree(0.5)); 15 | } 16 | 17 | test(no_quorum) { 18 | Voting<3> voting; 19 | 20 | voting.vote(1); 21 | voting.vote(2); 22 | voting.vote(3); 23 | 24 | assertFalse(voting.agree(2)); 25 | assertFalse(voting.agree(0.5)); 26 | } 27 | 28 | test(absolute_quorum) { 29 | Voting<3> voting; 30 | 31 | voting.vote(1); 32 | voting.vote(1); 33 | voting.vote(2); 34 | 35 | assertTrue(voting.agree(2)); 36 | assertEqual(voting.decision(), 1); 37 | } 38 | 39 | test(relative_quorum) { 40 | Voting<3> voting; 41 | 42 | voting.vote(1); 43 | voting.vote(1); 44 | voting.vote(2); 45 | 46 | assertTrue(voting.agree(0.5)); 47 | assertEqual(voting.decision(), 1); 48 | } 49 | 50 | test(rolling_votes) { 51 | Voting<3> voting; 52 | 53 | voting.vote(1); 54 | voting.vote(1); 55 | voting.vote(2); 56 | voting.vote(2); 57 | voting.vote(3); 58 | 59 | assertTrue(voting.agree(2)); 60 | assertEqual(voting.decision(), 2); 61 | } 62 | 63 | void setup() { 64 | Serial.begin(115200); 65 | } 66 | 67 | 68 | void loop() { 69 | Test::run(); 70 | } -------------------------------------------------------------------------------- /deprecated/examples/EloquentEEValueExample.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * eeValue synchronizes a variable to the EEPROM, so it keeps its value 5 | * even after reboots. It is a template class, so you have to provide a 6 | * primitive type at definition time. 7 | * Several shortcuts are available: 8 | * - eeUint8 9 | * - eeUint16 10 | * - eeUint32 11 | * - eeInt8 12 | * - eeInt16 13 | * - eeInt32 14 | * You can directy access its value via `value()` and `set(newValue)` 15 | */ 16 | 17 | using namespace Eloquent; 18 | 19 | // The argument is the starting address in EEPROM 20 | // !!! eeValue uses 1 byte for internal use, so you have to allocate 21 | // !!! your addresses accordingly 22 | eeInt32 value(0); 23 | 24 | // This is wrong and will produce unexpected behavior 25 | // because eeInt32 size is 4 byte for int32_t + 1 byte for internal use 26 | // eeInt32 value2(4); 27 | 28 | // This is fine 29 | eeInt16 value2(5); 30 | 31 | 32 | void setup() { 33 | Serial.begin(9600); 34 | // !!! Never forget to begin. You can set a default value if you want 35 | value.begin(); 36 | delay(1000); 37 | 38 | Serial.print("At first boot, value should be 0: "); 39 | Serial.println(value.value()); 40 | Serial.println("On subsequent boots, it should be greater than 0"); 41 | 42 | // eeValue implements most common operators 43 | value = 1; 44 | value++; 45 | value--; 46 | value += 10; 47 | value -= 5; 48 | 49 | Serial.print("Value should be 1 + 1 - 1 + 10 - 5 = 6: "); 50 | Serial.println(value.value()); 51 | 52 | Serial.print("Value - 3 should be 3: "); 53 | Serial.println(value - 3); 54 | } 55 | 56 | 57 | void loop() { 58 | value++; 59 | Serial.print("Now value is: "); 60 | Serial.println(value.value()); 61 | delay(1000); 62 | } -------------------------------------------------------------------------------- /deprecated/examples/EloquentLoggingExample.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * Available severities are, in order: 5 | * 1. EMERGENCY 6 | * 2. ALERT 7 | * 3. CRITICAL 8 | * 4. ERROR 9 | * 5. WARNING 10 | * 6. NOTICE 11 | * 7. INFO 12 | * 8. DEBUG 13 | * 14 | * All messages with a severity <= LOG_SEVERITY are logged, otherwise discarded. 15 | * A few utilities exist, such as: 16 | * - log_SEVERITY_if(condition, msg): log msg only if condition is true 17 | * - log_SEVERITY_unless(condition, msg): log msg only if condition is false 18 | * - var_dump(key, value): dump the variable with a descriptive name. LOG_SEVERITY MUST be at least LOG_SEVERITY_DEBUG 19 | */ 20 | 21 | #define LOG_SEVERITY LOG_SEVERITY_DEBUG 22 | 23 | 24 | void setup() { 25 | Serial.begin(9600); 26 | delay(1000); 27 | 28 | log_emergency_unless(false, "EMERGENCY"); 29 | log_alert_unless(false, "ALERT"); 30 | log_critical_unless(false, "CRITICAL"); 31 | log_error_unless(false, "ERROR"); 32 | log_warning_unless(false, "WARNING"); 33 | log_notice_unless(false, "NOTICE"); 34 | log_info_unless(false, "INFO"); 35 | log_debug_unless(false, "DEBUG"); 36 | 37 | int value = 1; 38 | var_dump("Value", value); 39 | 40 | } 41 | 42 | void loop() { 43 | 44 | } -------------------------------------------------------------------------------- /deprecated/examples/EloquentPinExample.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /** 5 | * The Pin class lets you manipulate a pin like a number. 6 | * You can assign a value to it and use arithmetic and boolean operators. 7 | * Plus it implements utility methods to test and update the pin state. 8 | * Each pin keeps track of its previous value, so an input pin can determine 9 | * if its value changed, is rising or is falling, for example. 10 | */ 11 | 12 | 13 | using namespace Eloquent; 14 | 15 | 16 | Pin analogOut(9, OUTPUT, PinMode::ANALOG); 17 | Pin analogIn(A0, INPUT, PinMode::INPUT); 18 | 19 | 20 | void setup() { 21 | Serial.begin(9600); 22 | delay(1000); 23 | 24 | analogOut.turnOff(); 25 | assert("Pin value should be 0", analogOut == 0); 26 | delay(1000); 27 | 28 | analogOut.turnOn(); 29 | assert("Pin value should be 255", analogOut == 255); 30 | delay(1000); 31 | 32 | analogOut -= 100; 33 | assert("Pin value should be 155", analogOut == 155); 34 | assert("Pin delta should be -100", analogOut.delta() == -100); 35 | assert("Pin value should be falling", analogOut.falling()); 36 | delay(1000); 37 | 38 | // Here pin value is 155, so it's ON 39 | analogOut.toggle(); 40 | assert("Pin should be off", analogOut.isOff()); 41 | delay(1000); 42 | 43 | // fade in 44 | while (analogOut < 255) { 45 | analogOut += 10; 46 | delay(20); 47 | } 48 | 49 | // fade out 50 | while (analogOut > 0) { 51 | analogOut -= 10; 52 | delay(20); 53 | } 54 | 55 | delay(1000); 56 | analogOut.blink(5, 1000); 57 | } 58 | 59 | 60 | void loop() { 61 | uint16_t read = analogIn.read(); 62 | 63 | Serial.print("Read: "); 64 | Serial.println(read); 65 | delay(1000); 66 | } -------------------------------------------------------------------------------- /deprecated/examples/EloquentTimeUtilsExample.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int interval = 3000; 4 | 5 | 6 | void setup() { 7 | Serial.begin(9600); 8 | 9 | // await 1 second for Serial to be available 10 | bool serialAvailable = await(Serial, 1 * Second); 11 | Serial.println(serialAvailable ? "SERIAL" : "NO SERIAL"); 12 | } 13 | 14 | void loop() { 15 | every(1000) { 16 | Serial.println("Every 1 second"); 17 | } 18 | 19 | every(2 * Seconds) { 20 | Serial.println("Every 2 seconds"); 21 | } 22 | 23 | every(interval) 24 | Serial.println("Every 3 seconds"); 25 | 26 | // This doesn't work 27 | //every(interval + 1000) 28 | // Serial.println("Every 4 seconds") 29 | } -------------------------------------------------------------------------------- /deprecated/examples/HashMapExample/HashMapExample.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | 5 | using namespace Eloquent::DataStructures; 6 | 7 | 8 | /** 9 | * The HashMap class needs 3 template arguments: 10 | * 1. key datatype 11 | * 2. value datatype 12 | * 3. max number of entries 13 | */ 14 | 15 | 16 | test(exists) { 17 | HashMap hashmap; 18 | 19 | hashmap.put(0, 10); 20 | hashmap.put(1, 20); 21 | 22 | assertTrue(hashmap.exists(0)); 23 | assertTrue(hashmap.exists(1)); 24 | assertFalse(hashmap.exists(2)); 25 | } 26 | 27 | 28 | test(get) { 29 | HashMap hashmap; 30 | 31 | hashmap.put(0, 10); 32 | hashmap.put(1, 20); 33 | 34 | assertEqual(hashmap.get(0), 10); 35 | assertEqual(hashmap.get(1), 20); 36 | // if the key doesn't exists, 0 is returned 37 | assertEqual(hashmap.get(2), 0); 38 | } 39 | 40 | test(get_string) { 41 | HashMap hashmap; 42 | 43 | hashmap.put("abc", 10); 44 | hashmap.put("xyz", 20); 45 | 46 | assertEqual(hashmap.get("abc"), 10); 47 | assertEqual(hashmap.get("xyz"), 20); 48 | assertEqual(hashmap.get("foo"), 0); 49 | } 50 | 51 | 52 | test(prevents_overflow) { 53 | HashMap hashmap; 54 | 55 | hashmap.put(0, 10); 56 | hashmap.put(1, 20); 57 | hashmap.put(2, 30); 58 | 59 | assertEqual(hashmap.get(0), 10); 60 | assertEqual(hashmap.get(1), 20); 61 | // if you put when the max number of entries 62 | // has been reached, it is ignored 63 | assertFalse(hashmap.exists(2)); 64 | } 65 | 66 | 67 | void setup() { 68 | Serial.begin(115200); 69 | } 70 | 71 | 72 | void loop() { 73 | Test::run(); 74 | } -------------------------------------------------------------------------------- /deprecated/examples/MicromlColorIdentificationAttinyExample/MicromlColorIdentificationAttinyExample.ino: -------------------------------------------------------------------------------- 1 | // On Attiny we can only do classification 2 | // since there's no Serial 3 | // We'll light a led based on the detected color 4 | 5 | #include "model.h" 6 | 7 | #define S2 2 8 | #define S3 3 9 | #define sensorOut 4 10 | #define LED 0 11 | 12 | double features[3]; 13 | 14 | 15 | void setup() { 16 | pinMode(S2, OUTPUT); 17 | pinMode(S3, OUTPUT); 18 | pinMode(sensorOut, INPUT); 19 | } 20 | 21 | void loop() { 22 | readRGB(); 23 | classify(); 24 | delay(100); 25 | } 26 | 27 | int readComponent(bool s2, bool s3) { 28 | delay(10); 29 | digitalWrite(S2, s2); 30 | digitalWrite(S3, s3); 31 | 32 | return pulseIn(sensorOut, LOW); 33 | } 34 | 35 | void readRGB() { 36 | features[0] = readComponent(LOW, LOW); 37 | features[1] = readComponent(HIGH, HIGH); 38 | features[2] = readComponent(LOW, HIGH); 39 | } 40 | 41 | void classify() { 42 | uint8_t classIdx = predict(features); 43 | 44 | if (classIdx == 0) 45 | return; 46 | 47 | for (uint8_t i = 0; i < classIdx; i++) { 48 | digitalWrite(LED, HIGH); 49 | delay(10); 50 | digitalWrite(LED, LOW); 51 | delay(10); 52 | } 53 | } -------------------------------------------------------------------------------- /deprecated/examples/MicromlColorIdentificationExample/MicromlColorIdentificationExample.ino: -------------------------------------------------------------------------------- 1 | // uncomment when you have a model.h 2 | // to tun the classification 3 | // #define CLASSIFY 4 | 5 | #define S2 2 6 | #define S3 3 7 | #define sensorOut 4 8 | 9 | double features[3]; 10 | 11 | #if defined(CLASSIFY) 12 | #include "model.h" 13 | 14 | void classify() { 15 | Serial.print("Detected color: "); 16 | Serial.println(classIdxToName(predict(features))); 17 | } 18 | #endif 19 | 20 | void setup() { 21 | Serial.begin(115200); 22 | pinMode(S2, OUTPUT); 23 | pinMode(S3, OUTPUT); 24 | pinMode(sensorOut, INPUT); 25 | } 26 | 27 | void loop() { 28 | readRGB(); 29 | printFeatures(); 30 | #if defined(CLASSIFY) 31 | classify(); 32 | #endif 33 | delay(100); 34 | } 35 | 36 | int readComponent(bool s2, bool s3) { 37 | delay(10); 38 | digitalWrite(S2, s2); 39 | digitalWrite(S3, s3); 40 | 41 | return pulseIn(sensorOut, LOW); 42 | } 43 | 44 | void readRGB() { 45 | features[0] = readComponent(LOW, LOW); 46 | features[1] = readComponent(HIGH, HIGH); 47 | features[2] = readComponent(LOW, HIGH); 48 | } 49 | 50 | void printFeatures() { 51 | const uint16_t numFeatures = sizeof(features) / sizeof(double); 52 | 53 | for (int i = 0; i < numFeatures; i++) { 54 | Serial.print(features[i]); 55 | Serial.print(i == numFeatures - 1 ? '\n' : ','); 56 | } 57 | } -------------------------------------------------------------------------------- /deprecated/examples/MicromlGestureIdentificationExample/ble_sense.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | 4 | void imu_setup() { 5 | IMU.begin(); 6 | } 7 | 8 | void imu_read(float *ax, float *ay, float *az) { 9 | if (IMU.accelerationAvailable()) 10 | IMU.readAcceleration(*ax, *ay, *az); 11 | } -------------------------------------------------------------------------------- /deprecated/examples/MicromlGestureIdentificationExample/imu_6050.h: -------------------------------------------------------------------------------- 1 | #include 2 | // library from https://github.com/jrowberg/i2cdevlib/tree/master/Arduino/MPU6050 3 | #include 4 | #define OUTPUT_READABLE_ACCELGYRO 5 | 6 | MPU6050 imu; 7 | 8 | void imu_setup() { 9 | Wire.begin(); 10 | imu.initialize(); 11 | } 12 | 13 | void imu_read(float *ax, float *ay, float *az) { 14 | int16_t _ax, _ay, _az, _gx, _gy, _gz; 15 | 16 | imu.getMotion6(&_ax, &_ay, &_az, &_gx, &_gy, &_gz); 17 | 18 | *ax = _ax; 19 | *ay = _ay; 20 | *az = _az; 21 | } 22 | -------------------------------------------------------------------------------- /deprecated/examples/MicromlGestureIdentificationExample/imu_9250.h: -------------------------------------------------------------------------------- 1 | #include 2 | // library from https://github.com/bolderflight/MPU9250 3 | #include 4 | 5 | MPU9250 imu(Wire, 0x68); 6 | 7 | void imu_setup() { 8 | Wire.begin(); 9 | imu.begin(); 10 | } 11 | 12 | void imu_read(float *ax, float *ay, float *az) { 13 | imu.readSensor(); 14 | 15 | *ax = imu.getAccelX_mss(); 16 | *ay = imu.getAccelY_mss(); 17 | *az = imu.getAccelZ_mss(); 18 | } -------------------------------------------------------------------------------- /deprecated/examples/MicromlIrisExample/MicromlIrisExample.ino: -------------------------------------------------------------------------------- 1 | #include "iris.h" 2 | 3 | double features[4]; 4 | 5 | void setup() { 6 | // Serial.begin(115200); 7 | } 8 | 9 | void loop() { 10 | double features[] = {1, 2, 3, 4}; 11 | digitalWrite(1, predict(features)); 12 | 13 | delay(10); 14 | } -------------------------------------------------------------------------------- /deprecated/examples/MicromlMorseIdentificationExample/MicromlMorseIdentificationExample.ino: -------------------------------------------------------------------------------- 1 | // uncomment when doing classification 2 | #include "model.h" 3 | 4 | #define IN 4 5 | #define NUM_SAMPLES 30 6 | #define INTERVAL 100 7 | 8 | double features[NUM_SAMPLES]; 9 | 10 | 11 | void setup() { 12 | Serial.begin(115200); 13 | pinMode(IN, INPUT_PULLUP); 14 | Serial.println("Begin"); 15 | self_test(); 16 | } 17 | 18 | void loop() { 19 | if (digitalRead(IN) == 0) { 20 | recordButtonStatus(); 21 | printFeatures(); 22 | 23 | // uncomment when doing classification 24 | Serial.print("Detected letter: "); 25 | Serial.println(classIdxToName(predict(features))); 26 | 27 | delay(1000); 28 | } 29 | 30 | delay(10); 31 | } 32 | 33 | void printFeatures() { 34 | const uint16_t numFeatures = sizeof(features) / sizeof(double); 35 | 36 | for (int i = 0; i < numFeatures; i++) { 37 | Serial.print(features[i]); 38 | Serial.print(i == numFeatures - 1 ? '\n' : ','); 39 | } 40 | } 41 | 42 | void recordButtonStatus() { 43 | for (int i = 0; i < NUM_SAMPLES; i++) { 44 | features[i] = digitalRead(IN); 45 | delay(INTERVAL); 46 | } 47 | } -------------------------------------------------------------------------------- /deprecated/examples/TheUltimateGuideToWifiIndoorPositioningExample/CollectData.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define print(string) Serial.print(string); 4 | #define quote(string) print('"'); print(string); print('"'); 5 | 6 | 7 | String location = ""; 8 | 9 | 10 | /** 11 | * 12 | */ 13 | void setup() { 14 | Serial.begin(115200); 15 | delay(3000); 16 | WiFi.disconnect(); 17 | print("Enter 'scan {location}' to start the scanning and 'stop' to stop scanning\n"); 18 | } 19 | 20 | /** 21 | * 22 | */ 23 | void loop() { 24 | // look for new command 25 | if (Serial.available()) { 26 | String input = Serial.readStringUntil('\n'); 27 | 28 | if (input.indexOf("scan ") == 0) { 29 | location = input.substring(5); 30 | print("Started scanning..."); 31 | print(location); 32 | print("\n"); 33 | } 34 | else { 35 | print("Command not found. Enter 'scan {location}' to start the scanning\n"); 36 | location = ""; 37 | } 38 | } 39 | 40 | // if location is set, scan networks 41 | if (location != "") { 42 | int numNetworks = WiFi.scanNetworks(); 43 | 44 | // print location 45 | print('{'); 46 | quote("__location"); 47 | print(": "); 48 | quote(location); 49 | print(", "); 50 | 51 | // print each network SSID and RSSI 52 | for (int i = 0; i < numNetworks; i++) { 53 | quote(WiFi.SSID(i)); 54 | print(": "); 55 | print(WiFi.RSSI(i)); 56 | print(i == numNetworks - 1 ? "}\n" : ", "); 57 | } 58 | 59 | delay(1000); 60 | } 61 | } -------------------------------------------------------------------------------- /deprecated/examples/TheUltimateGuideToWifiIndoorPositioningExample/GetPosition.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Converter.h" 3 | #include "Classifier.h" 4 | 5 | 6 | Eloquent::Projects::WifiIndoorPositioning positioning; 7 | Eloquent::ML::Port::DecisionTree classifier; 8 | 9 | 10 | void setup() { 11 | Serial.begin(115200); 12 | WiFi.disconnect(); 13 | } 14 | 15 | 16 | void loop() { 17 | positioning.scan(); 18 | Serial.print("You're in "); 19 | Serial.println(classifier.predictLabel(positioning.features)); 20 | delay(3000); 21 | } -------------------------------------------------------------------------------- /deprecated/examples/TheUltimateGuideToWifiIndoorPositioningExample/TheUltimateGuideToWifiIndoorPositioningExample.ino: -------------------------------------------------------------------------------- 1 | // Upload this first and record the features 2 | #include "CollectData.h" 3 | 4 | // Then generate the "Converter.h" and "Classifier.h" content with micromlgen 5 | // and upload the following 6 | //#include "GetPosition.h" -------------------------------------------------------------------------------- /deprecated/examples/ThermalCameraToAsciiArtExample/ThermalCameraToAsciiArtExample.ino: -------------------------------------------------------------------------------- 1 | #include "EloquentAsciiArt.h" 2 | #include "EloquentMLX90640.h" 3 | 4 | 5 | using namespace Eloquent::Sensors; 6 | using namespace Eloquent::ImageProcessing; 7 | 8 | float buffer[768]; 9 | uint8_t bufferBytes[768]; 10 | MLX90640 camera; 11 | // we need to specify width and height of the image 12 | AsciiArt<32, 24> art(bufferBytes); 13 | 14 | 15 | void setup() { 16 | Serial.begin(115200); 17 | delay(3000); 18 | 19 | if (!camera.begin()) { 20 | Serial.println("Init error"); 21 | delay(50000); 22 | } 23 | } 24 | 25 | 26 | void loop() { 27 | camera.read(buffer); 28 | 29 | // convert float image to uint8 30 | for (size_t i = 0; i < 768; i++) { 31 | // assumes readings are in the range 0-40 degrees 32 | // change as per your need 33 | bufferBytes[i] = map(buffer[i], 0, 40, 0, 255); 34 | } 35 | 36 | // print to Serial with a border of 2 characters, to distinguish one image from the next 37 | art.print(&Serial, 2); 38 | delay(2000); 39 | } -------------------------------------------------------------------------------- /deprecated/examples/Vision/MotionDetection/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eloquentarduino/EloquentArduino/15983e68cf82c54afadaf2b6c8fdc95cad268489/deprecated/examples/Vision/MotionDetection/.DS_Store -------------------------------------------------------------------------------- /deprecated/examples/Vision/Processing/RGBHistogramExample/RGBHistogramExample.ino: -------------------------------------------------------------------------------- 1 | /** 2 | * Example on how to use the RGBHistogram class. 3 | * It computes the (binned) frequency histogram of R, G, B values in an image. 4 | */ 5 | #define CAMERA_MODEL_M5STACK_WIDE 6 | #define FRAME_SIZE FRAMESIZE_QVGA 7 | #define NUM_BINS 16 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | 14 | Eloquent::Vision::Camera::ESP32Camera camera(PIXFORMAT_RGB565); 15 | Eloquent::Vision::Processing::RGBHistogram hist; 16 | 17 | 18 | /** 19 | * Function prototype 20 | */ 21 | void printHistogram(uint16_t *hist, char bar = '|', uint8_t divisor = 10); 22 | 23 | 24 | /** 25 | * 26 | */ 27 | void setup() { 28 | Serial.begin(115200); 29 | camera.begin(FRAME_SIZE); 30 | delay(4000); 31 | } 32 | 33 | 34 | /** 35 | * 36 | */ 37 | void loop() { 38 | camera_fb_t *frame = camera.capture(); 39 | 40 | // actually compute histogram 41 | hist.update(frame->buf, frame->len); 42 | 43 | // the hist object has the attributes rHistogram, gHistrogram, bHistogram 44 | // that contain the calculated histograms 45 | printHistogram(hist.gHistogram); 46 | delay(4000); 47 | } 48 | 49 | 50 | /** 51 | * Print histogram on the serial monitor 52 | */ 53 | void printHistogram(uint16_t *hist, char bar, uint8_t divisor) { 54 | // for each bin 55 | for (uint8_t i = 0; i < NUM_BINS; i++) { 56 | Serial.printf("%-2d ", i); 57 | 58 | // print row proportional to its height 59 | for (uint16_t j = hist[i] / divisor; j > 0; j--) { 60 | Serial.print(bar); 61 | } 62 | 63 | Serial.println(); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /deprecated/examples/exampleInputStream.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace Eloquent; 4 | using namespace Eloquent::IO; 5 | 6 | 7 | float arr[] = {-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; 8 | ArrayInputStream is(arr, sizeof(arr) / sizeof(float)); 9 | 10 | 11 | void setup() { 12 | Serial.begin(115200); 13 | delay(3000); 14 | Serial.println(); 15 | is 16 | .then(new Constrain(0, 9999)) 17 | .then(new EWMA(0.7)) 18 | .then(new Map(0, 10, 0, 100)) 19 | .then(new Average(3)) 20 | //.then(new Round(RoundStrategy::FLOOR)) 21 | ; 22 | } 23 | 24 | void loop() { 25 | if (!isnan(is.read())) { 26 | Serial.print(is.raw()); 27 | Serial.print('\t'); 28 | Serial.println(is.value()); 29 | } 30 | } -------------------------------------------------------------------------------- /deprecated/src/EloquentArduino.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | #define _ELOQUENTARDUINO_H_ 1 -------------------------------------------------------------------------------- /deprecated/src/data_structures/Counter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../../src/dev/logging.h" 4 | 5 | 6 | namespace Eloquent { 7 | 8 | /** 9 | * Count, extended 10 | */ 11 | class Counter { 12 | public: 13 | 14 | /** 15 | * @see increment 16 | * @return 17 | */ 18 | Counter* operator++() { 19 | return increment(); 20 | } 21 | 22 | /** 23 | * Start timer 24 | */ 25 | void begin() { 26 | _start = millis(); 27 | } 28 | 29 | /** 30 | * Set debounce interval 31 | * @param debounce 32 | */ 33 | void debounce(uint32_t debounce) { 34 | _debounce = debounce; 35 | } 36 | 37 | /** 38 | * Increment if debounced 39 | * @return 40 | */ 41 | Counter* increment() { 42 | if (millis() > _last + _debounce) { 43 | _count++; 44 | _last = millis(); 45 | } 46 | else { 47 | library_log_warning("increment ignored because of debouncing"); 48 | } 49 | 50 | return this; 51 | } 52 | 53 | /** 54 | * Get count 55 | * @return 56 | */ 57 | uint32_t count() { 58 | return _count; 59 | } 60 | 61 | /** 62 | * Get count per second 63 | * @return 64 | */ 65 | float countPerSecond() { 66 | return 1000.0 * _count / (millis() - _start); 67 | } 68 | 69 | protected: 70 | uint32_t _start; 71 | uint32_t _last; 72 | uint32_t _debounce; 73 | uint32_t _count; 74 | }; 75 | 76 | } -------------------------------------------------------------------------------- /deprecated/src/dev/await.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define AWAIT2(condition, timeout) AWAIT3(condition, timeout, 10) 4 | 5 | /** 6 | * Await for a condition to become true 7 | * within the given timeout. 8 | */ 9 | #define AWAIT3(condition, timeout, interval) \ 10 | ([]() { \ 11 | uint32_t start = millis(); \ 12 | while (millis() - start <= timeout) { \ 13 | if (condition) return true; \ 14 | delay(interval); \ 15 | } \ 16 | return false; })() 17 | 18 | #define CHOOSE_AWAIT_MACRO(_1, _2, _3, NAME, ...) NAME 19 | #define await(...) CHOOSE_AWAIT_MACRO(__VA_ARGS__, AWAIT3, AWAIT2)(__VA_ARGS__) -------------------------------------------------------------------------------- /deprecated/src/dev/retry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | #define retry(condition, times) \ 5 | ([]() {\ 6 | for (uint16_t i = 0; i < times; i++)\ 7 | if (condition)\ 8 | return true;\ 9 | return false;\ 10 | }) -------------------------------------------------------------------------------- /deprecated/src/dev/voltage.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /** 4 | * 5 | * @param calibrationFactor 6 | * @return 7 | */ 8 | 9 | float readVcc(float calibrationFactor = 1) { 10 | // Read 1.1V reference against AVcc 11 | // set the reference to Vcc and the measurement to the internal 1.1V reference 12 | #if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) 13 | ADMUX = _BV(REFS0) | _BV(MUX4) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1); 14 | #elif defined (__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__) 15 | ADMUX = _BV(MUX5) | _BV(MUX0); 16 | #elif defined (__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) 17 | ADMUX = _BV(MUX3) | _BV(MUX2); 18 | #elif defined(_BV) && defined(REFS0) && defined(MUX1) && defined(MUX2) && defined(MUX3) 19 | ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1); 20 | #else 21 | return 0; 22 | #endif 23 | 24 | delay(2); // Wait for Vref to settle 25 | ADCSRA |= _BV(ADSC); // Start conversion 26 | 27 | while (bit_is_set(ADCSRA,ADSC)); // measuring 28 | 29 | uint8_t low = ADCL; // must read ADCL first - it then locks ADCH 30 | uint8_t high = ADCH; // unlocks both 31 | 32 | float result = (high<<8) | low; 33 | 34 | // Calculate Vcc (in mV); 1125300 = 1.1*1023*1000 35 | return calibrationFactor * (1125300.0f / result); 36 | } -------------------------------------------------------------------------------- /deprecated/src/eloquentarduino/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eloquentarduino/EloquentArduino/15983e68cf82c54afadaf2b6c8fdc95cad268489/deprecated/src/eloquentarduino/.DS_Store -------------------------------------------------------------------------------- /deprecated/src/eloquentarduino/data_structures/VariableWatcher.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | namespace eloquent { 5 | namespace data { 6 | 7 | template 8 | class VariableWatcher { 9 | public: 10 | 11 | /** 12 | * Update current value 13 | * @param current 14 | */ 15 | void update(T current) { 16 | _old = _current; 17 | _current = current; 18 | } 19 | 20 | /** 21 | * Test if value changed 22 | * @return 23 | */ 24 | bool changed() { 25 | return _current != _old; 26 | } 27 | 28 | protected: 29 | T _old; 30 | T _current; 31 | }; 32 | } 33 | } -------------------------------------------------------------------------------- /deprecated/src/eloquentarduino/io/serial_print.h: -------------------------------------------------------------------------------- 1 | #ifndef ELOQUENTARDUINO_SERIAL_PRINT 2 | #define ELOQUENTARDUINO_SERIAL_PRINT 1 3 | 4 | #if defined(Stream_h) 5 | 6 | #include "print.h" 7 | 8 | 9 | namespace eloquent { 10 | namespace io { 11 | 12 | /** 13 | * Print all arguments to Serial 14 | * @tparam Args 15 | * @param args 16 | */ 17 | template 18 | void print_all(Args... args) { 19 | fprint_all(&Serial, args...); 20 | } 21 | 22 | 23 | /** 24 | * Print CSV-style line to serial 25 | * @tparam Args 26 | * @param args 27 | */ 28 | template 29 | void print_csv(Args... args) { 30 | fprint_csv(&Serial, args...); 31 | } 32 | 33 | 34 | /** 35 | * Print array to Serial 36 | */ 37 | template 38 | void print_array(T *array, uint16_t length, char separator=',') { 39 | fprint_array(&Serial, array, length, separator); 40 | } 41 | 42 | } 43 | } 44 | 45 | #endif 46 | #endif -------------------------------------------------------------------------------- /deprecated/src/eloquentarduino/vision/io/decoders/Blue565RandomAccessDecoder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "RGB565RandomAccessDecoder.h" 4 | 5 | 6 | namespace Eloquent { 7 | namespace Vision { 8 | namespace IO { 9 | namespace Decoders { 10 | /** 11 | * Decode B channel from RGB 565 images 12 | */ 13 | class Blue565RandomAccessDecoder : public RGB565RandomAccessDecoder { 14 | public: 15 | /** 16 | * Get B 17 | * @param x 18 | * @param y 19 | * @return 20 | */ 21 | uint8_t get(uint8_t *image, uint16_t width, uint16_t height, uint16_t x, uint16_t y) { 22 | return _get(image, width, height, x, y, 0b111111, 0, 3); 23 | } 24 | }; 25 | } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /deprecated/src/eloquentarduino/vision/io/decoders/GrayscaleRandomAccessDecoder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "RandomAccessDecoder.h" 4 | 5 | 6 | namespace Eloquent { 7 | namespace Vision { 8 | namespace IO { 9 | namespace Decoders { 10 | /** 11 | * Decode gray channel 12 | */ 13 | class GrayscaleRandomAccessDecoder : public RandomAccessDecoder { 14 | public: 15 | /** 16 | * @param x 17 | * @param y 18 | * @return 19 | */ 20 | uint8_t get(uint8_t *image, uint16_t width, uint16_t height, uint16_t x, uint16_t y) { 21 | return image[y * width + x]; 22 | } 23 | }; 24 | } 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /deprecated/src/eloquentarduino/vision/io/decoders/Green565RandomAccessDecoder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "RGB565RandomAccessDecoder.h" 4 | 5 | 6 | namespace Eloquent { 7 | namespace Vision { 8 | namespace IO { 9 | namespace Decoders { 10 | /** 11 | * Decode G channel from RGB 565 images 12 | */ 13 | class Green565RandomAccessDecoder : public RGB565RandomAccessDecoder { 14 | public: 15 | /** 16 | * Get G 17 | * @param x 18 | * @param y 19 | * @return 20 | */ 21 | uint8_t get(uint8_t *image, uint16_t width, uint16_t height, uint16_t x, uint16_t y) { 22 | return _get(image, width, height, x, y, 0b11111100000, 5, 2); 23 | } 24 | }; 25 | } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /deprecated/src/eloquentarduino/vision/io/decoders/RGB565RandomAccessDecoder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "RandomAccessDecoder.h" 4 | 5 | 6 | namespace Eloquent { 7 | namespace Vision { 8 | namespace IO { 9 | namespace Decoders { 10 | /** 11 | * Decode RGB channel from RGB 565 images 12 | */ 13 | class RGB565RandomAccessDecoder : public RandomAccessDecoder { 14 | protected: 15 | /** 16 | * Get channel value 17 | * @param x 18 | * @param y 19 | * @param mask 20 | * @param shift 21 | * @return 22 | */ 23 | uint8_t _get(uint8_t *image, uint16_t width, uint16_t height, uint16_t x, uint16_t y, uint16_t mask, uint8_t shiftRight, uint8_t shiftLeft = 0) { 24 | uint32_t offset = (y * width + x) * 2; 25 | uint16_t *pointer = (uint16_t *) (&image[offset]); 26 | uint16_t rgb = __builtin_bswap16(*pointer); 27 | 28 | return ((rgb & mask) >> shiftRight) << shiftLeft; 29 | } 30 | }; 31 | } 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /deprecated/src/eloquentarduino/vision/io/decoders/RandomAccessDecoder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | namespace Eloquent { 5 | namespace Vision { 6 | namespace IO { 7 | namespace Decoders { 8 | /** 9 | * Abstract API to decode images from different formats in random-access 10 | */ 11 | class RandomAccessDecoder { 12 | public: 13 | 14 | /** 15 | * Get value at (x, y) 16 | */ 17 | virtual uint8_t get(uint8_t *image, uint16_t width, uint16_t height, uint16_t x, uint16_t y) = 0; 18 | }; 19 | } 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /deprecated/src/eloquentarduino/vision/io/decoders/Red565RandomAccessDecoder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "RGB565RandomAccessDecoder.h" 4 | 5 | 6 | namespace Eloquent { 7 | namespace Vision { 8 | namespace IO { 9 | namespace Decoders { 10 | /** 11 | * Decode R channel from RGB 565 images 12 | */ 13 | class Red565RandomAccessDecoder : public RGB565RandomAccessDecoder { 14 | public: 15 | /** 16 | * Get R 17 | * @param x 18 | * @param y 19 | * @return 20 | */ 21 | uint8_t get(uint8_t *image, uint16_t width, uint16_t height, uint16_t x, uint16_t y) { 22 | return _get(image, width, height, x, y, 0b1111100000000000, 11, 3); 23 | } 24 | }; 25 | } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /deprecated/src/eloquentarduino/vision/processing/downscaling/Center.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Strategy.h" 4 | 5 | 6 | namespace Eloquent { 7 | namespace Vision { 8 | namespace Processing { 9 | namespace Downscaling { 10 | 11 | /** 12 | * Return the block's center pixel value 13 | */ 14 | template 15 | class Center : public Strategy { 16 | public: 17 | 18 | /** 19 | * Return true only on center pixel 20 | * @param x 21 | * @param y 22 | * @return 23 | */ 24 | const bool test(uint8_t x, uint8_t y) { 25 | return x == (blockSizeX / 2) && y == (blockSizeY / 2); 26 | } 27 | 28 | /** 29 | * Save center pixel value 30 | * @param x 31 | * @param y 32 | * @param pixel 33 | */ 34 | void accumulate(uint8_t x, uint8_t y, uint8_t pixel) { 35 | _pixel = pixel; 36 | } 37 | 38 | /** 39 | * Return pixel value 40 | * @param block 41 | * @return 42 | */ 43 | uint8_t reduce() { 44 | return _pixel; 45 | } 46 | 47 | protected: 48 | uint16_t _pixel; 49 | }; 50 | } 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /deprecated/src/eloquentarduino/vision/processing/downscaling/Strategy.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | namespace Eloquent { 5 | namespace Vision { 6 | namespace Processing { 7 | namespace Downscaling { 8 | 9 | /** 10 | * Abstract class for downscaling strategies 11 | */ 12 | template 13 | class Strategy { 14 | public: 15 | 16 | /** 17 | * Test if pixel is relevant for the strategy 18 | * @param x 19 | * @param y 20 | * @return 21 | */ 22 | virtual const bool test(uint8_t x, uint8_t y) = 0; 23 | 24 | /** 25 | * Process pixel 26 | * @param x 27 | * @param y 28 | * @param pixel 29 | */ 30 | virtual void accumulate(uint8_t x, uint8_t y, uint8_t pixel) = 0; 31 | 32 | /** 33 | * Collapse accumulated pixels to a single value 34 | * @param block 35 | * @param width 36 | * @param height 37 | * @return 38 | */ 39 | virtual uint8_t reduce() = 0; 40 | 41 | /** 42 | * Reset strategy count 43 | */ 44 | void reset() { 45 | _pixel = 0; 46 | } 47 | 48 | protected: 49 | uint16_t _pixel; 50 | }; 51 | } 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /deprecated/src/io/InputStream/AnalogPinInputStream.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "InputStream.h" 4 | 5 | namespace Eloquent { 6 | namespace InputStream { 7 | 8 | /** 9 | * Generate input stream from analog pin 10 | */ 11 | class AnalogPinInputStream : public InputStream { 12 | public: 13 | AnalogPinInputStream(uint8_t pin) : 14 | _pin(pin) { 15 | 16 | } 17 | 18 | protected: 19 | uint8_t _pin; 20 | 21 | /** 22 | * Read value from analog pin 23 | * @return 24 | */ 25 | virtual float _read() { 26 | return analogRead(_pin); 27 | } 28 | }; 29 | } 30 | } -------------------------------------------------------------------------------- /deprecated/src/io/InputStream/ArrayInputStream.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "InputStream.h" 4 | 5 | namespace Eloquent { 6 | namespace InputStream { 7 | /** 8 | * Generate values from an array 9 | */ 10 | class ArrayInputStream : public InputStream { 11 | public: 12 | ArrayInputStream(float *array, uint16_t count) { 13 | _array = array; 14 | _index = 0; 15 | _count = count; 16 | } 17 | 18 | protected: 19 | uint16_t _index; 20 | uint16_t _count; 21 | float *_array; 22 | 23 | /** 24 | * Values are available until end of array 25 | * @return 26 | */ 27 | bool available() override { 28 | return _index < _count; 29 | } 30 | 31 | /** 32 | * Read next array element 33 | * @return 34 | */ 35 | float _read() override { 36 | return _array[_index++]; 37 | } 38 | }; 39 | } 40 | } -------------------------------------------------------------------------------- /deprecated/src/io/InputStream/AssignableInputStream.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "InputStream.h" 4 | 5 | namespace Eloquent { 6 | namespace InputStream { 7 | 8 | /** 9 | * Generate input stream when an assignment is made 10 | */ 11 | class AssignableInputStream : public InputStream { 12 | public: 13 | AssignableInputStream() : 14 | _isAssigned(false), 15 | _assigned(0) { 16 | 17 | } 18 | 19 | /** 20 | * 21 | * @param value 22 | */ 23 | void operator=(const float value) { 24 | _assigned = value; 25 | _isAssigned = true; 26 | 27 | read(); 28 | } 29 | 30 | protected: 31 | bool _isAssigned; 32 | float _assigned; 33 | 34 | /** 35 | * A value is available once it has been assigned 36 | * @return 37 | */ 38 | bool available() override { 39 | if (_isAssigned) { 40 | _isAssigned = false; 41 | 42 | return true; 43 | } 44 | 45 | return false; 46 | } 47 | 48 | /** 49 | * Get assigned value 50 | * @return 51 | */ 52 | float _read() override { 53 | return _assigned; 54 | } 55 | }; 56 | } 57 | } -------------------------------------------------------------------------------- /deprecated/src/io/InputStream/AtLeast.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Transformer.h" 4 | 5 | 6 | namespace Eloquent { 7 | namespace InputStream { 8 | 9 | /** 10 | * Truncate values less than threshold 11 | */ 12 | class AtLeast : public Transformer { 13 | public: 14 | AtLeast(float atLeast) : 15 | _atLeast(abs(atLeast)) { 16 | 17 | } 18 | 19 | protected: 20 | float _atLeast; 21 | 22 | /** 23 | * 24 | * @param value 25 | * @return 26 | */ 27 | float transform(float value) override { 28 | return abs(value) > _atLeast ? value : 0; 29 | } 30 | }; 31 | } 32 | } -------------------------------------------------------------------------------- /deprecated/src/io/InputStream/Average.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Transformer.h" 4 | 5 | namespace Eloquent { 6 | namespace InputStream { 7 | 8 | /** 9 | * Average multiple values 10 | */ 11 | class Average : public Transformer { 12 | public: 13 | Average(uint16_t count) : 14 | _count(count), 15 | _counter(0), 16 | _average(0) { 17 | 18 | } 19 | 20 | protected: 21 | const uint16_t _count; 22 | uint16_t _counter; 23 | float _average; 24 | 25 | /** 26 | * 27 | * @param value 28 | * @return 29 | */ 30 | virtual float transform(float value) override { 31 | _counter = (_counter + 1) % _count; 32 | _average += value / _count; 33 | 34 | if (_counter != 0) 35 | return NaN; 36 | 37 | const float average = _average; 38 | 39 | _average = 0; 40 | 41 | return average; 42 | } 43 | }; 44 | } 45 | } -------------------------------------------------------------------------------- /deprecated/src/io/InputStream/Baseline.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Transformer.h" 4 | 5 | 6 | namespace Eloquent { 7 | namespace InputStream { 8 | /** 9 | * Substract the average of the calibrating samples 10 | * from the current value 11 | */ 12 | class Baseline : public Transformer { 13 | public: 14 | Baseline(uint16_t samples) : 15 | _samples(samples), 16 | _average(0), 17 | _i(0) { 18 | 19 | } 20 | 21 | protected: 22 | uint16_t _i; 23 | uint16_t _samples; 24 | float _average; 25 | 26 | float transform(float value) override { 27 | if (_i == _samples) 28 | return value - _average; 29 | 30 | _i++; 31 | 32 | if (_i > 5) 33 | _average += value / (_samples - 5); 34 | 35 | return NaN; 36 | } 37 | }; 38 | } 39 | } -------------------------------------------------------------------------------- /deprecated/src/io/InputStream/Constrain.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Transformer.h" 4 | 5 | namespace Eloquent { 6 | namespace InputStream { 7 | /** 8 | * Constrain value to a given range 9 | */ 10 | class Constrain : public Transformer { 11 | public: 12 | Constrain(float low, float high) : 13 | _low(low), 14 | _high(high) { 15 | 16 | } 17 | 18 | protected: 19 | float _low; 20 | float _high; 21 | 22 | /** 23 | * 24 | * @param value 25 | * @return 26 | */ 27 | virtual float transform(float value) override { 28 | return constrain(value, _low, _high); 29 | } 30 | }; 31 | } 32 | } -------------------------------------------------------------------------------- /deprecated/src/io/InputStream/Derivative.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Transformer.h" 4 | 5 | namespace Eloquent { 6 | namespace InputStream { 7 | 8 | class Derivative : public Transformer { 9 | protected: 10 | float _old = 0; 11 | 12 | /** 13 | * 14 | * @param value 15 | * @return 16 | */ 17 | virtual float transform(float value) override { 18 | float derivative = value - _old; 19 | 20 | _old = value; 21 | 22 | return derivative; 23 | } 24 | }; 25 | } 26 | } -------------------------------------------------------------------------------- /deprecated/src/io/InputStream/EWMA.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Transformer.h" 4 | 5 | namespace Eloquent { 6 | namespace InputStream { 7 | /** 8 | * Exponentially weightened moving average 9 | */ 10 | class EWMA : public Transformer { 11 | public: 12 | EWMA(float smoothingFactor) { 13 | _zeroed = false; 14 | _old = 0; 15 | _smoothingFactor = constrain(smoothingFactor, 0, 1); 16 | } 17 | 18 | protected: 19 | bool _zeroed; 20 | float _smoothingFactor; 21 | float _old; 22 | 23 | /** 24 | * 25 | * @param value 26 | * @return 27 | */ 28 | virtual float transform(float value) override { 29 | if (_zeroed) { 30 | _zeroed = true; 31 | _old = value; 32 | return value; 33 | } 34 | 35 | return (_old = _smoothingFactor * value + (1 - _smoothingFactor) * _old); 36 | } 37 | }; 38 | } 39 | } -------------------------------------------------------------------------------- /deprecated/src/io/InputStream/Map.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Transformer.h" 4 | 5 | namespace Eloquent { 6 | namespace InputStream { 7 | 8 | /** 9 | * Map a value from one range to another 10 | */ 11 | class Map : public Transformer { 12 | public: 13 | Map(float fromMin, float fromMax, float toMin, float toMax, bool constrain = false) : 14 | _fromMin(fromMin), 15 | _fromMax(fromMax), 16 | _toMin(toMin), 17 | _toMax(toMax), 18 | _constrain(constrain) { 19 | 20 | } 21 | 22 | protected: 23 | bool _constrain; 24 | float _fromMin; 25 | float _fromMax; 26 | float _toMin; 27 | float _toMax; 28 | 29 | /** 30 | * 31 | * @param value 32 | */ 33 | virtual float transform(float value) override { 34 | if (_constrain) 35 | value = constrain(value, _fromMin, _fromMax); 36 | 37 | return map(value, _fromMin, _fromMax, _toMin, _toMax); 38 | } 39 | }; 40 | } 41 | } -------------------------------------------------------------------------------- /deprecated/src/io/InputStream/Round.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Transformer.h" 4 | 5 | namespace Eloquent { 6 | namespace InputStream { 7 | 8 | /** 9 | * Round, ceil, floor 10 | */ 11 | enum class RoundStrategy { ROUND, FLOOR, CEIL}; 12 | 13 | /** 14 | * Round, ceil, floor a value 15 | */ 16 | class Round : public Transformer { 17 | public: 18 | Round(RoundStrategy strategy = RoundStrategy::ROUND) : 19 | _strategy(strategy) { 20 | 21 | } 22 | 23 | protected: 24 | RoundStrategy _strategy; 25 | 26 | /** 27 | * 28 | * @param value 29 | * @return 30 | */ 31 | virtual float transform(float value) override { 32 | switch (_strategy) { 33 | case RoundStrategy::CEIL: 34 | return ceil(value); 35 | case RoundStrategy::FLOOR: 36 | return floor(value); 37 | default: 38 | return round(value); 39 | } 40 | } 41 | }; 42 | } 43 | } -------------------------------------------------------------------------------- /deprecated/src/io/InputStream/Transformer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef NaN 4 | #define NaN sqrt(-1) 5 | #endif 6 | 7 | namespace Eloquent { 8 | namespace InputStream { 9 | 10 | /** 11 | * 12 | */ 13 | class Transformer { 14 | public: 15 | /** 16 | * Chain transformers 17 | * @param next 18 | * @return 19 | */ 20 | virtual Transformer *then(Transformer *next) final { 21 | return (_next = next); 22 | } 23 | 24 | /** 25 | * Receive next value 26 | * @param value 27 | * @return 28 | */ 29 | float consume(float value) { 30 | float transformed = transform(value); 31 | 32 | if (isnan(transformed)) 33 | return transformed; 34 | 35 | if (!_next) 36 | return transformed; 37 | 38 | return _next->transform(transformed); 39 | } 40 | 41 | protected: 42 | /** 43 | * 44 | * @param value 45 | * @return 46 | */ 47 | virtual float transform(float value) = 0; 48 | 49 | private: 50 | Transformer *_next = NULL; 51 | }; 52 | } 53 | } -------------------------------------------------------------------------------- /deprecated/src/io/Pin/AnalogIn.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Pin.h" 4 | 5 | namespace Eloquent { 6 | namespace Pin { 7 | 8 | /** 9 | * A class to interact with analog input pins 10 | */ 11 | class AnalogIn : public Pin { 12 | public: 13 | /** 14 | * Contructor 15 | * @param pin Pin number 16 | */ 17 | AnalogIn(uint8_t pin) : 18 | Pin(pin), 19 | _prev(0) { 20 | 21 | } 22 | 23 | /** 24 | * Set pin mode to INPUT 25 | */ 26 | void begin() { 27 | pinMode(_pin, INPUT); 28 | } 29 | 30 | /** 31 | * Read the pin 32 | * @return whether the pin is ON 33 | */ 34 | uint16_t read() { 35 | _prev = _value; 36 | _value = analogRead(_pin); 37 | 38 | return value(); 39 | } 40 | 41 | /** 42 | * Get pin's previous value 43 | * @return 44 | */ 45 | uint16_t prev() { 46 | return _prev; 47 | } 48 | 49 | /** 50 | * Get pin's change from last read 51 | * @return 52 | */ 53 | int16_t delta() { 54 | return _value - _prev; 55 | } 56 | 57 | /** 58 | * Get absolute value of delta() 59 | * @return 60 | */ 61 | uint16_t absDelta() { 62 | return abs(delta()); 63 | } 64 | 65 | protected: 66 | uint16_t _prev; 67 | }; 68 | } 69 | } -------------------------------------------------------------------------------- /deprecated/src/io/Pin/AnalogOut.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Pin.h" 4 | 5 | namespace Eloquent { 6 | namespace Pin { 7 | 8 | /** 9 | * A class to interact with analog output pins 10 | */ 11 | class AnalogOut : public Pin { 12 | public: 13 | /** 14 | * Contructor 15 | * @param pin Pin number 16 | */ 17 | AnalogOut(uint8_t pin) : 18 | Pin(pin) { 19 | 20 | } 21 | 22 | /** 23 | * Set pin mode to OUTPUT 24 | */ 25 | void begin() { 26 | pinMode(_pin, OUTPUT); 27 | } 28 | 29 | /** 30 | * Write to pin 31 | * @param value 32 | * @return the written value 33 | */ 34 | uint8_t write(uint8_t value) { 35 | _value = value; 36 | analogWrite(_pin, value); 37 | 38 | return this->value(); 39 | } 40 | }; 41 | } 42 | } -------------------------------------------------------------------------------- /deprecated/src/io/Pin/Pin.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace Eloquent { 4 | namespace Pin { 5 | /** 6 | * Pin handling made easy 7 | */ 8 | class Pin { 9 | public: 10 | Pin(uint8_t pin) : 11 | _pin(pin), 12 | _value(0) { 13 | 14 | } 15 | 16 | /** 17 | * Get the pin number 18 | * @return 19 | */ 20 | uint8_t pin() { 21 | return _pin; 22 | } 23 | 24 | /** 25 | * Get pin value 26 | * @return 27 | */ 28 | uint16_t value() { 29 | return _value; 30 | } 31 | 32 | protected: 33 | uint8_t _pin; 34 | uint16_t _value; 35 | }; 36 | } 37 | } -------------------------------------------------------------------------------- /deprecated/src/io/Spiffs/Dir.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace Eloquent { 6 | namespace Spiffs { 7 | /** 8 | * Abstract SPIFFS directory 9 | */ 10 | class Dir { 11 | public: 12 | /** 13 | * Constructor 14 | * @param dirname 15 | */ 16 | Dir(String dirname) : 17 | _dirname(dirname) { 18 | 19 | } 20 | 21 | /** 22 | * Run function for each file in directory 23 | */ 24 | void walk(void (*handler)(File)) { 25 | File dir = SPIFFS.open(_dirname); 26 | File file; 27 | 28 | while (file = dir.openNextFile()) { 29 | handler(file); 30 | file.close(); 31 | } 32 | 33 | dir.close(); 34 | } 35 | 36 | protected: 37 | String _dirname; 38 | }; 39 | } 40 | } -------------------------------------------------------------------------------- /examples/CameraWebServerExample/CameraWebServerExample.ino: -------------------------------------------------------------------------------- 1 | #include "eloquent.h" 2 | #include "eloquent/networking/wifi.h" 3 | #include "eloquent/vision/camera/esp32/webserver.h" 4 | 5 | // replace 'm5wide' with your own model 6 | // possible values are 'aithinker', 'eye', 'm5stack', 'm5wide', 'wrover' 7 | #include "eloquent/vision/camera/m5wide.h" 8 | 9 | 10 | 11 | void setup() { 12 | Serial.begin(115200); 13 | delay(2000); 14 | 15 | camera.jpeg(); 16 | // replace with desired resolution 17 | // possible values are qqvga, qvga, vga 18 | camera.qqvga(); 19 | 20 | // replace with your WiFi credentials 21 | while (!wifi.connectTo("Abc", "12345678")) 22 | Serial.println("Cannot connect to WiFi"); 23 | 24 | while (!camera.begin()) 25 | Serial.println("Cannot connect to camera"); 26 | 27 | webServer.start(); 28 | Serial.print("Camera web server started at http://"); 29 | Serial.println(WiFi.localIP()); 30 | } 31 | 32 | void loop() { 33 | // do nothing 34 | } -------------------------------------------------------------------------------- /examples/EdgeImpulse/EdgeImpulseExample/EdgeImpulseExample.ino: -------------------------------------------------------------------------------- 1 | /** 2 | * This example shows how to use the Eloquent library 3 | * to perform inference using the EdgeImpulse generated library 4 | */ 5 | #include 6 | #include 7 | #include 8 | 9 | 10 | Eloquent::TinyML::EdgeImpulse::Impulse impulse; 11 | 12 | 13 | void setup() { 14 | Serial.begin(115200); 15 | delay(3000); 16 | Serial.println("Starting EdgeImpulse inference"); 17 | Serial.println("Paste your feature vector in the Serial Monitor and get the predicted value"); 18 | Serial.print("(expecting "); 19 | Serial.print(EI_CLASSIFIER_DSP_INPUT_FRAME_SIZE); 20 | Serial.println(" comma-separated features)"); 21 | } 22 | 23 | 24 | void loop() { 25 | float features[EI_CLASSIFIER_DSP_INPUT_FRAME_SIZE] = {0}; 26 | 27 | if (!Serial.available()) 28 | return; 29 | 30 | for (int i = 0; i < EI_CLASSIFIER_DSP_INPUT_FRAME_SIZE; i++) 31 | features[i] = Serial.readStringUntil(',').toFloat(); 32 | 33 | // here is where the magic happens... 34 | Serial.print("Predicted class: "); 35 | Serial.println(impulse.predict(features)); 36 | Serial.print("Predicted label: "); 37 | Serial.println(impulse.getLabel()); 38 | 39 | // debug class probabilities and timing 40 | impulse.printTo(Serial); 41 | } -------------------------------------------------------------------------------- /examples/IndoorPositioning/WiFiScannerExample/WiFiScannerExample.ino: -------------------------------------------------------------------------------- 1 | /** 2 | * WiFi scanner example 3 | * Print WiFi hotspots with their RSSI in Json format 4 | * 5 | * Enter the name of the location to start scanning 6 | * Enter 'stop' to stop the scanning 7 | */ 8 | 9 | // replace with WiFiNINA.h if you use a different board 10 | #include "WiFi.h" 11 | 12 | #include "eloquent.h" 13 | #include "eloquent/networking/wifi/WifiScanner.h" 14 | 15 | 16 | String location; 17 | 18 | 19 | void setup() { 20 | Serial.begin(115200); 21 | delay(2000); 22 | Serial.println("Instructions:"); 23 | Serial.println("\tEnter the name of the location to start scanning"); 24 | Serial.println("\tEnter 'stop' to stop scanning"); 25 | 26 | // you can identify networks either by MAC address 27 | wifiScanner.identifyByMAC(); 28 | // or SSID (default) 29 | wifiScanner.identifyBySSID(); 30 | } 31 | 32 | void loop() { 33 | // await user to input his current location or "stop" to abort scanning 34 | if (Serial.available()) { 35 | location = Serial.readStringUntil('\n'); 36 | } 37 | 38 | // if a location is set, perform scan 39 | if (location != "" && location != "stop") { 40 | Serial.print(location); 41 | Serial.print(": "); 42 | wifiScanner.scan(); 43 | wifiScanner.printAsJson(Serial); 44 | delay(2000); 45 | } 46 | } -------------------------------------------------------------------------------- /examples/Telegram/SendJpegExample/SendJpegExample.ino: -------------------------------------------------------------------------------- 1 | #define TELEGRAM_TOKEN "xxxxxxxxxx:yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy" 2 | #define CHAT_ID "0123456789" 3 | #define WIFI_SSID "SSID" 4 | #define WIFI_PASSWORD "PASSWORD" 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | 13 | void setup() { 14 | Serial.begin(115200); 15 | filesystem.begin(true); 16 | delay(2000); 17 | 18 | // list files on filesystem 19 | filesystem.listTo(Serial); 20 | wifi.connectTo(WIFI_SSID, WIFI_PASSWORD); 21 | 22 | Serial.println("Connected to WiFi. Attempting to connect to Telegram API..."); 23 | 24 | if (!telegramBot.connect()) { 25 | eloquent::abort(Serial, "Cannot connect to Telegram API"); 26 | } 27 | 28 | Serial.println("Connected!"); 29 | Serial.println("Type a jpeg filename to send to Telegram Bot"); 30 | } 31 | 32 | void loop() { 33 | if (Serial.available()) { 34 | String filename = Serial.readStringUntil('\n'); 35 | 36 | Serial.print("Sending file: "); 37 | Serial.println(filename); 38 | 39 | auto jpeg = filesystem.readBinary(filename); 40 | bool jpegStatus = telegramBot.sendJpegTo(CHAT_ID, jpeg); 41 | 42 | Serial.println(jpegStatus ? "Jpeg sent" : "Jpeg error"); 43 | } 44 | } -------------------------------------------------------------------------------- /examples/Telegram/SendMessageExample/SendMessageExample.ino: -------------------------------------------------------------------------------- 1 | #define TELEGRAM_TOKEN "xxxxxxxxxx:yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy" 2 | #define CHAT_ID "0123456789" 3 | #define WIFI_SSID "SSID" 4 | #define WIFI_PASSWORD "PASSWORD" 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | 12 | void setup() { 13 | Serial.begin(115200); 14 | delay(2000); 15 | 16 | wifi.connectTo(WIFI_SSID, WIFI_PASSWORD); 17 | Serial.println("Connected to WiFi. Attempting to connect to Telegram API..."); 18 | 19 | if (!telegramBot.connect()) { 20 | eloquent::abort(Serial, "Cannot connect to Telegram API"); 21 | } 22 | 23 | Serial.println("Connected!"); 24 | Serial.println("Type a message to send to Telegram Bot"); 25 | } 26 | 27 | void loop() { 28 | if (Serial.available()) { 29 | String message = Serial.readStringUntil('\n'); 30 | 31 | Serial.print("Sending message: "); 32 | Serial.println(message); 33 | 34 | bool messageStatus = telegramBot.sendMessageTo(CHAT_ID, message); 35 | 36 | Serial.println(messageStatus ? "Message sent" : "Message error"); 37 | } 38 | } -------------------------------------------------------------------------------- /examples/VL53L5CX/VL53L5cxCapture/VL53L5cxCapture.ino: -------------------------------------------------------------------------------- 1 | /** 2 | * Capture data from VL53L5CX 8x8 Time of Flight sensor 3 | */ 4 | #include 5 | #include 6 | #include 7 | 8 | 9 | 10 | void setup() { 11 | Serial.begin(115200); 12 | Wire.begin(); 13 | 14 | // (optional) turn on high speed communication 15 | Wire.setClock(1000000); 16 | vllcx.highFreq(); 17 | 18 | // (optional) truncate readings lower than 30 (3 cm) and higher than 500 (50 cm) 19 | vllcx.truncateLowerThan(30); 20 | vllcx.truncateHigherThan(500); 21 | 22 | // (optional) rescale distances from millimeters to 0-1 range (aka normalize distances) 23 | vllcx.scaleToRange(0, 1); 24 | 25 | if (!vllcx.begin()) 26 | eloquent::abort(Serial, "vl53l5cx not found"); 27 | 28 | Serial.println("vl53l5cx is ok"); 29 | } 30 | 31 | 32 | void loop() { 33 | // await for new data 34 | if (!vllcx.hasNewData() || !vllcx.read()) 35 | return; 36 | 37 | // print readings to Serial 38 | vllcx.printTo(Serial); 39 | delay(100); 40 | } 41 | -------------------------------------------------------------------------------- /keywords.txt: -------------------------------------------------------------------------------- 1 | Counter KEYWORD1 2 | eeValue KEYWORD1 3 | InterruptCounter KEYWORD1 4 | PicoFarad KEYWORD1 5 | RainGauge KEYWORD1 6 | increment KEYWORD2 7 | reset KEYWORD2 8 | debounce KEYWORD2 9 | count KEYWORD2 10 | countPerSecond KEYWORD2 11 | set KEYWORD2 12 | value KEYWORD2 13 | pin KEYWORD2 14 | mode KEYWORD2 15 | read KEYWORD2 16 | watch KEYWORD2 17 | mm KEYWORD2 18 | inches KEYWORD2 19 | -------------------------------------------------------------------------------- /library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "EloquentArduino", 3 | "keywords": "", 4 | "description": "", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/eloquentarduino/EloquentArduino" 8 | }, 9 | "version": "2.1.3", 10 | "authors": { 11 | "name": "Simone Salerno", 12 | "url": "https://github.com/eloquentarduino" 13 | }, 14 | "frameworks": "arduino", 15 | "platforms": "*" 16 | } 17 | -------------------------------------------------------------------------------- /library.properties: -------------------------------------------------------------------------------- 1 | name=EloquentArduino 2 | version=2.1.3 3 | author=Simone Salerno 4 | maintainer=Simone Salerno 5 | sentence=An eloquent interface to common Arduino patterns, data structures and algorithms 6 | paragraph=Follow the project at eloquentarduino.com for details 7 | category=Other 8 | url=https://github.com/eloquentarduino/EloquentArduino 9 | architectures=* 10 | includes=eloquent.h 11 | -------------------------------------------------------------------------------- /publish: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | if [ -z "$1" ] 5 | then 6 | echo "You MUST supply a version number" 7 | exit 1 8 | fi 9 | 10 | message=${2:-bump} 11 | 12 | 13 | sed -i '' -E "s/\"version\": \".+\",/\"version\": \"${1}\",/" library.json 14 | sed -i '' -E "s/version=.+/version=${1}/" library.properties 15 | git add . && git commit -m "bump dist to ${1}" && git tag -a $1 -m "$message" && git push origin master -f && git push origin $1 -f -------------------------------------------------------------------------------- /src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eloquentarduino/EloquentArduino/15983e68cf82c54afadaf2b6c8fdc95cad268489/src/.DS_Store -------------------------------------------------------------------------------- /src/eloquent.h: -------------------------------------------------------------------------------- 1 | #ifndef ELOQUENTARDUINO_ELOQUENT_H 2 | #define ELOQUENTARDUINO_ELOQUENT_H 3 | 4 | 5 | // entry point for the Eloquent Arduino library 6 | #include "./eloquent/utils.h" 7 | 8 | #endif //ELOQUENTARDUINO_ELOQUENT_H 9 | -------------------------------------------------------------------------------- /src/eloquent/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eloquentarduino/EloquentArduino/15983e68cf82c54afadaf2b6c8fdc95cad268489/src/eloquent/.DS_Store -------------------------------------------------------------------------------- /src/eloquent/apps/telegram/bot/Errors.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 20/04/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | namespace Eloquent { 8 | namespace Apps { 9 | namespace Telegram { 10 | enum class TelegramBotError { 11 | OK, 12 | INIT_ERROR, 13 | CONNECTION_ERROR, 14 | REQUEST_ERROR, 15 | EMPTY_PAYLOAD_ERROR 16 | }; 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/eloquent/apps/telegram/bot/wifi.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 11/04/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #ifdef ELOQUENT_TELEGRAM 8 | 9 | #include 10 | #include "../../../macros.h" 11 | #include "./BaseTelegramBot.h" 12 | #include "./witnessmenow/TelegramCertificate.h" 13 | 14 | static WiFiClientSecure _telegramBotWifiSecureClient; 15 | 16 | 17 | namespace Eloquent { 18 | namespace Apps { 19 | namespace Telegram { 20 | 21 | /** 22 | * 23 | */ 24 | class WiFiTelegramBot : public BaseTelegramBot { 25 | public: 26 | 27 | /** 28 | * Constructor 29 | * @param token 30 | */ 31 | WiFiTelegramBot(const char *token) : 32 | BaseTelegramBot(&_telegramBotWifiSecureClient, token) { 33 | 34 | } 35 | 36 | /** 37 | * 38 | * @return 39 | */ 40 | bool begin() override { 41 | _telegramBotWifiSecureClient.setCACert(TELEGRAM_CERTIFICATE_ROOT); 42 | 43 | return true; 44 | } 45 | }; 46 | } 47 | } 48 | } 49 | 50 | #ifdef TELEGRAM_TOKEN 51 | ELOQUENT_SINGLETON(Eloquent::Apps::Telegram::WiFiTelegramBot telegramBot(TELEGRAM_TOKEN)); 52 | #endif 53 | 54 | #endif -------------------------------------------------------------------------------- /src/eloquent/graphics/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eloquentarduino/EloquentArduino/15983e68cf82c54afadaf2b6c8fdc95cad268489/src/eloquent/graphics/.DS_Store -------------------------------------------------------------------------------- /src/eloquent/graphics/colormaps/autumn.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 18/05/2022. 3 | // 4 | 5 | #pragma once 6 | #include "../../macros.h" 7 | 8 | 9 | namespace Eloquent { 10 | namespace Graphics { 11 | namespace Colormaps { 12 | class Autumn { 13 | public: 14 | 15 | /** 16 | * Convert single byte to RGB color 17 | * @param x 18 | * @param r 19 | * @param g 20 | * @param b 21 | */ 22 | void convert(uint8_t x, uint8_t *r, uint8_t *g, uint8_t *b) { 23 | *r = red[x << 2]; 24 | *g = green[x << 2]; 25 | *b = blue[x << 2]; 26 | } 27 | 28 | protected: 29 | uint8_t red[64] = {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}; 30 | uint8_t green[64] = {0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 170, 174, 178, 182, 186, 190, 194, 198, 202, 206, 210, 214, 218, 222, 226, 230, 234, 238, 242, 246, 250, 255}; 31 | uint8_t blue[64] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 32 | }; 33 | } 34 | } 35 | } 36 | 37 | ELOQUENT_SINGLETON(Eloquent::Graphics::Colormaps::Autumn autumn); -------------------------------------------------------------------------------- /src/eloquent/graphics/colormaps/autumn_r.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 18/05/2022. 3 | // 4 | 5 | #pragma once 6 | #include "../../macros.h" 7 | 8 | 9 | namespace Eloquent { 10 | namespace Graphics { 11 | namespace Colormaps { 12 | class Autumn_r { 13 | public: 14 | 15 | /** 16 | * Convert single byte to RGB color 17 | * @param x 18 | * @param r 19 | * @param g 20 | * @param b 21 | */ 22 | void convert(uint8_t x, uint8_t *r, uint8_t *g, uint8_t *b) { 23 | *r = red[x << 2]; 24 | *g = green[x << 2]; 25 | *b = blue[x << 2]; 26 | } 27 | 28 | protected: 29 | uint8_t red[64] = {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}; 30 | uint8_t green[64] = {255, 250, 246, 242, 238, 234, 230, 226, 222, 218, 214, 210, 206, 202, 198, 194, 190, 186, 182, 178, 174, 170, 165, 161, 157, 153, 149, 145, 141, 137, 133, 129, 125, 121, 117, 113, 109, 105, 101, 97, 93, 89, 85, 80, 76, 72, 68, 64, 60, 56, 52, 48, 44, 40, 36, 32, 28, 24, 20, 16, 12, 8, 4, 0}; 31 | uint8_t blue[64] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 32 | }; 33 | } 34 | } 35 | } 36 | 37 | ELOQUENT_SINGLETON(Eloquent::Graphics::Colormaps::Autumn_r autumn_r); -------------------------------------------------------------------------------- /src/eloquent/graphics/colormaps/brg.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 18/05/2022. 3 | // 4 | 5 | #pragma once 6 | #include "../../macros.h" 7 | 8 | 9 | namespace Eloquent { 10 | namespace Graphics { 11 | namespace Colormaps { 12 | class Brg { 13 | public: 14 | 15 | /** 16 | * Convert single byte to RGB color 17 | * @param x 18 | * @param r 19 | * @param g 20 | * @param b 21 | */ 22 | void convert(uint8_t x, uint8_t *r, uint8_t *g, uint8_t *b) { 23 | *r = red[x << 2]; 24 | *g = green[x << 2]; 25 | *b = blue[x << 2]; 26 | } 27 | 28 | protected: 29 | uint8_t red[64] = {0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 89, 97, 105, 113, 121, 129, 137, 145, 153, 161, 170, 178, 186, 194, 202, 210, 218, 226, 234, 242, 250, 250, 242, 234, 226, 218, 210, 202, 194, 186, 178, 170, 161, 153, 145, 137, 129, 121, 113, 105, 97, 89, 80, 72, 64, 56, 48, 40, 32, 24, 16, 8, 0}; 30 | uint8_t green[64] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 12, 20, 28, 36, 44, 52, 60, 68, 76, 85, 93, 101, 109, 117, 125, 133, 141, 149, 157, 165, 174, 182, 190, 198, 206, 214, 222, 230, 238, 246, 255}; 31 | uint8_t blue[64] = {255, 246, 238, 230, 222, 214, 206, 198, 190, 182, 174, 165, 157, 149, 141, 133, 125, 117, 109, 101, 93, 85, 76, 68, 60, 52, 44, 36, 28, 20, 12, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 32 | }; 33 | } 34 | } 35 | } 36 | 37 | ELOQUENT_SINGLETON(Eloquent::Graphics::Colormaps::Brg brg); -------------------------------------------------------------------------------- /src/eloquent/graphics/colormaps/brg_r.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 18/05/2022. 3 | // 4 | 5 | #pragma once 6 | #include "../../macros.h" 7 | 8 | 9 | namespace Eloquent { 10 | namespace Graphics { 11 | namespace Colormaps { 12 | class Brg_r { 13 | public: 14 | 15 | /** 16 | * Convert single byte to RGB color 17 | * @param x 18 | * @param r 19 | * @param g 20 | * @param b 21 | */ 22 | void convert(uint8_t x, uint8_t *r, uint8_t *g, uint8_t *b) { 23 | *r = red[x << 2]; 24 | *g = green[x << 2]; 25 | *b = blue[x << 2]; 26 | } 27 | 28 | protected: 29 | uint8_t red[64] = {0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 89, 97, 105, 113, 121, 129, 137, 145, 153, 161, 170, 178, 186, 194, 202, 210, 218, 226, 234, 242, 250, 250, 242, 234, 226, 218, 210, 202, 194, 186, 178, 170, 161, 153, 145, 137, 129, 121, 113, 105, 97, 89, 80, 72, 64, 56, 48, 40, 32, 24, 16, 8, 0}; 30 | uint8_t green[64] = {255, 246, 238, 230, 222, 214, 206, 198, 190, 182, 174, 165, 157, 149, 141, 133, 125, 117, 109, 101, 93, 85, 76, 68, 60, 52, 44, 36, 28, 20, 12, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 31 | uint8_t blue[64] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 12, 20, 28, 36, 44, 52, 60, 68, 76, 85, 93, 101, 109, 117, 125, 133, 141, 149, 157, 165, 174, 182, 190, 198, 206, 214, 222, 230, 238, 246, 255}; 32 | }; 33 | } 34 | } 35 | } 36 | 37 | ELOQUENT_SINGLETON(Eloquent::Graphics::Colormaps::Brg_r brg_r); -------------------------------------------------------------------------------- /src/eloquent/graphics/colormaps/flag.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 18/05/2022. 3 | // 4 | 5 | #pragma once 6 | #include "../../macros.h" 7 | 8 | 9 | namespace Eloquent { 10 | namespace Graphics { 11 | namespace Colormaps { 12 | class Flag { 13 | public: 14 | 15 | /** 16 | * Convert single byte to RGB color 17 | * @param x 18 | * @param r 19 | * @param g 20 | * @param b 21 | */ 22 | void convert(uint8_t x, uint8_t *r, uint8_t *g, uint8_t *b) { 23 | *r = red[x << 2]; 24 | *g = green[x << 2]; 25 | *b = blue[x << 2]; 26 | } 27 | 28 | protected: 29 | uint8_t red[64] = {255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0}; 30 | uint8_t green[64] = {0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0}; 31 | uint8_t blue[64] = {0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0}; 32 | }; 33 | } 34 | } 35 | } 36 | 37 | ELOQUENT_SINGLETON(Eloquent::Graphics::Colormaps::Flag flag); -------------------------------------------------------------------------------- /src/eloquent/graphics/colormaps/flag_r.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 18/05/2022. 3 | // 4 | 5 | #pragma once 6 | #include "../../macros.h" 7 | 8 | 9 | namespace Eloquent { 10 | namespace Graphics { 11 | namespace Colormaps { 12 | class Flag_r { 13 | public: 14 | 15 | /** 16 | * Convert single byte to RGB color 17 | * @param x 18 | * @param r 19 | * @param g 20 | * @param b 21 | */ 22 | void convert(uint8_t x, uint8_t *r, uint8_t *g, uint8_t *b) { 23 | *r = red[x << 2]; 24 | *g = green[x << 2]; 25 | *b = blue[x << 2]; 26 | } 27 | 28 | protected: 29 | uint8_t red[64] = {0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255}; 30 | uint8_t green[64] = {0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0}; 31 | uint8_t blue[64] = {0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0}; 32 | }; 33 | } 34 | } 35 | } 36 | 37 | ELOQUENT_SINGLETON(Eloquent::Graphics::Colormaps::Flag_r flag_r); -------------------------------------------------------------------------------- /src/eloquent/graphics/colormaps/gist_heat.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 18/05/2022. 3 | // 4 | 5 | #pragma once 6 | #include "../../macros.h" 7 | 8 | 9 | namespace Eloquent { 10 | namespace Graphics { 11 | namespace Colormaps { 12 | class Gist_heat { 13 | public: 14 | 15 | /** 16 | * Convert single byte to RGB color 17 | * @param x 18 | * @param r 19 | * @param g 20 | * @param b 21 | */ 22 | void convert(uint8_t x, uint8_t *r, uint8_t *g, uint8_t *b) { 23 | *r = red[x << 2]; 24 | *g = green[x << 2]; 25 | *b = blue[x << 2]; 26 | } 27 | 28 | protected: 29 | uint8_t red[64] = {0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72, 78, 85, 91, 97, 103, 109, 115, 121, 127, 133, 139, 145, 151, 157, 163, 170, 176, 182, 188, 194, 200, 206, 212, 218, 224, 230, 236, 242, 248, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}; 30 | uint8_t green[64] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 12, 20, 28, 36, 44, 52, 60, 68, 76, 84, 93, 101, 109, 117, 125, 133, 141, 149, 157, 165, 174, 182, 190, 198, 206, 214, 222, 230, 238, 246, 255}; 31 | uint8_t blue[64] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 28, 44, 60, 76, 93, 109, 125, 141, 157, 174, 190, 206, 222, 238, 255}; 32 | }; 33 | } 34 | } 35 | } 36 | 37 | ELOQUENT_SINGLETON(Eloquent::Graphics::Colormaps::Gist_heat gist_heat); -------------------------------------------------------------------------------- /src/eloquent/graphics/colormaps/gist_heat_r.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 18/05/2022. 3 | // 4 | 5 | #pragma once 6 | #include "../../macros.h" 7 | 8 | 9 | namespace Eloquent { 10 | namespace Graphics { 11 | namespace Colormaps { 12 | class Gist_heat_r { 13 | public: 14 | 15 | /** 16 | * Convert single byte to RGB color 17 | * @param x 18 | * @param r 19 | * @param g 20 | * @param b 21 | */ 22 | void convert(uint8_t x, uint8_t *r, uint8_t *g, uint8_t *b) { 23 | *r = red[x << 2]; 24 | *g = green[x << 2]; 25 | *b = blue[x << 2]; 26 | } 27 | 28 | protected: 29 | uint8_t red[64] = {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 248, 242, 236, 230, 224, 218, 212, 206, 200, 194, 188, 182, 176, 170, 163, 157, 151, 145, 139, 133, 127, 121, 115, 109, 103, 97, 91, 85, 78, 72, 66, 60, 54, 48, 42, 36, 30, 24, 18, 12, 6, 0}; 30 | uint8_t green[64] = {255, 246, 238, 230, 222, 214, 206, 198, 190, 182, 174, 165, 157, 149, 141, 133, 125, 117, 109, 101, 93, 85, 76, 68, 60, 52, 44, 36, 28, 20, 12, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 31 | uint8_t blue[64] = {255, 238, 222, 206, 190, 174, 157, 141, 125, 109, 93, 76, 60, 44, 28, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 32 | }; 33 | } 34 | } 35 | } 36 | 37 | ELOQUENT_SINGLETON(Eloquent::Graphics::Colormaps::Gist_heat_r gist_heat_r); -------------------------------------------------------------------------------- /src/eloquent/graphics/colormaps/gnuplot.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 18/05/2022. 3 | // 4 | 5 | #pragma once 6 | #include "../../macros.h" 7 | 8 | 9 | namespace Eloquent { 10 | namespace Graphics { 11 | namespace Colormaps { 12 | class Gnuplot { 13 | public: 14 | 15 | /** 16 | * Convert single byte to RGB color 17 | * @param x 18 | * @param r 19 | * @param g 20 | * @param b 21 | */ 22 | void convert(uint8_t x, uint8_t *r, uint8_t *g, uint8_t *b) { 23 | *r = red[x << 2]; 24 | *g = green[x << 2]; 25 | *b = blue[x << 2]; 26 | } 27 | 28 | protected: 29 | uint8_t red[64] = {0, 32, 45, 55, 64, 71, 78, 85, 90, 96, 101, 106, 111, 115, 120, 124, 128, 132, 136, 140, 143, 147, 150, 154, 157, 160, 163, 166, 170, 173, 175, 178, 181, 184, 187, 190, 192, 195, 198, 200, 203, 205, 208, 210, 213, 215, 217, 220, 222, 224, 227, 229, 231, 233, 236, 238, 240, 242, 244, 246, 248, 250, 252, 255}; 30 | uint8_t green[64] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 4, 5, 5, 6, 8, 9, 10, 12, 14, 15, 17, 20, 22, 24, 27, 30, 33, 36, 40, 43, 47, 51, 55, 60, 65, 70, 75, 81, 86, 92, 99, 105, 112, 119, 127, 135, 143, 151, 160, 169, 179, 188, 198, 209, 220, 231, 243, 255}; 31 | uint8_t blue[64] = {0, 25, 50, 75, 99, 121, 143, 163, 182, 199, 214, 226, 237, 245, 251, 254, 254, 253, 248, 241, 232, 220, 207, 191, 173, 153, 132, 110, 87, 62, 38, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 32 | }; 33 | } 34 | } 35 | } 36 | 37 | ELOQUENT_SINGLETON(Eloquent::Graphics::Colormaps::Gnuplot gnuplot); -------------------------------------------------------------------------------- /src/eloquent/graphics/colormaps/gnuplot_r.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 18/05/2022. 3 | // 4 | 5 | #pragma once 6 | #include "../../macros.h" 7 | 8 | 9 | namespace Eloquent { 10 | namespace Graphics { 11 | namespace Colormaps { 12 | class Gnuplot_r { 13 | public: 14 | 15 | /** 16 | * Convert single byte to RGB color 17 | * @param x 18 | * @param r 19 | * @param g 20 | * @param b 21 | */ 22 | void convert(uint8_t x, uint8_t *r, uint8_t *g, uint8_t *b) { 23 | *r = red[x << 2]; 24 | *g = green[x << 2]; 25 | *b = blue[x << 2]; 26 | } 27 | 28 | protected: 29 | uint8_t red[64] = {255, 252, 250, 248, 246, 244, 242, 240, 238, 236, 233, 231, 229, 227, 224, 222, 220, 217, 215, 213, 210, 208, 205, 203, 200, 198, 195, 192, 190, 187, 184, 181, 178, 175, 173, 170, 166, 163, 160, 157, 154, 150, 147, 143, 140, 136, 132, 128, 124, 120, 115, 111, 106, 101, 96, 90, 85, 78, 71, 64, 55, 45, 32, 0}; 30 | uint8_t green[64] = {255, 243, 231, 220, 209, 198, 188, 179, 169, 160, 151, 143, 135, 127, 119, 112, 105, 99, 92, 86, 81, 75, 70, 65, 60, 55, 51, 47, 43, 40, 36, 33, 30, 27, 24, 22, 20, 17, 15, 14, 12, 10, 9, 8, 6, 5, 5, 4, 3, 2, 2, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 31 | uint8_t blue[64] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 38, 62, 87, 110, 132, 153, 173, 191, 207, 220, 232, 241, 248, 253, 254, 254, 251, 245, 237, 226, 214, 199, 182, 163, 143, 121, 99, 75, 50, 25, 0}; 32 | }; 33 | } 34 | } 35 | } 36 | 37 | ELOQUENT_SINGLETON(Eloquent::Graphics::Colormaps::Gnuplot_r gnuplot_r); -------------------------------------------------------------------------------- /src/eloquent/graphics/colormaps/hot.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 18/05/2022. 3 | // 4 | 5 | #pragma once 6 | #include "../../macros.h" 7 | 8 | 9 | namespace Eloquent { 10 | namespace Graphics { 11 | namespace Colormaps { 12 | class Hot { 13 | public: 14 | 15 | /** 16 | * Convert single byte to RGB color 17 | * @param x 18 | * @param r 19 | * @param g 20 | * @param b 21 | */ 22 | void convert(uint8_t x, uint8_t *r, uint8_t *g, uint8_t *b) { 23 | *r = red[x << 2]; 24 | *g = green[x << 2]; 25 | *b = blue[x << 2]; 26 | } 27 | 28 | protected: 29 | uint8_t red[64] = {10, 21, 31, 42, 53, 63, 74, 84, 95, 106, 116, 127, 138, 148, 159, 169, 180, 191, 201, 212, 223, 233, 244, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}; 30 | uint8_t green[64] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 21, 31, 42, 53, 63, 74, 85, 95, 106, 116, 127, 138, 148, 159, 169, 180, 191, 201, 212, 223, 233, 244, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}; 31 | uint8_t blue[64] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 31, 47, 63, 79, 95, 111, 127, 143, 159, 175, 191, 207, 223, 239, 255}; 32 | }; 33 | } 34 | } 35 | } 36 | 37 | ELOQUENT_SINGLETON(Eloquent::Graphics::Colormaps::Hot hot); -------------------------------------------------------------------------------- /src/eloquent/graphics/colormaps/hot_r.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 18/05/2022. 3 | // 4 | 5 | #pragma once 6 | #include "../../macros.h" 7 | 8 | 9 | namespace Eloquent { 10 | namespace Graphics { 11 | namespace Colormaps { 12 | class Hot_r { 13 | public: 14 | 15 | /** 16 | * Convert single byte to RGB color 17 | * @param x 18 | * @param r 19 | * @param g 20 | * @param b 21 | */ 22 | void convert(uint8_t x, uint8_t *r, uint8_t *g, uint8_t *b) { 23 | *r = red[x << 2]; 24 | *g = green[x << 2]; 25 | *b = blue[x << 2]; 26 | } 27 | 28 | protected: 29 | uint8_t red[64] = {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 244, 233, 223, 212, 201, 191, 180, 169, 159, 148, 138, 127, 116, 106, 95, 84, 74, 63, 53, 42, 31, 21, 10}; 30 | uint8_t green[64] = {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 254, 244, 233, 223, 212, 201, 191, 180, 169, 159, 148, 138, 127, 116, 106, 95, 85, 74, 63, 53, 42, 31, 21, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 31 | uint8_t blue[64] = {255, 239, 223, 207, 191, 175, 159, 143, 127, 111, 95, 79, 63, 47, 31, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 32 | }; 33 | } 34 | } 35 | } 36 | 37 | ELOQUENT_SINGLETON(Eloquent::Graphics::Colormaps::Hot_r hot_r); -------------------------------------------------------------------------------- /src/eloquent/graphics/colormaps/hsv.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 18/05/2022. 3 | // 4 | 5 | #pragma once 6 | #include "../../macros.h" 7 | 8 | 9 | namespace Eloquent { 10 | namespace Graphics { 11 | namespace Colormaps { 12 | class Hsv { 13 | public: 14 | 15 | /** 16 | * Convert single byte to RGB color 17 | * @param x 18 | * @param r 19 | * @param g 20 | * @param b 21 | */ 22 | void convert(uint8_t x, uint8_t *r, uint8_t *g, uint8_t *b) { 23 | *r = red[x << 2]; 24 | *g = green[x << 2]; 25 | *b = blue[x << 2]; 26 | } 27 | 28 | protected: 29 | uint8_t red[64] = {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 254, 247, 223, 199, 175, 151, 127, 103, 79, 55, 31, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 31, 55, 79, 103, 127, 151, 175, 199, 223, 247, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255}; 30 | uint8_t green[64] = {0, 23, 47, 71, 95, 119, 143, 167, 191, 215, 239, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 231, 207, 183, 159, 135, 111, 87, 63, 39, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 31 | uint8_t blue[64] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 39, 63, 87, 111, 135, 159, 183, 207, 231, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 239, 215, 191, 167, 143, 119, 95, 71, 47, 23}; 32 | }; 33 | } 34 | } 35 | } 36 | 37 | ELOQUENT_SINGLETON(Eloquent::Graphics::Colormaps::Hsv hsv); -------------------------------------------------------------------------------- /src/eloquent/graphics/colormaps/hsv_r.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 18/05/2022. 3 | // 4 | 5 | #pragma once 6 | #include "../../macros.h" 7 | 8 | 9 | namespace Eloquent { 10 | namespace Graphics { 11 | namespace Colormaps { 12 | class Hsv_r { 13 | public: 14 | 15 | /** 16 | * Convert single byte to RGB color 17 | * @param x 18 | * @param r 19 | * @param g 20 | * @param b 21 | */ 22 | void convert(uint8_t x, uint8_t *r, uint8_t *g, uint8_t *b) { 23 | *r = red[x << 2]; 24 | *g = green[x << 2]; 25 | *b = blue[x << 2]; 26 | } 27 | 28 | protected: 29 | uint8_t red[64] = {255, 255, 255, 255, 255, 255, 255, 255, 255, 254, 247, 223, 199, 175, 151, 127, 103, 79, 55, 31, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 31, 55, 79, 103, 127, 151, 175, 199, 223, 247, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}; 30 | uint8_t green[64] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 39, 63, 87, 111, 135, 159, 183, 207, 231, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 239, 215, 191, 167, 143, 119, 95, 71, 47, 23, 0}; 31 | uint8_t blue[64] = {23, 47, 71, 95, 119, 143, 167, 191, 215, 239, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 254, 231, 207, 183, 159, 135, 111, 87, 63, 39, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 32 | }; 33 | } 34 | } 35 | } 36 | 37 | ELOQUENT_SINGLETON(Eloquent::Graphics::Colormaps::Hsv_r hsv_r); -------------------------------------------------------------------------------- /src/eloquent/graphics/colormaps/jet.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 18/05/2022. 3 | // 4 | 5 | #pragma once 6 | #include "../../macros.h" 7 | 8 | 9 | namespace Eloquent { 10 | namespace Graphics { 11 | namespace Colormaps { 12 | class Jet { 13 | public: 14 | 15 | /** 16 | * Convert single byte to RGB color 17 | * @param x 18 | * @param r 19 | * @param g 20 | * @param b 21 | */ 22 | void convert(uint8_t x, uint8_t *r, uint8_t *g, uint8_t *b) { 23 | *r = red[x << 2]; 24 | *g = green[x << 2]; 25 | *b = blue[x << 2]; 26 | } 27 | 28 | protected: 29 | uint8_t red[64] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 25, 38, 51, 64, 77, 90, 103, 116, 129, 142, 156, 169, 182, 195, 208, 221, 234, 247, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 237, 219, 201, 182, 164, 145, 127}; 30 | uint8_t green[64] = {0, 0, 0, 0, 0, 0, 0, 0, 2, 18, 34, 50, 66, 82, 99, 115, 131, 147, 163, 180, 196, 212, 228, 244, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 244, 229, 214, 199, 184, 169, 154, 139, 124, 109, 94, 79, 64, 49, 34, 19, 4, 0, 0, 0, 0, 0, 0}; 31 | uint8_t blue[64] = {127, 145, 164, 182, 201, 219, 237, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 247, 234, 221, 208, 195, 182, 169, 156, 142, 129, 116, 103, 90, 77, 64, 51, 38, 25, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 32 | }; 33 | } 34 | } 35 | } 36 | 37 | ELOQUENT_SINGLETON(Eloquent::Graphics::Colormaps::Jet jet); -------------------------------------------------------------------------------- /src/eloquent/graphics/colormaps/jet_r.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 18/05/2022. 3 | // 4 | 5 | #pragma once 6 | #include "../../macros.h" 7 | 8 | 9 | namespace Eloquent { 10 | namespace Graphics { 11 | namespace Colormaps { 12 | class Jet_r { 13 | public: 14 | 15 | /** 16 | * Convert single byte to RGB color 17 | * @param x 18 | * @param r 19 | * @param g 20 | * @param b 21 | */ 22 | void convert(uint8_t x, uint8_t *r, uint8_t *g, uint8_t *b) { 23 | *r = red[x << 2]; 24 | *g = green[x << 2]; 25 | *b = blue[x << 2]; 26 | } 27 | 28 | protected: 29 | uint8_t red[64] = {127, 145, 164, 182, 201, 219, 237, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 247, 234, 221, 208, 195, 182, 169, 156, 142, 129, 116, 103, 90, 77, 64, 51, 38, 25, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 30 | uint8_t green[64] = {0, 0, 0, 0, 0, 0, 4, 19, 34, 49, 64, 79, 94, 109, 124, 139, 154, 169, 184, 199, 214, 229, 244, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 244, 228, 212, 196, 180, 163, 147, 131, 115, 99, 82, 66, 50, 34, 18, 2, 0, 0, 0, 0, 0, 0, 0, 0}; 31 | uint8_t blue[64] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 25, 38, 51, 64, 77, 90, 103, 116, 129, 142, 156, 169, 182, 195, 208, 221, 234, 247, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 237, 219, 201, 182, 164, 145, 127}; 32 | }; 33 | } 34 | } 35 | } 36 | 37 | ELOQUENT_SINGLETON(Eloquent::Graphics::Colormaps::Jet_r jet_r); -------------------------------------------------------------------------------- /src/eloquent/graphics/colormaps/nipy_spectral.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 18/05/2022. 3 | // 4 | 5 | #pragma once 6 | #include "../../macros.h" 7 | 8 | 9 | namespace Eloquent { 10 | namespace Graphics { 11 | namespace Colormaps { 12 | class Nipy_spectral { 13 | public: 14 | 15 | /** 16 | * Convert single byte to RGB color 17 | * @param x 18 | * @param r 19 | * @param g 20 | * @param b 21 | */ 22 | void convert(uint8_t x, uint8_t *r, uint8_t *g, uint8_t *b) { 23 | *r = red[x << 2]; 24 | *g = green[x << 2]; 25 | *b = blue[x << 2]; 26 | } 27 | 28 | protected: 29 | uint8_t red[64] = {0, 37, 75, 113, 123, 128, 134, 105, 62, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 71, 130, 187, 203, 220, 236, 242, 248, 253, 255, 255, 255, 255, 255, 255, 250, 239, 228, 219, 213, 208, 204, 204, 204, 204}; 30 | uint8_t green[64] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 52, 90, 121, 132, 143, 153, 158, 164, 169, 170, 170, 170, 165, 160, 154, 160, 170, 181, 192, 203, 213, 224, 235, 246, 255, 255, 255, 254, 249, 243, 238, 228, 217, 206, 191, 175, 159, 123, 75, 26, 0, 0, 0, 0, 0, 0, 9, 74, 139, 204}; 31 | uint8_t blue[64] = {0, 43, 86, 129, 140, 145, 151, 156, 162, 167, 178, 195, 211, 221, 221, 221, 221, 221, 221, 219, 203, 187, 170, 159, 148, 138, 101, 58, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 74, 139, 204}; 32 | }; 33 | } 34 | } 35 | } 36 | 37 | ELOQUENT_SINGLETON(Eloquent::Graphics::Colormaps::Nipy_spectral nipy_spectral); -------------------------------------------------------------------------------- /src/eloquent/graphics/colormaps/ocean.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 18/05/2022. 3 | // 4 | 5 | #pragma once 6 | #include "../../macros.h" 7 | 8 | 9 | namespace Eloquent { 10 | namespace Graphics { 11 | namespace Colormaps { 12 | class Ocean { 13 | public: 14 | 15 | /** 16 | * Convert single byte to RGB color 17 | * @param x 18 | * @param r 19 | * @param g 20 | * @param b 21 | */ 22 | void convert(uint8_t x, uint8_t *r, uint8_t *g, uint8_t *b) { 23 | *r = red[x << 2]; 24 | *g = green[x << 2]; 25 | *b = blue[x << 2]; 26 | } 27 | 28 | protected: 29 | uint8_t red[64] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 24, 36, 48, 60, 72, 84, 97, 109, 121, 133, 145, 157, 169, 182, 194, 206, 218, 230, 242, 255}; 30 | uint8_t green[64] = {127, 121, 115, 109, 103, 97, 91, 85, 78, 72, 66, 60, 54, 48, 42, 36, 30, 24, 18, 12, 6, 0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72, 78, 85, 91, 97, 103, 109, 115, 121, 127, 133, 139, 145, 151, 157, 163, 169, 176, 182, 188, 194, 200, 206, 212, 218, 224, 230, 236, 242, 248, 255}; 31 | uint8_t blue[64] = {0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 170, 174, 178, 182, 186, 190, 194, 198, 202, 206, 210, 214, 218, 222, 226, 230, 234, 238, 242, 246, 250, 255}; 32 | }; 33 | } 34 | } 35 | } 36 | 37 | ELOQUENT_SINGLETON(Eloquent::Graphics::Colormaps::Ocean ocean); -------------------------------------------------------------------------------- /src/eloquent/graphics/colormaps/ocean_r.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 18/05/2022. 3 | // 4 | 5 | #pragma once 6 | #include "../../macros.h" 7 | 8 | 9 | namespace Eloquent { 10 | namespace Graphics { 11 | namespace Colormaps { 12 | class Ocean_r { 13 | public: 14 | 15 | /** 16 | * Convert single byte to RGB color 17 | * @param x 18 | * @param r 19 | * @param g 20 | * @param b 21 | */ 22 | void convert(uint8_t x, uint8_t *r, uint8_t *g, uint8_t *b) { 23 | *r = red[x << 2]; 24 | *g = green[x << 2]; 25 | *b = blue[x << 2]; 26 | } 27 | 28 | protected: 29 | uint8_t red[64] = {255, 242, 230, 218, 206, 194, 182, 169, 157, 145, 133, 121, 109, 97, 85, 72, 60, 48, 36, 24, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 30 | uint8_t green[64] = {255, 248, 242, 236, 230, 224, 218, 212, 206, 200, 194, 188, 182, 176, 170, 163, 157, 151, 145, 139, 133, 127, 121, 115, 109, 103, 97, 91, 85, 78, 72, 66, 60, 54, 48, 42, 36, 30, 24, 18, 12, 6, 0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72, 78, 84, 91, 97, 103, 109, 115, 121, 127}; 31 | uint8_t blue[64] = {255, 250, 246, 242, 238, 234, 230, 226, 222, 218, 214, 210, 206, 202, 198, 194, 190, 186, 182, 178, 174, 170, 165, 161, 157, 153, 149, 145, 141, 137, 133, 129, 125, 121, 117, 113, 109, 105, 101, 97, 93, 89, 85, 80, 76, 72, 68, 64, 60, 56, 52, 48, 44, 40, 36, 32, 28, 24, 20, 16, 12, 8, 4, 0}; 32 | }; 33 | } 34 | } 35 | } 36 | 37 | ELOQUENT_SINGLETON(Eloquent::Graphics::Colormaps::Ocean_r ocean_r); -------------------------------------------------------------------------------- /src/eloquent/graphics/colormaps/prism.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 18/05/2022. 3 | // 4 | 5 | #pragma once 6 | #include "../../macros.h" 7 | 8 | 9 | namespace Eloquent { 10 | namespace Graphics { 11 | namespace Colormaps { 12 | class Prism { 13 | public: 14 | 15 | /** 16 | * Convert single byte to RGB color 17 | * @param x 18 | * @param r 19 | * @param g 20 | * @param b 21 | */ 22 | void convert(uint8_t x, uint8_t *r, uint8_t *g, uint8_t *b) { 23 | *r = red[x << 2]; 24 | *g = green[x << 2]; 25 | *b = blue[x << 2]; 26 | } 27 | 28 | protected: 29 | uint8_t red[64] = {255, 255, 222, 37, 0, 116, 255, 255, 227, 41, 0, 111, 255, 255, 233, 46, 0, 105, 255, 255, 238, 50, 0, 100, 255, 255, 243, 54, 0, 95, 255, 255, 249, 59, 0, 90, 255, 255, 254, 64, 0, 84, 255, 255, 255, 69, 0, 79, 255, 255, 255, 73, 0, 74, 255, 255, 255, 78, 0, 69, 255, 255, 255, 84}; 30 | uint8_t green[64] = {0, 132, 255, 221, 38, 0, 0, 127, 255, 225, 43, 0, 0, 121, 255, 229, 49, 0, 0, 115, 255, 232, 55, 0, 0, 110, 255, 236, 60, 0, 0, 104, 255, 239, 66, 0, 0, 98, 255, 242, 72, 0, 0, 93, 253, 246, 77, 0, 0, 87, 250, 249, 83, 0, 0, 81, 248, 251, 89, 0, 0, 76, 245, 254}; 31 | uint8_t blue[64] = {0, 0, 0, 0, 240, 246, 8, 0, 0, 0, 235, 250, 16, 0, 0, 0, 230, 253, 25, 0, 0, 0, 226, 255, 33, 0, 0, 0, 221, 255, 41, 0, 0, 0, 215, 255, 50, 0, 0, 0, 210, 255, 58, 0, 0, 0, 204, 255, 66, 0, 0, 0, 198, 255, 74, 0, 0, 0, 192, 255, 82, 0, 0, 0}; 32 | }; 33 | } 34 | } 35 | } 36 | 37 | ELOQUENT_SINGLETON(Eloquent::Graphics::Colormaps::Prism prism); -------------------------------------------------------------------------------- /src/eloquent/graphics/colormaps/prism_r.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 18/05/2022. 3 | // 4 | 5 | #pragma once 6 | #include "../../macros.h" 7 | 8 | 9 | namespace Eloquent { 10 | namespace Graphics { 11 | namespace Colormaps { 12 | class Prism_r { 13 | public: 14 | 15 | /** 16 | * Convert single byte to RGB color 17 | * @param x 18 | * @param r 19 | * @param g 20 | * @param b 21 | */ 22 | void convert(uint8_t x, uint8_t *r, uint8_t *g, uint8_t *b) { 23 | *r = red[x << 2]; 24 | *g = green[x << 2]; 25 | *b = blue[x << 2]; 26 | } 27 | 28 | protected: 29 | uint8_t red[64] = {84, 255, 255, 255, 69, 0, 78, 255, 255, 255, 74, 0, 73, 255, 255, 255, 79, 0, 69, 255, 255, 255, 84, 0, 64, 254, 255, 255, 90, 0, 59, 249, 255, 255, 95, 0, 54, 243, 255, 255, 100, 0, 50, 238, 255, 255, 105, 0, 46, 233, 255, 255, 111, 0, 41, 227, 255, 255, 116, 0, 37, 222, 255, 255}; 30 | uint8_t green[64] = {254, 245, 76, 0, 0, 89, 251, 248, 81, 0, 0, 83, 249, 250, 87, 0, 0, 77, 246, 253, 93, 0, 0, 72, 242, 255, 98, 0, 0, 66, 239, 255, 104, 0, 0, 60, 236, 255, 110, 0, 0, 55, 232, 255, 115, 0, 0, 49, 229, 255, 121, 0, 0, 43, 225, 255, 127, 0, 0, 38, 221, 255, 132, 0}; 31 | uint8_t blue[64] = {0, 0, 0, 82, 255, 192, 0, 0, 0, 74, 255, 198, 0, 0, 0, 66, 255, 204, 0, 0, 0, 58, 255, 210, 0, 0, 0, 50, 255, 215, 0, 0, 0, 41, 255, 221, 0, 0, 0, 33, 255, 226, 0, 0, 0, 25, 253, 230, 0, 0, 0, 16, 250, 235, 0, 0, 0, 8, 246, 240, 0, 0, 0, 0}; 32 | }; 33 | } 34 | } 35 | } 36 | 37 | ELOQUENT_SINGLETON(Eloquent::Graphics::Colormaps::Prism_r prism_r); -------------------------------------------------------------------------------- /src/eloquent/graphics/colormaps/seismic.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 18/05/2022. 3 | // 4 | 5 | #pragma once 6 | #include "../../macros.h" 7 | 8 | 9 | namespace Eloquent { 10 | namespace Graphics { 11 | namespace Colormaps { 12 | class Seismic { 13 | public: 14 | 15 | /** 16 | * Convert single byte to RGB color 17 | * @param x 18 | * @param r 19 | * @param g 20 | * @param b 21 | */ 22 | void convert(uint8_t x, uint8_t *r, uint8_t *g, uint8_t *b) { 23 | *r = red[x << 2]; 24 | *g = green[x << 2]; 25 | *b = blue[x << 2]; 26 | } 27 | 28 | protected: 29 | uint8_t red[64] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 20, 36, 52, 68, 85, 101, 117, 133, 149, 165, 182, 198, 214, 230, 246, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 248, 240, 232, 224, 216, 208, 200, 192, 184, 176, 167, 159, 151, 143, 135, 127}; 30 | uint8_t green[64] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 20, 36, 52, 68, 85, 101, 117, 133, 149, 165, 182, 198, 214, 230, 246, 246, 230, 214, 198, 182, 165, 149, 133, 117, 101, 85, 68, 52, 36, 20, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 31 | uint8_t blue[64] = {76, 87, 99, 110, 121, 133, 144, 155, 167, 178, 189, 201, 212, 223, 235, 246, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 246, 230, 214, 198, 182, 165, 149, 133, 117, 101, 85, 68, 52, 36, 20, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 32 | }; 33 | } 34 | } 35 | } 36 | 37 | ELOQUENT_SINGLETON(Eloquent::Graphics::Colormaps::Seismic seismic); -------------------------------------------------------------------------------- /src/eloquent/graphics/colormaps/seismic_r.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 18/05/2022. 3 | // 4 | 5 | #pragma once 6 | #include "../../macros.h" 7 | 8 | 9 | namespace Eloquent { 10 | namespace Graphics { 11 | namespace Colormaps { 12 | class Seismic_r { 13 | public: 14 | 15 | /** 16 | * Convert single byte to RGB color 17 | * @param x 18 | * @param r 19 | * @param g 20 | * @param b 21 | */ 22 | void convert(uint8_t x, uint8_t *r, uint8_t *g, uint8_t *b) { 23 | *r = red[x << 2]; 24 | *g = green[x << 2]; 25 | *b = blue[x << 2]; 26 | } 27 | 28 | protected: 29 | uint8_t red[64] = {127, 135, 143, 151, 159, 167, 176, 184, 192, 200, 208, 216, 224, 232, 240, 248, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 246, 230, 214, 198, 182, 165, 149, 133, 117, 101, 85, 68, 52, 36, 20, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 30 | uint8_t green[64] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 20, 36, 52, 68, 85, 101, 117, 133, 149, 165, 182, 198, 214, 230, 246, 246, 230, 214, 198, 182, 165, 149, 133, 117, 101, 85, 68, 52, 36, 20, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 31 | uint8_t blue[64] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 20, 36, 52, 68, 85, 101, 117, 133, 149, 165, 182, 198, 214, 230, 246, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 246, 235, 223, 212, 201, 189, 178, 167, 155, 144, 133, 121, 110, 99, 87, 76}; 32 | }; 33 | } 34 | } 35 | } 36 | 37 | ELOQUENT_SINGLETON(Eloquent::Graphics::Colormaps::Seismic_r seismic_r); -------------------------------------------------------------------------------- /src/eloquent/graphics/colormaps/winter.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 18/05/2022. 3 | // 4 | 5 | #pragma once 6 | #include "../../macros.h" 7 | 8 | 9 | namespace Eloquent { 10 | namespace Graphics { 11 | namespace Colormaps { 12 | class Winter { 13 | public: 14 | 15 | /** 16 | * Convert single byte to RGB color 17 | * @param x 18 | * @param r 19 | * @param g 20 | * @param b 21 | */ 22 | void convert(uint8_t x, uint8_t *r, uint8_t *g, uint8_t *b) { 23 | *r = red[x << 2]; 24 | *g = green[x << 2]; 25 | *b = blue[x << 2]; 26 | } 27 | 28 | protected: 29 | uint8_t red[64] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 30 | uint8_t green[64] = {0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 170, 174, 178, 182, 186, 190, 194, 198, 202, 206, 210, 214, 218, 222, 226, 230, 234, 238, 242, 246, 250, 255}; 31 | uint8_t blue[64] = {255, 252, 250, 248, 246, 244, 242, 240, 238, 236, 234, 232, 230, 228, 226, 224, 222, 220, 218, 216, 214, 212, 210, 208, 206, 204, 202, 200, 198, 196, 194, 192, 190, 188, 186, 184, 182, 180, 178, 176, 174, 172, 170, 167, 165, 163, 161, 159, 157, 155, 153, 151, 149, 147, 145, 143, 141, 139, 137, 135, 133, 131, 129, 127}; 32 | }; 33 | } 34 | } 35 | } 36 | 37 | ELOQUENT_SINGLETON(Eloquent::Graphics::Colormaps::Winter winter); -------------------------------------------------------------------------------- /src/eloquent/graphics/colormaps/winter_r.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 18/05/2022. 3 | // 4 | 5 | #pragma once 6 | #include "../../macros.h" 7 | 8 | 9 | namespace Eloquent { 10 | namespace Graphics { 11 | namespace Colormaps { 12 | class Winter_r { 13 | public: 14 | 15 | /** 16 | * Convert single byte to RGB color 17 | * @param x 18 | * @param r 19 | * @param g 20 | * @param b 21 | */ 22 | void convert(uint8_t x, uint8_t *r, uint8_t *g, uint8_t *b) { 23 | *r = red[x << 2]; 24 | *g = green[x << 2]; 25 | *b = blue[x << 2]; 26 | } 27 | 28 | protected: 29 | uint8_t red[64] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 30 | uint8_t green[64] = {255, 250, 246, 242, 238, 234, 230, 226, 222, 218, 214, 210, 206, 202, 198, 194, 190, 186, 182, 178, 174, 170, 165, 161, 157, 153, 149, 145, 141, 137, 133, 129, 125, 121, 117, 113, 109, 105, 101, 97, 93, 89, 85, 80, 76, 72, 68, 64, 60, 56, 52, 48, 44, 40, 36, 32, 28, 24, 20, 16, 12, 8, 4, 0}; 31 | uint8_t blue[64] = {127, 129, 131, 133, 135, 137, 139, 141, 143, 145, 147, 149, 151, 153, 155, 157, 159, 161, 163, 165, 167, 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232, 234, 236, 238, 240, 242, 244, 246, 248, 250, 252, 255}; 32 | }; 33 | } 34 | } 35 | } 36 | 37 | ELOQUENT_SINGLETON(Eloquent::Graphics::Colormaps::Winter_r winter_r); -------------------------------------------------------------------------------- /src/eloquent/io/json.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 17/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "./json/JsonEncoder.h" -------------------------------------------------------------------------------- /src/eloquent/macros.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 04/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | 8 | #ifdef ELOQUENT_NO_SINGLETON 9 | #define ELOQUENT_SINGLETON(expr) 10 | #else 11 | #define ELOQUENT_SINGLETON(expr) expr; 12 | #endif -------------------------------------------------------------------------------- /src/eloquent/modules/vl53l5cx/4x4.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 29/05/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../vl53l5cx.h" 8 | 9 | Eloquent::Modules::Vl53l5cx vllcx(4 * 4); -------------------------------------------------------------------------------- /src/eloquent/modules/vl53l5cx/8x8.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 29/05/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../vl53l5cx.h" 8 | 9 | Eloquent::Modules::Vl53l5cx vllcx(8 * 8); -------------------------------------------------------------------------------- /src/eloquent/networking/wifi.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 12/04/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include "../macros.h" 9 | 10 | 11 | namespace Eloquent { 12 | namespace Networking { 13 | class WiFiHelper { 14 | public: 15 | 16 | /** 17 | * 18 | * @param ssid 19 | * @param password 20 | * @return 21 | */ 22 | bool connectTo(const char *ssid, const char *password, uint16_t timeout = 10000) { 23 | WiFi.mode(WIFI_STA); 24 | WiFi.begin(ssid, password); 25 | 26 | uint16_t start = millis(); 27 | 28 | while (millis() - start < timeout) { 29 | if (WiFi.status() == WL_CONNECTED) 30 | return true; 31 | } 32 | 33 | return false; 34 | } 35 | }; 36 | } 37 | } 38 | 39 | ELOQUENT_SINGLETON(Eloquent::Networking::WiFiHelper wifi); -------------------------------------------------------------------------------- /src/eloquent/perf.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 23/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | 8 | /** 9 | * An ugly hack to override the micros function 10 | * @shame 11 | * @return 12 | */ 13 | uint32_t _________micros() { 14 | return micros(); 15 | } 16 | 17 | 18 | namespace eloquent { 19 | namespace perf { 20 | 21 | template 22 | uint32_t micros(Function function) { 23 | uint32_t start = _________micros(); 24 | 25 | function(); 26 | 27 | return _________micros() - start; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/eloquent/print.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 08/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | 10 | namespace eloquent { 11 | namespace print { 12 | 13 | /** 14 | * 15 | * @tparam Printer 16 | * @param stream 17 | * @param fmt 18 | * @param ... 19 | */ 20 | template 21 | void printf(Printer &printer, char *fmt, ...) { 22 | char buf[256]; 23 | 24 | va_list args; 25 | va_start (args, fmt ); 26 | vsnprintf(buf, 256, fmt, args); 27 | va_end (args); 28 | printer.print(buf); 29 | } 30 | 31 | /** 32 | * Stop condition for print_all 33 | * @tparam Printer 34 | * @param printer 35 | */ 36 | template 37 | void print_all(Printer& printer) { 38 | 39 | } 40 | 41 | /** 42 | * Print all arguments 43 | * @tparam Printer 44 | * @tparam T 45 | * @tparam Args 46 | * @param stream 47 | * @param first 48 | * @param args 49 | */ 50 | template 51 | void print_all(Printer& printer, T first, Args... args) { 52 | printer.print(first); 53 | print_all(printer, args...); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/eloquent/tinyml/edgeimpulse.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 15/04/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | 8 | #include "./edgeimpulse/impulse.h" -------------------------------------------------------------------------------- /src/eloquent/utils.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 13/04/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | 8 | namespace eloquent { 9 | 10 | /** 11 | * Print a message forever 12 | * @tparam Printer 13 | * @tparam Message 14 | * @param printer 15 | * @param message 16 | * @param interval 17 | */ 18 | template 19 | void abort(Printer &printer, Message message, uint16_t interval = 1000) { 20 | while (true) { 21 | printer.print(message); 22 | printer.print('\n'); 23 | delay(interval); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/eloquent/vision/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eloquentarduino/EloquentArduino/15983e68cf82c54afadaf2b6c8fdc95cad268489/src/eloquent/vision/.DS_Store -------------------------------------------------------------------------------- /src/eloquent/vision/camera/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eloquentarduino/EloquentArduino/15983e68cf82c54afadaf2b6c8fdc95cad268489/src/eloquent/vision/camera/.DS_Store -------------------------------------------------------------------------------- /src/eloquent/vision/camera/Errors.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 04/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | 8 | namespace Eloquent { 9 | namespace Vision { 10 | namespace Cam { 11 | enum class Error { 12 | OK, 13 | INIT_ERROR, 14 | CAPTURE_ERROR 15 | }; 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/eloquent/vision/camera/aithinker.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 06/07/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #define PWDN_GPIO_NUM 32 8 | #define RESET_GPIO_NUM -1 9 | #define XCLK_GPIO_NUM 0 10 | #define SIOD_GPIO_NUM 26 11 | #define SIOC_GPIO_NUM 27 12 | 13 | #define Y9_GPIO_NUM 35 14 | #define Y8_GPIO_NUM 34 15 | #define Y7_GPIO_NUM 39 16 | #define Y6_GPIO_NUM 36 17 | #define Y5_GPIO_NUM 21 18 | #define Y4_GPIO_NUM 19 19 | #define Y3_GPIO_NUM 18 20 | #define Y2_GPIO_NUM 5 21 | #define VSYNC_GPIO_NUM 25 22 | #define HREF_GPIO_NUM 23 23 | #define PCLK_GPIO_NUM 22 24 | 25 | #include "./esp32.h" -------------------------------------------------------------------------------- /src/eloquent/vision/camera/decoders.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 06/07/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "./decoders/gray.h" -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eloquentarduino/EloquentArduino/15983e68cf82c54afadaf2b6c8fdc95cad268489/src/eloquent/vision/camera/esp32/.DS_Store -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/aithinker/gray/96x96.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/x96x96.h" 9 | #include "../../pins/aithinker.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * 96x96 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::x96x96 image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_96X96; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/aithinker/gray/hd.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/hd.h" 9 | #include "../../pins/aithinker.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * HD 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::Hd image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_HD; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/aithinker/gray/hvga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/hvga.h" 9 | #include "../../pins/aithinker.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * HVGA 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::Hvga image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_HVGA; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/aithinker/gray/qcif.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/qcif.h" 9 | #include "../../pins/aithinker.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * QCIF 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::Qcif image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_QCIF; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/aithinker/gray/qqvga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/qqvga.h" 9 | #include "../../pins/aithinker.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * QQVGA 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::Qqvga image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_QQVGA; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/aithinker/gray/qvga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/qvga.h" 9 | #include "../../pins/aithinker.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * QVGA 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::Qvga image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_QVGA; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/aithinker/gray/uxga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/uxga.h" 9 | #include "../../pins/aithinker.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * UXGA 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::Uxga image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_UXGA; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/aithinker/gray/vga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/vga.h" 9 | #include "../../pins/aithinker.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * VGA 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::Vga image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_VGA; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/aithinker/jpeg/qqvga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 24/06/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | 8 | #include "../jpeg.h" 9 | 10 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::QqvgaJpegCamera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/aithinker/jpeg/qvga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 24/06/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | 8 | #include "../jpeg.h" 9 | 10 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::QvgaJpegCamera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/aithinker/jpeg/vga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 24/06/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | 8 | #include "../jpeg.h" 9 | 10 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::VgaJpegCamera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/eye/gray/96x96.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/x96x96.h" 9 | #include "../../pins/eye.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * 96x96 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::x96x96 image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_96X96; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/eye/gray/hd.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/hd.h" 9 | #include "../../pins/eye.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * HD 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::Hd image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_HD; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/eye/gray/hvga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/hvga.h" 9 | #include "../../pins/eye.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * HVGA 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::Hvga image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_HVGA; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/eye/gray/qcif.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/qcif.h" 9 | #include "../../pins/eye.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * QCIF 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::Qcif image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_QCIF; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/eye/gray/qqvga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/qqvga.h" 9 | #include "../../pins/eye.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * QQVGA 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::Qqvga image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_QQVGA; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/eye/gray/qvga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/qvga.h" 9 | #include "../../pins/eye.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * QVGA 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::Qvga image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_QVGA; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/eye/gray/uxga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/uxga.h" 9 | #include "../../pins/eye.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * UXGA 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::Uxga image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_UXGA; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/eye/gray/vga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/vga.h" 9 | #include "../../pins/eye.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * VGA 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::Vga image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_VGA; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/m5/gray/96x96.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/x96x96.h" 9 | #include "../../pins/m5stack.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * 96x96 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::x96x96 image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_96X96; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/m5/gray/hd.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/hd.h" 9 | #include "../../pins/m5stack.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * HD 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::Hd image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_HD; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/m5/gray/hvga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/hvga.h" 9 | #include "../../pins/m5stack.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * HVGA 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::Hvga image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_HVGA; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/m5/gray/qcif.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/qcif.h" 9 | #include "../../pins/m5stack.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * QCIF 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::Qcif image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_QCIF; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/m5/gray/qqvga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/qqvga.h" 9 | #include "../../pins/m5stack.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * QQVGA 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::Qqvga image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_QQVGA; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/m5/gray/qvga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/qvga.h" 9 | #include "../../pins/m5stack.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * QVGA 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::Qvga image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_QVGA; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/m5/gray/uxga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/uxga.h" 9 | #include "../../pins/m5stack.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * UXGA 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::Uxga image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_UXGA; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/m5/gray/vga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/vga.h" 9 | #include "../../pins/m5stack.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * VGA 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::Vga image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_VGA; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/m5wide/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eloquentarduino/EloquentArduino/15983e68cf82c54afadaf2b6c8fdc95cad268489/src/eloquent/vision/camera/esp32/m5wide/.DS_Store -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/m5wide/gray/96x96.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/x96x96.h" 9 | #include "../../pins/m5wide.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * 96x96 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::x96x96 image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_96X96; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/m5wide/gray/hd.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/hd.h" 9 | #include "../../pins/m5wide.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * HD 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::Hd image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_HD; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/m5wide/gray/hvga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/hvga.h" 9 | #include "../../pins/m5wide.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * HVGA 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::Hvga image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_HVGA; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/m5wide/gray/qcif.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/qcif.h" 9 | #include "../../pins/m5wide.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * QCIF 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::Qcif image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_QCIF; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/m5wide/gray/qqvga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/qqvga.h" 9 | #include "../../pins/m5wide.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * QQVGA 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::Qqvga image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_QQVGA; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/m5wide/gray/qvga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/qvga.h" 9 | #include "../../pins/m5wide.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * QVGA 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::Qvga image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_QVGA; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/m5wide/gray/uxga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/uxga.h" 9 | #include "../../pins/m5wide.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * UXGA 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::Uxga image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_UXGA; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/m5wide/gray/vga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/vga.h" 9 | #include "../../pins/m5wide.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * VGA 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::Vga image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_VGA; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/m5wide/jpeg/qqvga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 24/06/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | 8 | #include "../jpeg.h" 9 | 10 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::QqvgaJpegCamera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/m5wide/jpeg/qvga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 24/06/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | 8 | #include "../jpeg.h" 9 | 10 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::QvgaJpegCamera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/m5wide/jpeg/vga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 24/06/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | 8 | #include "../jpeg.h" 9 | 10 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::VgaJpegCamera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/m5wide/m5wide.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 24/06/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../pins/m5wide.h" 8 | #include "../BaseEsp32Camera.h" 9 | 10 | 11 | namespace Eloquent { 12 | namespace Vision { 13 | namespace Cam { 14 | namespace Esp32 { 15 | class M5WideCamera : public BaseEsp32Camera { 16 | protected: 17 | /** 18 | * 19 | */ 20 | void configureSensor() { 21 | //vflip(); 22 | //hmirror(); 23 | } 24 | }; 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/pins/aithinker.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #define PWDN_GPIO_NUM 32 8 | #define RESET_GPIO_NUM -1 9 | #define XCLK_GPIO_NUM 0 10 | #define SIOD_GPIO_NUM 26 11 | #define SIOC_GPIO_NUM 27 12 | 13 | #define Y9_GPIO_NUM 35 14 | #define Y8_GPIO_NUM 34 15 | #define Y7_GPIO_NUM 39 16 | #define Y6_GPIO_NUM 36 17 | #define Y5_GPIO_NUM 21 18 | #define Y4_GPIO_NUM 19 19 | #define Y3_GPIO_NUM 18 20 | #define Y2_GPIO_NUM 5 21 | #define VSYNC_GPIO_NUM 25 22 | #define HREF_GPIO_NUM 23 23 | #define PCLK_GPIO_NUM 22 -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/pins/eye.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #define PWDN_GPIO_NUM -1 8 | #define RESET_GPIO_NUM -1 9 | #define XCLK_GPIO_NUM 4 10 | #define SIOD_GPIO_NUM 18 11 | #define SIOC_GPIO_NUM 23 12 | 13 | #define Y9_GPIO_NUM 36 14 | #define Y8_GPIO_NUM 37 15 | #define Y7_GPIO_NUM 38 16 | #define Y6_GPIO_NUM 39 17 | #define Y5_GPIO_NUM 35 18 | #define Y4_GPIO_NUM 14 19 | #define Y3_GPIO_NUM 13 20 | #define Y2_GPIO_NUM 34 21 | #define VSYNC_GPIO_NUM 5 22 | #define HREF_GPIO_NUM 27 23 | #define PCLK_GPIO_NUM 25 -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/pins/m5stack.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #define PWDN_GPIO_NUM -1 8 | #define RESET_GPIO_NUM 15 9 | #define XCLK_GPIO_NUM 27 10 | #define SIOD_GPIO_NUM 25 11 | #define SIOC_GPIO_NUM 23 12 | 13 | #define Y9_GPIO_NUM 19 14 | #define Y8_GPIO_NUM 36 15 | #define Y7_GPIO_NUM 18 16 | #define Y6_GPIO_NUM 39 17 | #define Y5_GPIO_NUM 5 18 | #define Y4_GPIO_NUM 34 19 | #define Y3_GPIO_NUM 35 20 | #define Y2_GPIO_NUM 32 21 | #define VSYNC_GPIO_NUM 22 22 | #define HREF_GPIO_NUM 26 23 | #define PCLK_GPIO_NUM 21 -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/pins/m5wide.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #define PWDN_GPIO_NUM -1 8 | #define RESET_GPIO_NUM 15 9 | #define XCLK_GPIO_NUM 27 10 | #define SIOD_GPIO_NUM 22 11 | #define SIOC_GPIO_NUM 23 12 | 13 | #define Y9_GPIO_NUM 19 14 | #define Y8_GPIO_NUM 36 15 | #define Y7_GPIO_NUM 18 16 | #define Y6_GPIO_NUM 39 17 | #define Y5_GPIO_NUM 5 18 | #define Y4_GPIO_NUM 34 19 | #define Y3_GPIO_NUM 35 20 | #define Y2_GPIO_NUM 32 21 | #define VSYNC_GPIO_NUM 25 22 | #define HREF_GPIO_NUM 26 23 | #define PCLK_GPIO_NUM 21 -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/pins/wrover.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #define PWDN_GPIO_NUM -1 8 | #define RESET_GPIO_NUM -1 9 | #define XCLK_GPIO_NUM 21 10 | #define SIOD_GPIO_NUM 26 11 | #define SIOC_GPIO_NUM 27 12 | 13 | #define Y9_GPIO_NUM 35 14 | #define Y8_GPIO_NUM 34 15 | #define Y7_GPIO_NUM 39 16 | #define Y6_GPIO_NUM 36 17 | #define Y5_GPIO_NUM 19 18 | #define Y4_GPIO_NUM 18 19 | #define Y3_GPIO_NUM 5 20 | #define Y2_GPIO_NUM 4 21 | #define VSYNC_GPIO_NUM 25 22 | #define HREF_GPIO_NUM 23 23 | #define PCLK_GPIO_NUM 22 -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/wrover/gray/96x96.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/x96x96.h" 9 | #include "../../pins/wrover.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * 96x96 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::x96x96 image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_96X96; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/wrover/gray/hd.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/hd.h" 9 | #include "../../pins/wrover.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * HD 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::Hd image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_HD; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/wrover/gray/hvga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/hvga.h" 9 | #include "../../pins/wrover.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * HVGA 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::Hvga image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_HVGA; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/wrover/gray/qcif.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/qcif.h" 9 | #include "../../pins/wrover.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * QCIF 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::Qcif image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_QCIF; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/wrover/gray/qqvga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/qqvga.h" 9 | #include "../../pins/wrover.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * QQVGA 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::Qqvga image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_QQVGA; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/wrover/gray/qvga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/qvga.h" 9 | #include "../../pins/wrover.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * QVGA 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::Qvga image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_QVGA; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/wrover/gray/uxga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/uxga.h" 9 | #include "../../pins/wrover.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * UXGA 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::Uxga image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_UXGA; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/esp32/wrover/gray/vga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 31/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../../macros.h" 8 | #include "../../../../image/gray/vga.h" 9 | #include "../../pins/wrover.h" 10 | #include "../../BaseEsp32Camera.h" 11 | 12 | 13 | namespace Eloquent { 14 | namespace Vision { 15 | namespace Cam { 16 | namespace Esp32 { 17 | /** 18 | * M5 wide 19 | * Grayscale 20 | * VGA 21 | */ 22 | class Camera : public BaseEsp32Camera { 23 | public: 24 | Eloquent::Vision::Image::Gray::Vga image; 25 | 26 | /** 27 | * 28 | * @return 29 | */ 30 | framesize_t getFrameSize() { 31 | return FRAMESIZE_VGA; 32 | } 33 | 34 | /** 35 | * 36 | * @return 37 | */ 38 | pixformat_t getPixFormat() { 39 | return PIXFORMAT_GRAYSCALE; 40 | } 41 | 42 | /** 43 | * 44 | * @param buffer 45 | */ 46 | void setFrameBuffer(uint8_t *buffer) { 47 | image.refresh(buffer); 48 | } 49 | 50 | }; 51 | } 52 | } 53 | } 54 | } 55 | 56 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::Esp32::Camera camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/eye.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 06/07/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #define PWDN_GPIO_NUM -1 8 | #define RESET_GPIO_NUM -1 9 | #define XCLK_GPIO_NUM 4 10 | #define SIOD_GPIO_NUM 18 11 | #define SIOC_GPIO_NUM 23 12 | 13 | #define Y9_GPIO_NUM 36 14 | #define Y8_GPIO_NUM 37 15 | #define Y7_GPIO_NUM 38 16 | #define Y6_GPIO_NUM 39 17 | #define Y5_GPIO_NUM 35 18 | #define Y4_GPIO_NUM 14 19 | #define Y3_GPIO_NUM 13 20 | #define Y2_GPIO_NUM 34 21 | #define VSYNC_GPIO_NUM 5 22 | #define HREF_GPIO_NUM 27 23 | #define PCLK_GPIO_NUM 25 24 | 25 | #include "./esp32.h" -------------------------------------------------------------------------------- /src/eloquent/vision/camera/m5stack.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 06/07/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #define PWDN_GPIO_NUM -1 8 | #define RESET_GPIO_NUM 15 9 | #define XCLK_GPIO_NUM 27 10 | #define SIOD_GPIO_NUM 25 11 | #define SIOC_GPIO_NUM 23 12 | 13 | #define Y9_GPIO_NUM 19 14 | #define Y8_GPIO_NUM 36 15 | #define Y7_GPIO_NUM 18 16 | #define Y6_GPIO_NUM 39 17 | #define Y5_GPIO_NUM 5 18 | #define Y4_GPIO_NUM 34 19 | #define Y3_GPIO_NUM 35 20 | #define Y2_GPIO_NUM 32 21 | #define VSYNC_GPIO_NUM 22 22 | #define HREF_GPIO_NUM 26 23 | #define PCLK_GPIO_NUM 21 24 | 25 | #include "./esp32.h" -------------------------------------------------------------------------------- /src/eloquent/vision/camera/m5wide.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 06/07/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #define PWDN_GPIO_NUM -1 8 | #define RESET_GPIO_NUM 15 9 | #define XCLK_GPIO_NUM 27 10 | #define SIOD_GPIO_NUM 22 11 | #define SIOC_GPIO_NUM 23 12 | 13 | #define Y9_GPIO_NUM 19 14 | #define Y8_GPIO_NUM 36 15 | #define Y7_GPIO_NUM 18 16 | #define Y6_GPIO_NUM 39 17 | #define Y5_GPIO_NUM 5 18 | #define Y4_GPIO_NUM 34 19 | #define Y3_GPIO_NUM 35 20 | #define Y2_GPIO_NUM 32 21 | #define VSYNC_GPIO_NUM 25 22 | #define HREF_GPIO_NUM 26 23 | #define PCLK_GPIO_NUM 21 24 | 25 | #include "./esp32.h" -------------------------------------------------------------------------------- /src/eloquent/vision/camera/ov767x/gray/cif.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 29/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../macros.h" 8 | #include "../../../image/gray/cif.h" 9 | #include "../BaseOV767x.h" 10 | 11 | using namespace Eloquent::Vision::Cam::OV767x; 12 | 13 | 14 | namespace Eloquent { 15 | namespace Vision { 16 | namespace Cam { 17 | namespace OV767x { 18 | namespace Gray { 19 | /** 20 | * OV767x grayscale camera CIF resolution 21 | */ 22 | class Cif : public BaseOV767x<352, 240, 1> { 23 | public: 24 | Eloquent::Vision::Image::Gray::Cif image; 25 | 26 | protected: 27 | 28 | /** 29 | * 30 | * @return 31 | */ 32 | bool configure() override { 33 | return Camera.begin(CIF, GRAYSCALE, _fps); 34 | } 35 | 36 | /** 37 | * 38 | * @param buffer 39 | */ 40 | void setFrameBuffer(uint8_t *buffer) override { 41 | this->image.refresh(buffer); 42 | } 43 | }; 44 | } 45 | } 46 | } 47 | } 48 | } 49 | 50 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::OV767x::Gray::Cif camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/ov767x/gray/qcif.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 29/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../macros.h" 8 | #include "../../../image/gray/qcif.h" 9 | #include "../BaseOV767x.h" 10 | 11 | using namespace Eloquent::Vision::Cam::OV767x; 12 | 13 | 14 | namespace Eloquent { 15 | namespace Vision { 16 | namespace Cam { 17 | namespace OV767x { 18 | namespace Gray { 19 | /** 20 | * OV767x grayscale camera QCIF resolution 21 | */ 22 | class Qcif : public BaseOV767x<176, 144, 1> { 23 | public: 24 | Eloquent::Vision::Image::Gray::Qcif image; 25 | 26 | protected: 27 | 28 | /** 29 | * 30 | * @return 31 | */ 32 | bool configure() override { 33 | return Camera.begin(QCIF, GRAYSCALE, _fps); 34 | } 35 | 36 | /** 37 | * 38 | * @param buffer 39 | */ 40 | void setFrameBuffer(uint8_t *buffer) override { 41 | this->image.refresh(buffer); 42 | } 43 | }; 44 | } 45 | } 46 | } 47 | } 48 | } 49 | 50 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::OV767x::Gray::Qcif camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/ov767x/gray/qqvga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 29/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../macros.h" 8 | #include "../../../image/gray/qqvga.h" 9 | #include "../BaseOV767x.h" 10 | 11 | using namespace Eloquent::Vision::Cam::OV767x; 12 | 13 | 14 | namespace Eloquent { 15 | namespace Vision { 16 | namespace Cam { 17 | namespace OV767x { 18 | namespace Gray { 19 | /** 20 | * OV767x grayscale camera QQVGA resolution 21 | */ 22 | class Qqvga : public BaseOV767x<160, 120, 1> { 23 | public: 24 | Eloquent::Vision::Image::Gray::Qqvga image; 25 | 26 | protected: 27 | 28 | /** 29 | * 30 | * @return 31 | */ 32 | bool configure() override { 33 | return Camera.begin(QQVGA, GRAYSCALE, _fps); 34 | } 35 | 36 | /** 37 | * 38 | * @param buffer 39 | */ 40 | void setFrameBuffer(uint8_t *buffer) override { 41 | this->image.refresh(buffer); 42 | } 43 | }; 44 | } 45 | } 46 | } 47 | } 48 | } 49 | 50 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::OV767x::Gray::Qqvga camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/ov767x/gray/qvga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 29/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../macros.h" 8 | #include "../../../image/gray/qvga.h" 9 | #include "../BaseOV767x.h" 10 | 11 | using namespace Eloquent::Vision::Cam::OV767x; 12 | 13 | 14 | namespace Eloquent { 15 | namespace Vision { 16 | namespace Cam { 17 | namespace OV767x { 18 | namespace Gray { 19 | /** 20 | * OV767x grayscale camera QVGA resolution 21 | */ 22 | class Qvga : public BaseOV767x<320, 240, 1> { 23 | public: 24 | Eloquent::Vision::Image::Gray::Qvga image; 25 | 26 | protected: 27 | 28 | /** 29 | * 30 | * @return 31 | */ 32 | bool configure() override { 33 | return Camera.begin(QVGA, GRAYSCALE, _fps); 34 | } 35 | 36 | /** 37 | * 38 | * @param buffer 39 | */ 40 | void setFrameBuffer(uint8_t *buffer) override { 41 | this->image.refresh(buffer); 42 | } 43 | }; 44 | } 45 | } 46 | } 47 | } 48 | } 49 | 50 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::OV767x::Gray::Qvga camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/ov767x/gray/vga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 29/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "../../../../macros.h" 8 | #include "../../../image/gray/vga.h" 9 | #include "../BaseOV767x.h" 10 | 11 | using namespace Eloquent::Vision::Cam::OV767x; 12 | 13 | 14 | namespace Eloquent { 15 | namespace Vision { 16 | namespace Cam { 17 | namespace OV767x { 18 | namespace Gray { 19 | /** 20 | * OV767x grayscale camera VGA resolution 21 | */ 22 | class Vga : public BaseOV767x<640, 480, 1> { 23 | public: 24 | Eloquent::Vision::Image::Gray::Vga image; 25 | 26 | protected: 27 | 28 | /** 29 | * 30 | * @return 31 | */ 32 | bool configure() override { 33 | return Camera.begin(VGA, GRAYSCALE, _fps); 34 | } 35 | 36 | /** 37 | * 38 | * @param buffer 39 | */ 40 | void setFrameBuffer(uint8_t *buffer) override { 41 | this->image.refresh(buffer); 42 | } 43 | }; 44 | } 45 | } 46 | } 47 | } 48 | } 49 | 50 | ELOQUENT_SINGLETON(Eloquent::Vision::Cam::OV767x::Gray::Vga camera); -------------------------------------------------------------------------------- /src/eloquent/vision/camera/wrover.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 06/07/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #define PWDN_GPIO_NUM -1 8 | #define RESET_GPIO_NUM -1 9 | #define XCLK_GPIO_NUM 21 10 | #define SIOD_GPIO_NUM 26 11 | #define SIOC_GPIO_NUM 27 12 | 13 | #define Y9_GPIO_NUM 35 14 | #define Y8_GPIO_NUM 34 15 | #define Y7_GPIO_NUM 39 16 | #define Y6_GPIO_NUM 36 17 | #define Y5_GPIO_NUM 19 18 | #define Y4_GPIO_NUM 18 19 | #define Y3_GPIO_NUM 5 20 | #define Y2_GPIO_NUM 4 21 | #define VSYNC_GPIO_NUM 25 22 | #define HREF_GPIO_NUM 23 23 | #define PCLK_GPIO_NUM 22 24 | 25 | #include "./esp32.h" -------------------------------------------------------------------------------- /src/eloquent/vision/image/gray/cif.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 30/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "./custom.h" 8 | 9 | 10 | namespace Eloquent { 11 | namespace Vision { 12 | namespace Image { 13 | namespace Gray { 14 | /** 15 | * Grayscale image at CIF resolution 16 | */ 17 | class Cif : public Custom<352, 240> { 18 | 19 | }; 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/eloquent/vision/image/gray/hd.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 30/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "./custom.h" 8 | 9 | 10 | namespace Eloquent { 11 | namespace Vision { 12 | namespace Image { 13 | namespace Gray { 14 | /** 15 | * Grayscale image at UXGA resolution 16 | */ 17 | class Hd : public Custom<1280, 720> { 18 | 19 | }; 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/eloquent/vision/image/gray/hvga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 30/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "./custom.h" 8 | 9 | 10 | namespace Eloquent { 11 | namespace Vision { 12 | namespace Image { 13 | namespace Gray { 14 | /** 15 | * Grayscale image at HVGA resolution 16 | */ 17 | class Hvga : public Custom<480, 320> { 18 | 19 | }; 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/eloquent/vision/image/gray/qcif.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 30/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "./custom.h" 8 | 9 | 10 | namespace Eloquent { 11 | namespace Vision { 12 | namespace Image { 13 | namespace Gray { 14 | /** 15 | * Grayscale image at QCIF resolution 16 | */ 17 | class Qcif : public Custom<176, 144> { 18 | 19 | }; 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/eloquent/vision/image/gray/qqvga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 30/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "./custom.h" 8 | 9 | 10 | namespace Eloquent { 11 | namespace Vision { 12 | namespace Image { 13 | namespace Gray { 14 | /** 15 | * Grayscale image at QQVGA resolution 16 | */ 17 | class Qqvga : public Custom<160, 120> { 18 | 19 | }; 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/eloquent/vision/image/gray/qvga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 30/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "./custom.h" 8 | 9 | 10 | namespace Eloquent { 11 | namespace Vision { 12 | namespace Image { 13 | namespace Gray { 14 | /** 15 | * Grayscale image at QVGA resolution 16 | */ 17 | class Qvga : public Custom<320, 240> { 18 | 19 | }; 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/eloquent/vision/image/gray/uxga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 30/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "./custom.h" 8 | 9 | 10 | namespace Eloquent { 11 | namespace Vision { 12 | namespace Image { 13 | namespace Gray { 14 | /** 15 | * Grayscale image at UXGA resolution 16 | */ 17 | class Uxga : public Custom<1600, 1200> { 18 | 19 | }; 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/eloquent/vision/image/gray/vga.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 30/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "./custom.h" 8 | 9 | 10 | namespace Eloquent { 11 | namespace Vision { 12 | namespace Image { 13 | namespace Gray { 14 | /** 15 | * Grayscale image at VGA resolution 16 | */ 17 | class Vga : public Custom<640, 480> { 18 | 19 | }; 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/eloquent/vision/image/gray/x96x96.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 30/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include "./custom.h" 8 | 9 | 10 | namespace Eloquent { 11 | namespace Vision { 12 | namespace Image { 13 | namespace Gray { 14 | /** 15 | * Grayscale image at 96x96 resolution 16 | */ 17 | class x96x96 : public Custom<96, 96> { 18 | 19 | }; 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/eloquent/vision/jpeg.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 24/03/2022. 3 | // 4 | 5 | #include "./jpeg/JpegEncoder.h" -------------------------------------------------------------------------------- /src/eloquent/vision/jpeg/bitbank2/BitBankJpegEncoder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "./definitions.h" 4 | #include "./jpeg.inl" 5 | 6 | 7 | /** 8 | * 9 | */ 10 | namespace Eloquent { 11 | namespace Dependencies { 12 | namespace BitBank2 { 13 | template 14 | class JpegEncoder { 15 | public: 16 | JpegEncoder(Stream *stream) : 17 | _stream(stream) { 18 | 19 | } 20 | 21 | int open() { 22 | memset(&_jpeg, 0, sizeof(JPEGIMAGE)); 23 | _jpeg.pHighWater = &_jpeg.ucFileBuf[JPEG_FILE_BUF_SIZE - 512]; 24 | 25 | return JPEG_SUCCESS; 26 | } 27 | 28 | int close() { 29 | return JPEGEncodeEnd(_stream, &_jpeg); 30 | } 31 | 32 | int encodeBegin(JPEGENCODE *pEncode, int iWidth, int iHeight, uint8_t ucPixelType, uint8_t ucSubSample, uint8_t ucQFactor) { 33 | return JPEGEncodeBegin(&_jpeg, pEncode, iWidth, iHeight, ucPixelType, ucSubSample, ucQFactor); 34 | } 35 | 36 | int addMCU(JPEGENCODE *pEncode, uint8_t *pPixels, int iPitch) { 37 | return JPEGAddMCU(_stream, &_jpeg, pEncode, pPixels, iPitch); 38 | } 39 | 40 | int getLastError() { 41 | return _jpeg.iError; 42 | } 43 | 44 | protected: 45 | Stream *_stream; 46 | JPEGIMAGE _jpeg; 47 | }; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/eloquent/vision/motion.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 17/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | 8 | #include "motion/NaiveMotionDetector.h" 9 | -------------------------------------------------------------------------------- /src/eloquent/vision/transform.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simone on 04/03/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | 8 | //#include "transform/gray/Transform.h" 9 | //#include "transform/gray/NearestResize.h" --------------------------------------------------------------------------------