├── .gitignore ├── Accessory └── ServoKit180_360 │ ├── Arduino │ └── ServoKit180_360 │ │ └── ServoKit180_360.ino │ └── UIFlow │ └── ServoKit.m5f ├── App ├── BalaC-Plus │ ├── Arduino │ │ └── BalaCplus │ │ │ └── BalaCplus.ino │ └── UIFlow │ │ └── BalaC-Plus.m5f ├── BalaC │ ├── Arduino │ │ └── Balac │ │ │ └── Balac.ino │ └── UIFlow │ │ └── BALAC.m5f ├── IIoTDual │ └── IIoTDual.ino ├── M5IoT-kit │ ├── DC-Motor │ │ └── DC-Motor.ino │ ├── Microphone │ │ └── Microphone.ino │ ├── joystick │ │ └── joystick.ino │ └── servo │ │ └── servo.ino ├── M5SCALE_DIY_kit │ ├── Arduino │ │ └── M5SCALE_DIY_kit │ │ │ ├── HX711.cpp │ │ │ ├── HX711.h │ │ │ └── M5SCALE_DIY_kit.ino │ └── UIFlow │ │ └── M5SCALE_DIY_kit.m5f ├── M5StickC_Slot │ └── M5StickC_Slot.zip ├── PIANO │ └── Arduino │ │ └── M5PIANO │ │ └── M5PIANO.ino ├── RoverC_TrackLine │ ├── StickC │ │ └── main.cpp │ ├── pid.py │ └── run.py ├── UnitV │ └── track_ball │ │ ├── track_ball.ino │ │ └── track_ball.py └── acSocketCtl │ ├── .gitignore │ ├── .travis.yml │ ├── .vscode │ ├── extensions.json │ └── settings.json │ ├── acSocketCtl.ino │ ├── acSoclet.cpp │ ├── modbus.c │ ├── modbus.h │ ├── protocol.cpp │ └── protocol.h ├── Application ├── Bala2 │ ├── .gitignore │ ├── Bala2.ino │ ├── MadgwickAHRS.cpp │ ├── MadgwickAHRS.h │ ├── README.md │ ├── bala.cpp │ ├── bala.h │ ├── bala2.bin │ ├── bala_img.c │ ├── calibration.cpp │ ├── calibration.h │ ├── imu_filter.cpp │ ├── imu_filter.h │ ├── pid.cpp │ └── pid.h ├── RoverC_Arduino_Alone │ ├── RoverC.cpp │ ├── RoverC.h │ └── RoverC_Arduino_Alone.ino ├── RoverC_PRO_Arduino_Alone │ ├── RoverC.cpp │ ├── RoverC.h │ └── RoverC_PRO_Arduino_Alone.ino └── butterfly │ ├── butterfly.m5b │ └── butterfly_core.m5f ├── AtomBase ├── AtomFLY │ ├── AtomFLY.ino │ ├── AtomFly.cpp │ └── AtomFly.h ├── AtomHub │ └── Arduino_LED_Hap │ │ ├── .gitattributes │ │ ├── .vs │ │ ├── ESPHap │ │ │ └── v15 │ │ │ │ └── .suo │ │ ├── ProjectSettings.json │ │ ├── VSWorkspaceState.json │ │ └── slnx.sqlite │ │ ├── Arduino_LED_HAP.ino │ │ ├── LICENSE │ │ ├── aa.c │ │ ├── accessories.c │ │ ├── arduino_homekit_server.cpp │ │ ├── arduino_homekit_server.h │ │ ├── base64.c │ │ ├── base64.h │ │ ├── bench.c │ │ ├── cJSON.c │ │ ├── cJSON.h │ │ ├── cJSON_Utils.c │ │ ├── cJSON_Utils.h │ │ ├── cQueue.c │ │ ├── cQueue.h │ │ ├── characteristics.h │ │ ├── crypto.c │ │ ├── crypto.h │ │ ├── debug.c │ │ ├── debug.h │ │ ├── hapfilestorage │ │ └── hapfilestorage.hpp │ │ ├── homeintegration.c │ │ ├── homeintegration.h │ │ ├── homekit.h │ │ ├── homekitintegrationcpp.cpp │ │ ├── homekitintegrationcpp.h │ │ ├── http_parser.c │ │ ├── http_parser.h │ │ ├── json.c │ │ ├── json.h │ │ ├── keywords.txt │ │ ├── library.json │ │ ├── library.properties │ │ ├── mdnsA8266.cpp │ │ ├── mdnsA8266.h │ │ ├── mdnsresponder.c │ │ ├── mdnsresponder.h │ │ ├── os_settings.h │ │ ├── pairing.c │ │ ├── pairing.h │ │ ├── port.c │ │ ├── port.h │ │ ├── port_x.h │ │ ├── query_params.c │ │ ├── query_params.h │ │ ├── release_notes.md │ │ ├── server.c │ │ ├── serverA8266.c │ │ ├── serverA8266.not │ │ ├── storage.c │ │ ├── storage.h │ │ ├── storage_ex.h │ │ ├── tlv.c │ │ ├── tlv.h │ │ ├── types.h │ │ ├── watchdog.c │ │ ├── watchdog.h │ │ ├── wolfSSL_3_13_0.rar │ │ ├── wolfssl │ │ ├── settings.h │ │ ├── user_settings.h │ │ └── wolfSSL.rar │ │ ├── xrtos.c │ │ └── xrtos.h ├── AtomHubSwitch │ ├── AtomHubSwitch │ │ └── AtomHubSwitch.ino │ └── UIFlow │ │ └── AtomHubSwitch.m5f ├── AtomicGPS │ ├── AtomicGPS.ino │ ├── GPSAnalyse.cpp │ └── GPSAnalyse.h ├── AtomicQR │ ├── AtomicQR │ │ └── AtomicQR.ino │ └── UIFlow │ │ └── Atomic_QR.m5f ├── AtomicRS232 │ ├── Arduino │ │ └── AtomicRS232 │ │ │ └── AtomicRS232.ino │ └── UIFlow │ │ └── AtomicRS232.m5f ├── AtomicRS485 │ ├── Arduino │ │ └── AtomicRS485 │ │ │ └── AtomicRS485.ino │ └── UIFlow │ │ └── AtomicRS485.m5f ├── AtomicTF │ └── AtomicTF.ino ├── Atomic_StepMotor │ ├── Atomic_StepMotor │ │ ├── Atomic_StepMotor.ino │ │ ├── StepperDriver.cpp │ │ └── StepperDriver.h │ └── UIFlow │ │ └── STEPMOTOR.m5f └── Tail485 │ ├── Tail485 │ └── Tail485.ino │ └── UIFlow │ └── Tail485.m5f ├── Base ├── BTC │ └── Arduino │ │ ├── BTC │ │ ├── BTC.ino │ │ ├── DHT12.cpp │ │ ├── DHT12.h │ │ └── README.md │ │ └── BTC2.1 │ │ ├── Adafruit_Sensor.h │ │ ├── BTC2.1.ino │ │ ├── SHT3X.cpp │ │ └── SHT3X.h ├── BaseX │ ├── Arduino │ │ └── BaseX │ │ │ ├── BaseX.cpp │ │ │ ├── BaseX.h │ │ │ └── BaseX.ino │ └── UIFlow │ │ └── BASEX.m5f ├── LAN │ └── Arduino │ │ └── W5500 │ │ └── WebServer │ │ └── WebServer.ino ├── M5GO_BOTTOM2 │ ├── M5GO_BOTTOM2.ino │ ├── fft.cpp │ └── fft.h ├── PM2.5 │ ├── DFRobot_SHT20.cpp │ ├── DFRobot_SHT20.h │ ├── Free_Fonts.h │ └── P25.ino └── W5500_PoE │ └── W5500_PoE.ino ├── BasicExamples ├── dual_core.ino │ └── dual_core.ino └── i2c_scanner │ └── i2c_scanner.ino ├── Core ├── Atom │ ├── Arduino │ │ └── LEDDisplayNumber │ │ │ └── LEDDisplayNumber.ino │ ├── Atom Lite │ │ └── atomLite.m5f │ ├── Atom Matrix │ │ └── AtomMatrix.m5f │ └── AtomEcho │ │ ├── Arduino │ │ ├── EchoSTT │ │ │ ├── BaiduRest.cpp │ │ │ ├── BaiduRest.h │ │ │ └── EchoSTT.ino │ │ ├── EchoSTT2QiYeWX │ │ │ ├── BaiduRest.cpp │ │ │ ├── BaiduRest.h │ │ │ └── EchoSTT2QiYeWX.ino │ │ ├── Factory_Test │ │ │ ├── 11-fanfare.c │ │ │ ├── Factory_Test.ino │ │ │ ├── fft.cpp │ │ │ └── fft.h │ │ ├── Repeater │ │ │ └── Repeater.ino │ │ └── StreamHttpClient_ECHO │ │ │ ├── .travis.yml │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── StreamHttpClient_ECHO │ │ │ └── StreamHttpClient_ECHO.ino │ │ │ ├── keywords.txt │ │ │ ├── library.json │ │ │ ├── library.properties │ │ │ ├── src │ │ │ ├── AudioFileSource.h │ │ │ ├── AudioFileSourceBuffer.cpp │ │ │ ├── AudioFileSourceBuffer.h │ │ │ ├── AudioFileSourceFS.cpp │ │ │ ├── AudioFileSourceFS.h │ │ │ ├── AudioFileSourceHTTPStream.cpp │ │ │ ├── AudioFileSourceHTTPStream.h │ │ │ ├── AudioFileSourceICYStream.cpp │ │ │ ├── AudioFileSourceICYStream.h │ │ │ ├── AudioFileSourceID3.cpp │ │ │ ├── AudioFileSourceID3.h │ │ │ ├── AudioFileSourcePROGMEM.cpp │ │ │ ├── AudioFileSourcePROGMEM.h │ │ │ ├── AudioFileSourceSD.cpp │ │ │ ├── AudioFileSourceSD.h │ │ │ ├── AudioFileSourceSPIFFS.h │ │ │ ├── AudioFileSourceSPIRAMBuffer.cpp │ │ │ ├── AudioFileSourceSPIRAMBuffer.h │ │ │ ├── AudioFileSourceSTDIO.cpp │ │ │ ├── AudioFileSourceSTDIO.h │ │ │ ├── AudioFileStream.cpp │ │ │ ├── AudioFileStream.h │ │ │ ├── AudioGenerator.h │ │ │ ├── AudioGeneratorAAC.cpp │ │ │ ├── AudioGeneratorAAC.h │ │ │ ├── AudioGeneratorFLAC.cpp │ │ │ ├── AudioGeneratorFLAC.h │ │ │ ├── AudioGeneratorMIDI.cpp │ │ │ ├── AudioGeneratorMIDI.h │ │ │ ├── AudioGeneratorMOD.cpp │ │ │ ├── AudioGeneratorMOD.h │ │ │ ├── AudioGeneratorMP3.cpp │ │ │ ├── AudioGeneratorMP3.h │ │ │ ├── AudioGeneratorMP3a.cpp │ │ │ ├── AudioGeneratorMP3a.h │ │ │ ├── AudioGeneratorRTTTL.cpp │ │ │ ├── AudioGeneratorRTTTL.h │ │ │ ├── AudioGeneratorWAV.cpp │ │ │ ├── AudioGeneratorWAV.h │ │ │ ├── AudioLogger.cpp │ │ │ ├── AudioLogger.h │ │ │ ├── AudioOutput.h │ │ │ ├── AudioOutputBuffer.cpp │ │ │ ├── AudioOutputBuffer.h │ │ │ ├── AudioOutputFilterDecimate.cpp │ │ │ ├── AudioOutputFilterDecimate.h │ │ │ ├── AudioOutputI2S.cpp │ │ │ ├── AudioOutputI2S.h │ │ │ ├── AudioOutputI2SNoDAC.cpp │ │ │ ├── AudioOutputI2SNoDAC.h │ │ │ ├── AudioOutputMixer.cpp │ │ │ ├── AudioOutputMixer.h │ │ │ ├── AudioOutputNull.h │ │ │ ├── AudioOutputSPIFFSWAV.cpp │ │ │ ├── AudioOutputSPIFFSWAV.h │ │ │ ├── AudioOutputSTDIO.cpp │ │ │ ├── AudioOutputSTDIO.h │ │ │ ├── AudioOutputSerialWAV.cpp │ │ │ ├── AudioOutputSerialWAV.h │ │ │ ├── AudioStatus.h │ │ │ ├── libflac │ │ │ │ ├── AUTHORS │ │ │ │ ├── COPYING.FDL │ │ │ │ ├── COPYING.GPL │ │ │ │ ├── COPYING.LGPL │ │ │ │ ├── COPYING.Xiph │ │ │ │ ├── FLAC │ │ │ │ │ ├── assert.h │ │ │ │ │ ├── callback.h │ │ │ │ │ ├── export.h │ │ │ │ │ ├── format.h │ │ │ │ │ ├── metadata.h │ │ │ │ │ ├── ordinals.h │ │ │ │ │ └── stream_decoder.h │ │ │ │ ├── README │ │ │ │ ├── README.ESP8266 │ │ │ │ ├── bitmath.c │ │ │ │ ├── bitreader.c │ │ │ │ ├── config.h │ │ │ │ ├── cpu.c │ │ │ │ ├── crc.c │ │ │ │ ├── fixed.c │ │ │ │ ├── float.c │ │ │ │ ├── format.c │ │ │ │ ├── lpc.c │ │ │ │ ├── md5.c │ │ │ │ ├── memory.c │ │ │ │ ├── private │ │ │ │ │ ├── bitmath.h │ │ │ │ │ ├── bitreader.h │ │ │ │ │ ├── cpu.h │ │ │ │ │ ├── crc.h │ │ │ │ │ ├── fixed.h │ │ │ │ │ ├── float.h │ │ │ │ │ ├── format.h │ │ │ │ │ ├── lpc.h │ │ │ │ │ ├── macros.h │ │ │ │ │ ├── md5.h │ │ │ │ │ ├── memory.h │ │ │ │ │ ├── metadata.h │ │ │ │ │ └── window.h │ │ │ │ ├── protected │ │ │ │ │ ├── all.h │ │ │ │ │ ├── stream_decoder.h │ │ │ │ │ └── stream_encoder.h │ │ │ │ ├── share │ │ │ │ │ ├── alloc.h │ │ │ │ │ ├── compat.h │ │ │ │ │ ├── endswap.h │ │ │ │ │ ├── getopt.h │ │ │ │ │ ├── macros.h │ │ │ │ │ ├── private.h │ │ │ │ │ ├── safe_str.h │ │ │ │ │ └── utf8.h │ │ │ │ ├── stream_decoder.c │ │ │ │ └── window.c │ │ │ ├── libhelix-aac │ │ │ │ ├── aaccommon.h │ │ │ │ ├── aacdec.c │ │ │ │ ├── aacdec.h │ │ │ │ ├── aactabs.c │ │ │ │ ├── assembly.h │ │ │ │ ├── bitstream.c │ │ │ │ ├── bitstream.h │ │ │ │ ├── buffers.c │ │ │ │ ├── coder.h │ │ │ │ ├── dct4.c │ │ │ │ ├── decelmnt.c │ │ │ │ ├── dequant.c │ │ │ │ ├── fft.c │ │ │ │ ├── filefmt.c │ │ │ │ ├── huffman.c │ │ │ │ ├── hufftabs.c │ │ │ │ ├── imdct.c │ │ │ │ ├── noiseless.c │ │ │ │ ├── pns.c │ │ │ │ ├── readme.txt │ │ │ │ ├── sbr.c │ │ │ │ ├── sbr.h │ │ │ │ ├── sbrfft.c │ │ │ │ ├── sbrfreq.c │ │ │ │ ├── sbrhfadj.c │ │ │ │ ├── sbrhfgen.c │ │ │ │ ├── sbrhuff.c │ │ │ │ ├── sbrimdct.c │ │ │ │ ├── sbrmath.c │ │ │ │ ├── sbrqmf.c │ │ │ │ ├── sbrside.c │ │ │ │ ├── sbrtabs.c │ │ │ │ ├── statname.h │ │ │ │ ├── stproc.c │ │ │ │ ├── tns.c │ │ │ │ └── trigtabs.c │ │ │ ├── libhelix-mp3 │ │ │ │ ├── LICENSE.txt │ │ │ │ ├── RCSL.txt │ │ │ │ ├── RPSL.txt │ │ │ │ ├── assembly.h │ │ │ │ ├── bitstream.c │ │ │ │ ├── buffers.c │ │ │ │ ├── coder.h │ │ │ │ ├── dct32.c │ │ │ │ ├── dequant.c │ │ │ │ ├── dqchan.c │ │ │ │ ├── huffman.c │ │ │ │ ├── hufftabs.c │ │ │ │ ├── imdct.c │ │ │ │ ├── mp3common.h │ │ │ │ ├── mp3dec.c │ │ │ │ ├── mp3dec.h │ │ │ │ ├── mp3tabs.c │ │ │ │ ├── mpadecobjfixpt.h │ │ │ │ ├── player.h │ │ │ │ ├── polyphase.c │ │ │ │ ├── scalfact.c │ │ │ │ ├── statname.h │ │ │ │ ├── stproc.c │ │ │ │ ├── subband.c │ │ │ │ └── trigtabs.c │ │ │ ├── libmad │ │ │ │ ├── CHANGES │ │ │ │ ├── COPYING │ │ │ │ ├── COPYRIGHT │ │ │ │ ├── CREDITS │ │ │ │ ├── D.dat.h │ │ │ │ ├── LICENSE │ │ │ │ ├── README │ │ │ │ ├── README.ESP8266 │ │ │ │ ├── TODO │ │ │ │ ├── VERSION │ │ │ │ ├── bit.c │ │ │ │ ├── bit.h │ │ │ │ ├── config.h │ │ │ │ ├── decoder.c │ │ │ │ ├── decoder.h │ │ │ │ ├── fixed.c │ │ │ │ ├── fixed.h │ │ │ │ ├── frame.c │ │ │ │ ├── frame.h │ │ │ │ ├── global.h │ │ │ │ ├── huffman.c │ │ │ │ ├── huffman.h │ │ │ │ ├── imdct_s.dat.h │ │ │ │ ├── layer3.c │ │ │ │ ├── layer3.h │ │ │ │ ├── mad.h │ │ │ │ ├── mad.h.sed │ │ │ │ ├── qc_table.dat.h │ │ │ │ ├── rq_table.dat.h │ │ │ │ ├── sf_table.dat.h │ │ │ │ ├── stream.c │ │ │ │ ├── stream.h │ │ │ │ ├── synth.c │ │ │ │ ├── synth.h │ │ │ │ ├── timer.c │ │ │ │ ├── timer.h │ │ │ │ ├── version.c │ │ │ │ └── version.h │ │ │ └── libtinysoundfont │ │ │ │ ├── LICENSE │ │ │ │ ├── README.ESP8266 │ │ │ │ ├── README.md │ │ │ │ └── tsf.h │ │ │ └── tests │ │ │ ├── common.sh │ │ │ └── host │ │ │ ├── Arduino.h │ │ │ ├── Makefile │ │ │ ├── Serial.cpp │ │ │ ├── aac.cpp │ │ │ ├── mp3.cpp │ │ │ └── wav.cpp │ │ └── Factory_BT_SPEAKER_Firmware │ │ ├── BIN │ │ └── Atom_echo_a2dp_led_0x00.bin │ │ └── a2dp_sink_led │ │ ├── CMakeLists.txt │ │ ├── Makefile │ │ ├── README.md │ │ ├── main │ │ ├── CMakeLists.txt │ │ ├── Kconfig.projbuild │ │ ├── bt_app_av.c │ │ ├── bt_app_av.h │ │ ├── bt_app_core.c │ │ ├── bt_app_core.h │ │ ├── component.mk │ │ ├── main.c │ │ ├── ws2812_control.c │ │ └── ws2812_control.h │ │ ├── sdkconfig │ │ ├── sdkconfig.defaults │ │ └── sdkconfig.old ├── M5Core2 │ └── Arduino │ │ ├── Core2_Factory_test │ │ ├── Core2Cover.c │ │ ├── Core2Main.c │ │ ├── Core2_Factory_test.ino │ │ ├── Number8x7.c │ │ ├── SettingAppImage.c │ │ ├── TimerAppImage.c │ │ ├── WifiSacn.c │ │ ├── batPower.c │ │ ├── batRect.c │ │ ├── bibisig.c │ │ ├── clockImage.c │ │ ├── digNumber.c │ │ ├── digNumber_35px.c │ │ ├── fft.cpp │ │ ├── fft.h │ │ ├── ft6336_fw_app_v17.h │ │ ├── ft6336_fw_updater.cpp │ │ ├── image.c │ │ ├── imageMenu.c │ │ ├── initImage.c │ │ ├── line3D.cpp │ │ ├── line3D.h │ │ ├── power.c │ │ ├── preview_R.c │ │ ├── rect_320_20.c │ │ ├── sdCardImage.c │ │ ├── touchFish.c │ │ └── touchImage.c │ │ ├── record │ │ └── record.ino │ │ ├── speak │ │ ├── data.c │ │ └── speak.ino │ │ └── touch │ │ └── touch.ino ├── M5Stick │ ├── Arduino │ │ ├── stickAnalogreadSerial │ │ │ ├── README.md │ │ │ └── stickAnalogreadSerial.ino │ │ └── stickReactionGame │ │ │ ├── README.md │ │ │ └── stickReactionGame.ino │ └── UIFlow │ │ └── example_core_m5stick_01.m5f ├── M5StickC │ ├── Arduino │ │ └── FactoryTest │ │ │ ├── .vscode │ │ │ ├── arduino.json │ │ │ ├── c_cpp_properties.json │ │ │ └── settings.json │ │ │ ├── AXP192.cpp │ │ │ ├── AXP192.h │ │ │ ├── DHT12.cpp │ │ │ ├── DHT12.h │ │ │ ├── FactoryTest.ino │ │ │ ├── Fonts │ │ │ ├── ASC16 │ │ │ ├── ASC16.h │ │ │ ├── Custom │ │ │ │ ├── Orbitron_Light_24.h │ │ │ │ ├── Orbitron_Light_32.h │ │ │ │ ├── Roboto_Thin_24.h │ │ │ │ ├── Satisfy_24.h │ │ │ │ └── Yellowtail_32.h │ │ │ ├── Font16.c │ │ │ ├── Font16.h │ │ │ ├── Font32rle.c │ │ │ ├── Font32rle.h │ │ │ ├── Font64rle.c │ │ │ ├── Font64rle.h │ │ │ ├── Font72rle.c │ │ │ ├── Font72rle.h │ │ │ ├── Font7srle.c │ │ │ ├── Font7srle.h │ │ │ ├── GFXFF │ │ │ │ ├── FreeMono12pt7b.h │ │ │ │ ├── FreeMono18pt7b.h │ │ │ │ ├── FreeMono24pt7b.h │ │ │ │ ├── FreeMono9pt7b.h │ │ │ │ ├── FreeMonoBold12pt7b.h │ │ │ │ ├── FreeMonoBold18pt7b.h │ │ │ │ ├── FreeMonoBold24pt7b.h │ │ │ │ ├── FreeMonoBold9pt7b.h │ │ │ │ ├── FreeMonoBoldOblique12pt7b.h │ │ │ │ ├── FreeMonoBoldOblique18pt7b.h │ │ │ │ ├── FreeMonoBoldOblique24pt7b.h │ │ │ │ ├── FreeMonoBoldOblique9pt7b.h │ │ │ │ ├── FreeMonoOblique12pt7b.h │ │ │ │ ├── FreeMonoOblique18pt7b.h │ │ │ │ ├── FreeMonoOblique24pt7b.h │ │ │ │ ├── FreeMonoOblique9pt7b.h │ │ │ │ ├── FreeSans12pt7b.h │ │ │ │ ├── FreeSans18pt7b.h │ │ │ │ ├── FreeSans24pt7b.h │ │ │ │ ├── FreeSans9pt7b.h │ │ │ │ ├── FreeSansBold12pt7b.h │ │ │ │ ├── FreeSansBold18pt7b.h │ │ │ │ ├── FreeSansBold24pt7b.h │ │ │ │ ├── FreeSansBold9pt7b.h │ │ │ │ ├── FreeSansBoldOblique12pt7b.h │ │ │ │ ├── FreeSansBoldOblique18pt7b.h │ │ │ │ ├── FreeSansBoldOblique24pt7b.h │ │ │ │ ├── FreeSansBoldOblique9pt7b.h │ │ │ │ ├── FreeSansOblique12pt7b.h │ │ │ │ ├── FreeSansOblique18pt7b.h │ │ │ │ ├── FreeSansOblique24pt7b.h │ │ │ │ ├── FreeSansOblique9pt7b.h │ │ │ │ ├── FreeSerif12pt7b.h │ │ │ │ ├── FreeSerif18pt7b.h │ │ │ │ ├── FreeSerif24pt7b.h │ │ │ │ ├── FreeSerif9pt7b.h │ │ │ │ ├── FreeSerifBold12pt7b.h │ │ │ │ ├── FreeSerifBold18pt7b.h │ │ │ │ ├── FreeSerifBold24pt7b.h │ │ │ │ ├── FreeSerifBold9pt7b.h │ │ │ │ ├── FreeSerifBoldItalic12pt7b.h │ │ │ │ ├── FreeSerifBoldItalic18pt7b.h │ │ │ │ ├── FreeSerifBoldItalic24pt7b.h │ │ │ │ ├── FreeSerifBoldItalic9pt7b.h │ │ │ │ ├── FreeSerifItalic12pt7b.h │ │ │ │ ├── FreeSerifItalic18pt7b.h │ │ │ │ ├── FreeSerifItalic24pt7b.h │ │ │ │ ├── FreeSerifItalic9pt7b.h │ │ │ │ ├── TomThumb.h │ │ │ │ ├── gfxfont.h │ │ │ │ ├── license.txt │ │ │ │ └── print.txt │ │ │ ├── HZK16 │ │ │ ├── HZK16.h │ │ │ ├── TrueType │ │ │ │ └── Not_yet_supported.txt │ │ │ └── glcdfont.c │ │ │ ├── IMU.cpp │ │ │ ├── IMU.h │ │ │ ├── LCD_Config.h │ │ │ ├── Lcd_Driver.cpp │ │ │ ├── Lcd_Driver.h │ │ │ ├── RTC.cpp │ │ │ ├── RTC.h │ │ │ ├── esp32_rmt.cpp │ │ │ ├── esp32_rmt.h │ │ │ ├── iic.cpp │ │ │ ├── iic.h │ │ │ ├── nec.cpp │ │ │ ├── rc5_rc6.cpp │ │ │ ├── rmt.c │ │ │ └── rmt.h │ └── UIFlow │ │ └── m5_protractor.m5f ├── M5_draw_heart.m5f ├── M5_play_a_song.m5f └── m5go │ └── m5go_lite │ ├── Arduino │ └── ENV │ │ ├── Adafruit_Sensor.h │ │ ├── DHT12.cpp │ │ ├── DHT12.h │ │ ├── ENV.ino │ │ └── README.md │ └── UIFlow │ └── example_unit_env.m5f ├── Hat ├── 8servos-hat │ ├── Arduino │ │ └── 8SERVOS │ │ │ ├── 8SERVOS.ino │ │ │ ├── IIC_servo.cpp │ │ │ └── IIC_servo.h │ └── UIFlow │ │ └── 8_servos_hat.m5f ├── BugC │ ├── UIFlow │ │ ├── With_the_controller │ │ │ ├── bugc.m5f │ │ │ └── bugc_ctl.m5f │ │ └── hat_bugc.m5f │ └── bugC │ │ ├── bugC.cpp │ │ ├── bugC.h │ │ └── bugC.ino ├── CardKB_HAT │ ├── CardKB_HAT │ │ └── CardKB_HAT.ino │ ├── UIFLOW │ │ └── CardKB_HAT.m5f │ └── firmware_328p │ │ └── cardKB_HAT │ │ └── KeyBoardHat_328.ino.standard.hex ├── ENVII_HAT │ ├── Arduino │ │ └── ENVII_HAT │ │ │ ├── Adafruit_Sensor.h │ │ │ ├── ENVII_HAT.ino │ │ │ ├── SHT3X.cpp │ │ │ ├── SHT3X.h │ │ │ ├── bmm150.cpp │ │ │ ├── bmm150.h │ │ │ └── bmm150_defs.h │ └── UIFlow │ │ └── ENVII_Hat.m5f ├── JoyC │ ├── Arduino │ │ └── JoyC │ │ │ ├── JoyC.ino │ │ │ └── icon.c │ └── UIFlow │ │ └── hat_joyc.m5f ├── MLX90640 │ └── UIFlow │ │ └── THERMAL.m5f ├── PowerC │ ├── PowerC │ │ └── PowerC.ino │ └── UIFlow │ │ └── IP5209.m5f ├── PuppyC │ ├── IIC_.cpp │ ├── IIC_.h │ ├── PuppyC.ino │ └── UIFlow │ │ └── PUPPY.m5f ├── RoverC │ ├── Arduino │ │ └── RoverC │ │ │ └── RoverC.ino │ └── UIFlow │ │ └── hat_rover.m5f ├── beetleC │ └── stickC │ │ └── beetleC │ │ ├── README.md │ │ ├── beetleC.ino │ │ ├── carControl.cpp │ │ ├── carControl.h │ │ ├── lock.h │ │ ├── page.h │ │ └── setTimer.h ├── finger-hat │ └── Arduino │ │ └── FINGER │ │ ├── FINGER.ino │ │ ├── finger.cpp │ │ └── finger.h ├── hat-env │ └── UIFlow │ │ └── example_hat_env.m5f ├── hat-joystick │ ├── Arduino │ │ └── Joystick_hat │ │ │ └── Joystick_hat.ino │ └── UIFlow │ │ └── Joystick_examples.m5f ├── hat-ncir │ └── UIFlow │ │ └── example_hat_ncir.m5f ├── hat-pir │ └── UIFlow │ │ └── example_hat_pir.m5f ├── hat-yun │ └── Arduino │ │ └── hat-yun │ │ ├── SHT20.cpp │ │ ├── SHT20.h │ │ ├── diaplay.cpp │ │ ├── display.h │ │ ├── hat-yun.ino │ │ ├── yunBoard.cpp │ │ └── yunBoard.h ├── neoflash-hat │ └── Arduino │ │ └── display_rainbow │ │ └── display_rainbow.ino ├── servo-hat │ ├── Arduino │ │ ├── SERVO │ │ │ └── servo │ │ │ │ └── servo.ino │ │ └── SERVOwithStickV │ │ │ ├── SERVOwithStickV.ino │ │ │ └── boot.py │ └── UIFlow │ │ └── servo_examples.m5f └── tof-hat │ ├── Arduino │ └── ToF │ │ └── ToF.ino │ └── UIFlow │ └── TOF_examples.m5f ├── LICENSE ├── Module ├── CALCULATOR │ └── CALCULATOR.ino ├── COMMU │ └── Arduino │ │ ├── CAN │ │ ├── commu_can_receiver │ │ │ ├── commu_can_receiver.ino │ │ │ └── m5_logo.h │ │ └── commu_can_transmitter │ │ │ ├── commu_can_transmitter.ino │ │ │ └── m5_logo.h │ │ ├── DependentLibrary │ │ └── MCP_CAN_lib │ │ │ ├── .gitattributes │ │ │ ├── .gitignore │ │ │ ├── MCP2515Calc.xlsx │ │ │ ├── README.md │ │ │ ├── examples │ │ │ ├── CAN_loopback │ │ │ │ └── CAN_loopback.ino │ │ │ ├── CAN_receive │ │ │ │ └── CAN_receive.ino │ │ │ ├── CAN_send │ │ │ │ └── CAN_send.ino │ │ │ ├── CAN_to_Ethernet │ │ │ │ ├── CAN_to_Ethernet.ino │ │ │ │ └── udp_listen.pl │ │ │ ├── Dual_CAN │ │ │ │ └── Dual_CAN.ino │ │ │ ├── Extended_MaskFilter │ │ │ │ └── Extended_MaskFilter.ino │ │ │ └── Standard_MaskFilter │ │ │ │ └── Standard_MaskFilter.ino │ │ │ ├── keywords.txt │ │ │ ├── mcp_can.cpp │ │ │ ├── mcp_can.h │ │ │ └── mcp_can_dfs.h │ │ ├── RS485 │ │ ├── commu_rs485_A │ │ │ ├── commu_rs485_A.ino │ │ │ └── m5_logo.h │ │ └── commu_rs485_B │ │ │ ├── commu_rs485_B.ino │ │ │ └── m5_logo.h │ │ └── factory_test │ │ ├── COMMU_Test_A │ │ ├── COMMU_Test_A.ino │ │ └── m5_logo.h │ │ └── COMMU_Test_B │ │ ├── COMMU_Test_B.ino │ │ └── m5_logo.h ├── COMX_GPS │ └── COMX_GPS.ino ├── COMX_GSM │ ├── COMX_GSM.ino │ ├── TFTTerminal.cpp │ └── TFTTerminal.h ├── COMX_LTE-DATA │ ├── COMX_LTE-DATA.ino │ ├── TFTTerminal.cpp │ └── TFTTerminal.h ├── COMX_LTE │ ├── COMX_LTE.ino │ ├── TFTTerminal.cpp │ └── TFTTerminal.h ├── COMX_NB-IoT │ ├── COMX_NB-IoT.ino │ ├── TFTTerminal.cpp │ └── TFTTerminal.h ├── COMX_SigFox │ └── COMX_SigFox.ino ├── COM_LoRaWAN │ ├── Arduino │ │ ├── LoRaWAN_Receive │ │ │ ├── LoRaWAN_Receive.ino │ │ │ ├── TFTTerminal.cpp │ │ │ └── TFTTerminal.h │ │ └── LoRaWAN_Send │ │ │ ├── LoRaWAN_Send.ino │ │ │ ├── TFTTerminal.cpp │ │ │ └── TFTTerminal.h │ └── UIFlow │ │ └── COM.LoRaWAN.m5f ├── ECG │ └── ECG.ino ├── ENCODER │ ├── Arduino │ │ └── faces_encoder │ │ │ └── faces_encoder.ino │ └── firmware_328p │ │ └── FacesEncoder328 │ │ ├── .vs │ │ └── FacesEncoder328 │ │ │ └── v15 │ │ │ └── .suo │ │ ├── FACE_ENCODER_v1.0.PcbDoc │ │ ├── FACE_ENCODER_v1.0.PcbDoc.htm │ │ ├── FacesEncoder328.ino │ │ ├── FacesEncoder328.ino.eightanaloginputs.hex │ │ ├── FacesEncoder328.ino.with_bootloader.eightanaloginputs.hex │ │ ├── FacesEncoder328.vcxproj │ │ ├── FacesEncoder328.vcxproj.filters │ │ ├── FacesEncoder328.vcxproj.user │ │ ├── __vm │ │ └── .FacesEncoder328.vsarduino.h │ │ └── debug.log ├── FACESII_NeoPixelTest │ └── FACESII_NeoPixelTest.ino ├── FACES_FINGER │ ├── FACES_FINGER.ino │ ├── UIFlow │ │ └── FINGER.m5f │ ├── finger.cpp │ └── finger.h ├── FACES_RFID │ ├── RFID │ │ ├── MFRC522_I2C.cpp │ │ ├── MFRC522_I2C.h │ │ └── RFID.ino │ └── UIFlow │ │ └── RFID.m5f ├── GOPLUS │ └── UIFLOW │ │ └── goplus.m5f ├── GPS │ ├── Arduino │ │ └── GPSRaw │ │ │ ├── GPSRaw.ino │ │ │ └── TFT_Terminal.ino │ └── TinyGPSPlus-1.0.2.zip ├── GSM │ └── Arduino │ │ └── GSM.ino ├── GoPLUS2 │ ├── GoPLUS2.ino │ ├── GoPlus2.cpp │ └── GoPlus2.h ├── JOYSTICK │ ├── Arduino │ │ └── faces_joystick │ │ │ └── faces_joystick.ino │ ├── UIFlow │ │ └── JOYSTICK.m5f │ └── firmware_328p │ │ └── FaceJoystick328 │ │ ├── FaceJoystick328.ino │ │ ├── FaceJoystick328.ino.eightanaloginputs.hex │ │ ├── FaceJoystick328.ino.with_bootloader.eightanaloginputs.hex │ │ └── FaceJoystick328_old.hex ├── LEGO_PLUS │ ├── UIFlow │ │ ├── example_module_lego_plus_en.m5f │ │ └── example_module_lego_plus_zh_CN.m5f │ └── firmware_328p │ │ └── m5_lego │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── .vscode │ │ ├── extensions.json │ │ └── settings.json │ │ ├── LICENSE │ │ ├── lib │ │ ├── L293DDH_half │ │ │ ├── L293DDH_half.cpp │ │ │ └── L293DDH_half.h │ │ └── readme.txt │ │ ├── platformio.ini │ │ └── src │ │ └── lego_motor_basic.ino ├── LORA │ └── Arduino │ │ ├── LoRaDuplex_A │ │ └── LoRaDuplex_A.ino │ │ └── LoRaDuplex_B │ │ └── LoRaDuplex_B.ino ├── LORA868 │ └── Arduino │ │ ├── LoRa868Duplex_A │ │ └── LoRa868Duplex_A.ino │ │ └── LoRa868Duplex_B │ │ └── LoRa868Duplex_B.ino ├── LORAWAN │ └── Arduino │ │ ├── LoRaWan Library for M5Stack.rar │ │ ├── lorawan_receiver │ │ └── lorawan_receiver.ino │ │ └── lorawan_transmmiter │ │ └── lorawan_transmmiter.ino ├── NB-IoT_PLUS │ └── NB-IoT_PLUS.ino ├── PLUS │ ├── Arduino │ │ └── plus_read_encoder │ │ │ └── plus_read_enconder.ino │ ├── UIFLOW │ │ └── plus.m5f │ └── firmware_328p │ │ └── plus │ │ ├── plus.ino │ │ ├── plus.ino.eightanaloginputs.hex │ │ └── plus.ino.with_bootloader.eightanaloginputs.hex ├── SERVO │ ├── Arduino │ │ └── Servo │ │ │ └── Servo.ino │ ├── UIFlow │ │ └── example_module_servo.m5f │ └── firmware_328p │ │ └── Servo328 │ │ ├── .vs │ │ └── Servo328 │ │ │ └── v15 │ │ │ └── .suo │ │ ├── Release │ │ ├── Servo │ │ │ ├── avr │ │ │ │ ├── Servo.cpp.d │ │ │ │ └── Servo.cpp.o │ │ │ ├── nrf52 │ │ │ │ ├── Servo.cpp.d │ │ │ │ └── Servo.cpp.o │ │ │ ├── sam │ │ │ │ ├── Servo.cpp.d │ │ │ │ └── Servo.cpp.o │ │ │ ├── samd │ │ │ │ ├── Servo.cpp.d │ │ │ │ └── Servo.cpp.o │ │ │ └── stm32f4 │ │ │ │ ├── Servo.cpp.d │ │ │ │ └── Servo.cpp.o │ │ ├── Servo328.cpp.d │ │ ├── Servo328.cpp.o │ │ ├── Servo328.elf │ │ ├── Servo328.hex │ │ ├── Servo328.ino.elf │ │ ├── Servo328.ino.hex │ │ ├── Servo328.ino.with_bootloader.hex │ │ ├── Servo328.with_bootloader.hex │ │ ├── Wire │ │ │ ├── Wire.cpp.d │ │ │ ├── Wire.cpp.o │ │ │ └── utility │ │ │ │ ├── twi.c.d │ │ │ │ └── twi.c.o │ │ └── board.buildinfo │ │ ├── Servo328.ino │ │ ├── Servo328.ino.eightanaloginputs.hex │ │ ├── Servo328.ino.standard.hex │ │ ├── Servo328.ino.with_bootloader.eightanaloginputs.hex │ │ ├── Servo328.ino.with_bootloader.standard.hex │ │ ├── Servo328.sln │ │ ├── Servo328.vcxproj │ │ ├── Servo328.vcxproj.filters │ │ ├── Servo328.vcxproj.user │ │ └── __vm │ │ ├── .Servo328.vsarduino.h │ │ ├── Compile.vmps.xml │ │ ├── Configuration.Release.vmps.xml │ │ └── Upload.vmps.xml ├── SERVO2 │ ├── Arduino │ │ └── SERVO2 │ │ │ ├── Adafruit_PWMServoDriver.cpp │ │ │ ├── Adafruit_PWMServoDriver.h │ │ │ └── SERVO2.ino │ └── UIFlow │ │ └── Servo2.m5f ├── SIM800 │ └── Arduino │ │ └── send_short_message │ │ └── send_short_message.ino ├── STEPMOTOR │ └── UIFlow │ │ └── example_module_stepmotor.m5f └── USB │ └── Arduino │ ├── Library │ └── USB_Host_Shield_Library_2.0.zip │ └── usb_mouse │ ├── M5Mouse.h │ └── usb_mouse.ino ├── README.md ├── README_en.md ├── README_ja.md ├── Unit ├── 4-relay │ └── 4-relay.ino ├── ACCEL │ ├── ACCEL │ │ └── ACCEL.ino │ └── UIFLOW │ │ └── accel.m5f ├── ADC │ ├── Arduino │ │ └── ADC_ADS1100 │ │ │ ├── ADC_ADS1100.ino │ │ │ ├── ADS1100.cpp │ │ │ └── ADS1100.h │ └── UIFlow │ │ └── example_unit_adc.m5f ├── ANGLE │ ├── Arduino │ │ └── potentiometer_read │ │ │ └── potentiometer_read.ino │ └── UIFlow │ │ └── example_unit_angle.m5f ├── A_Meter_Unit │ ├── EasyLoader_A_Meter │ │ ├── EasyLoader_A_Meter.ino │ │ ├── ammeter.cpp │ │ └── ammeter.h │ ├── UIFlow │ │ └── Ameter Example.m5f │ └── ammeter │ │ ├── ammeter.cpp │ │ ├── ammeter.h │ │ └── ammeter.ino ├── BPS_Unit │ ├── Arduino │ │ └── BPS_Unit │ │ │ ├── BPS_Unit.ino │ │ │ ├── bmp280.cpp │ │ │ └── bmp280.h │ └── UIFlow │ │ └── BPS Example.m5f ├── BUTTERFLY │ └── UIFlow │ │ └── example_butterfly.m5f ├── BUTTON │ ├── Arduino │ │ └── button │ │ │ └── button.ino │ └── UIFlow │ │ └── example_unit_button.m5f ├── CAN │ ├── CAN_RECEIVE │ │ ├── CAN.c │ │ ├── CAN.h │ │ ├── CAN_RECEIVE.ino │ │ ├── CAN_config.h │ │ ├── ESP32CAN.cpp │ │ ├── ESP32CAN.h │ │ └── can_regdef.h │ └── CAN_SEND │ │ ├── CAN.c │ │ ├── CAN.h │ │ ├── CAN_SEND.ino │ │ ├── CAN_config.h │ │ ├── ESP32CAN.cpp │ │ ├── ESP32CAN.h │ │ └── can_regdef.h ├── CARDKB │ ├── Arduino │ │ └── CardKBTestM5 │ │ │ └── CardKBTestM5.ino │ ├── UIFlow │ │ └── example_unit_carkb.m5f │ ├── cardkb_key_value.xlsx │ └── firmware_328p │ │ ├── CardKeyBoard.ino.eightanaloginputs.hex │ │ ├── CardKeyBoard │ │ └── CardKeyBoard.ino │ │ └── cardkb_sch_01.png ├── CATEAR │ └── UIFlow │ │ └── example_unit_catear.m5f ├── COLOR │ ├── Arduino │ │ └── Color │ │ │ └── Color.ino │ └── UIFlow │ │ └── COLOR.m5f ├── DAC │ ├── Arduino │ │ └── DAC_MCP4725 │ │ │ └── DAC_MCP4725.ino │ └── UIFlow │ │ └── DAC.m5f ├── DUAL_BUTTON │ ├── Arduino │ │ └── dual_button │ │ │ └── dual_button.ino │ └── UIFlow │ │ └── example_unit_dual_button.m5f ├── EARTH │ ├── Arduino │ │ └── Earth │ │ │ └── Earth.ino │ └── UIFlow │ │ └── example_unit_earth.m5f ├── ENV │ ├── Arduino │ │ └── ENV │ │ │ ├── Adafruit_Sensor.h │ │ │ ├── DHT12.cpp │ │ │ ├── DHT12.h │ │ │ ├── ENV.ino │ │ │ └── README.md │ └── UIFlow │ │ └── example_unit_env.m5f ├── ENVII │ ├── Arduino │ │ └── ENVII │ │ │ ├── Adafruit_Sensor.h │ │ │ ├── ENVII.ino │ │ │ ├── SHT3X.cpp │ │ │ └── SHT3X.h │ └── UIFlow │ │ └── ENVII.m5f ├── EXTIO │ ├── Arduino │ │ └── EXT_IO │ │ │ ├── EXT_IO.ino │ │ │ ├── PCA9554.cpp │ │ │ └── PCA9554.h │ └── UIFlow │ │ └── example_unit_extio.m5f ├── FAN │ ├── Arduino │ │ └── FAN │ │ │ └── FAN.ino │ └── UIFlow │ │ └── FAN.m5f ├── FINGER │ ├── Arduino │ │ └── Fingerprint │ │ │ ├── Fingerprint.ino │ │ │ ├── finger.c │ │ │ └── finger.h │ ├── FINGER Library │ │ ├── finger.c │ │ └── finger.h │ └── UIFlow │ │ └── FINGER.m5f ├── Fingerprint │ ├── Arduino │ │ └── Fingerprint │ │ │ └── Fingerprint.ino │ ├── Other │ │ ├── finger.c │ │ └── finger.h │ └── UIFlow │ │ └── unit_example_finger.m5f ├── GPS │ ├── Arduino │ │ └── GPSRaw │ │ │ ├── GPSRaw.ino │ │ │ └── TFT_Terminal.ino │ ├── Array.h │ ├── GPSUnitExample.ino │ ├── TinyGPSPlus-1.0.2.zip │ └── UIFlow │ │ └── GPS.m5f ├── HALL │ ├── HALL │ │ └── HALL.ino │ └── UIFlow │ │ └── HALL_Unit.m5f ├── HEART │ ├── Arduino │ │ └── MAX30100_RawData │ │ │ └── MAX30100_RawData.ino │ └── UIFlow │ │ └── HEART_Example.m5f ├── HEX │ ├── Arduino │ │ └── hex │ │ │ └── hex.ino │ └── UIFlow │ │ └── example_unit_hex.m5f ├── IMU_Unit │ ├── IMU_6886.cpp │ ├── IMU_6886.h │ └── IMU_Unit.ino ├── IR │ ├── Arduino │ │ └── ir_dectect │ │ │ └── ir_dectect.ino │ └── UIFlow │ │ └── example_unit_ir.m5f ├── ISO485 │ ├── Arduino │ │ └── ISO485 │ │ │ ├── ISO485.ino │ │ │ └── TFT_Terminal.h │ └── UIFlow │ │ └── ISO485 .m5f ├── JOYSTICK │ ├── Arduino │ │ └── Joystick │ │ │ └── Joystick.ino │ └── UIFlow │ │ └── example_unit_joystick.m5f ├── KEY │ └── UIFlow │ │ ├── KEY.m5f │ │ └── Unit-KEY&LIMIT.m5f ├── LASER-RX │ └── UIFlow │ │ └── LASER-RX.m5f ├── LIGHT │ ├── Arduino │ │ └── Light │ │ │ └── Light.ino │ └── UIFlow │ │ └── example_unit_light.m5f ├── LIMIT │ └── UIFlow │ │ └── Unit-Limit_noBlock.m5f ├── M5Bit │ └── Arduino │ │ └── M5BIT │ │ └── M5BIT.ino ├── MIC_Unit │ └── MIC_Unit.ino ├── Makey_NewVersion │ ├── Arduino │ │ └── Makey_new_version │ │ │ └── Makey_new_version.ino │ ├── UIFlow │ │ └── makey.m5f │ └── firmware_328p │ │ └── Makey328 │ │ └── Makey328.ino ├── NCIR │ ├── Arduino │ │ └── NCIR │ │ │ └── NCIR.ino │ └── UIFlow │ │ └── example_unit_ncir.m5f ├── NEOFLASH │ └── Arduino │ │ └── neoflash_digitalclock │ │ ├── DisplayCurrentTime.cpp │ │ ├── DisplayCurrentTime.h │ │ ├── NEOFLASH.ino │ │ └── README.md ├── NEOPIXEL │ ├── Arduino │ │ └── display_rainbow │ │ │ └── display_rainbow.ino │ └── UIFlow │ │ └── example_unit_neopixel.m5f ├── OP90.180 │ ├── Arduino │ │ └── OP90.180 │ │ │ └── OP90.180.ino │ └── UIFlow │ │ └── OP90_180.m5f ├── PDM │ ├── PDM.ino │ ├── fft.cpp │ └── fft.h ├── PIR │ ├── Arduino │ │ └── pir │ │ │ └── pir.ino │ └── UIFlow │ │ └── example_unit_pir.m5f ├── PaHUB │ ├── Arduino │ │ └── PaHUB │ │ │ └── PaHUB.ino │ └── UIFlow │ │ └── Pa.HUB.m5f ├── PbHUB │ └── UIFlow │ │ └── PbHUB.m5f ├── RELAY │ ├── Arduino │ │ └── Relay │ │ │ └── Relay.ino │ └── UIFlow │ │ └── example_unit_relay.m5f ├── RFID │ ├── Arduino │ │ └── RFID │ │ │ ├── MFRC522_I2C.cpp │ │ │ ├── MFRC522_I2C.h │ │ │ └── RFID.ino │ └── UIFlow │ │ └── example_unit_rfid.m5f ├── RGB │ ├── Arduino │ │ └── rgb │ │ │ └── rgb.ino │ └── UIFlow │ │ └── example_unit_rgb.m5f ├── RS485 │ └── UIFlow │ │ └── RS485.m5f ├── THERMAL │ ├── Arduino │ │ └── MLX90640 │ │ │ ├── MLX90640.ino │ │ │ ├── MLX90640_API.cpp │ │ │ ├── MLX90640_API.h │ │ │ ├── MLX90640_I2C_Driver.cpp │ │ │ ├── MLX90640_I2C_Driver.h │ │ │ └── interpolation.cpp │ └── UIFlow │ │ └── THERMAL.m5f ├── TOF │ ├── Arduino │ │ ├── MeasureDistance │ │ │ └── MeasureDistance.ino │ │ └── TOF_VL53L0X │ │ │ └── TOF_VL53L0X.ino │ └── UIFlow │ │ └── example_unit_tof.m5f ├── TRACE │ ├── Arduino │ │ └── trace.ino │ ├── UIFlow │ │ └── unit_trace_example.m5f │ └── firmware_328p │ │ └── TRACK │ │ ├── TRACK.ino │ │ ├── TRACK.ino.eightanaloginputs.hex │ │ └── TRACK.ino.with_bootloader.eightanaloginputs.hex ├── TVOC │ ├── TVOC │ │ ├── Adafruit_SGP30.cpp │ │ ├── Adafruit_SGP30.h │ │ └── TVOC.ino │ └── UIFlow │ │ └── TVOC_eCO2 Example.m5f ├── UHF_RFID │ ├── RFID_command.cpp │ ├── RFID_command.h │ ├── RFID_command_basics.cpp │ └── UHF_RFID.ino ├── ULTRA │ ├── Arduino │ │ └── ULTRA │ │ │ └── ULTRA.ino │ └── UIFlow │ │ └── ULTRA.m5f ├── UNIT_CAM │ └── CAM2CORE │ │ ├── CAM2CORE.ino │ │ ├── uart_frame.cpp │ │ └── uart_frame.h ├── VIBRATOR │ ├── Arduino │ │ └── VIBRATOR │ │ │ └── VIBRATOR.ino │ └── UIFlow │ │ └── VIBRATOR.m5f ├── V_Meter_Unit │ ├── EasyLoader_A_Meter │ │ └── V_Meter_Unit │ │ │ ├── V_Meter_Unit.ino │ │ │ ├── voltmeter.cpp │ │ │ └── voltmeter.h │ ├── UIFlow │ │ └── Voltmeter Example.m5f │ └── voltmeter │ │ ├── .vscode │ │ ├── arduino.json │ │ └── c_cpp_properties.json │ │ ├── voltmeter.cpp │ │ ├── voltmeter.h │ │ └── voltmeter.ino ├── WATERING │ └── UIFlow │ │ └── Watering_Example.m5f └── WEIGHT │ ├── Arduino │ └── WEIGHT │ │ ├── HX711.cpp │ │ ├── HX711.h │ │ └── WEIGHT.ino │ └── UIFlow │ └── example_unit_weight.m5f └── V_Function ├── AprilTag_Code └── AprilTag_Code.m5f ├── Bar_Code └── bar_Code.m5f ├── Color_Track └── Color_Track.m5f ├── Datamatrix_Code └── Datamatrix_Code.m5f ├── Face_Detect └── Face_Detect.m5f ├── Line_Tracker └── Line_Tracker.m5f ├── Motion_Detect └── Motion_Detect.m5f ├── QR_Code └── QR_Code.m5f ├── Tag_Reader └── Tag_Reader.m5f └── Target_Track └── Target_Track.m5f /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | .DS_Store 3 | .vscode/ 4 | -------------------------------------------------------------------------------- /Accessory/ServoKit180_360/Arduino/ServoKit180_360/ServoKit180_360.ino: -------------------------------------------------------------------------------- 1 | //Control rotation angle or speed and direction by sending pulse 2 | //Servo PIN 26 3 | 4 | #define COUNT_LOW 1500 5 | #define COUNT_HIGH 8500 6 | #define TIMER_WIDTH 16 7 | #include "esp32-hal-ledc.h" 8 | #include 9 | 10 | void setup() { 11 | // put your setup code here, to run once: 12 | M5.begin(); 13 | ledcSetup(1, 50, TIMER_WIDTH); 14 | ledcAttachPin(26, 1); 15 | M5.Lcd.setCursor(20, 80, 2); 16 | M5.Lcd.print("SERVO"); 17 | 18 | } 19 | 20 | void loop() { 21 | // put your main code here, to run repeatedly: 22 | for(int i = COUNT_LOW; i < COUNT_HIGH; i = i + 100){ 23 | ledcWrite(1, i); 24 | delay(50); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /App/M5IoT-kit/DC-Motor/DC-Motor.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Name: DC-Motor.ino 3 | Created: 2019/5/17 10:06:15 4 | Author: shaoxiang 5 | */ 6 | 7 | #include 8 | // The setup() function runs once each time the micro-controller starts 9 | void setup() { 10 | // init lcd, serial, but don't init sd card 11 | M5.begin(true, false, true); 12 | M5.Lcd.clear(BLACK); 13 | M5.Lcd.setTextColor(YELLOW); 14 | M5.Lcd.setTextSize(2); 15 | M5.Lcd.setCursor(65, 10); 16 | M5.Lcd.println("DC motor example"); 17 | M5.Lcd.setCursor(30, 220); 18 | M5.Lcd.println("Forward"); 19 | M5.Lcd.setCursor(140, 220); 20 | M5.Lcd.println("stop"); 21 | M5.Lcd.setCursor(220, 220); 22 | M5.Lcd.println("Reverse"); 23 | 24 | pinMode(21, OUTPUT); 25 | pinMode(22, OUTPUT); 26 | pinMode(13, INPUT_PULLUP); 27 | pinMode(15, INPUT_PULLUP); 28 | } 29 | 30 | // Add the main program code into the continuous loop() function 31 | void loop() { 32 | M5.update(); 33 | 34 | if (M5.BtnA.wasReleased()) { 35 | M5.Lcd.print('A'); 36 | digitalWrite(22, LOW); 37 | digitalWrite(21, HIGH); 38 | } else if (M5.BtnB.wasReleased()) { 39 | M5.Lcd.print('B'); 40 | digitalWrite(21, LOW); 41 | digitalWrite(22, LOW); 42 | } else if (M5.BtnC.wasReleased()) { 43 | M5.Lcd.print('C'); 44 | digitalWrite(21, LOW); 45 | digitalWrite(22, HIGH); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /App/M5IoT-kit/Microphone/Microphone.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void setup() { 4 | M5.begin(); 5 | //disable the speak noise 6 | dacWrite(25, 0); 7 | 8 | M5.Lcd.setTextColor(YELLOW); 9 | M5.Lcd.setTextSize(2); 10 | M5.Lcd.setCursor(65, 50); 11 | M5.Lcd.printf("Microphone\n"); 12 | pinMode(26, INPUT); 13 | M5.Lcd.setCursor(85, 80); 14 | M5.Lcd.print("GPIO36:"); 15 | M5.Lcd.setCursor(85, 100); 16 | M5.Lcd.print("GPIO26:"); 17 | } 18 | 19 | uint16_t analogRead_value = 0; 20 | uint16_t digitalRead_value = 0; 21 | void loop() { 22 | // put your main code here, to run repeatedly: 23 | M5.Lcd.setCursor(175, 80); 24 | M5.Lcd.setTextColor(BLACK); 25 | M5.Lcd.printf("%d\n", analogRead_value); 26 | M5.Lcd.setCursor(175, 100); 27 | M5.Lcd.printf("%d\n", digitalRead_value); 28 | analogRead_value = analogRead(36); 29 | digitalRead_value = digitalRead(26); 30 | M5.Lcd.setTextColor(YELLOW); 31 | M5.Lcd.setCursor(175, 80); 32 | M5.Lcd.printf("%d\n", analogRead_value); 33 | M5.Lcd.setCursor(175, 100); 34 | M5.Lcd.printf("%d\n", digitalRead_value); 35 | delay(10); 36 | } 37 | -------------------------------------------------------------------------------- /App/M5IoT-kit/joystick/joystick.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void setup() { 4 | M5.begin(); 5 | //disable the speak noise 6 | dacWrite(25, 0); 7 | 8 | M5.Lcd.setTextColor(YELLOW); 9 | M5.Lcd.setTextSize(2); 10 | 11 | M5.Lcd.setCursor(80, 80); 12 | M5.Lcd.print("GPIO34_x:"); 13 | M5.Lcd.setCursor(80, 100); 14 | M5.Lcd.print("GPIO35_y:"); 15 | M5.Lcd.setCursor(80, 120); 16 | M5.Lcd.print("GPIO2_z:"); 17 | 18 | pinMode(34, INPUT); 19 | pinMode(35, INPUT); 20 | pinMode(2, INPUT_PULLUP); 21 | } 22 | 23 | uint16_t x_value = 0; 24 | uint16_t y_value = 0; 25 | uint16_t z_value = 0; 26 | void loop() { 27 | // put your main code here, to run repeatedly: 28 | M5.Lcd.setTextColor(BLACK); 29 | M5.Lcd.setCursor(185, 80); 30 | M5.Lcd.printf("%d\n", x_value); 31 | M5.Lcd.setCursor(185, 100); 32 | M5.Lcd.printf("%d\n", y_value); 33 | M5.Lcd.setCursor(185, 120); 34 | M5.Lcd.printf("%d\n", z_value); 35 | 36 | x_value = analogRead(34); 37 | y_value = analogRead(35); 38 | z_value = digitalRead(2); 39 | 40 | M5.Lcd.setTextColor(YELLOW); 41 | M5.Lcd.setCursor(185, 80); 42 | M5.Lcd.printf("%d\n", x_value); 43 | M5.Lcd.setCursor(185, 100); 44 | M5.Lcd.printf("%d\n", y_value); 45 | M5.Lcd.setCursor(185, 120); 46 | M5.Lcd.printf("%d\n", z_value); 47 | delay(10); 48 | } 49 | -------------------------------------------------------------------------------- /App/M5IoT-kit/servo/servo.ino: -------------------------------------------------------------------------------- 1 | #include "driver/ledc.h" 2 | 3 | int freq = 50; 4 | int ledChannel = 0; 5 | int resolution = 8; 6 | 7 | void setup() { 8 | 9 | ledcSetup(ledChannel, freq, resolution); 10 | ledcAttachPin(15, ledChannel); 11 | 12 | } 13 | 14 | void loop() { 15 | 16 | ledcWrite(ledChannel, 6);//0° 17 | delay(1000); 18 | ledcWrite(ledChannel, 18);//90° 19 | delay(1000); 20 | ledcWrite(ledChannel, 30);//180° 21 | delay(1000); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /App/M5StickC_Slot/M5StickC_Slot.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m5stack/M5-ProductExampleCodes/1bc38736e61a362080d1dffc4020b3a2a1dff6ae/App/M5StickC_Slot/M5StickC_Slot.zip -------------------------------------------------------------------------------- /App/acSocketCtl/.gitignore: -------------------------------------------------------------------------------- 1 | .pio 2 | .vscode/.browse.c_cpp.db* 3 | .vscode/c_cpp_properties.json 4 | .vscode/launch.json 5 | .vscode/ipch 6 | -------------------------------------------------------------------------------- /App/acSocketCtl/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=827846 3 | // for the documentation about the extensions.json format 4 | "recommendations": [ 5 | "platformio.platformio-ide" 6 | ] 7 | } -------------------------------------------------------------------------------- /App/acSocketCtl/acSoclet.cpp: -------------------------------------------------------------------------------- 1 | #include "protocol.h" 2 | 3 | void acSocketSetState() { 4 | 5 | } -------------------------------------------------------------------------------- /App/acSocketCtl/protocol.h: -------------------------------------------------------------------------------- 1 | #ifndef __PROTOCOL__H 2 | #define __PROTOCOL__H 3 | 4 | #include "Arduino.h" 5 | 6 | /*֡ͷ����*/ 7 | #define FRAME_HEADER_LENGTH 1U 8 | 9 | /*֡β����(��У���)*/ 10 | #define FRAME_TAIL_LENGTH 1U 11 | 12 | /*֡ͷ��ͬ�ֽ�*/ 13 | #define FRAME_HEAD_SAME_FA 0xFA 14 | 15 | /*���ջ���������*/ 16 | #define RX_BUF_LENGTH 64U 17 | #define RX_END_LENGTH 1U 18 | 19 | typedef struct { 20 | uint8_t cmd_id; 21 | uint8_t ack_flag; 22 | uint8_t *cmd_value; 23 | uint16_t cmd_length; 24 | } PayloadData; 25 | 26 | typedef struct { 27 | uint8_t src; 28 | uint8_t dst; 29 | uint8_t seq; 30 | uint8_t res; 31 | PayloadData payload; 32 | } CmdData; 33 | 34 | /*����Э�鹫������*/ 35 | typedef struct { 36 | volatile uint8_t step; /*switch �����ת����*/ 37 | volatile int8_t tmpCnt; /*���ڼ�������ʱ����*/ 38 | volatile uint8_t aRxBufIndex; /*�������ݻ���������*/ 39 | volatile uint8_t aRxCrcIndex; /*��β���ݻ���������*/ 40 | uint8_t aRxCrc[RX_END_LENGTH]; 41 | uint8_t aRxBuf[RX_BUF_LENGTH]; 42 | } protocolComType_t; 43 | 44 | extern void protocol_rec_put(uint8_t data); 45 | extern void protocol_send_data(CmdData dat); 46 | 47 | #endif -------------------------------------------------------------------------------- /Application/Bala2/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | build/ 3 | 4 | .vscode/ 5 | -------------------------------------------------------------------------------- /Application/Bala2/MadgwickAHRS.h: -------------------------------------------------------------------------------- 1 | //===================================================================================================== 2 | // MadgwickAHRS.h 3 | //===================================================================================================== 4 | // 5 | // Implementation of Madgwick's IMU and AHRS algorithms. 6 | // See: http://www.x-io.co.uk/node/8#open_source_ahrs_and_imu_algorithms 7 | // 8 | // Date Author Notes 9 | // 29/09/2011 SOH Madgwick Initial release 10 | // 02/10/2011 SOH Madgwick Optimised for reduced CPU load 11 | // 12 | //===================================================================================================== 13 | #ifndef MadgwickAHRS_h 14 | #define MadgwickAHRS_h 15 | 16 | //---------------------------------------------------------------------------------------------------- 17 | // Variable declaration 18 | 19 | // extern volatile float q0, q1, q2, q3; // quaternion of sensor frame relative to auxiliary frame 20 | 21 | //--------------------------------------------------------------------------------------------------- 22 | // Function declarations 23 | 24 | void MadgwickAHRSupdate(float gx, float gy, float gz, float ax, float ay, float az, float mx, float my, float mz); 25 | void MadgwickAHRSupdateIMU(float gx, float gy, float gz, float ax, float ay, float az, float *pitch, float *roll, float *yaw); 26 | void MadgwickAHRSetBeta(float beta); 27 | #endif 28 | //===================================================================================================== 29 | // End of file 30 | //===================================================================================================== 31 | -------------------------------------------------------------------------------- /Application/Bala2/README.md: -------------------------------------------------------------------------------- 1 | Bala2 2 | -------------------------------------------------------------------------------- /Application/Bala2/bala.h: -------------------------------------------------------------------------------- 1 | #ifndef _BALA_H__ 2 | #define _BALA_H__ 3 | 4 | #include "Arduino.h" 5 | #include "freertos/FreeRTOS.h" 6 | 7 | class Bala { 8 | public: 9 | int32_t wheel_left_encoder, wheel_right_encoder; 10 | 11 | public: 12 | Bala(); 13 | void ClearEncoder(); 14 | void GetEncoder(int32_t* wheel_left, int32_t* wheel_right); 15 | void SetEncoder(int32_t wheel_left, int32_t wheel_right); 16 | void UpdateEncoder(); 17 | 18 | // -1023 ~ 1024 19 | void SetSpeed(int16_t wheel_left, int16_t wheel_right); 20 | 21 | // 500 ~ 2500 -> 0 ~ 180 22 | void SetServoAngle(uint8_t pos, uint8_t angle); 23 | 24 | // 500 ~ 2500 25 | void SetServoPulse(uint8_t pos, uint16_t width); 26 | 27 | // used i2c lock 28 | void SetMutex(SemaphoreHandle_t* mutex); 29 | 30 | private: 31 | SemaphoreHandle_t i2c_mutex; 32 | 33 | }; 34 | #endif -------------------------------------------------------------------------------- /Application/Bala2/bala2.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m5stack/M5-ProductExampleCodes/1bc38736e61a362080d1dffc4020b3a2a1dff6ae/Application/Bala2/bala2.bin -------------------------------------------------------------------------------- /Application/Bala2/calibration.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | void calibrationGryo(); 4 | void calibrationInit(); 5 | void calibrationSaveCenterAngle(float angle); 6 | void calibrationGet(int16_t* gyro_x_offset, int16_t* gyro_y_offset, int16_t* gyro_z_offset, float *angle_center); -------------------------------------------------------------------------------- /Application/Bala2/imu_filter.h: -------------------------------------------------------------------------------- 1 | #ifndef __IMU__H_ 2 | #define __IMU__H_ 3 | 4 | #include "Arduino.h" 5 | 6 | #define ACC_8G_RES (0.000244140625f) 7 | #define GYRO_2000DPS_RES (0.06103515625f) 8 | 9 | typedef union { 10 | uint8_t raw[14]; 11 | struct { 12 | uint8_t acc_x_h; 13 | uint8_t acc_x_l; 14 | uint8_t acc_y_h; 15 | uint8_t acc_y_l; 16 | uint8_t acc_z_h; 17 | uint8_t acc_z_l; 18 | uint8_t temp_h; 19 | uint8_t temp_l; 20 | uint8_t gyro_x_h; 21 | uint8_t gyro_x_l; 22 | uint8_t gyro_y_h; 23 | uint8_t gyro_y_l; 24 | uint8_t gyro_z_h; 25 | uint8_t gyro_z_l; 26 | } value; 27 | } ImuData_t; 28 | 29 | 30 | float getAngle(); 31 | void ImuTaskStart(int16_t x_offset, int16_t y_offset, int16_t z_offset, SemaphoreHandle_t* i2c_lock); 32 | 33 | #endif -------------------------------------------------------------------------------- /Application/Bala2/pid.h: -------------------------------------------------------------------------------- 1 | #ifndef _PID_H_ 2 | #define _PID_H_ 3 | 4 | #include "Arduino.h" 5 | 6 | class PID { 7 | 8 | 9 | public: 10 | 11 | //commonly used functions ************************************************************************** 12 | PID(float point, float kp, float ki, float kd); 13 | 14 | float Update(float input); 15 | void SetOutputLimits(float max_out, float min_out); 16 | void SetIntegralLimits(float max_out, float min_out); 17 | void SetPoint(float point); 18 | void SetDirection(int8_t dir); 19 | void UpdateParam(float kp, float ki, float kd); 20 | void SetIntegral(float integral); 21 | void SetIntegralOffset(float offset); 22 | 23 | float error_integral; 24 | 25 | private: 26 | float _kp, _ki, _kd; 27 | float _point; 28 | float error_integral_offset; 29 | float input_last; 30 | float error; 31 | float output_max, output_min; 32 | float integral_max, integral_min; 33 | int8_t _dir; 34 | }; 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /Application/RoverC_Arduino_Alone/RoverC.h: -------------------------------------------------------------------------------- 1 | #ifndef _ROVERC_H_ 2 | #define _ROVERC_H_ 3 | 4 | #include 5 | 6 | #define ROVER_ADDRESS 0X38 7 | void RoverC_Init(void); //sda 0 scl 26 8 | 9 | void Move_forward(int8_t Speed); 10 | 11 | void Move_back(int8_t Speed); 12 | 13 | void Move_turnleft(int8_t Speed); 14 | 15 | void Move_turnright(int8_t Speed); 16 | 17 | void Move_left(int8_t Speed); 18 | 19 | void Move_right(int8_t Speed); 20 | 21 | void Move_stop(int8_t Speed); 22 | 23 | void Send_iic(uint8_t Register, uint8_t Speed); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /Application/RoverC_Arduino_Alone/RoverC_Arduino_Alone.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include "RoverC.h" 3 | 4 | 5 | 6 | 7 | // the setup routine runs once when M5StickC starts up 8 | void setup(){ 9 | 10 | // Initialize the M5StickC object 11 | M5.begin(); 12 | 13 | M5.Lcd.setRotation(3); 14 | M5.Lcd.setTextColor(BLUE); 15 | M5.Lcd.setCursor(40, 30, 4); 16 | M5.Lcd.printf("Rover"); 17 | 18 | 19 | RoverC_Init(); 20 | } 21 | 22 | // the loop routine runs over and over again forever 23 | void loop() { 24 | 25 | Move_forward(100); 26 | delay(2000); 27 | Move_back(100); 28 | delay(2000); 29 | Move_turnleft(100); 30 | delay(2000); 31 | Move_turnright(100); 32 | delay(2000); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /Application/RoverC_PRO_Arduino_Alone/RoverC.h: -------------------------------------------------------------------------------- 1 | #ifndef _ROVERC_H_ 2 | #define _ROVERC_H_ 3 | 4 | #include 5 | 6 | #define ROVER_ADDRESS 0X38 7 | void RoverC_Init(void); //sda 0 scl 26 8 | 9 | void Move_forward(int8_t Speed); 10 | 11 | void Move_back(int8_t Speed); 12 | 13 | void Move_turnleft(int8_t Speed); 14 | 15 | void Move_turnright(int8_t Speed); 16 | 17 | void Move_left(int8_t Speed); 18 | 19 | void Move_right(int8_t Speed); 20 | 21 | void Move_stop(int8_t Speed); 22 | 23 | void Send_iic(uint8_t Register, uint8_t Speed); 24 | 25 | void Servo_angle(uint8_t Servo_ch, uint8_t degree); 26 | 27 | void Servo_pulse(uint8_t Servo_ch, uint16_t width); 28 | #endif 29 | -------------------------------------------------------------------------------- /Application/RoverC_PRO_Arduino_Alone/RoverC_PRO_Arduino_Alone.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include "RoverC.h" 3 | 4 | // the setup routine runs once when M5StickC starts up 5 | void setup(){ 6 | 7 | // Initialize the M5StickC object 8 | M5.begin(); 9 | 10 | M5.Lcd.setRotation(3); 11 | M5.Lcd.setTextColor(BLUE); 12 | M5.Lcd.setCursor(30, 30, 4); 13 | M5.Lcd.printf("RoverC"); 14 | 15 | RoverC_Init(); 16 | Move_stop(100); 17 | } 18 | 19 | // the loop routine runs over and over again forever 20 | void loop() { 21 | M5.update(); 22 | if (M5.BtnA.wasReleased()) { 23 | delay(1500); 24 | Servo_angle(1, 90); 25 | delay(1000); 26 | Move_back(50); 27 | delay(2000); 28 | Move_turnleft(30); 29 | delay(2000); 30 | Move_turnright(30); 31 | delay(2000); 32 | Move_forward(50); 33 | delay(2000); 34 | Move_stop(100); 35 | Servo_angle(1, 0); 36 | delay(1000); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /AtomBase/AtomHub/Arduino_LED_Hap/.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /AtomBase/AtomHub/Arduino_LED_Hap/.vs/ESPHap/v15/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m5stack/M5-ProductExampleCodes/1bc38736e61a362080d1dffc4020b3a2a1dff6ae/AtomBase/AtomHub/Arduino_LED_Hap/.vs/ESPHap/v15/.suo -------------------------------------------------------------------------------- /AtomBase/AtomHub/Arduino_LED_Hap/.vs/ProjectSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrentProjectSetting": "Нет конфигураций" 3 | } -------------------------------------------------------------------------------- /AtomBase/AtomHub/Arduino_LED_Hap/.vs/VSWorkspaceState.json: -------------------------------------------------------------------------------- 1 | { 2 | "ExpandedNodes": [ 3 | "", 4 | "\\httpparser" 5 | ], 6 | "SelectedNode": "\\homeintegration.h", 7 | "PreviewInSolutionExplorer": false 8 | } -------------------------------------------------------------------------------- /AtomBase/AtomHub/Arduino_LED_Hap/.vs/slnx.sqlite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m5stack/M5-ProductExampleCodes/1bc38736e61a362080d1dffc4020b3a2a1dff6ae/AtomBase/AtomHub/Arduino_LED_Hap/.vs/slnx.sqlite -------------------------------------------------------------------------------- /AtomBase/AtomHub/Arduino_LED_Hap/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 yurik972 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /AtomBase/AtomHub/Arduino_LED_Hap/aa.c: -------------------------------------------------------------------------------- 1 | // to be shure that IDE will found wolfssl lib 2 | #include -------------------------------------------------------------------------------- /AtomBase/AtomHub/Arduino_LED_Hap/base64.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "port_x.h" 5 | #ifdef ARDUINO8266_SERVER_CPP 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | #endif 10 | size_t base64_encoded_size(const unsigned char* data, size_t size); 11 | size_t base64_decoded_size(const unsigned char* encoded_data, size_t encoded_size); 12 | 13 | int base64_encode(const unsigned char* data, size_t data_size, unsigned char *encoded_data); 14 | int base64_decode(const unsigned char* encoded_data, size_t encoded_size, unsigned char *data); 15 | 16 | #include "port_x.h" 17 | #ifdef ARDUINO8266_SERVER_CPP 18 | #ifdef __cplusplus 19 | } //extern C 20 | #endif 21 | #endif -------------------------------------------------------------------------------- /AtomBase/AtomHub/Arduino_LED_Hap/debug.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "debug.h" 4 | 5 | 6 | char *binary_to_string(const byte *data, size_t size) { 7 | int i; 8 | 9 | size_t buffer_size = 1; // 1 char for eos 10 | for (i=0; i= 32 && data[i] < 128) ? 1 : 4); 12 | 13 | char *buffer = malloc(buffer_size); 14 | 15 | int pos = 0; 16 | for (i=0; i= 128) { 21 | size_t printed = snprintf(&buffer[pos], buffer_size - pos, "\\x%02X", data[i]); 22 | if (printed > 0) { 23 | pos += printed; 24 | } 25 | } else { 26 | buffer[pos++] = data[i]; 27 | } 28 | } 29 | buffer[pos] = 0; 30 | 31 | return buffer; 32 | } 33 | 34 | 35 | void print_binary(const char *prompt, const byte *data, size_t size) { 36 | #ifdef HOMEKIT_DEBUG 37 | char *buffer = binary_to_string(data, size); 38 | printf("%s (%d bytes): \"%s\"\n", prompt, (int)size, buffer); 39 | free(buffer); 40 | #endif 41 | } 42 | -------------------------------------------------------------------------------- /AtomBase/AtomHub/Arduino_LED_Hap/hapfilestorage/hapfilestorage.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | extern "C" { 5 | #include "../homeintegration.h" 6 | } 7 | static String hap_pair_file_name; 8 | void hap_storage_changed(char * szstorage, int bufsize) { 9 | 10 | 11 | 12 | SPIFFS.remove(hap_pair_file_name); 13 | File fsDAT = SPIFFS.open(hap_pair_file_name, "w+"); 14 | if (!fsDAT) { 15 | Serial.println("Failed to open pair.dat"); 16 | return; 17 | } 18 | fsDAT.write((uint8_t*)szstorage, bufsize); 19 | 20 | fsDAT.close(); 21 | } 22 | void init_hap_storage(const char* filename) { 23 | //Serial.print("init_hap_storage"); 24 | hap_pair_file_name = filename; 25 | if (!hap_pair_file_name.startsWith("/")) hap_pair_file_name = "/" + hap_pair_file_name; 26 | File fsDAT = SPIFFS.open(hap_pair_file_name, "r"); 27 | 28 | if (!fsDAT) { 29 | //Serial.println("Failed to read pair.dat"); 30 | SPIFFS.format(); 31 | 32 | } 33 | int size = hap_get_storage_size_ex(); 34 | char* buf = new char[size]; 35 | memset(buf, 0xff, size); 36 | if (fsDAT) 37 | fsDAT.readBytes(buf, size); 38 | 39 | hap_init_storage_ex(buf, size); 40 | if (fsDAT) 41 | fsDAT.close(); 42 | delete[]buf; 43 | 44 | set_callback_storage_change(hap_storage_changed); 45 | } -------------------------------------------------------------------------------- /AtomBase/AtomHub/Arduino_LED_Hap/homekitintegrationcpp.cpp: -------------------------------------------------------------------------------- 1 | #include "port_x.h" 2 | #include "debug.h" 3 | #ifdef ARDUINO8266_SERVER_CPP 4 | extern "C" { 5 | #include "homeintegration.h" 6 | } 7 | #include "arduino_homekit_server.h" 8 | void hap_init_homekit_server() 9 | { 10 | hap_setup_final_step(); 11 | 12 | INFO("homekit_is_paired %d", arduino_homekit_is_paired()); 13 | homekit_server_config_t* cfg = hap_get_server_config(); 14 | arduino_homekit_setup(cfg); 15 | } 16 | void hap_homekit_loop() { 17 | arduino_homekit_loop(); 18 | } 19 | bool hap_homekit_is_paired() { 20 | return arduino_homekit_is_paired(); 21 | } 22 | void hap_restart_server() { 23 | homekit_server_restart(); 24 | } 25 | #endif -------------------------------------------------------------------------------- /AtomBase/AtomHub/Arduino_LED_Hap/homekitintegrationcpp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "port_x.h" 3 | #ifdef ARDUINO8266_SERVER_CPP 4 | #include "homeintegration.h" 5 | 6 | void hap_init_homekit_server(); 7 | void hap_homekit_loop(); 8 | bool hap_homekit_is_paired(); 9 | void hap_restart_server(); 10 | #endif 11 | -------------------------------------------------------------------------------- /AtomBase/AtomHub/Arduino_LED_Hap/json.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "port_x.h" 5 | 6 | #ifdef ARDUINO8266_SERVER_CPP 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | #endif 11 | struct json_stream; 12 | typedef struct json_stream json_stream; 13 | 14 | typedef void(*json_flush_callback)(uint8_t *buffer, size_t size, void *context); 15 | 16 | json_stream *json_new(size_t buffer_size, json_flush_callback on_flush, void *context); 17 | void json_free(json_stream *json); 18 | 19 | void json_flush(json_stream *json); 20 | 21 | void json_object_start(json_stream *json); 22 | void json_object_end(json_stream *json); 23 | 24 | void json_array_start(json_stream *json); 25 | void json_array_end(json_stream *json); 26 | 27 | void json_integer(json_stream *json, long long x); 28 | void json_float(json_stream *json, float x); 29 | void json_string(json_stream *json, const char *x); 30 | void json_boolean(json_stream *json, bool x); 31 | void json_null(json_stream *json); 32 | 33 | #ifdef ARDUINO8266_SERVER_CPP 34 | #ifdef __cplusplus 35 | } //extern c 36 | #endif 37 | #endif -------------------------------------------------------------------------------- /AtomBase/AtomHub/Arduino_LED_Hap/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For ESPHap 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | homekit_service_t KEYWORD1 10 | homekit_characteristic_t KEYWORD1 11 | homekit_value_t KEYWORD1 12 | -------------------------------------------------------------------------------- /AtomBase/AtomHub/Arduino_LED_Hap/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "FastLED", 3 | "description": "Native support Apple home kit protocol with Arduino projects", 4 | "keywords": "Apple Home Kit native esp32", 5 | "authors": [ 6 | { 7 | "name": "Yurik72", 8 | "url": "https://github.com/Yurik72", 9 | "maintainer": true 10 | } 11 | ], 12 | "repository": { 13 | "type": "git", 14 | "url": "https://github.com/Yurik72/ESPHap" 15 | }, 16 | "version": "0.9", 17 | "license": "MIT", 18 | 19 | "frameworks": "arduino", 20 | "platforms": "espressif32", 21 | "export": { 22 | "exclude": [ 23 | "docs", 24 | "extras" 25 | ] 26 | }, 27 | "build": { 28 | "srcFilter": [ 29 | "+<*.c>", 30 | "+<*.cpp>", 31 | "+<*.h>" 32 | ], 33 | "libArchive": false 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /AtomBase/AtomHub/Arduino_LED_Hap/library.properties: -------------------------------------------------------------------------------- 1 | name=ESPHap 2 | version=1.0 3 | author=Yurik 4 | maintainer=Yurik 5 | sentence=Native support Apple home kit protocol with Arduino projects 6 | paragraph=Native support Apple home kit protocol with Arduino projects. 7 | category=Home Automation 8 | url=https://github.com/Yurik72/ESPHap 9 | architectures=esp8266,esp32 10 | -------------------------------------------------------------------------------- /AtomBase/AtomHub/Arduino_LED_Hap/os_settings.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #if defined ARDUINO 4 | #if defined ESP32 5 | //#include 6 | //#include 7 | #elif defined ESP8266 8 | #define portTICK_PERIOD_MS 10 9 | #if( configUSE_16_BIT_TICKS == 1 ) 10 | typedef uint16_t TickType_t; 11 | #define portMAX_DELAY ( TickType_t ) 0xffff 12 | #else 13 | typedef uint32_t TickType_t; 14 | #define portMAX_DELAY ( TickType_t ) 0xffffffffUL 15 | #endif 16 | 17 | #else 18 | #endif 19 | 20 | #endif -------------------------------------------------------------------------------- /AtomBase/AtomHub/Arduino_LED_Hap/pairing.c: -------------------------------------------------------------------------------- 1 | #include "pairing.h" 2 | 3 | 4 | pairing_t *pairing_new() { 5 | pairing_t *p = malloc(sizeof(pairing_t)); 6 | p->id = -1; 7 | p->device_id = NULL; 8 | p->device_key = NULL; 9 | p->permissions = 0; 10 | 11 | return p; 12 | } 13 | 14 | void pairing_free(pairing_t *pairing) { 15 | if (pairing->device_id) 16 | free(pairing->device_id); 17 | 18 | if (pairing->device_key) 19 | crypto_ed25519_free(pairing->device_key); 20 | 21 | free(pairing); 22 | } 23 | -------------------------------------------------------------------------------- /AtomBase/AtomHub/Arduino_LED_Hap/pairing.h: -------------------------------------------------------------------------------- 1 | #ifndef __PAIRING_H__ 2 | #define __PAIRING_H__ 3 | 4 | #include "crypto.h" 5 | #include "port_x.h" 6 | #ifdef ARDUINO8266_SERVER_CPP 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | #endif 11 | typedef enum { 12 | pairing_permissions_admin = (1 << 0), 13 | } pairing_permissions_t; 14 | 15 | typedef struct { 16 | int id; 17 | char *device_id; 18 | ed25519_key *device_key; 19 | pairing_permissions_t permissions; 20 | } pairing_t; 21 | 22 | pairing_t *pairing_new(); 23 | void pairing_free(pairing_t *pairing); 24 | 25 | 26 | 27 | #ifdef ARDUINO8266_SERVER_CPP 28 | #ifdef __cplusplus 29 | } //Extern C 30 | #endif 31 | #endif 32 | #endif // __PAIRING_H__ 33 | -------------------------------------------------------------------------------- /AtomBase/AtomHub/Arduino_LED_Hap/port_x.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | //#define HOMEKIT_DEBUG 3 | #if defined(ARDUINO) && defined(ESP8266) 4 | #define ARDUINO8266_SERVER 5 | 6 | #define ARDUINO8266_SERVER_CPP 7 | 8 | //#define HOMEKIT_DEBUG 9 | #define HOMEKIT_SHORT_APPLE_UUIDS 10 | #define HOMEKIT_OVERCLOCK_PAIR_SETUP 11 | #endif -------------------------------------------------------------------------------- /AtomBase/AtomHub/Arduino_LED_Hap/query_params.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "query_params.h" 4 | 5 | 6 | query_param_t *query_params_parse(const char *s) { 7 | query_param_t *params = NULL; 8 | 9 | int i = 0; 10 | while (1) { 11 | int pos = i; 12 | while (s[i] && s[i] != '=' && s[i] != '&' && s[i] != '#') i++; 13 | if (i == pos) { 14 | i++; 15 | continue; 16 | } 17 | 18 | query_param_t *param = malloc(sizeof(query_param_t)); 19 | param->name = strndup(s+pos, i-pos); 20 | param->value = NULL; 21 | param->next = params; 22 | params = param; 23 | 24 | if (s[i] == '=') { 25 | i++; 26 | pos = i; 27 | while (s[i] && s[i] != '&' && s[i] != '#') i++; 28 | if (i != pos) { 29 | param->value = strndup(s+pos, i-pos); 30 | } 31 | } 32 | 33 | if (!s[i] || s[i] == '#') 34 | break; 35 | } 36 | 37 | return params; 38 | } 39 | 40 | 41 | query_param_t *query_params_find(query_param_t *params, const char *name) { 42 | while (params) { 43 | if (!strcmp(params->name, name)) 44 | return params; 45 | params = params->next; 46 | } 47 | 48 | return NULL; 49 | } 50 | 51 | 52 | void query_params_free(query_param_t *params) { 53 | while (params) { 54 | query_param_t *next = params->next; 55 | if (params->name) 56 | free(params->name); 57 | if (params->value) 58 | free(params->value); 59 | free(params); 60 | 61 | params = next; 62 | } 63 | } 64 | 65 | -------------------------------------------------------------------------------- /AtomBase/AtomHub/Arduino_LED_Hap/query_params.h: -------------------------------------------------------------------------------- 1 | #ifndef __HOMEKIT_QUERY_PARAMS__ 2 | #define __HOMEKIT_QUERY_PARAMS__ 3 | #include "port_x.h" 4 | #ifdef ARDUINO8266_SERVER_CPP 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | #endif 9 | 10 | typedef struct _query_param { 11 | char *name; 12 | char *value; 13 | 14 | struct _query_param *next; 15 | } query_param_t; 16 | 17 | query_param_t *query_params_parse(const char *s); 18 | query_param_t *query_params_find(query_param_t *params, const char *name); 19 | void query_params_free(query_param_t *params); 20 | 21 | #ifdef ARDUINO8266_SERVER_CPP 22 | #ifdef __cplusplus 23 | } //extern C 24 | #endif 25 | #endif 26 | 27 | #endif // __HOMEKIT_QUERY_PARAMS__ 28 | -------------------------------------------------------------------------------- /AtomBase/AtomHub/Arduino_LED_Hap/release_notes.md: -------------------------------------------------------------------------------- 1 | ESPHap 0.9 2 | ============= 3 | 4 | * first version and commit 5 | 6 | -------------------------------------------------------------------------------- /AtomBase/AtomHub/Arduino_LED_Hap/storage_ex.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m5stack/M5-ProductExampleCodes/1bc38736e61a362080d1dffc4020b3a2a1dff6ae/AtomBase/AtomHub/Arduino_LED_Hap/storage_ex.h -------------------------------------------------------------------------------- /AtomBase/AtomHub/Arduino_LED_Hap/tlv.h: -------------------------------------------------------------------------------- 1 | #ifndef __TLV_H__ 2 | #define __TLV_H__ 3 | #include "port_x.h" 4 | 5 | #ifdef ARDUINO8266_SERVER_CPP 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | #endif 10 | 11 | typedef unsigned char byte; 12 | 13 | typedef struct _tlv { 14 | struct _tlv *next; 15 | byte type; 16 | byte *value; 17 | size_t size; 18 | } tlv_t; 19 | 20 | 21 | typedef struct { 22 | tlv_t *head; 23 | } tlv_values_t; 24 | 25 | 26 | tlv_values_t *tlv_new(); 27 | 28 | void tlv_free(tlv_values_t *values); 29 | 30 | int tlv_add_value(tlv_values_t *values, byte type, const byte *value, size_t size); 31 | int tlv_add_string_value(tlv_values_t *values, byte type, const char *value); 32 | int tlv_add_integer_value(tlv_values_t *values, byte type, size_t size, int value); 33 | int tlv_add_tlv_value(tlv_values_t *values, byte type, tlv_values_t *value); 34 | 35 | tlv_t *tlv_get_value(const tlv_values_t *values, byte type); 36 | int tlv_get_integer_value(const tlv_values_t *values, byte type, int def); 37 | tlv_values_t *tlv_get_tlv_value(const tlv_values_t *values, byte type); 38 | 39 | int tlv_format(const tlv_values_t *values, byte *buffer, size_t *size); 40 | 41 | int tlv_parse(const byte *buffer, size_t length, tlv_values_t *values); 42 | 43 | #ifdef ARDUINO8266_SERVER_CPP 44 | #ifdef __cplusplus 45 | } //extern C 46 | #endif 47 | #endif 48 | 49 | #endif // __TLV_H__ 50 | -------------------------------------------------------------------------------- /AtomBase/AtomHub/Arduino_LED_Hap/watchdog.c: -------------------------------------------------------------------------------- 1 | // Base on esp_hw_wdt in github 2 | /* 3 | * Copyright (c) 2014-2017 Cesanta Software Limited 4 | * All rights reserved 5 | * Changed: 6 | * 2017 Alexander Epstine (a@epstine.com) 7 | */ 8 | #if defined(ARDUINO) && defined(ESP8266) 9 | #include "watchdog.h" 10 | #include "Arduino.h" 11 | #include "stdint.h" 12 | #include "user_interface.h" 13 | 14 | #define REG_WDT_BASE 0x60000900 15 | 16 | #define WDT_CTL (REG_WDT_BASE + 0x0) 17 | #define WDT_CTL_ENABLE (BIT(0)) 18 | #define WDT_RESET (REG_WDT_BASE + 0x14) 19 | #define WDT_RESET_VALUE 0x73 20 | 21 | void esp_hw_wdt_enable() { 22 | SET_PERI_REG_MASK(WDT_CTL, WDT_CTL_ENABLE); 23 | } 24 | 25 | void esp_hw_wdt_disable() { 26 | CLEAR_PERI_REG_MASK(WDT_CTL, WDT_CTL_ENABLE); 27 | } 28 | 29 | void esp_hw_wdt_feed() { 30 | WRITE_PERI_REG(WDT_RESET, WDT_RESET_VALUE); 31 | } 32 | 33 | 34 | void watchdog_disable_all() { 35 | system_soft_wdt_stop(); 36 | esp_hw_wdt_disable(); 37 | } 38 | 39 | void watchdog_enable_all() { 40 | esp_hw_wdt_enable(); 41 | system_soft_wdt_restart(); 42 | } 43 | 44 | static uint32_t wdt_checkpoint; 45 | 46 | void watchdog_check_begin() { 47 | wdt_checkpoint = millis(); 48 | } 49 | 50 | void watchdog_check_end(const char *message) { 51 | uint32_t d = millis() - wdt_checkpoint; 52 | //printf("=== %s took: %dms\n", message, d); 53 | } 54 | #endif -------------------------------------------------------------------------------- /AtomBase/AtomHub/Arduino_LED_Hap/watchdog.h: -------------------------------------------------------------------------------- 1 | #ifndef WATCHDOG_H_ 2 | #define WATCHDOG_H_ 3 | 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | void watchdog_disable_all(); 10 | 11 | void watchdog_enable_all(); 12 | 13 | void watchdog_check_begin(); 14 | 15 | void watchdog_check_end(const char* message); 16 | 17 | #ifdef __cplusplus 18 | } 19 | #endif 20 | 21 | 22 | #endif /* WATCHDOG_H_ */ 23 | -------------------------------------------------------------------------------- /AtomBase/AtomHub/Arduino_LED_Hap/wolfSSL_3_13_0.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m5stack/M5-ProductExampleCodes/1bc38736e61a362080d1dffc4020b3a2a1dff6ae/AtomBase/AtomHub/Arduino_LED_Hap/wolfSSL_3_13_0.rar -------------------------------------------------------------------------------- /AtomBase/AtomHub/Arduino_LED_Hap/wolfssl/wolfSSL.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m5stack/M5-ProductExampleCodes/1bc38736e61a362080d1dffc4020b3a2a1dff6ae/AtomBase/AtomHub/Arduino_LED_Hap/wolfssl/wolfSSL.rar -------------------------------------------------------------------------------- /AtomBase/AtomHub/Arduino_LED_Hap/xrtos.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "port_x.h" 3 | 4 | #if defined(ARDUINO8266_SERVER) 5 | 6 | #include "Arduino.h" 7 | #include "queue.h" 8 | 9 | #define gpio_enable(p,m) pinMode(p,m) 10 | #define gpio_set_direction(p,m) pinMode(p,m) 11 | #define gpio_set_level(p,l) digitalWrite(p,l) 12 | 13 | typedef void(*callbacktask_with_arg_t)(void*); 14 | void* xTaskCreate(callbacktask_with_arg_t fn, const char* szname, unsigned int stacksize, void* context, unsigned int priority, void* handle); 15 | void vTaskDelay(unsigned int delay); 16 | void vTaskDelete(void* thandle); 17 | 18 | 19 | typedef struct q_data_s q_data_t; 20 | struct q_data_s { 21 | unsigned int value; 22 | STAILQ_ENTRY(q_data_s) entries; 23 | }; 24 | typedef STAILQ_HEAD(stailqhead, q_data_s) q_head_t; 25 | typedef q_head_t* QueueHandle_t; 26 | QueueHandle_t xQueueCreate(unsigned int size, unsigned int elem_size); 27 | 28 | int xQueueSendToBack(QueueHandle_t xQueue, const void * pvItemToQueue, unsigned int xTicksToWait); 29 | bool xQueueReceive(QueueHandle_t xQueue, void *pvBuffer, unsigned int xTicksToWait); 30 | 31 | void vQueueDelete(QueueHandle_t q); 32 | #endif 33 | -------------------------------------------------------------------------------- /AtomBase/AtomicQR/AtomicQR/AtomicQR.ino: -------------------------------------------------------------------------------- 1 | /*Press button to scan, serial monitor will print information*/ 2 | 3 | #include 4 | 5 | #define TRIG 23 6 | #define DLED 33 7 | 8 | void setup() { 9 | M5.begin(false, false, true); 10 | Serial.begin(9600); 11 | Serial2.begin(9600, SERIAL_8N1, 22, 19); 12 | M5.dis.drawpix(0, 0x00f000); 13 | pinMode(TRIG, OUTPUT); 14 | pinMode(DLED, INPUT); 15 | digitalWrite(TRIG, HIGH); 16 | } 17 | 18 | void loop() { 19 | M5.update(); 20 | if(digitalRead(39) == LOW){ 21 | digitalWrite(TRIG, LOW); 22 | }else { 23 | digitalWrite(TRIG, HIGH); 24 | } 25 | if(digitalRead(DLED) == HIGH){ 26 | while(Serial2.available() > 0){ 27 | char ch = Serial2.read(); 28 | Serial.print(ch); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /AtomBase/AtomicRS232/Arduino/AtomicRS232/AtomicRS232.ino: -------------------------------------------------------------------------------- 1 | /*When the serial port sends or receives messages, the LED lights up,Press button to send character*/ 2 | 3 | 4 | #include 5 | 6 | 7 | void setup() { 8 | 9 | M5.begin(true, false, true); 10 | // Serial2.begin(unsigned long baud, uint32_t config, int8_t rxPin, int8_t txPin, bool invert) 11 | Serial2.begin(115200, SERIAL_8N1, 22, 19); 12 | } 13 | 14 | void loop() { 15 | if(M5.Btn.wasPressed()){ 16 | M5.dis.drawpix(0, 0xff00ff); 17 | M5.update(); 18 | Serial2.write('a'); 19 | delay(50); 20 | }else{ 21 | M5.dis.drawpix(0, 0x000000); 22 | } 23 | if(Serial2.available()) { 24 | int ch = Serial2.read(); 25 | Serial.write(ch); 26 | M5.dis.drawpix(0, 0x00ffff); 27 | M5.update(); 28 | delay(50); 29 | }else{ 30 | M5.dis.drawpix(0, 0x000000); 31 | } 32 | M5.update(); 33 | } 34 | -------------------------------------------------------------------------------- /AtomBase/AtomicRS485/Arduino/AtomicRS485/AtomicRS485.ino: -------------------------------------------------------------------------------- 1 | /*When the serial port sends or receives messages, the LED lights up,Press button to send character*/ 2 | 3 | 4 | #include 5 | 6 | void setup() { 7 | 8 | M5.begin(true, false, true); 9 | // Serial2.begin(unsigned long baud, uint32_t config, int8_t rxPin, int8_t txPin, bool invert) 10 | Serial2.begin(115200, SERIAL_8N1, 22, 19); 11 | } 12 | 13 | void loop() { 14 | if(M5.Btn.wasPressed()){ 15 | M5.dis.drawpix(0, 0xff00ff); 16 | M5.update(); 17 | Serial2.write('a'); 18 | delay(50); 19 | }else{ 20 | M5.dis.drawpix(0, 0x000000); 21 | } 22 | if(Serial2.available()) { 23 | int ch = Serial2.read(); 24 | Serial.write(ch); 25 | M5.dis.drawpix(0, 0x00ffff); 26 | M5.update(); 27 | delay(50); 28 | }else{ 29 | M5.dis.drawpix(0, 0x000000); 30 | } 31 | M5.update(); 32 | } 33 | -------------------------------------------------------------------------------- /AtomBase/Atomic_StepMotor/Atomic_StepMotor/Atomic_StepMotor.ino: -------------------------------------------------------------------------------- 1 | //Press button the stepmotor will turn 5000 steps clockwise then turn 5000 steps anti-clockwise 2 | 3 | 4 | #include 5 | #include "StepperDriver.h" 6 | 7 | int motor_steps = 200; 8 | int step_divisition = 32; 9 | int en_pin = 22; 10 | int dir_pin = 23; 11 | int step_pin = 19; 12 | 13 | int step = 0; 14 | int speed = 0; 15 | 16 | 17 | StepperDriver ss(motor_steps, step_divisition, en_pin, dir_pin, step_pin); 18 | 19 | void setup() 20 | { 21 | M5.begin(true, false, true); 22 | ss.setSpeed(0); 23 | ss.powerEnable(true); 24 | delay(1600); 25 | } 26 | 27 | void loop() 28 | { 29 | if(M5.Btn.wasPressed()) { 30 | ss.setSpeed(300); 31 | ss.step(5000); 32 | ss.step(-5000); 33 | } 34 | M5.update(); 35 | } 36 | -------------------------------------------------------------------------------- /AtomBase/Atomic_StepMotor/Atomic_StepMotor/StepperDriver.h: -------------------------------------------------------------------------------- 1 | #ifndef StepperDriver_h 2 | #define StepperDriver_h 3 | 4 | // library interface description 5 | class StepperDriver { 6 | public: 7 | // constructors: 8 | StepperDriver(int number_of_steps, int step_division, int en_pin, int dir_pin, int step_pin); 9 | 10 | // speed setter method: 11 | void setSpeed(float rpm); 12 | 13 | void powerEnable(bool ena); 14 | 15 | // mover method: 16 | void step(long steps_to_move); 17 | 18 | void step(long steps_to_move, long steps_acc, long steps_dec); 19 | 20 | private: 21 | void setDirection(long steps_to_move); 22 | 23 | void move(); 24 | 25 | void dynamicMove(int s1, int s2); 26 | 27 | void moveInterval(unsigned long target_delay); 28 | 29 | 30 | int number_of_steps; 31 | int step_division; 32 | unsigned long step_interval; 33 | unsigned long last_step_time; 34 | unsigned long target_step_time1; 35 | unsigned long target_step_time2; 36 | 37 | // motor pin numbers: 38 | int en_pin; 39 | int dir_pin; 40 | int step_pin; 41 | 42 | }; 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /AtomBase/Tail485/Tail485/Tail485.ino: -------------------------------------------------------------------------------- 1 | #include "M5Atom.h" 2 | 3 | #define RX_PIN 32 4 | #define TX_PIN 26 5 | 6 | void setup() { 7 | M5.begin(true, false, true); 8 | Serial2.begin(115200, SERIAL_8N1, RX_PIN, TX_PIN); 9 | } 10 | 11 | void loop() { 12 | if(M5.Btn.wasPressed()) { 13 | Serial2.write("hello"); 14 | M5.dis.drawpix(0, 0x00f000); 15 | } 16 | while(Serial2.available()){ 17 | char c = Serial2.read(); 18 | Serial.print(c); 19 | M5.dis.drawpix(0, 0x0000f0); 20 | } 21 | delay(20); 22 | M5.dis.drawpix(0, 0x000000); 23 | M5.update(); 24 | } 25 | -------------------------------------------------------------------------------- /Base/BTC/Arduino/BTC/BTC.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Example for DHT12 Sensor 3 | */ 4 | 5 | #include 6 | #include "DHT12.h" 7 | #include //The DHT12 uses I2C comunication. 8 | 9 | void setup() { 10 | M5.begin(); 11 | Wire.begin(); 12 | M5.Lcd.setBrightness(10); 13 | Serial.println(F("ENV Unit(DHT12 and BMP280) test...")); 14 | } 15 | 16 | void loop() { 17 | float tmp = dht12.readTemperature(); 18 | float hum = dht12.readHumidity(); 19 | Serial.printf("Temperatura: %2.2f*C Humedad: %0.2f%%\r\n", tmp, hum); 20 | 21 | M5.Lcd.setCursor(0, 0); 22 | M5.Lcd.setTextColor(WHITE, BLACK); 23 | M5.Lcd.setTextSize(3); 24 | M5.Lcd.printf("Temp: %2.1f \r\nHumi: %2.0f%% \r\n", tmp, hum); 25 | 26 | delay(100); 27 | } -------------------------------------------------------------------------------- /Base/BTC/Arduino/BTC/DHT12.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | DHT12.cpp - Library for DHT12 sensor. 3 | v0.0.1 Beta 4 | Created by Bobadas, July 30,2016. 5 | Released into the public domain. 6 | */ 7 | #include "Arduino.h" 8 | #include "Wire.h" 9 | #include "DHT12.h" 10 | 11 | DHT12::DHT12(byte scale,byte id) 12 | { 13 | if (id==0 || id>126) _id=0x5c; 14 | else _id=id; 15 | if (scale==0 || scale>3) _scale=CELSIUS; 16 | else _scale=scale; 17 | } 18 | 19 | byte DHT12::read() 20 | { 21 | Wire.beginTransmission(_id); 22 | Wire.write(0); 23 | if (Wire.endTransmission()!=0) return 1; 24 | Wire.requestFrom(_id, 5); 25 | for (int i=0;i<5;i++) { 26 | datos[i]=Wire.read(); 27 | }; 28 | delay(50); 29 | if (Wire.available()!=0) return 2; 30 | if (datos[4]!=(datos[0]+datos[1]+datos[2]+datos[3])) return 3; 31 | return 0; 32 | } 33 | 34 | float DHT12::readTemperature(byte scale) 35 | { 36 | float resultado=0; 37 | byte error=read(); 38 | if (error!=0) return (float)error/100; 39 | if (scale==0) scale=_scale; 40 | switch(scale) { 41 | case CELSIUS: 42 | resultado=(datos[2]+(float)datos[3]/10); 43 | break; 44 | case FAHRENHEIT: 45 | resultado=((datos[2]+(float)datos[3]/10)*1.8+32); 46 | break; 47 | case KELVIN: 48 | resultado=(datos[2]+(float)datos[3]/10)+273.15; 49 | break; 50 | }; 51 | return resultado; 52 | } 53 | 54 | float DHT12::readHumidity() 55 | { 56 | float resultado; 57 | byte error=read(); 58 | if (error!=0) return (float)error/100; 59 | resultado=(datos[0]+(float)datos[1]/10); 60 | return resultado; 61 | } 62 | 63 | -------------------------------------------------------------------------------- /Base/BTC/Arduino/BTC/DHT12.h: -------------------------------------------------------------------------------- 1 | /* 2 | DHT12.h - Library for DHT12 sensor. 3 | v0.0.1 Beta 4 | Created by Bobadas, July 30,2016. 5 | Released into the public domain. 6 | */ 7 | #ifndef DHT12_h 8 | #define DHT12_h 9 | #include "Arduino.h" 10 | #include "Wire.h" 11 | 12 | #define CELSIUS 1 13 | #define KELVIN 2 14 | #define FAHRENHEIT 3 15 | 16 | class DHT12 17 | { 18 | public: 19 | DHT12(byte scale=0,byte id=0); 20 | float readTemperature(byte scale=0); 21 | float readHumidity(); 22 | private: 23 | byte read(); 24 | byte datos[5]; 25 | byte _id; 26 | byte _scale; 27 | }; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /Base/BTC/Arduino/BTC/README.md: -------------------------------------------------------------------------------- 1 | # Example for ENV Unit 2 | 3 | *注意,编译例程前,需要将DHT12.h和DHT12.cpp文件放置在例程ENV.ino所在文件夹下,并且通过Arduino IDE的库管理安装[Adafruit BMP280](https://github.com/adafruit/Adafruit_BMP280_Library)库,然后下载这个[地址](https://github.com/adafruit/Adafruit_Sensor)的Adafruit_Sensor.h,并放置在Adafruit_BMP280_Library文件夹中。* 4 | 5 | ## Desc 6 | 7 | 从ENV Unit读取温湿度和压力值,然后通过串口0打印到串口终端,同时在M5Core的屏幕上显示这些数据。 8 | 9 | ## Result 10 | 11 | 串口终端显示结果: 12 | 13 | Temperatura: 25.40*C Humedad: 28.50% Pressure: 102137.55Pa 14 | 15 | Temperatura: 25.40*C Humedad: 28.50% Pressure: 102136.17Pa 16 | 17 | Temperatura: 25.50*C Humedad: 28.50% Pressure: 102139.25Pa 18 | 19 | Temperatura: 25.50*C Humedad: 28.50% Pressure: 102133.55Pa 20 | 21 | Temperatura: 25.50*C Humedad: 28.50% Pressure: 102137.08Pa 22 | 23 | Temperatura: 25.50*C Humedad: 28.50% Pressure: 102140.25Pa 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Base/BTC/Arduino/BTC2.1/BTC2.1.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Description: Use BTC2.1/SHT30 BASE to read temperature, humidity and display the data on the screen. 3 | */ 4 | 5 | #include 6 | #include 7 | #include "SHT3X.h" 8 | SHT3X sht30; 9 | 10 | float tmp = 0.0; 11 | float hum = 0.0; 12 | 13 | void setup() { 14 | M5.begin(); 15 | Wire.begin(); 16 | M5.Lcd.setBrightness(10); 17 | M5.Lcd.setTextSize(3); 18 | Serial.println(F("BTC2.1 SHT30 test...")); 19 | M5.Lcd.clear(BLACK); 20 | M5.Lcd.println("BTC2.1 SHT30 TEST"); 21 | 22 | } 23 | 24 | void loop() { 25 | if(sht30.get()==0){ 26 | tmp = sht30.cTemp; 27 | hum = sht30.humidity; 28 | } 29 | Serial.printf("Temperatura: %2.2f*C Humedad: %0.2f%% \r\n", tmp, hum); 30 | M5.Lcd.setCursor(0, 40); 31 | M5.Lcd.setTextColor(WHITE, BLACK); 32 | M5.Lcd.printf("Temp: %2.1f \r\nHumi: %2.0f%% \r\n", tmp, hum); 33 | delay(100); 34 | } 35 | -------------------------------------------------------------------------------- /Base/BTC/Arduino/BTC2.1/SHT3X.cpp: -------------------------------------------------------------------------------- 1 | #include "SHT3X.h" 2 | 3 | /* Motor() 4 | 5 | */ 6 | SHT3X::SHT3X(uint8_t address) 7 | { 8 | Wire.begin(); 9 | _address=address; 10 | } 11 | 12 | 13 | 14 | byte SHT3X::get() 15 | { 16 | unsigned int data[6]; 17 | 18 | // Start I2C Transmission 19 | Wire.beginTransmission(_address); 20 | // Send measurement command 21 | Wire.write(0x2C); 22 | Wire.write(0x06); 23 | // Stop I2C transmission 24 | if (Wire.endTransmission()!=0) 25 | return 1; 26 | 27 | delay(500); 28 | 29 | // Request 6 bytes of data 30 | Wire.requestFrom(_address, 6); 31 | 32 | // Read 6 bytes of data 33 | // cTemp msb, cTemp lsb, cTemp crc, humidity msb, humidity lsb, humidity crc 34 | for (int i=0;i<6;i++) { 35 | data[i]=Wire.read(); 36 | }; 37 | 38 | delay(50); 39 | 40 | if (Wire.available()!=0) 41 | return 2; 42 | 43 | // Convert the data 44 | cTemp = ((((data[0] * 256.0) + data[1]) * 175) / 65535.0) - 45; 45 | fTemp = (cTemp * 1.8) + 32; 46 | humidity = ((((data[3] * 256.0) + data[4]) * 100) / 65535.0); 47 | 48 | return 0; 49 | } 50 | -------------------------------------------------------------------------------- /Base/BTC/Arduino/BTC2.1/SHT3X.h: -------------------------------------------------------------------------------- 1 | #ifndef __SHT3X_H 2 | #define __HT3X_H 3 | 4 | 5 | #if ARDUINO >= 100 6 | #include "Arduino.h" 7 | #else 8 | #include "WProgram.h" 9 | #endif 10 | 11 | #include "Wire.h" 12 | 13 | class SHT3X{ 14 | public: 15 | SHT3X(uint8_t address=0x44); 16 | byte get(void); 17 | float cTemp=0; 18 | float fTemp=0; 19 | float humidity=0; 20 | 21 | private: 22 | uint8_t _address; 23 | 24 | }; 25 | 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Arduino/EchoSTT/BaiduRest.h: -------------------------------------------------------------------------------- 1 | #ifndef _BAIDUREST_H_ 2 | #define _BAIDUREST_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | 9 | #define TOKEN_GET_URL "flow.m5stack.com:5003/token_get" 10 | #define REST_URL "flow.m5stack.com:5003/pcm" 11 | #define REST_URL_T2A "flow.m5stack.com:5003/text2audio" 12 | 13 | #define JSON_DOCSIZE 512 14 | 15 | #define DEV_PID_MANDARIN "1537" //普通话(纯中文识别) 16 | #define DEV_PID_M_AND_E "1536" //普通话(支持简单的英文识别) 17 | #define DEV_PID_ENGLISH "1737" //英语 18 | #define DEV_PID_CANTONESE "1637" //粤语 19 | 20 | 21 | struct pcmPack 22 | { 23 | uint8_t *packData; 24 | uint32_t packsize; 25 | }; 26 | 27 | class BaiduRest 28 | { 29 | private: 30 | String api_token_str; 31 | StaticJsonDocument rest_json_doc; 32 | char ascii2hex_buff[17] ="0123456789abcdef"; 33 | 34 | public: 35 | QueueHandle_t xQ_i2sSteam = NULL; 36 | 37 | public: 38 | BaiduRest(); 39 | ~BaiduRest(); 40 | int gettoken(void); 41 | int creattoken(void); 42 | void settoken(String token_str); 43 | 44 | int Pcm2String(uint8_t* pcm_buff, uint32_t pcm_lan, String dev_pid, String *results_str); 45 | int String2Pcm(String str, int spd, int pit, int vol, int per,uint8_t* pcm_buff, size_t* len); 46 | int String2Pcm(String str, int spd, int pit, int vol, int per); 47 | String Str2UrlEncode(String str); 48 | 49 | }; 50 | 51 | 52 | 53 | #endif -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Arduino/EchoSTT2QiYeWX/BaiduRest.h: -------------------------------------------------------------------------------- 1 | #ifndef _BAIDUREST_H_ 2 | #define _BAIDUREST_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | 9 | #define TOKEN_GET_URL "flow.m5stack.com:5003/token_get" 10 | #define REST_URL "flow.m5stack.com:5003/pcm" 11 | #define REST_URL_T2A "flow.m5stack.com:5003/text2audio" 12 | 13 | #define JSON_DOCSIZE 512 14 | 15 | #define DEV_PID_MANDARIN "1537" //普通话(纯中文识别) 16 | #define DEV_PID_M_AND_E "1536" //普通话(支持简单的英文识别) 17 | #define DEV_PID_ENGLISH "1737" //英语 18 | #define DEV_PID_CANTONESE "1637" //粤语 19 | 20 | 21 | struct pcmPack 22 | { 23 | uint8_t *packData; 24 | uint32_t packsize; 25 | }; 26 | 27 | class BaiduRest 28 | { 29 | private: 30 | String api_token_str; 31 | StaticJsonDocument rest_json_doc; 32 | char ascii2hex_buff[17] ="0123456789abcdef"; 33 | 34 | public: 35 | QueueHandle_t xQ_i2sSteam = NULL; 36 | 37 | public: 38 | BaiduRest(); 39 | ~BaiduRest(); 40 | int gettoken(void); 41 | int creattoken(void); 42 | void settoken(String token_str); 43 | 44 | int Pcm2String(uint8_t* pcm_buff, uint32_t pcm_lan, String dev_pid, String *results_str); 45 | int String2Pcm(String str, int spd, int pit, int vol, int per,uint8_t* pcm_buff, size_t* len); 46 | int String2Pcm(String str, int spd, int pit, int vol, int per); 47 | String Str2UrlEncode(String str); 48 | 49 | }; 50 | 51 | 52 | 53 | #endif -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Arduino/StreamHttpClient_ECHO/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: bash 3 | os: linux 4 | dist: trusty 5 | 6 | matrix: 7 | include: 8 | - env: 9 | - BUILD_TYPE=build 10 | - env: 11 | - BUILD_TYPE=build_esp32 12 | 13 | install: 14 | 15 | script: 16 | - $TRAVIS_BUILD_DIR/tests/common.sh 17 | 18 | deploy: 19 | 20 | notifications: 21 | email: 22 | on_success: change 23 | on_failure: change 24 | webhooks: 25 | urls: 26 | on_success: change # options: [always|never|change] default: always 27 | on_failure: always # options: [always|never|change] default: always 28 | on_start: false # default: false 29 | -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Arduino/StreamHttpClient_ECHO/keywords.txt: -------------------------------------------------------------------------------- 1 | AudioFileSource KEYWORD1 2 | AudioFileSourceSPIFFS KEYWORD1 3 | AudioFileSourceFS KEYWORD1 4 | AudioFileSourcePROGMEM KEYWORD1 5 | AudioFileSourceHTTPStream KEYWORD1 6 | AudioFileSourceICYStream KEYWORD1 7 | AudioFileSourceID3 KEYWORD1 8 | AudioFileSourceSD KEYWORD1 9 | AudioFileSourceBuffer KEYWORD1 10 | AudioFileSourceSPIRAMBuffer KEYWORD1 11 | AudioGenerator KEYWORD1 12 | AudioGeneratorAAC KEYWORD1 13 | AudioGeneratorFLAC KEYWORD1 14 | AudioGeneratorMOD KEYWORD1 15 | AudioGeneratorMIDI KEYWORD1 16 | AudioGeneratorMP3 KEYWORD1 17 | AudioGeneratorRTTTL KEYWORD1 18 | AudioGeneratorWAV KEYWORD1 19 | AudioOutput KEYWORD1 20 | AudioOutputI2S KEYWORD1 21 | AudioOutputI2SNoDAC KEYWORD1 22 | AudioOutputNull KEYWORD1 23 | AudioOutputBuffer KEYWORD1 24 | AudioOutputSerialWAV KEYWORD1 25 | AudioOutputSPIFFSWAV KEYWORD1 26 | AudioOutputMixer KEYWORD1 27 | AudioOutputMixerStub KEYWORD1 28 | -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Arduino/StreamHttpClient_ECHO/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ESP8266Audio", 3 | "description": "Audio file format and I2S DAC library", 4 | "keywords": "ESP8266, ESP32, MP3, AAC, WAV, MOD, FLAC, RTTTL, I2S, DAC, Delta-Sigma", 5 | "authors": [ 6 | { 7 | "name": "Earle F. Philhower, III", 8 | "email": "earlephilhower@yahoo.com", 9 | "url": "https://github.com/earlephilhower/ESP8266Audio", 10 | "maintainer": true 11 | } 12 | ], 13 | "repository": { 14 | "type": "git", 15 | "url": "https://github.com/earlephilhower/ESP8266Audio" 16 | }, 17 | "version": "1.1.3", 18 | "homepage": "https://github.com/earlephilhower/ESP8266Audio", 19 | "dependencies": { 20 | "ESP8266Spiram": "1.0", 21 | "SPI": "1.0" 22 | }, 23 | "frameworks": "Arduino", 24 | "examples": [ 25 | "examples/*/*.ino" 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Arduino/StreamHttpClient_ECHO/library.properties: -------------------------------------------------------------------------------- 1 | name=ESP8266Audio 2 | version=1.1.4 3 | author=Earle F. Philhower, III 4 | maintainer=Earle F. Philhower, III 5 | sentence=Audio file and I2S sound playing routines. 6 | paragraph=Decode compressed MP3, AAC, FLAC, Screamtracker MOD, MIDI, RTTL, and WAV and play on an I2S DAC or a software-driven delta-sigma DAC and 1-transistor amplifier. 7 | category=Signal Input/Output 8 | url=https://github.com/earlephilhower/ESP8266Audio 9 | architectures=esp8266,esp32 10 | 11 | -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Arduino/StreamHttpClient_ECHO/src/AudioFileSourceICYStream.h: -------------------------------------------------------------------------------- 1 | /* 2 | AudioFileSourceHTTPStream 3 | Connect to a HTTP based streaming service 4 | 5 | Copyright (C) 2017 Earle F. Philhower, III 6 | 7 | This program is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . 19 | */ 20 | 21 | #ifndef _AUDIOFILESOURCEICYSTREAM_H 22 | #define _AUDIOFILESOURCEICYSTREAM_H 23 | 24 | #include 25 | #ifdef ESP32 26 | #include 27 | #else 28 | #include 29 | #endif 30 | 31 | #include "AudioFileSourceHTTPStream.h" 32 | 33 | class AudioFileSourceICYStream : public AudioFileSourceHTTPStream 34 | { 35 | public: 36 | AudioFileSourceICYStream(); 37 | AudioFileSourceICYStream(const char *url); 38 | virtual ~AudioFileSourceICYStream() override; 39 | 40 | virtual bool open(const char *url) override; 41 | 42 | private: 43 | virtual uint32_t readInternal(void *data, uint32_t len, bool nonBlock) override; 44 | int icyMetaInt; 45 | int icyByteCount; 46 | }; 47 | 48 | 49 | #endif 50 | 51 | -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Arduino/StreamHttpClient_ECHO/src/AudioFileSourceID3.h: -------------------------------------------------------------------------------- 1 | /* 2 | AudioFileSourceID3 3 | ID3 filter that extracts any ID3 fields and sends to CB function 4 | 5 | Copyright (C) 2017 Earle F. Philhower, III 6 | 7 | This program is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . 19 | */ 20 | 21 | #ifndef _AUDIOFILESOURCEID3_H 22 | #define _AUDIOFILESOURCEID3_H 23 | 24 | #include 25 | 26 | #include "AudioFileSource.h" 27 | 28 | class AudioFileSourceID3 : public AudioFileSource 29 | { 30 | public: 31 | AudioFileSourceID3(AudioFileSource *src); 32 | virtual ~AudioFileSourceID3() override; 33 | 34 | virtual uint32_t read(void *data, uint32_t len) override; 35 | virtual bool seek(int32_t pos, int dir) override; 36 | virtual bool close() override; 37 | virtual bool isOpen() override; 38 | virtual uint32_t getSize() override; 39 | virtual uint32_t getPos() override; 40 | 41 | private: 42 | AudioFileSource *src; 43 | bool checked; 44 | }; 45 | 46 | 47 | #endif 48 | 49 | -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Arduino/StreamHttpClient_ECHO/src/AudioFileSourceSD.h: -------------------------------------------------------------------------------- 1 | /* 2 | AudioFileSourceSPIFFS 3 | Input SD card "file" to be used by AudioGenerator 4 | 5 | Copyright (C) 2017 Earle F. Philhower, III 6 | 7 | This program is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . 19 | */ 20 | 21 | #ifndef _AUDIOFILESOURCESD_H 22 | #define _AUDIOFILESOURCESD_H 23 | 24 | #include "AudioFileSource.h" 25 | #include 26 | 27 | 28 | class AudioFileSourceSD : public AudioFileSource 29 | { 30 | public: 31 | AudioFileSourceSD(); 32 | AudioFileSourceSD(const char *filename); 33 | virtual ~AudioFileSourceSD() override; 34 | 35 | virtual bool open(const char *filename) override; 36 | virtual uint32_t read(void *data, uint32_t len) override; 37 | virtual bool seek(int32_t pos, int dir) override; 38 | virtual bool close() override; 39 | virtual bool isOpen() override; 40 | virtual uint32_t getSize() override; 41 | virtual uint32_t getPos() override; 42 | 43 | private: 44 | File f; 45 | }; 46 | 47 | 48 | #endif 49 | 50 | -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Arduino/StreamHttpClient_ECHO/src/AudioFileSourceSPIFFS.h: -------------------------------------------------------------------------------- 1 | /* 2 | AudioFileSourceFS 3 | Input Arduion "file" to be used by AudioGenerator 4 | 5 | Copyright (C) 2017 Earle F. Philhower, III 6 | 7 | This program is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . 19 | */ 20 | 21 | #ifndef _AUDIOFILESOURCESPIFFS_H 22 | #define _AUDIOFILESOURCESPIFFS_H 23 | 24 | #include 25 | #include 26 | 27 | #include "AudioFileSource.h" 28 | #include "AudioFileSourceFS.h" 29 | 30 | class AudioFileSourceSPIFFS : public AudioFileSourceFS 31 | { 32 | public: 33 | AudioFileSourceSPIFFS() : AudioFileSourceFS(SPIFFS) { }; 34 | AudioFileSourceSPIFFS(const char *filename) : AudioFileSourceFS(SPIFFS, filename) {}; 35 | // Others are inherited from base 36 | }; 37 | 38 | 39 | #endif 40 | 41 | -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Arduino/StreamHttpClient_ECHO/src/AudioFileStream.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "AudioFileStream.h" 3 | 4 | 5 | AudioFileStream::AudioFileStream(AudioFileSource *source, int definedLen) 6 | { 7 | src = source; 8 | len = definedLen; 9 | ptr = 0; 10 | saved = -1; 11 | } 12 | 13 | AudioFileStream::~AudioFileStream() 14 | { 15 | // If there's a defined len, read until we're empty 16 | if (len) { 17 | while (ptr++ < len) (void)read(); 18 | } 19 | } 20 | 21 | 22 | int AudioFileStream::available() 23 | { 24 | if (saved >= 0) return 1; 25 | else if (len) return ptr - len; 26 | else if (src->getSize()) return (src->getPos() - src->getSize()); 27 | else return 1; 28 | } 29 | 30 | int AudioFileStream::read() 31 | { 32 | uint8_t c; 33 | int r; 34 | if (ptr >= len) return -1; 35 | ptr++; 36 | if (saved >= 0) { 37 | c = (uint8_t)saved; 38 | saved = -1; 39 | r = 1; 40 | } else { 41 | r = src->read(&c, 1); 42 | } 43 | if (r != 1) return -1; 44 | return (int)c; 45 | } 46 | 47 | int AudioFileStream::peek() 48 | { 49 | uint8_t c; 50 | if ((ptr+1) >= len) return -1; 51 | if (saved >= 0) return saved; 52 | int r = src->read(&c, 1); 53 | if (r<1) return -1; 54 | saved = c; 55 | return saved; 56 | } 57 | 58 | void AudioFileStream::flush() 59 | { 60 | /* noop? */ 61 | } 62 | -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Arduino/StreamHttpClient_ECHO/src/AudioFileStream.h: -------------------------------------------------------------------------------- 1 | /* 2 | AudioFileStream 3 | Convert an AudioFileSource* to a Stream* 4 | 5 | Copyright (C) 2017 Earle F. Philhower, III 6 | 7 | This program is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . 19 | */ 20 | 21 | #ifndef AUDIOFILESTREAM_H 22 | #define AUDIOFILESTREAM_H 23 | 24 | #include 25 | #include "AudioFileSource.h" 26 | 27 | class AudioFileStream : public Stream 28 | { 29 | public: 30 | AudioFileStream(AudioFileSource *source, int definedLen); 31 | virtual ~AudioFileStream(); 32 | 33 | public: 34 | // Stream interface - see the Arduino library documentation. 35 | virtual int available() override; 36 | virtual int read() override; 37 | virtual int peek() override; 38 | virtual void flush() override; 39 | virtual size_t write(uint8_t x) override { (void)x; return 0; }; 40 | 41 | private: 42 | AudioFileSource *src; 43 | int saved; 44 | int len; 45 | int ptr; 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Arduino/StreamHttpClient_ECHO/src/AudioLogger.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "AudioLogger.h" 3 | 4 | DevNullOut silencedLogger; 5 | Print* audioLogger = &silencedLogger; 6 | -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Arduino/StreamHttpClient_ECHO/src/AudioLogger.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #ifndef _AUDIOLOGGER_H 5 | #define _AUDIOLOGGER_H 6 | 7 | class DevNullOut: public Print 8 | { 9 | public: 10 | virtual size_t write(uint8_t) { return 1; } 11 | }; 12 | 13 | extern DevNullOut silencedLogger; 14 | 15 | // Global `audioLogger` is initialized to &silencedLogger 16 | // It can be initialized anytime to &Serial or any other Print:: derivative instance. 17 | extern Print* audioLogger; 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Arduino/StreamHttpClient_ECHO/src/AudioOutputNull.h: -------------------------------------------------------------------------------- 1 | /* 2 | AudioOutput 3 | Base class of an audio output player 4 | 5 | Copyright (C) 2017 Earle F. Philhower, III 6 | 7 | This program is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . 19 | */ 20 | 21 | #ifndef _AUDIOOUTPUTNULL_H 22 | #define _AUDIOOUTPUTNULL_H 23 | 24 | #include "AudioOutput.h" 25 | 26 | class AudioOutputNull : public AudioOutput 27 | { 28 | public: 29 | AudioOutputNull() {}; 30 | ~AudioOutputNull() {}; 31 | virtual bool begin() { samples = 0; startms = millis(); return true; } 32 | virtual bool ConsumeSample(int16_t sample[2]) { (void)sample; samples++; return true; } 33 | virtual bool stop() { endms = millis(); return true; }; 34 | unsigned long GetMilliseconds() { return endms - startms; } 35 | int GetSamples() { return samples; } 36 | int GetFrequency() { return hertz; } 37 | 38 | protected: 39 | unsigned long startms; 40 | unsigned long endms; 41 | int samples; 42 | }; 43 | 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Arduino/StreamHttpClient_ECHO/src/AudioOutputSPIFFSWAV.h: -------------------------------------------------------------------------------- 1 | /* 2 | AudioOutputSPIFFSWAV 3 | Writes a WAV file to the SPIFFS filesystem 4 | 5 | Copyright (C) 2017 Earle F. Philhower, III 6 | 7 | This program is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . 19 | */ 20 | 21 | #ifndef _AUDIOOUTPUTSPIFFSWAV_H 22 | #define _AUDIOOUTPUTSPIFFSWAV_H 23 | 24 | #include 25 | #include 26 | 27 | #include "AudioOutput.h" 28 | 29 | class AudioOutputSPIFFSWAV : public AudioOutput 30 | { 31 | public: 32 | AudioOutputSPIFFSWAV() { filename = NULL; }; 33 | ~AudioOutputSPIFFSWAV() { free(filename); }; 34 | virtual bool begin() override; 35 | virtual bool ConsumeSample(int16_t sample[2]) override; 36 | virtual bool stop() override; 37 | void SetFilename(const char *name); 38 | 39 | private: 40 | File f; 41 | char *filename; 42 | }; 43 | 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Arduino/StreamHttpClient_ECHO/src/AudioOutputSTDIO.h: -------------------------------------------------------------------------------- 1 | /* 2 | AudioOutputSTDIO 3 | Writes a WAV file to the STDIO filesystem 4 | Only for host-based testing 5 | 6 | Copyright (C) 2017 Earle F. Philhower, III 7 | 8 | This program is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . 20 | */ 21 | 22 | #ifndef _AUDIOOUTPUTSTDIO_H 23 | #define _AUDIOOUTPUTSTDIO_H 24 | 25 | #include 26 | #ifndef ARDUINO 27 | 28 | #include "AudioOutput.h" 29 | 30 | class AudioOutputSTDIO : public AudioOutput 31 | { 32 | public: 33 | AudioOutputSTDIO() { filename = NULL; f = NULL; }; 34 | ~AudioOutputSTDIO() { free(filename); }; 35 | virtual bool begin() override; 36 | virtual bool ConsumeSample(int16_t sample[2]) override; 37 | virtual bool stop() override; 38 | void SetFilename(const char *name); 39 | 40 | private: 41 | FILE *f; 42 | char *filename; 43 | }; 44 | 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Arduino/StreamHttpClient_ECHO/src/AudioOutputSerialWAV.h: -------------------------------------------------------------------------------- 1 | /* 2 | AudioOutputSerialWAV 3 | Writes a mostly correct WAV file to the serial port 4 | 5 | Copyright (C) 2017 Earle F. Philhower, III 6 | 7 | This program is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . 19 | */ 20 | 21 | #ifndef _AUDIOOUTPUTSERIALWAV_H 22 | #define _AUDIOOUTPUTSERIALWAV_H 23 | 24 | #include "AudioOutput.h" 25 | 26 | class AudioOutputSerialWAV : public AudioOutput 27 | { 28 | public: 29 | AudioOutputSerialWAV() {}; 30 | ~AudioOutputSerialWAV() {}; 31 | virtual bool begin() override; 32 | virtual bool ConsumeSample(int16_t sample[2]) override; 33 | virtual bool stop() override; 34 | private: 35 | int count; 36 | }; 37 | 38 | #endif 39 | 40 | -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Arduino/StreamHttpClient_ECHO/src/libflac/COPYING.Xiph: -------------------------------------------------------------------------------- 1 | Copyright (C) 2000-2009 Josh Coalson 2 | Copyright (C) 2011-2016 Xiph.Org Foundation 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | 8 | - Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | - Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 15 | - Neither the name of the Xiph.org Foundation nor the names of its 16 | contributors may be used to endorse or promote products derived from 17 | this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 23 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 24 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 25 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 26 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Arduino/StreamHttpClient_ECHO/src/libflac/README.ESP8266: -------------------------------------------------------------------------------- 1 | This is LIBFLAC 1.3.2 ported to the ESP8266 by Earle F. Philhower, III 2 | . It's pretty much unchanged from base sourcew, 3 | with some CRC and string constants moved into PROGMEM. Headers have been 4 | purged of references to STDIO/FILE*. Files not needed for playback have 5 | been removed. 6 | -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Arduino/StreamHttpClient_ECHO/src/libflac/share/utf8.h: -------------------------------------------------------------------------------- 1 | #ifndef SHARE__UTF8_H 2 | #define SHARE__UTF8_H 3 | 4 | /* 5 | * Convert a string between UTF-8 and the locale's charset. 6 | * Invalid bytes are replaced by '#', and characters that are 7 | * not available in the target encoding are replaced by '?'. 8 | * 9 | * If the locale's charset is not set explicitly then it is 10 | * obtained using nl_langinfo(CODESET), where available, the 11 | * environment variable CHARSET, or assumed to be US-ASCII. 12 | * 13 | * Return value of conversion functions: 14 | * 15 | * -1 : memory allocation failed 16 | * 0 : data was converted exactly 17 | * 1 : valid data was converted approximately (using '?') 18 | * 2 : input was invalid (but still converted, using '#') 19 | * 3 : unknown encoding (but still converted, using '?') 20 | */ 21 | 22 | int utf8_encode(const char *from, char **to); 23 | int utf8_decode(const char *from, char **to); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Arduino/StreamHttpClient_ECHO/src/libhelix-aac/readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m5stack/M5-ProductExampleCodes/1bc38736e61a362080d1dffc4020b3a2a1dff6ae/Core/Atom/AtomEcho/Arduino/StreamHttpClient_ECHO/src/libhelix-aac/readme.txt -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Arduino/StreamHttpClient_ECHO/src/libhelix-mp3/RCSL.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m5stack/M5-ProductExampleCodes/1bc38736e61a362080d1dffc4020b3a2a1dff6ae/Core/Atom/AtomEcho/Arduino/StreamHttpClient_ECHO/src/libhelix-mp3/RCSL.txt -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Arduino/StreamHttpClient_ECHO/src/libhelix-mp3/player.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | //SPI 5 | #define PIN_SPI_SCK 14 6 | #define PIN_SPI_MOSI 7 7 | #define PIN_SPI_SDCARD_CS 10 //SD-Card CS 8 | #define PIN_SPI_MEM_CS 6 //Flashmem CS 9 | 10 | //3V3 Voltage Regulator 11 | #define PIN_SHUTDOWNPWR3V3 5 12 | #define PWR3V3_ON HIGH 13 | #define PWR3V3_OFF LOW -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Arduino/StreamHttpClient_ECHO/src/libmad/COPYRIGHT: -------------------------------------------------------------------------------- 1 | 2 | libmad - MPEG audio decoder library 3 | Copyright (C) 2000-2004 Underbit Technologies, Inc. 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | If you would like to negotiate alternate licensing terms, you may do 20 | so by contacting: Underbit Technologies, Inc. 21 | 22 | -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Arduino/StreamHttpClient_ECHO/src/libmad/VERSION: -------------------------------------------------------------------------------- 1 | 0.15.1b 2 | configure.ac:24 3 | version.h:25-28 4 | msvc++/config.h:99,105,120 5 | msvc++/mad.h:41-44 6 | 7 | Makefile.am:98-100 8 | -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Arduino/StreamHttpClient_ECHO/src/libmad/layer3.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libmad - MPEG audio decoder library 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | * $Id: layer3.h,v 1.10 2004/01/23 09:41:32 rob Exp $ 20 | */ 21 | 22 | # ifndef LIBMAD_LAYER3_H 23 | # define LIBMAD_LAYER3_H 24 | 25 | # include "stream.h" 26 | # include "frame.h" 27 | 28 | int mad_layer_III(struct mad_stream *, struct mad_frame *); 29 | 30 | # endif 31 | -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Arduino/StreamHttpClient_ECHO/src/libmad/mad.h.sed: -------------------------------------------------------------------------------- 1 | # 2 | # libmad - MPEG audio decoder library 3 | # Copyright (C) 2000-2004 Underbit Technologies, Inc. 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 2 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program; if not, write to the Free Software 17 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | # 19 | # $Id: mad.h.sed,v 1.9 2004/01/23 09:41:32 rob Exp $ 20 | # 21 | 22 | /^\/\*$/{ 23 | N 24 | s/ \* libmad - /&/ 25 | t copy 26 | b next 27 | : copy 28 | g 29 | n 30 | s|^ \* \$\(Id: .*\) \$$|/* \1 */|p 31 | /^ \*\/$/d 32 | b copy 33 | } 34 | /^# *include "/d 35 | : next 36 | p 37 | -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Arduino/StreamHttpClient_ECHO/src/libtinysoundfont/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2017 Bernhard Schelling 2 | Based on SFZero, Copyright (C) 2012 Steve Folta (https://github.com/stevefolta/SFZero) 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of 5 | this software and associated documentation files (the "Software"), to deal in 6 | the Software without restriction, including without limitation the rights to 7 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 8 | of the Software, and to permit persons to whom the Software is furnished to do 9 | so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all 12 | copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | SOFTWARE. 21 | -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Arduino/StreamHttpClient_ECHO/src/libtinysoundfont/README.md: -------------------------------------------------------------------------------- 1 | # TinySoundFont 2 | SoundFont2 synthesizer library in a single C/C++ file 3 | 4 | ## Overview 5 | 6 | TinySoundFont is a software synthesizer using SoundFont2 sound bank files. 7 | 8 | The library is a single C header file so it is extremely simple to integrate in your C/C++ projects. 9 | 10 | ```c++ 11 | #define TSF_IMPLEMENTATION 12 | #include "tsf.h" 13 | 14 | ... 15 | 16 | tsf* TinySoundFont = tsf_load_filename("soundfont.sf2"); 17 | tsf_set_output(TinySoundFont, TSF_MONO, 44100, 0); //sample rate 18 | tsf_note_on(TinySoundFont, 0, 60, 1.0f); //preset 0, middle C 19 | short HalfSecond[22050]; //synthesize 0.5 seconds 20 | tsf_render_short(TinySoundFont, HalfSecond, 22050, 0); 21 | ``` 22 | 23 | The library code is based on [SFZero by Steve Folta](https://github.com/stevefolta/SFZero). 24 | 25 | ## Documentation 26 | 27 | The API documentation can be found on [top of the library source code](https://github.com/schellingb/TinySoundFont/blob/master/tsf.h). 28 | 29 | There are also [examples available](https://github.com/schellingb/TinySoundFont/tree/master/examples) which come with a sample SoundFont file and build and play sound on Win32, Win64, Linux and MacOSX with no further dependencies. 30 | 31 | ## Dependencies 32 | 33 | C standard libraries for fopen, math and malloc (can be removed by providing custom functions with #defines). 34 | 35 | ## License 36 | 37 | TinySoundFont is available under the [MIT license](https://choosealicense.com/licenses/mit/). 38 | -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Arduino/StreamHttpClient_ECHO/tests/host/Serial.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | SerialEmulator Serial; 4 | 5 | -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Arduino/StreamHttpClient_ECHO/tests/host/aac.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "AudioFileSourceSTDIO.h" 3 | #include "AudioOutputSTDIO.h" 4 | #include "AudioGeneratorAAC.h" 5 | 6 | int main(int argc, char **argv) 7 | { 8 | (void) argc; 9 | (void) argv; 10 | AudioFileSourceSTDIO *in = new AudioFileSourceSTDIO("jamonit.aac"); 11 | AudioOutputSTDIO *out = new AudioOutputSTDIO(); 12 | out->SetFilename("jamonit.aac.wav"); 13 | void *space = malloc(28000+60000); 14 | AudioGeneratorAAC *aac = new AudioGeneratorAAC(space, 28000+60000); 15 | 16 | aac->begin(in, out); 17 | while (aac->loop()) { /*noop*/ } 18 | aac->stop(); 19 | 20 | delete aac; 21 | delete out; 22 | delete in; 23 | 24 | free(space); 25 | } 26 | -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Arduino/StreamHttpClient_ECHO/tests/host/wav.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "AudioFileSourceSTDIO.h" 3 | #include "AudioOutputSTDIO.h" 4 | #include "AudioGeneratorWAV.h" 5 | 6 | 7 | int main(int argc, char **argv) 8 | { 9 | (void) argc; 10 | (void) argv; 11 | AudioFileSourceSTDIO *in = new AudioFileSourceSTDIO("test_8u_16.wav"); 12 | AudioOutputSTDIO *out = new AudioOutputSTDIO(); 13 | out->SetFilename("pcm.wav"); 14 | AudioGeneratorWAV *wav = new AudioGeneratorWAV(); 15 | 16 | wav->begin(in, out); 17 | while (wav->loop()) { /*noop*/ } 18 | wav->stop(); 19 | out->stop(); 20 | 21 | delete wav; 22 | delete out; 23 | delete in; 24 | } 25 | -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Factory_BT_SPEAKER_Firmware/BIN/Atom_echo_a2dp_led_0x00.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m5stack/M5-ProductExampleCodes/1bc38736e61a362080d1dffc4020b3a2a1dff6ae/Core/Atom/AtomEcho/Factory_BT_SPEAKER_Firmware/BIN/Atom_echo_a2dp_led_0x00.bin -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Factory_BT_SPEAKER_Firmware/a2dp_sink_led/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following lines of boilerplate have to be in your project's 2 | # CMakeLists in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 6 | project(a2dp_sink) 7 | -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Factory_BT_SPEAKER_Firmware/a2dp_sink_led/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | 6 | PROJECT_NAME := a2dp_sink 7 | 8 | include $(IDF_PATH)/make/project.mk 9 | 10 | -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Factory_BT_SPEAKER_Firmware/a2dp_sink_led/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(COMPONENT_SRCS "bt_app_av.c" 2 | "bt_app_core.c" 3 | "main.c") 4 | set(COMPONENT_ADD_INCLUDEDIRS ".") 5 | 6 | register_component() 7 | -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Factory_BT_SPEAKER_Firmware/a2dp_sink_led/main/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "A2DP Example Configuration" 2 | 3 | choice A2DP_SINK_OUTPUT 4 | prompt "A2DP Sink Output" 5 | default A2DP_SINK_OUTPUT_EXTERNAL_I2S 6 | help 7 | Select to use Internal DAC or external I2S driver 8 | 9 | config A2DP_SINK_OUTPUT_INTERNAL_DAC 10 | bool "Internal DAC" 11 | help 12 | Select this to use Internal DAC sink output 13 | 14 | config A2DP_SINK_OUTPUT_EXTERNAL_I2S 15 | bool "External I2S Codec" 16 | help 17 | Select this to use External I2S sink output 18 | 19 | endchoice 20 | 21 | config I2S_LRCK_PIN 22 | int "I2S LRCK (WS) GPIO" 23 | default 22 24 | depends on A2DP_SINK_OUTPUT_EXTERNAL_I2S 25 | help 26 | GPIO number to use for I2S LRCK(WS) Driver. 27 | 28 | config I2S_BCK_PIN 29 | int "I2S BCK GPIO" 30 | default 26 31 | depends on A2DP_SINK_OUTPUT_EXTERNAL_I2S 32 | help 33 | GPIO number to use for I2S BCK Driver. 34 | 35 | config I2S_DATA_PIN 36 | int "I2S DATA GPIO" 37 | default 25 38 | depends on A2DP_SINK_OUTPUT_EXTERNAL_I2S 39 | help 40 | GPIO number to use for I2S Data Driver. 41 | 42 | 43 | endmenu 44 | -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Factory_BT_SPEAKER_Firmware/a2dp_sink_led/main/bt_app_av.h: -------------------------------------------------------------------------------- 1 | /* 2 | This example code is in the Public Domain (or CC0 licensed, at your option.) 3 | 4 | Unless required by applicable law or agreed to in writing, this 5 | software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 6 | CONDITIONS OF ANY KIND, either express or implied. 7 | */ 8 | 9 | #ifndef __BT_APP_AV_H__ 10 | #define __BT_APP_AV_H__ 11 | 12 | #include 13 | #include "esp_a2dp_api.h" 14 | #include "esp_avrc_api.h" 15 | 16 | #include "ws2812_control.h" 17 | 18 | #define BT_AV_TAG "BT_AV" 19 | 20 | extern struct led_state new_state; 21 | 22 | /** 23 | * @brief callback function for A2DP sink 24 | */ 25 | void bt_app_a2d_cb(esp_a2d_cb_event_t event, esp_a2d_cb_param_t *param); 26 | 27 | /** 28 | * @brief callback function for A2DP sink audio data stream 29 | */ 30 | void bt_app_a2d_data_cb(const uint8_t *data, uint32_t len); 31 | 32 | /** 33 | * @brief callback function for AVRCP controller 34 | */ 35 | void bt_app_rc_ct_cb(esp_avrc_ct_cb_event_t event, esp_avrc_ct_cb_param_t *param); 36 | 37 | #endif /* __BT_APP_AV_H__*/ 38 | -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Factory_BT_SPEAKER_Firmware/a2dp_sink_led/main/bt_app_core.h: -------------------------------------------------------------------------------- 1 | /* 2 | This example code is in the Public Domain (or CC0 licensed, at your option.) 3 | 4 | Unless required by applicable law or agreed to in writing, this 5 | software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 6 | CONDITIONS OF ANY KIND, either express or implied. 7 | */ 8 | 9 | #ifndef __BT_APP_CORE_H__ 10 | #define __BT_APP_CORE_H__ 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | #define BT_APP_CORE_TAG "BT_APP_CORE" 17 | 18 | #define BT_APP_SIG_WORK_DISPATCH (0x01) 19 | 20 | /** 21 | * @brief handler for the dispatched work 22 | */ 23 | typedef void (* bt_app_cb_t) (uint16_t event, void *param); 24 | 25 | /* message to be sent */ 26 | typedef struct { 27 | uint16_t sig; /*!< signal to bt_app_task */ 28 | uint16_t event; /*!< message event id */ 29 | bt_app_cb_t cb; /*!< context switch callback */ 30 | void *param; /*!< parameter area needs to be last */ 31 | } bt_app_msg_t; 32 | 33 | /** 34 | * @brief parameter deep-copy function to be customized 35 | */ 36 | typedef void (* bt_app_copy_cb_t) (bt_app_msg_t *msg, void *p_dest, void *p_src); 37 | 38 | /** 39 | * @brief work dispatcher for the application task 40 | */ 41 | bool bt_app_work_dispatch(bt_app_cb_t p_cback, uint16_t event, void *p_params, int param_len, bt_app_copy_cb_t p_copy_cback); 42 | 43 | void bt_app_task_start_up(void); 44 | 45 | void bt_app_task_shut_down(void); 46 | 47 | #endif /* __BT_APP_CORE_H__ */ 48 | -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Factory_BT_SPEAKER_Firmware/a2dp_sink_led/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Factory_BT_SPEAKER_Firmware/a2dp_sink_led/main/ws2812_control.h: -------------------------------------------------------------------------------- 1 | #ifndef WS2812_CONTROL_H 2 | #define WS2812_CONTROL_H 3 | #include 4 | 5 | #ifndef NUM_LEDS 6 | #define NUM_LEDS 1 7 | #endif 8 | 9 | // This structure is used for indicating what the colors of each LED should be set to. 10 | // There is a 32bit value for each LED. Only the lower 3 bytes are used and they hold the 11 | // Red (byte 2), Green (byte 1), and Blue (byte 0) values to be set. 12 | struct led_state { 13 | uint32_t leds[NUM_LEDS]; 14 | }; 15 | 16 | // Setup the hardware peripheral. Only call this once. 17 | void ws2812_control_init(void); 18 | 19 | // Update the LEDs to the new state. Call as needed. 20 | // This function will block the current task until the RMT peripheral is finished sending 21 | // the entire sequence. 22 | void ws2812_write_leds(struct led_state new_state); 23 | 24 | #endif -------------------------------------------------------------------------------- /Core/Atom/AtomEcho/Factory_BT_SPEAKER_Firmware/a2dp_sink_led/sdkconfig.defaults: -------------------------------------------------------------------------------- 1 | # Override some defaults so BT stack is enabled and 2 | # Classic BT is enabled and BT_DRAM_RELEASE is disabled 3 | CONFIG_BT_ENABLED=y 4 | CONFIG_BTDM_CONTROLLER_MODE_BLE_ONLY= 5 | CONFIG_BTDM_CONTROLLER_MODE_BR_EDR_ONLY=y 6 | CONFIG_BTDM_CONTROLLER_MODE_BTDM= 7 | CONFIG_BLUEDROID_ENABLED=y 8 | CONFIG_CLASSIC_BT_ENABLED=y 9 | CONFIG_A2DP_ENABLE=y 10 | CONFIG_BT_SPP_ENABLED=n 11 | CONFIG_GATTS_ENABLE=n 12 | CONFIG_GATTC_ENABLE=n 13 | CONFIG_BLE_SMP_ENABLE=n 14 | -------------------------------------------------------------------------------- /Core/M5Core2/Arduino/Core2_Factory_test/line3D.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINE3D_H__ 2 | #define __LINE3D_H__ 3 | 4 | #include 5 | #include "utility/Sprite.h" 6 | 7 | typedef struct 8 | { 9 | double x; 10 | double y; 11 | double z; 12 | } point_3d_t; 13 | 14 | typedef struct 15 | { 16 | point_3d_t start_point; 17 | point_3d_t end_point; 18 | } line_3d_t; 19 | 20 | typedef struct 21 | { 22 | double x; 23 | double y; 24 | } point_2d_t; 25 | 26 | class line3D 27 | { 28 | private: 29 | 30 | double r_rand = PI / 180; 31 | 32 | double r_alpha = 19.47 * PI / 180; 33 | double r_gamma = 20.7 * PI / 180; 34 | 35 | double sin_alpha = sin(19.47 * PI / 180); 36 | double cos_alpha = cos(19.47 * PI / 180); 37 | double sin_gamma = sin(20.7 * PI / 180); 38 | double cos_gamma = cos(20.7 * PI / 180); 39 | 40 | int _zeroXoffset = 0; 41 | int _zeroYOffset = 0; 42 | 43 | public: 44 | line3D(/* args */); 45 | ~line3D(); 46 | 47 | void setZeroOffset(int offsetX,int offsetY){ _zeroXoffset = offsetX; _zeroYOffset = offsetY;} 48 | bool point3Dto2D(point_3d_t *source, point_2d_t *point); 49 | bool point2DToDisPoint(point_2d_t *point, uint8_t *x, uint8_t *y); 50 | bool printLine3D(TFT_eSprite *display, line_3d_t *line, uint32_t color); 51 | void RotatePoint(point_3d_t *point, double x, double y, double z); 52 | void RotatePoint(point_3d_t *point, point_3d_t *point_new, double x, double y, double z); 53 | 54 | }; 55 | 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /Core/M5Core2/Arduino/touch/touch.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | void showNum(short int X, short int Y) 6 | { 7 | char Str[10]; 8 | M5.Lcd.clear(WHITE); 9 | M5.Lcd.setCursor(10, 10); 10 | M5.Lcd.printf("DISPPLAY Test!"); 11 | M5.Lcd.setCursor(10, 26); 12 | sprintf(Str,"X:%d", X); 13 | M5.Lcd.printf(Str); 14 | M5.Lcd.setCursor(10, 42); 15 | sprintf(Str,"Y:%d", Y); 16 | M5.Lcd.printf(Str); 17 | } 18 | 19 | void touchsetup() 20 | { 21 | showNum(0,0); 22 | } 23 | 24 | void touchflush() 25 | { 26 | char X[4]; 27 | char Y[4]; 28 | M5.Lcd.setCursor(10, 10); 29 | TouchPoint_t pos= M5.Touch.getPressPoint(); 30 | bool touchStateNow = ( pos.x == -1 ) ? false : true; 31 | if( touchStateNow ) 32 | { 33 | showNum(pos.x,pos.y); 34 | } 35 | } 36 | 37 | void setup() { 38 | M5.begin(true, true, true, true); 39 | M5.Lcd.fillScreen(WHITE); 40 | M5.Lcd.setTextColor(BLACK); 41 | M5.Lcd.setTextSize(2); 42 | touchsetup(); 43 | } 44 | 45 | void loop() { 46 | TouchPoint_t pos= M5.Touch.getPressPoint(); 47 | if(pos.y > 240) 48 | if(pos.x < 109) 49 | M5.Lcd.setTextColor(RED); 50 | else if(pos.x > 218) 51 | M5.Lcd.setTextColor(BLUE); 52 | else if(pos.x >= 109 && pos.x <= 218) 53 | M5.Lcd.setTextColor(GREEN); 54 | touchflush(); 55 | delay(10); 56 | } 57 | -------------------------------------------------------------------------------- /Core/M5Stick/Arduino/stickAnalogreadSerial/README.md: -------------------------------------------------------------------------------- 1 | #### Description 2 | 3 | Read an analog sensor(ANGLE Unit) attached on the grove connector of the M5 Stick 4 | 5 | M5Stick will display the digital value received from ANGLE Unit -------------------------------------------------------------------------------- /Core/M5Stick/Arduino/stickReactionGame/README.md: -------------------------------------------------------------------------------- 1 | #### Description 2 | 3 | Simple reaction game for M5 Stick 4 | 5 | Press the button of M5Stick, if you catch the ball, score will increase by 1. -------------------------------------------------------------------------------- /Core/M5StickC/Arduino/FactoryTest/.vscode/arduino.json: -------------------------------------------------------------------------------- 1 | { 2 | "board": "esp8266:esp8266:huzzah", 3 | "configuration": "CpuFrequency=80,FlashSize=4M1M,LwIPVariant=v2mss536,Debug=Disabled,DebugLevel=None____,FlashErase=none,UploadSpeed=115200", 4 | "port": "COM86" 5 | } -------------------------------------------------------------------------------- /Core/M5StickC/Arduino/FactoryTest/.vscode/c_cpp_properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "Win32", 5 | "includePath": [ 6 | "C:\\Users\\yalezy\\AppData\\Local\\Arduino15\\packages\\esp8266\\tools\\**", 7 | "C:\\Users\\yalezy\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.4.1\\**", 8 | "E:\\stuty\\esp32\\arduino-1.8.7\\**" 9 | ], 10 | "forcedInclude": [], 11 | "intelliSenseMode": "msvc-x64", 12 | "compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe", 13 | "cStandard": "c11", 14 | "cppStandard": "c++17" 15 | } 16 | ], 17 | "version": 4 18 | } -------------------------------------------------------------------------------- /Core/M5StickC/Arduino/FactoryTest/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "arduino.path": "'E:\\stuty\\esp32\\arduino-1.8.7'" 3 | } -------------------------------------------------------------------------------- /Core/M5StickC/Arduino/FactoryTest/AXP192.h: -------------------------------------------------------------------------------- 1 | #ifndef __AXP192_H__ 2 | #define __AXP192_H__ 3 | 4 | #include 5 | 6 | 7 | class AXP192 { 8 | public: 9 | AXP192(); 10 | void Init(void); 11 | void ScreenBreath(uint8_t brightness); 12 | public: 13 | private: 14 | 15 | private: 16 | }; 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /Core/M5StickC/Arduino/FactoryTest/DHT12.h: -------------------------------------------------------------------------------- 1 | /* 2 | DHT12.h - Library for DHT12 sensor. 3 | v0.0.1 Beta 4 | Created by Bobadas, July 30,2016. 5 | Released into the public domain. 6 | */ 7 | #ifndef DHT12_h 8 | #define DHT12_h 9 | #include "Arduino.h" 10 | //#include "Wire.h" 11 | #include"iic.h" 12 | 13 | #define CELSIUS 1 14 | #define KELVIN 2 15 | #define FAHRENHEIT 3 16 | 17 | class DHT12 18 | { 19 | public: 20 | DHT12(); 21 | //DHT12(uint8_t scale=0,uint8_t id=0); 22 | float readTemperature(uint8_t scale=0); 23 | float readHumidity(); 24 | private: 25 | uint8_t read(); 26 | uint8_t datos[5]; 27 | uint8_t _id; 28 | uint8_t _scale; 29 | }; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /Core/M5StickC/Arduino/FactoryTest/Fonts/ASC16: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m5stack/M5-ProductExampleCodes/1bc38736e61a362080d1dffc4020b3a2a1dff6ae/Core/M5StickC/Arduino/FactoryTest/Fonts/ASC16 -------------------------------------------------------------------------------- /Core/M5StickC/Arduino/FactoryTest/Fonts/Font16.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define nr_chrs_f16 96 4 | #define chr_hgt_f16 16 5 | #define baseline_f16 13 6 | #define data_size_f16 8 7 | #define firstchr_f16 32 8 | 9 | extern const unsigned char widtbl_f16[96]; 10 | extern const unsigned char* const chrtbl_f16[96]; 11 | -------------------------------------------------------------------------------- /Core/M5StickC/Arduino/FactoryTest/Fonts/Font32rle.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define nr_chrs_f32 96 4 | #define chr_hgt_f32 26 5 | #define baseline_f32 19 6 | #define data_size_f32 8 7 | #define firstchr_f32 32 8 | 9 | extern const unsigned char widtbl_f32[96]; 10 | extern const unsigned char* const chrtbl_f32[96]; 11 | -------------------------------------------------------------------------------- /Core/M5StickC/Arduino/FactoryTest/Fonts/Font64rle.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define nr_chrs_f64 96 4 | #define chr_hgt_f64 48 5 | #define baseline_f64 36 6 | #define data_size_f64 8 7 | #define firstchr_f64 32 8 | 9 | extern const unsigned char widtbl_f64[96]; 10 | extern const unsigned char* const chrtbl_f64[96]; 11 | -------------------------------------------------------------------------------- /Core/M5StickC/Arduino/FactoryTest/Fonts/Font72rle.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define nr_chrs_f72 96 4 | #define chr_hgt_f72 75 5 | #define baseline_f72 73 6 | #define data_size_f72 8 7 | #define firstchr_f72 32 8 | 9 | extern const unsigned char widtbl_f72[96]; 10 | extern const unsigned char* const chrtbl_f72[96]; 11 | -------------------------------------------------------------------------------- /Core/M5StickC/Arduino/FactoryTest/Fonts/Font7srle.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define nr_chrs_f7s 96 4 | #define chr_hgt_f7s 48 5 | #define baseline_f7s 47 6 | #define data_size_f7s 8 7 | #define firstchr_f7s 32 8 | 9 | extern const unsigned char widtbl_f7s[96]; 10 | extern const unsigned char* const chrtbl_f7s[96]; 11 | -------------------------------------------------------------------------------- /Core/M5StickC/Arduino/FactoryTest/Fonts/GFXFF/gfxfont.h: -------------------------------------------------------------------------------- 1 | // Adopted by Bodmer to support TFT_HX8357_Due library. 2 | 3 | // Font structures for newer Adafruit_GFX (1.1 and later). 4 | // Example fonts are included in 'Fonts' directory. 5 | // To use a font in your Arduino sketch, #include the corresponding .h 6 | // file and pass address of GFXfont struct to setFont(). Pass NULL to 7 | // revert to 'classic' fixed-space bitmap font. 8 | 9 | #ifndef _GFXFONT_H_ 10 | #define _GFXFONT_H_ 11 | 12 | #ifdef LOAD_GFXFF 13 | 14 | typedef struct { // Data stored PER GLYPH 15 | uint16_t bitmapOffset; // Pointer into GFXfont->bitmap 16 | uint8_t width, height; // Bitmap dimensions in pixels 17 | uint8_t xAdvance; // Distance to advance cursor (x axis) 18 | int8_t xOffset, yOffset; // Dist from cursor pos to UL corner 19 | } GFXglyph; 20 | 21 | typedef struct { // Data stored for FONT AS A WHOLE: 22 | uint8_t *bitmap; // Glyph bitmaps, concatenated 23 | GFXglyph *glyph; // Glyph array 24 | uint8_t first, last; // ASCII extents 25 | uint8_t yAdvance; // Newline distance (y axis) 26 | } GFXfont; 27 | 28 | #endif // LOAD_GFXFF 29 | 30 | #endif // _GFXFONT_H_ 31 | -------------------------------------------------------------------------------- /Core/M5StickC/Arduino/FactoryTest/Fonts/HZK16: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m5stack/M5-ProductExampleCodes/1bc38736e61a362080d1dffc4020b3a2a1dff6ae/Core/M5StickC/Arduino/FactoryTest/Fonts/HZK16 -------------------------------------------------------------------------------- /Core/M5StickC/Arduino/FactoryTest/Fonts/TrueType/Not_yet_supported.txt: -------------------------------------------------------------------------------- 1 | TO DO: Add support for converted True Type fonts in an RLE format. -------------------------------------------------------------------------------- /Core/M5StickC/Arduino/FactoryTest/IMU.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #define SH200I_ADDRESS 0x6C //7bit i2c address 5 | #define SH200I_WHOAMI 0x30 6 | #define SH200I_ACC_CONFIG 0x0E 7 | #define SH200I_GYRO_CONFIG 0x0F 8 | #define SH200I_GYRO_DLPF 0x11 9 | #define SH200I_FIFO_CONFIG 0x12 10 | #define SH200I_ACC_RANGE 0x16 11 | #define SH200I_GYRO_RANGE 0x2B 12 | #define SH200I_OUTPUT_ACC_X 0x00 13 | #define SH200I_OUTPUT_GYRO_X 0x06 14 | #define SH200I_OUTPUT_TEMP 0x0C 15 | #define SH200I_REG_SET1 0xBA 16 | #define SH200I_REG_SET2 0xCA //ADC reset 17 | #define SH200I_ADC_RESET 0xC2 //drive reset 18 | #define SH200I_SOFT_RESET 0x7F 19 | #define SH200I_RESET 0x75 20 | 21 | 22 | 23 | extern void I2C_Read_NBytes(uint8_t driver_Addr, uint8_t start_Addr, uint8_t number_Bytes, uint8_t *read_Buffer); 24 | extern void I2C_Write_NBytes(uint8_t driver_Addr, uint8_t start_Addr, uint8_t number_Bytes, uint8_t *write_Buffer); 25 | extern void sh200i_ADCReset(void); 26 | extern void sh200i_Reset(void); 27 | extern void sh200i_init(void); 28 | 29 | -------------------------------------------------------------------------------- /Core/M5StickC/Arduino/FactoryTest/LCD_Config.h: -------------------------------------------------------------------------------- 1 | 2 | #define X_MAX_PIXEL 80 3 | #define Y_MAX_PIXEL 160 4 | 5 | 6 | -------------------------------------------------------------------------------- /Core/M5StickC/Arduino/FactoryTest/RTC.h: -------------------------------------------------------------------------------- 1 | #ifndef __RTC_H__ 2 | #define __RTC_H__ 3 | 4 | #include 5 | 6 | class Rtc { 7 | public: 8 | Rtc(); 9 | void GetBm8563Time(void); 10 | 11 | public: 12 | uint8_t Second; 13 | uint8_t Minute; 14 | uint8_t Hour; 15 | uint8_t Week; 16 | uint8_t Day; 17 | uint8_t Month; 18 | uint8_t Year; 19 | uint8_t DateString[9]; 20 | uint8_t TimeString[9]; 21 | 22 | uint8_t asc[14]; 23 | 24 | 25 | private: 26 | void Bcd2asc(void); 27 | void DataMask(); 28 | void Str2Time(void); 29 | 30 | private: 31 | 32 | /*定义数组用来存储读取的时间数据 */ 33 | uint8_t trdata[7]; 34 | /*定义数组用来存储转换的 asc 码时间数据*/ 35 | //uint8_t asc[14]; 36 | 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /Core/M5StickC/Arduino/FactoryTest/rc5_rc6.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m5stack/M5-ProductExampleCodes/1bc38736e61a362080d1dffc4020b3a2a1dff6ae/Core/M5StickC/Arduino/FactoryTest/rc5_rc6.cpp -------------------------------------------------------------------------------- /Core/m5go/m5go_lite/Arduino/ENV/DHT12.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | DHT12.cpp - Library for DHT12 sensor. 3 | v0.0.1 Beta 4 | Created by Bobadas, July 30,2016. 5 | Released into the public domain. 6 | */ 7 | #include "Arduino.h" 8 | #include "Wire.h" 9 | #include "DHT12.h" 10 | 11 | DHT12::DHT12(byte scale,byte id) 12 | { 13 | if (id==0 || id>126) _id=0x5c; 14 | else _id=id; 15 | if (scale==0 || scale>3) _scale=CELSIUS; 16 | else _scale=scale; 17 | } 18 | 19 | byte DHT12::read() 20 | { 21 | Wire.beginTransmission(_id); 22 | Wire.write(0); 23 | if (Wire.endTransmission()!=0) return 1; 24 | Wire.requestFrom(_id, 5); 25 | for (int i=0;i<5;i++) { 26 | datos[i]=Wire.read(); 27 | }; 28 | delay(50); 29 | if (Wire.available()!=0) return 2; 30 | if (datos[4]!=(datos[0]+datos[1]+datos[2]+datos[3])) return 3; 31 | return 0; 32 | } 33 | 34 | float DHT12::readTemperature(byte scale) 35 | { 36 | float resultado=0; 37 | byte error=read(); 38 | if (error!=0) return (float)error/100; 39 | if (scale==0) scale=_scale; 40 | switch(scale) { 41 | case CELSIUS: 42 | resultado=(datos[2]+(float)datos[3]/10); 43 | break; 44 | case FAHRENHEIT: 45 | resultado=((datos[2]+(float)datos[3]/10)*1.8+32); 46 | break; 47 | case KELVIN: 48 | resultado=(datos[2]+(float)datos[3]/10)+273.15; 49 | break; 50 | }; 51 | return resultado; 52 | } 53 | 54 | float DHT12::readHumidity() 55 | { 56 | float resultado; 57 | byte error=read(); 58 | if (error!=0) return (float)error/100; 59 | resultado=(datos[0]+(float)datos[1]/10); 60 | return resultado; 61 | } 62 | 63 | -------------------------------------------------------------------------------- /Core/m5go/m5go_lite/Arduino/ENV/DHT12.h: -------------------------------------------------------------------------------- 1 | /* 2 | DHT12.h - Library for DHT12 sensor. 3 | v0.0.1 Beta 4 | Created by Bobadas, July 30,2016. 5 | Released into the public domain. 6 | */ 7 | #ifndef DHT12_h 8 | #define DHT12_h 9 | #include "Arduino.h" 10 | #include "Wire.h" 11 | 12 | #define CELSIUS 1 13 | #define KELVIN 2 14 | #define FAHRENHEIT 3 15 | 16 | class DHT12 17 | { 18 | public: 19 | DHT12(byte scale=0,byte id=0); 20 | float readTemperature(byte scale=0); 21 | float readHumidity(); 22 | private: 23 | byte read(); 24 | byte datos[5]; 25 | byte _id; 26 | byte _scale; 27 | }; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /Core/m5go/m5go_lite/Arduino/ENV/ENV.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include "DHT12.h" 3 | #include //The DHT12 uses I2C comunication. 4 | #include "Adafruit_Sensor.h" 5 | #include 6 | DHT12 dht12; //Preset scale CELSIUS and ID 0x5c. 7 | Adafruit_BMP280 bme; 8 | 9 | void setup() { 10 | M5.begin(); 11 | Wire.begin(); 12 | 13 | M5.Lcd.setBrightness(10); 14 | 15 | Serial.println(F("ENV Unit(DHT12 and BMP280) test...")); 16 | 17 | if (!bme.begin()){ 18 | Serial.println("Could not find a valid BMP280 sensor, check wiring!"); 19 | while (1); 20 | } 21 | M5.Lcd.println("ENV Unit test..."); 22 | } 23 | 24 | void loop() { 25 | 26 | float tmp = dht12.readTemperature(); 27 | float hum = dht12.readHumidity(); 28 | float pressure = bme.readPressure(); 29 | Serial.printf("Temperatura: %2.2f*C Humedad: %0.2f%% Pressure: %0.2fPa\r\n", tmp, hum, pressure); 30 | 31 | M5.Lcd.setCursor(0, 0); 32 | M5.Lcd.setTextColor(WHITE, BLACK); 33 | M5.Lcd.setTextSize(3); 34 | M5.Lcd.printf("Temp: %2.1f \r\nHumi: %2.0f%% \r\nPressure:%2.0fPa\r\n", tmp, hum, pressure); 35 | 36 | delay(100); 37 | } 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /Core/m5go/m5go_lite/Arduino/ENV/README.md: -------------------------------------------------------------------------------- 1 | # Example for ENV Unit 2 | 3 | *注意,编译例程前,需要将DHT12.h和DHT12.cpp文件放置在例程ENV.ino所在文件夹下,并且通过Arduino IDE的库管理安装[Adafruit BMP280](https://github.com/adafruit/Adafruit_BMP280_Library)库,然后下载这个[地址](https://github.com/adafruit/Adafruit_Sensor)的Adafruit_Sensor.h,并放置在Adafruit_BMP280_Library文件夹中。* 4 | 5 | ## Desc 6 | 7 | 从ENV Unit读取温湿度和压力值,然后通过串口0打印到串口终端,同时在M5Core的屏幕上显示这些数据。 8 | 9 | ## Result 10 | 11 | 串口终端显示结果: 12 | 13 | Temperatura: 25.40*C Humedad: 28.50% Pressure: 102137.55Pa 14 | 15 | Temperatura: 25.40*C Humedad: 28.50% Pressure: 102136.17Pa 16 | 17 | Temperatura: 25.50*C Humedad: 28.50% Pressure: 102139.25Pa 18 | 19 | Temperatura: 25.50*C Humedad: 28.50% Pressure: 102133.55Pa 20 | 21 | Temperatura: 25.50*C Humedad: 28.50% Pressure: 102137.08Pa 22 | 23 | Temperatura: 25.50*C Humedad: 28.50% Pressure: 102140.25Pa 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Hat/8servos-hat/Arduino/8SERVOS/8SERVOS.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include "IIC_servo.h" 3 | 4 | 5 | 6 | 7 | // the setup routine runs once when M5StickC starts up 8 | void setup(){ 9 | 10 | // Initialize the M5StickC object 11 | M5.begin(); 12 | 13 | // LCD display 14 | M5.Lcd.println(" "); 15 | M5.Lcd.println(" IIC_servo"); 16 | 17 | IIC_Servo_Init(); //sda 0 scl 26 18 | 19 | Servo_angle_set(1,90); // CH1 ,90° 20 | Servo_angle_set(2,180); // CH2 ,180° 21 | 22 | Servo_pulse_set(3,2500); //CH3 ,2500us High level == 180° 23 | Servo_pulse_set(4,1500); //CH4 ,1500us High level == 90° 24 | 25 | 26 | 27 | M5.Lcd.println(" angle :"); 28 | M5.Lcd.print(" "); 29 | M5.Lcd.println(Servo_angle_read(3)); //CH3 30 | delay(1000); 31 | M5.Lcd.println(" pulse :"); 32 | M5.Lcd.print(" "); 33 | M5.Lcd.println(Servo_pulse_read(3)); //CH3 34 | delay(1000); 35 | M5.Lcd.println(" RGB :"); 36 | M5.Lcd.print(" "); 37 | M5.Lcd.println(RGB_read()); //RGB 38 | } 39 | 40 | // the loop routine runs over and over again forever 41 | void loop() { 42 | RGB_set(255,255,255); // red 43 | delay(200); 44 | RGB_set(0,1,0); // green 45 | delay(200); 46 | RGB_set(0,0,1); // blue 47 | delay(200); 48 | RGB_set(1,1,1); //RGB white 49 | 50 | for(int i=1;i<9;i++) 51 | { 52 | Servo_angle_set(i,0); // 53 | } 54 | delay(1000); 55 | for(int i=1;i<9;i++) 56 | { 57 | Servo_angle_set(i,180); // 58 | } 59 | delay(1000); 60 | } 61 | -------------------------------------------------------------------------------- /Hat/8servos-hat/Arduino/8SERVOS/IIC_servo.h: -------------------------------------------------------------------------------- 1 | #ifndef _M5SERVO_H_ 2 | #define _M5SERVO_H_ 3 | 4 | #include 5 | 6 | #define SERVO_ADDRESS 0X38 7 | void IIC_Servo_Init(); //sda 0 scl 26 8 | 9 | uint8_t Servo_angle_set(uint8_t Servo_CH,uint8_t angle); 10 | 11 | uint8_t Servo_pulse_set(uint8_t Servo_CH,uint16_t width); 12 | 13 | uint8_t RGB_set(uint8_t R,uint8_t G,uint8_t B); 14 | 15 | uint8_t Servo_angle_read(uint8_t Servo_CH); 16 | 17 | uint16_t Servo_pulse_read(uint8_t Servo_CH); 18 | 19 | uint32_t RGB_read(); 20 | 21 | 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /Hat/BugC/bugC/bugC.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * @Author: Sorzn 3 | * @Date: 2019-11-22 13:38:26 4 | * @LastEditTime: 2019-11-22 14:28:56 5 | * @Description: M5Stack Hat BUGC Lib 6 | * @FilePath: /M5StickC/examples/Hat/BUGC/bugC.cpp 7 | */ 8 | 9 | #include "M5StickC.h" 10 | #include "bugC.h" 11 | 12 | // if speed > 0; clockwise rotation 13 | void BugCSetSpeed(uint8_t pos, int8_t speed) 14 | { 15 | speed = (speed > 100) ? 100 : speed; 16 | speed = (speed < -100) ? -100 : speed; 17 | M5.I2C.writeByte(BUGC_ADDR, pos, speed); 18 | } 19 | 20 | void BugCSetAllSpeed(int8_t speed_0, int8_t speed_1, int8_t speed_2, int8_t speed_3) 21 | { 22 | int8_t speed_out[4] = {speed_0, speed_1, speed_2, speed_3}; 23 | for(uint8_t i = 0; i < 4; i++) 24 | { 25 | speed_out[i] = (speed_out[i] > 100) ? 100 : speed_out[i]; 26 | speed_out[i] = (speed_out[i] < -100) ? -100 : speed_out[i]; 27 | } 28 | M5.I2C.writeBytes(BUGC_ADDR, 0x00, (uint8_t *)speed_out, 4); 29 | } 30 | 31 | void BugCSetColor(uint32_t color_left, uint32_t color_right) 32 | { 33 | uint8_t color_out[4]; 34 | color_out[0] = 0; 35 | color_out[1] = (color_left & 0xff0000) >> 16; 36 | color_out[2] = (color_left & 0x00ff00) >> 8; 37 | color_out[3] = (color_left & 0x0000ff); 38 | M5.I2C.writeBytes(BUGC_ADDR, 0x10, color_out, 4); 39 | 40 | color_out[0] = 1; 41 | color_out[1] = (color_right & 0xff0000) >> 16; 42 | color_out[2] = (color_right & 0x00ff00) >> 8; 43 | color_out[3] = (color_right & 0x0000ff); 44 | M5.I2C.writeBytes(BUGC_ADDR, 0x10, color_out, 4); 45 | } 46 | -------------------------------------------------------------------------------- /Hat/BugC/bugC/bugC.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @Author: Sorzn 3 | * @Date: 2019-11-22 13:38:31 4 | * @LastEditTime: 2019-11-22 14:33:56 5 | * @Description: M5Stack Hat BUGC Lib 6 | * @FilePath: /M5StickC/examples/Hat/BUGC/bugC.h 7 | */ 8 | 9 | #ifndef __BUG_C_H 10 | #define __BUG_C_H 11 | 12 | #include "Arduino.h" 13 | 14 | #define BUGC_ADDR 0x38 15 | 16 | #define FRONT_LEFT 0 17 | #define FRONT_RIGHT 1 18 | #define REAR_LEFT 2 19 | #define REAR_RIGHT 3 20 | 21 | /** 22 | * @description: Set BugC single motor speed 23 | * @param pos: 0 ~ 3 24 | * @param speed: -100 ~ 100 25 | * @return: 26 | */ 27 | extern void BugCSetSpeed(uint8_t pos, int8_t speed); 28 | 29 | /** 30 | * @description: Set BugC motor speed 31 | * @param speed_0: -100 ~ 100 32 | * @param speed_1: -100 ~ 100 33 | * @param speed_2: -100 ~ 100 34 | * @param speed_3: -100 ~ 100 35 | * @return: 36 | */ 37 | extern void BugCSetAllSpeed(int8_t speed_0, int8_t speed_1, int8_t speed_2, int8_t speed_3); 38 | 39 | /** 40 | * @description: Set BugC sk6812 color 41 | * @param color_left: (r << 16) | (g << 8) | b 42 | * @param color_right: (r << 16) | (g << 8) | b 43 | * @return: 44 | */ 45 | extern void BugCSetColor(uint32_t color_left, uint32_t color_right); 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /Hat/BugC/bugC/bugC.ino: -------------------------------------------------------------------------------- 1 | #include "M5StickC.h" 2 | #include "bugC.h" 3 | 4 | void setup() { 5 | M5.begin(); 6 | Wire.begin(0, 26, 400000UL); 7 | M5.Lcd.setTextColor(TFT_GREEN); 8 | M5.Lcd.setRotation(1); 9 | M5.Lcd.drawCentreString("BUGC example", 80, 30, 2); 10 | // if add battery, need increase charge current 11 | M5.Axp.SetChargeCurrent(CURRENT_360MA); 12 | } 13 | 14 | void loop() { 15 | M5.update(); 16 | 17 | if (M5.BtnA.wasPressed()) { 18 | BugCSetColor(0x100000, 0x001000); 19 | BugCSetAllSpeed(-100, 100, -100, 100); 20 | } 21 | 22 | if (M5.BtnB.wasPressed()) { 23 | BugCSetColor(0x000000, 0x000000); 24 | BugCSetAllSpeed(0, 0, 0, 0); 25 | } 26 | 27 | delay(10); 28 | } 29 | -------------------------------------------------------------------------------- /Hat/CardKB_HAT/CardKB_HAT/CardKB_HAT.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #define CARDKB_ADDR 0x5F 5 | 6 | void setup() 7 | { 8 | M5.begin(); 9 | Wire.begin(0, 26); 10 | M5.Lcd.setRotation(3); 11 | M5.Lcd.fillScreen(BLACK); 12 | M5.Lcd.setCursor(0, 0, 2 ); 13 | M5.Lcd.setTextColor(YELLOW); 14 | 15 | M5.Lcd.println("IIC Address: 0x5F\n"); 16 | M5.Lcd.println(">>"); 17 | } 18 | void loop() 19 | { 20 | Wire.requestFrom(CARDKB_ADDR, 1); 21 | while(Wire.available()) 22 | { 23 | char c = Wire.read(); // receive a byte as characterif 24 | if (c != 0) 25 | { 26 | M5.Lcd.printf("%c", c); 27 | Serial.println(c, HEX); 28 | Serial.println(char(c)); 29 | } 30 | } 31 | // delay(10); 32 | } 33 | -------------------------------------------------------------------------------- /Hat/ENVII_HAT/Arduino/ENVII_HAT/SHT3X.cpp: -------------------------------------------------------------------------------- 1 | #include "SHT3X.h" 2 | 3 | /* Motor() 4 | 5 | */ 6 | SHT3X::SHT3X(uint8_t address) 7 | { 8 | Wire.begin(); 9 | _address=address; 10 | } 11 | 12 | 13 | 14 | byte SHT3X::get() 15 | { 16 | unsigned int data[6]; 17 | 18 | // Start I2C Transmission 19 | Wire.beginTransmission(_address); 20 | // Send measurement command 21 | Wire.write(0x2C); 22 | Wire.write(0x06); 23 | // Stop I2C transmission 24 | if (Wire.endTransmission()!=0) 25 | return 1; 26 | 27 | delay(500); 28 | 29 | // Request 6 bytes of data 30 | Wire.requestFrom(_address, 6); 31 | 32 | // Read 6 bytes of data 33 | // cTemp msb, cTemp lsb, cTemp crc, humidity msb, humidity lsb, humidity crc 34 | for (int i=0;i<6;i++) { 35 | data[i]=Wire.read(); 36 | }; 37 | 38 | delay(50); 39 | 40 | if (Wire.available()!=0) 41 | return 2; 42 | 43 | // Convert the data 44 | cTemp = ((((data[0] * 256.0) + data[1]) * 175) / 65535.0) - 45; 45 | fTemp = (cTemp * 1.8) + 32; 46 | humidity = ((((data[3] * 256.0) + data[4]) * 100) / 65535.0); 47 | 48 | return 0; 49 | } 50 | -------------------------------------------------------------------------------- /Hat/ENVII_HAT/Arduino/ENVII_HAT/SHT3X.h: -------------------------------------------------------------------------------- 1 | #ifndef __SHT3X_H 2 | #define __HT3X_H 3 | 4 | 5 | #if ARDUINO >= 100 6 | #include "Arduino.h" 7 | #else 8 | #include "WProgram.h" 9 | #endif 10 | 11 | #include "Wire.h" 12 | 13 | class SHT3X{ 14 | public: 15 | SHT3X(uint8_t address=0x44); 16 | byte get(void); 17 | float cTemp=0; 18 | float fTemp=0; 19 | float humidity=0; 20 | 21 | private: 22 | uint8_t _address; 23 | 24 | }; 25 | 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /Hat/PowerC/PowerC/PowerC.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void setup() { 5 | M5.begin(); 6 | Wire.begin(0, 26, 400000UL); 7 | M5.Lcd.setRotation(1); 8 | while (Wire.endTransmission() != 0) { 9 | M5.Lcd.setCursor(20, 0); 10 | M5.Lcd.print("Not found PowerC"); 11 | Wire.beginTransmission(0x75); 12 | } 13 | M5.Lcd.fillRect(0, 0, 160, 80, BLACK); 14 | } 15 | 16 | uint16_t readBatV(uint8_t Reg) { 17 | uint8_t dataV[2] = {0, 0}; 18 | M5.I2C.readBytes(0x75, Reg, 2, dataV); 19 | return ((dataV[1] << 8) & 0xff00) | dataV[0]; 20 | } 21 | 22 | uint16_t readBatI(uint8_t Reg) { 23 | uint8_t dataI[2] = {0, 0}; 24 | M5.I2C.readBytes(0x75, Reg, 2, dataI); 25 | return ((dataI[1] << 8) & 0xff00) | dataI[0]; 26 | } 27 | 28 | void loop() { 29 | float v = readBatV(0xA2); 30 | float i = readBatI(0XA4); 31 | v = v * 0.00026855 + 2.6; 32 | i = i * 0.745985; 33 | M5.Lcd.setCursor(0, 10); 34 | M5.Lcd.printf("%1.2f,V", v); 35 | Serial.printf("%1.2f", v); 36 | Serial.println(""); 37 | M5.Lcd.setCursor(0, 40); 38 | M5.Lcd.printf("%1.0f,mAh", i); 39 | Serial.printf("%1.0f", i); 40 | Serial.println(""); 41 | } 42 | -------------------------------------------------------------------------------- /Hat/PuppyC/IIC_.cpp: -------------------------------------------------------------------------------- 1 | #include "IIC_.h" 2 | 3 | void IIC_Init() // sda 0 scl 26 4 | { 5 | Wire.begin(0, 26, 100000UL); 6 | } 7 | 8 | /*******************************************************************************/ 9 | /* 10 | 11 | 1 2 12 | 3 4 13 | */ 14 | void angle_all_set(uint8_t angle1, uint8_t angle2, uint8_t angle3, 15 | uint8_t angle4) { 16 | Wire.beginTransmission(SERVO_ADDRESS); 17 | Wire.write(0x00); 18 | Wire.write(angle1); 19 | Wire.write(angle2); 20 | Wire.write(angle3); 21 | Wire.write(angle4); 22 | Wire.endTransmission(); 23 | } 24 | uint8_t angle_set(uint8_t whitch, uint8_t anglex) { 25 | if (whitch < 1 || whitch > 5) { 26 | return 0; 27 | } 28 | whitch -= 1; 29 | Wire.beginTransmission(SERVO_ADDRESS); 30 | Wire.write(whitch); 31 | Wire.write(anglex); 32 | Wire.endTransmission(); 33 | return 1; 34 | } 35 | -------------------------------------------------------------------------------- /Hat/PuppyC/IIC_.h: -------------------------------------------------------------------------------- 1 | #ifndef _IIC_H_ 2 | #define _IIC_H_ 3 | 4 | #include 5 | 6 | #define SERVO_ADDRESS 0X38 7 | void IIC_Init(); //sda 0 scl 26 8 | 9 | void angle_all_set(uint8_t angle1,uint8_t angle2,uint8_t angle3,uint8_t angle4) ; 10 | 11 | uint8_t angle_set(uint8_t whitch,uint8_t anglex) ; 12 | #endif 13 | -------------------------------------------------------------------------------- /Hat/beetleC/stickC/beetleC/README.md: -------------------------------------------------------------------------------- 1 | ## BeetleC 2 | 3 | ### method description 4 | 5 | - ```carLRcontrol(int8_t left, int8_t right)```: this function will send two value to the BeetleC base. 6 | - ```esp_err_t control(httpd_req_t *req)```: callback function of http server, receive http requeset to control the beetleC base. 7 | - ```esp_err_t test_handler(httpd_req_t *req)```: send back a control page when some one access ```192.168.4.1/ctl``` which can send the control message. 8 | - ```static esp_err_t http_server_init()```: Http Server initialization. callback function will be set here. 9 | - ```static void initWifi()```: wifi initalization. 10 | - ```void blink()```: turn on the led one by one for 3 times. 11 | 12 | ### code logic 13 | 14 | 1. initialize the wifi and http server which allow other to connect and access the control page. 15 | 2. BeetleC will wait for the control message all the time once you start it 16 | 3. control message will be decode and use it to control the BeetleC base when some one push the control button on the control page. -------------------------------------------------------------------------------- /Hat/beetleC/stickC/beetleC/carControl.cpp: -------------------------------------------------------------------------------- 1 | #include "carControl.h" 2 | 3 | void leftwheel(uint8_t val) { 4 | Wire.beginTransmission(0x38); 5 | Wire.write(0x00); 6 | Wire.write(val); 7 | Wire.endTransmission(); 8 | } 9 | 10 | void rightwheel(uint8_t val) { 11 | Wire.beginTransmission(0x38); 12 | Wire.write(0x01); 13 | Wire.write(val); 14 | Wire.endTransmission(); 15 | } 16 | 17 | void led(uint8_t num, uint32_t val) { 18 | Wire.beginTransmission(0x38); 19 | Wire.write(0x02); 20 | Wire.write(num); 21 | Wire.write(uint8_t(val >> 16)); 22 | Wire.write(uint8_t(val >> 8)); 23 | Wire.write(uint8_t(val & 0x0f)); 24 | Wire.endTransmission(); 25 | } 26 | 27 | -------------------------------------------------------------------------------- /Hat/beetleC/stickC/beetleC/carControl.h: -------------------------------------------------------------------------------- 1 | #ifndef __CARCONTROL_H 2 | #define __CARCONTROL_H 3 | 4 | #include 5 | #include 6 | 7 | void leftwheel(uint8_t val); 8 | void rightwheel(uint8_t val); 9 | void led(uint8_t num, uint32_t val); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /Hat/beetleC/stickC/beetleC/lock.h: -------------------------------------------------------------------------------- 1 | #ifndef __LOCK_H 2 | #define __LOCK_H 3 | 4 | //min may error here 5 | #undef min 6 | #include 7 | 8 | std::mutex g_mutex; 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /Hat/beetleC/stickC/beetleC/setTimer.h: -------------------------------------------------------------------------------- 1 | #ifndef __SETTIMER__H 2 | #define __SETTIMER__H 3 | 4 | #include "lock.h" 5 | #include "carControl.h" 6 | 7 | volatile int interruptCounter; 8 | int totalInterruptCounter; 9 | int timeCount = 0; 10 | 11 | 12 | hw_timer_t * timer = NULL; 13 | portMUX_TYPE timerMux = portMUX_INITIALIZER_UNLOCKED; 14 | 15 | void IRAM_ATTR onTimer() { 16 | portENTER_CRITICAL_ISR(&timerMux); 17 | interruptCounter++; 18 | portEXIT_CRITICAL_ISR(&timerMux); 19 | 20 | } 21 | 22 | void setTimer() { 23 | timer = timerBegin(0, 80, true); 24 | timerAttachInterrupt(timer, &onTimer, true); 25 | timerAlarmWrite(timer, 1000, true); 26 | timerAlarmEnable(timer); 27 | // timerAlarmDisable(timer); 28 | Serial.println("setTimer"); 29 | } 30 | 31 | void timerEnable() { 32 | timerAlarmEnable(timer); 33 | } 34 | 35 | void timerDisable() { 36 | timerAlarmDisable(timer); 37 | } 38 | 39 | void resetCount(void) { 40 | timeCount = 0; 41 | } 42 | 43 | int readTimerCount(void) { 44 | return timeCount; 45 | } 46 | 47 | int timerCounting() { 48 | if (interruptCounter > 0) { 49 | 50 | portENTER_CRITICAL(&timerMux); 51 | interruptCounter--; 52 | portEXIT_CRITICAL(&timerMux); 53 | 54 | if (timeCount > 500) { 55 | timeCount = 500; 56 | } 57 | 58 | g_mutex.lock(); 59 | if (timeCount >= 300) { 60 | //Serial.println("stop"); 61 | leftwheel(0); 62 | rightwheel(0); 63 | } 64 | g_mutex.unlock(); 65 | timeCount++; 66 | } 67 | } 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /Hat/hat-pir/UIFlow/example_hat_pir.m5f: -------------------------------------------------------------------------------- 1 | {"components":[{"id":"____screen","createTime":1562670697749,"name":"Screen","x":0,"y":0,"width":120,"height":240,"backgroundColor":"#111111","backgroundImage":"","type":"screen"},{"id":"9niH2MqXSr@L`no0","createTime":1562670810251,"name":"label1","x":61,"y":25,"color":"#FFFFFF","text":"Text","font":"lcd.FONT_DejaVu56","rotation":90,"type":"label","layer":4,"width":null,"height":null,"radius":null}],"type":"stick-C","units":[],"hats":[{"id":"zM67sib4TavcEEy-","createTime":1562671006996,"type":"hat_pir","name":"hat_pir0","port":"A","default":["A"],"icon":"hat_PIR.png"}],"blockly":"hat_pir0label1ONlabel1OFF","Blockly.Remotes":[],"modules":[]} -------------------------------------------------------------------------------- /Hat/hat-yun/Arduino/hat-yun/SHT20.h: -------------------------------------------------------------------------------- 1 | #ifndef SHT20_h 2 | #define SHT20_h 3 | 4 | #include 5 | #include 6 | 7 | #define SHT20_ADDR 0x40 8 | 9 | #define TRIGGER_TEMP_MEASURE_HOLD 0xE3 10 | #define TRIGGER_HUMD_MEASURE_HOLD 0xE5 11 | #define TRIGGER_TEMP_MEASURE_NOHOLD 0xF3 12 | #define TRIGGER_HUMD_MEASURE_NOHOLD 0xF5 13 | #define WRITE_USER_REG 0xE6 14 | #define READ_USER_REG 0xE7 15 | #define SOFT_RESET 0xFE 16 | #define REG_RESOLUTION_MASK 0x81 17 | #define REG_RESOLUTION_RH12_TEMP14 0x00 18 | #define REG_RESOLUTION_RH8_TEMP12 0x01 19 | #define REG_RESOLUTION_RH10_TEMP13 0x80 20 | #define REG_RESOLUTION_RH11_TEMP11 0x81 21 | #define REG_END_OF_BATTERY 0x40 22 | #define REG_HEATER_ENABLED 0x04 23 | #define REG_DISABLE_OTP_RELOAD 0x02 24 | #define MAX_WAIT 100 25 | #define DELAY_INTERVAL 10 26 | #define SHIFTED_DIVISOR 0x988000 27 | 28 | class SHT20 29 | { 30 | public: 31 | void set_resolution(uint8_t resBits); 32 | float read_humidity(void); 33 | float read_temperature(void); 34 | void write_register(uint8_t val); 35 | uint8_t read_register(void); 36 | 37 | private: 38 | bool check_crc(uint16_t data_in, uint8_t crc); 39 | bool I2C_read_u16(uint8_t reg, uint16_t *val); 40 | }; 41 | 42 | #endif -------------------------------------------------------------------------------- /Hat/hat-yun/Arduino/hat-yun/display.h: -------------------------------------------------------------------------------- 1 | #ifndef DISPLAY_h 2 | #define DISPLAY_h 3 | 4 | #include 5 | void display_light(void); 6 | void display_light0(void); 7 | void display_light1(void); 8 | void display_light2(void); 9 | void display_light3(void); 10 | void display_light4(void); 11 | 12 | void led_breath(void); 13 | void led_off(void); 14 | void display_led(void); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /Hat/hat-yun/Arduino/hat-yun/yunBoard.h: -------------------------------------------------------------------------------- 1 | #ifndef _BOARD__H_ 2 | #define _BOARD__H_ 3 | 4 | #include 5 | 6 | extern void led_set(uint8_t num, uint32_t color_in); 7 | extern void led_set_all(uint32_t color_in); 8 | extern uint16_t light_get(); 9 | 10 | #endif -------------------------------------------------------------------------------- /Hat/servo-hat/Arduino/SERVO/servo/servo.ino: -------------------------------------------------------------------------------- 1 | #define COUNT_LOW 1500 2 | #define COUNT_HIGH 8500 3 | #define TIMER_WIDTH 16 4 | #include "esp32-hal-ledc.h" 5 | #include 6 | 7 | void setup() { 8 | // put your setup code here, to run once: 9 | M5.begin(); 10 | ledcSetup(1, 50, TIMER_WIDTH); 11 | ledcAttachPin(26, 1); 12 | M5.Lcd.setCursor(20, 80, 2); 13 | M5.Lcd.print("SERVO"); 14 | 15 | } 16 | 17 | void loop() { 18 | // put your main code here, to run repeatedly: 19 | for(int i = COUNT_LOW; i < COUNT_HIGH; i = i + 100){ 20 | ledcWrite(1, i); 21 | delay(50); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Hat/servo-hat/Arduino/SERVOwithStickV/SERVOwithStickV.ino: -------------------------------------------------------------------------------- 1 | #include "esp32-hal-ledc.h" 2 | #include 3 | #define COUNT_HIGH 8000 4 | #define COUNT_LOW 3000 5 | #define COUNT_MID 5000 6 | #define TIMER_WIDTH 16 7 | #define CHANNEL 0 8 | #define FREQUANCE 50 9 | #define PIN 26 10 | 11 | 12 | String comData = ""; 13 | String lastContent = ""; 14 | bool flag; 15 | void setup() { 16 | M5.begin(); 17 | // Serial2.begin(unsigned long baud, uint32_t config, int8_t rxPin, int8_t txPin, bool invert) 18 | Serial2.begin(115200, SERIAL_8N1, 33, 32); 19 | ledcSetup(CHANNEL, FREQUANCE, TIMER_WIDTH); 20 | ledcAttachPin(PIN, CHANNEL); 21 | } 22 | 23 | void loop() { 24 | delay(20); 25 | if(Serial2.available()){ 26 | comData = ""; 27 | while(Serial2.available()){ 28 | char ch = Serial2.read(); 29 | if(ch != '\r'){ 30 | comData += ch; 31 | } 32 | } 33 | if(comData == "clear"){ 34 | M5.Lcd.fillScreen(BLACK); 35 | ledcWrite(CHANNEL, 1800); 36 | return; 37 | } 38 | if(lastContent != comData){ 39 | M5.Lcd.setCursor(0, 0); 40 | M5.Lcd.print(comData); 41 | if(comData == "M5Stick"){ 42 | ledcWrite(CHANNEL, COUNT_LOW); 43 | }else if(comData == "M5StickC"){ 44 | ledcWrite(CHANNEL, COUNT_HIGH); 45 | }else if(comData == "M5Stack Fire"){ 46 | ledcWrite(CHANNEL, COUNT_MID); 47 | } 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Hat/servo-hat/Arduino/SERVOwithStickV/boot.py: -------------------------------------------------------------------------------- 1 | import image 2 | import lcd 3 | import sensor 4 | import sys 5 | import time 6 | import KPU as kpu 7 | from fpioa_manager import fm 8 | from machine import UART 9 | 10 | fm.register(board_info.CONNEXT_A,fm.fpioa.UART1_RX) 11 | fm.register(board_info.CONNEXT_B,fm.fpioa.UART1_TX) 12 | 13 | uart_A = UART(UART.UART1, 115200) 14 | 15 | lcd.init() 16 | lcd.rotation(2) 17 | 18 | try: 19 | img = image.Image("/sd/startup.jpg") 20 | lcd.display(img) 21 | except: 22 | lcd.draw_string(lcd.width()//2-100,lcd.height()//2-4, "Error: Cannot find start.jpg", lcd.WHITE, lcd.RED) 23 | 24 | 25 | task = kpu.load("/sd/999723f600dad044_mbnet10_quant.kmodel") 26 | 27 | labels=["M5Stack Fire","M5StickC","M5Stick"] #You can check the numbers here to real names. 28 | 29 | sensor.reset() 30 | sensor.set_pixformat(sensor.RGB565) 31 | sensor.set_framesize(sensor.QVGA) 32 | sensor.set_windowing((224, 224)) 33 | sensor.run(1) 34 | 35 | lcd.clear() 36 | 37 | 38 | while(True): 39 | img = sensor.snapshot() 40 | fmap = kpu.forward(task, img) 41 | plist=fmap[:] 42 | pmax=max(plist) 43 | max_index=plist.index(pmax) 44 | a = lcd.display(img) 45 | uart_A.write('clear') 46 | uart_A.write('\r') 47 | if pmax > 0.95: 48 | lcd.draw_string(5, 60, "Accu:%.2f Type:%s"%(pmax, labels[max_index].strip())) 49 | uart_A.write(labels[max_index]) 50 | uart_A.write('\r') 51 | 52 | a = kpu.deinit(task) 53 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 John Hildenbiddle 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Module/COMMU/Arduino/DependentLibrary/MCP_CAN_lib/.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /Module/COMMU/Arduino/DependentLibrary/MCP_CAN_lib/MCP2515Calc.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m5stack/M5-ProductExampleCodes/1bc38736e61a362080d1dffc4020b3a2a1dff6ae/Module/COMMU/Arduino/DependentLibrary/MCP_CAN_lib/MCP2515Calc.xlsx -------------------------------------------------------------------------------- /Module/COMMU/Arduino/DependentLibrary/MCP_CAN_lib/examples/CAN_send/CAN_send.ino: -------------------------------------------------------------------------------- 1 | // CAN Send Example 2 | // 3 | 4 | #include 5 | #include 6 | 7 | MCP_CAN CAN0(10); // Set CS to pin 10 8 | 9 | void setup() 10 | { 11 | Serial.begin(115200); 12 | 13 | // Initialize MCP2515 running at 16MHz with a baudrate of 500kb/s and the masks and filters disabled. 14 | if(CAN0.begin(MCP_ANY, CAN_500KBPS, MCP_16MHZ) == CAN_OK) Serial.println("MCP2515 Initialized Successfully!"); 15 | else Serial.println("Error Initializing MCP2515..."); 16 | 17 | CAN0.setMode(MCP_NORMAL); // Change to normal mode to allow messages to be transmitted 18 | } 19 | 20 | byte data[8] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}; 21 | 22 | void loop() 23 | { 24 | // send data: ID = 0x100, Standard CAN Frame, Data length = 8 bytes, 'data' = array of data bytes to send 25 | byte sndStat = CAN0.sendMsgBuf(0x100, 0, 8, data); 26 | if(sndStat == CAN_OK){ 27 | Serial.println("Message Sent Successfully!"); 28 | } else { 29 | Serial.println("Error Sending Message..."); 30 | } 31 | delay(100); // send data per 100ms 32 | } 33 | 34 | /********************************************************************************************************* 35 | END FILE 36 | *********************************************************************************************************/ 37 | -------------------------------------------------------------------------------- /Module/COMMU/Arduino/DependentLibrary/MCP_CAN_lib/examples/CAN_to_Ethernet/udp_listen.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | #This works on Debian Linux 3 | #I have not tested it on a Windows system running Perl, but it should work if all dependencies are met. 4 | #Also, FIREWALL. <--- I gaurantee that will be the issue. 5 | 6 | use IO::Socket; 7 | 8 | ### Create UDP Listen Socket 9 | my $udpsocket = new IO::Socket::INET ( 10 | LocalPort => '54321', 11 | Proto => 'udp', 12 | ); 13 | die "Could not create socket: $!\n" unless $udpsocket; 14 | 15 | ### Data Manipulation and Display 16 | while(1) { 17 | $udpsocket->recv(my $data,512); 18 | print $data; 19 | } 20 | -------------------------------------------------------------------------------- /Module/COMX_GSM/TFTTerminal.h: -------------------------------------------------------------------------------- 1 | #ifndef _TFTTERMINAL_H_ 2 | #define _TFTTERMINAL_H_ 3 | 4 | #include 5 | #include 6 | 7 | class TFTTerminal : public Print 8 | { 9 | private: 10 | TFT_eSprite *disptr; 11 | char discharbuff[60][55]; 12 | uint32_t xpos = 0,ypos = 0, dispos = 0; 13 | TFT_eSprite* _dis_buff_ptr = NULL; 14 | uint16_t _bkcolor = TFT_BLACK; 15 | uint16_t _color = TFT_GREEN; 16 | 17 | uint16_t _win_x_pos = 0,_win_y_pos = 0,_win_w = 320,_win_h = 240; 18 | uint16_t _font_x_size = 6,_font_y_size = 8; 19 | uint8_t _fontSize = 0; 20 | uint16_t _line_x_limit = 53,_line_y_limit = 30; 21 | 22 | public: 23 | TFTTerminal(TFT_eSprite *dis_buff_ptr); 24 | ~TFTTerminal(); 25 | 26 | void setcolor( uint16_t color, uint16_t bk_color ); 27 | void setGeometry(uint16_t x, uint16_t y, uint16_t w, uint16_t h ); 28 | void setFontsize(uint8_t size); 29 | 30 | size_t write(uint8_t) ; 31 | size_t write(const uint8_t *buffer, size_t size); 32 | }; 33 | 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /Module/COMX_LTE-DATA/TFTTerminal.h: -------------------------------------------------------------------------------- 1 | #ifndef _TFTTERMINAL_H_ 2 | #define _TFTTERMINAL_H_ 3 | 4 | #include 5 | #include 6 | 7 | class TFTTerminal : public Print 8 | { 9 | private: 10 | TFT_eSprite *disptr; 11 | char discharbuff[60][55]; 12 | uint32_t xpos = 0,ypos = 0, dispos = 0; 13 | TFT_eSprite* _dis_buff_ptr = NULL; 14 | uint16_t _bkcolor = TFT_BLACK; 15 | uint16_t _color = TFT_GREEN; 16 | 17 | uint16_t _win_x_pos = 0,_win_y_pos = 0,_win_w = 320,_win_h = 240; 18 | uint16_t _font_x_size = 6,_font_y_size = 8; 19 | uint8_t _fontSize = 0; 20 | uint16_t _line_x_limit = 53,_line_y_limit = 30; 21 | 22 | public: 23 | TFTTerminal(TFT_eSprite *dis_buff_ptr); 24 | ~TFTTerminal(); 25 | 26 | void setcolor( uint16_t color, uint16_t bk_color ); 27 | void setGeometry(uint16_t x, uint16_t y, uint16_t w, uint16_t h ); 28 | void setFontsize(uint8_t size); 29 | 30 | size_t write(uint8_t) ; 31 | size_t write(const uint8_t *buffer, size_t size); 32 | }; 33 | 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /Module/COMX_LTE/TFTTerminal.h: -------------------------------------------------------------------------------- 1 | #ifndef _TFTTERMINAL_H_ 2 | #define _TFTTERMINAL_H_ 3 | 4 | #include 5 | #include 6 | 7 | class TFTTerminal : public Print 8 | { 9 | private: 10 | TFT_eSprite *disptr; 11 | char discharbuff[60][55]; 12 | uint32_t xpos = 0,ypos = 0, dispos = 0; 13 | TFT_eSprite* _dis_buff_ptr = NULL; 14 | uint16_t _bkcolor = TFT_BLACK; 15 | uint16_t _color = TFT_GREEN; 16 | 17 | uint16_t _win_x_pos = 0,_win_y_pos = 0,_win_w = 320,_win_h = 240; 18 | uint16_t _font_x_size = 6,_font_y_size = 8; 19 | uint8_t _fontSize = 0; 20 | uint16_t _line_x_limit = 53,_line_y_limit = 30; 21 | 22 | public: 23 | TFTTerminal(TFT_eSprite *dis_buff_ptr); 24 | ~TFTTerminal(); 25 | 26 | void setcolor( uint16_t color, uint16_t bk_color ); 27 | void setGeometry(uint16_t x, uint16_t y, uint16_t w, uint16_t h ); 28 | void setFontsize(uint8_t size); 29 | 30 | size_t write(uint8_t) ; 31 | size_t write(const uint8_t *buffer, size_t size); 32 | }; 33 | 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /Module/COMX_NB-IoT/TFTTerminal.h: -------------------------------------------------------------------------------- 1 | #ifndef _TFTTERMINAL_H_ 2 | #define _TFTTERMINAL_H_ 3 | 4 | #include 5 | #include 6 | 7 | class TFTTerminal : public Print 8 | { 9 | private: 10 | TFT_eSprite *disptr; 11 | char discharbuff[60][55]; 12 | uint32_t xpos = 0,ypos = 0, dispos = 0; 13 | TFT_eSprite* _dis_buff_ptr = NULL; 14 | uint16_t _bkcolor = TFT_BLACK; 15 | uint16_t _color = TFT_GREEN; 16 | 17 | uint16_t _win_x_pos = 0,_win_y_pos = 0,_win_w = 320,_win_h = 240; 18 | uint16_t _font_x_size = 6,_font_y_size = 8; 19 | uint8_t _fontSize = 0; 20 | uint16_t _line_x_limit = 53,_line_y_limit = 30; 21 | 22 | public: 23 | TFTTerminal(TFT_eSprite *dis_buff_ptr); 24 | ~TFTTerminal(); 25 | 26 | void setcolor( uint16_t color, uint16_t bk_color ); 27 | void setGeometry(uint16_t x, uint16_t y, uint16_t w, uint16_t h ); 28 | void setFontsize(uint8_t size); 29 | 30 | size_t write(uint8_t) ; 31 | size_t write(const uint8_t *buffer, size_t size); 32 | }; 33 | 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /Module/COM_LoRaWAN/Arduino/LoRaWAN_Receive/TFTTerminal.h: -------------------------------------------------------------------------------- 1 | #ifndef _TFTTERMINAL_H_ 2 | #define _TFTTERMINAL_H_ 3 | 4 | #include 5 | #include 6 | 7 | class TFTTerminal : public Print 8 | { 9 | private: 10 | TFT_eSprite *disptr; 11 | char discharbuff[60][55]; 12 | uint32_t xpos = 0,ypos = 0, dispos = 0; 13 | TFT_eSprite* _dis_buff_ptr = NULL; 14 | uint16_t _bkcolor = TFT_BLACK; 15 | uint16_t _color = TFT_GREEN; 16 | 17 | uint16_t _win_x_pos = 0,_win_y_pos = 0,_win_w = 320,_win_h = 240; 18 | uint16_t _font_x_size = 6,_font_y_size = 8; 19 | uint8_t _fontSize = 0; 20 | uint16_t _line_x_limit = 53,_line_y_limit = 30; 21 | 22 | public: 23 | TFTTerminal(TFT_eSprite *dis_buff_ptr); 24 | ~TFTTerminal(); 25 | 26 | void setcolor( uint16_t color, uint16_t bk_color ); 27 | void setGeometry(uint16_t x, uint16_t y, uint16_t w, uint16_t h ); 28 | void setFontsize(uint8_t size); 29 | 30 | size_t write(uint8_t) ; 31 | size_t write(const uint8_t *buffer, size_t size); 32 | }; 33 | 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /Module/COM_LoRaWAN/Arduino/LoRaWAN_Send/TFTTerminal.h: -------------------------------------------------------------------------------- 1 | #ifndef _TFTTERMINAL_H_ 2 | #define _TFTTERMINAL_H_ 3 | 4 | #include 5 | #include 6 | 7 | class TFTTerminal : public Print 8 | { 9 | private: 10 | TFT_eSprite *disptr; 11 | char discharbuff[60][55]; 12 | uint32_t xpos = 0,ypos = 0, dispos = 0; 13 | TFT_eSprite* _dis_buff_ptr = NULL; 14 | uint16_t _bkcolor = TFT_BLACK; 15 | uint16_t _color = TFT_GREEN; 16 | 17 | uint16_t _win_x_pos = 0,_win_y_pos = 0,_win_w = 320,_win_h = 240; 18 | uint16_t _font_x_size = 6,_font_y_size = 8; 19 | uint8_t _fontSize = 0; 20 | uint16_t _line_x_limit = 53,_line_y_limit = 30; 21 | 22 | public: 23 | TFTTerminal(TFT_eSprite *dis_buff_ptr); 24 | ~TFTTerminal(); 25 | 26 | void setcolor( uint16_t color, uint16_t bk_color ); 27 | void setGeometry(uint16_t x, uint16_t y, uint16_t w, uint16_t h ); 28 | void setFontsize(uint8_t size); 29 | 30 | size_t write(uint8_t) ; 31 | size_t write(const uint8_t *buffer, size_t size); 32 | }; 33 | 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /Module/ENCODER/firmware_328p/FacesEncoder328/.vs/FacesEncoder328/v15/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m5stack/M5-ProductExampleCodes/1bc38736e61a362080d1dffc4020b3a2a1dff6ae/Module/ENCODER/firmware_328p/FacesEncoder328/.vs/FacesEncoder328/v15/.suo -------------------------------------------------------------------------------- /Module/ENCODER/firmware_328p/FacesEncoder328/FACE_ENCODER_v1.0.PcbDoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m5stack/M5-ProductExampleCodes/1bc38736e61a362080d1dffc4020b3a2a1dff6ae/Module/ENCODER/firmware_328p/FacesEncoder328/FACE_ENCODER_v1.0.PcbDoc -------------------------------------------------------------------------------- /Module/ENCODER/firmware_328p/FacesEncoder328/FacesEncoder328.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | -------------------------------------------------------------------------------- /Module/ENCODER/firmware_328p/FacesEncoder328/FacesEncoder328.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Module/ENCODER/firmware_328p/FacesEncoder328/debug.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m5stack/M5-ProductExampleCodes/1bc38736e61a362080d1dffc4020b3a2a1dff6ae/Module/ENCODER/firmware_328p/FacesEncoder328/debug.log -------------------------------------------------------------------------------- /Module/FACESII_NeoPixelTest/FACESII_NeoPixelTest.ino: -------------------------------------------------------------------------------- 1 | /* 2 | neo pixel test 3 | 4 | hardwware: M5StackFire 5 | 6 | please install the Adafruit library first! 7 | September 2018, ChrisMicro 8 | */ 9 | 10 | #include 11 | 12 | #define M5STACK_FIRE_NEO_NUM_LEDS 10 13 | #define M5STACK_FIRE_NEO_DATA_PIN 15 14 | 15 | Adafruit_NeoPixel pixels = Adafruit_NeoPixel(M5STACK_FIRE_NEO_NUM_LEDS, M5STACK_FIRE_NEO_DATA_PIN, NEO_GRB + NEO_KHZ800); 16 | 17 | void setup() 18 | { 19 | pixels.begin(); 20 | } 21 | 22 | void loop() 23 | { 24 | 25 | static int pixelNumber=0;// = random(0, M5STACK_FIRE_NEO_NUM_LEDS - 1); 26 | pixelNumber++; 27 | if(pixelNumber>9)pixelNumber=0; 28 | int r = 1< 2 | 3 | /* By default, GPS is connected with M5Core through UART2 */ 4 | HardwareSerial GPSRaw(2); 5 | 6 | void setup() { 7 | 8 | M5.begin(); 9 | GPSRaw.begin(9600);// GPS init 10 | 11 | Serial.println("hello"); 12 | termInit(); 13 | } 14 | 15 | void loop() { 16 | // put your main code here, to run repeatedly: 17 | if(Serial.available()) { 18 | int ch = Serial.read(); 19 | GPSRaw.write(ch); 20 | } 21 | 22 | if(GPSRaw.available()) { 23 | int ch = GPSRaw.read();// read GPS information 24 | Serial.write(ch); 25 | termPutchar(ch); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Module/GPS/TinyGPSPlus-1.0.2.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m5stack/M5-ProductExampleCodes/1bc38736e61a362080d1dffc4020b3a2a1dff6ae/Module/GPS/TinyGPSPlus-1.0.2.zip -------------------------------------------------------------------------------- /Module/GSM/Arduino/GSM.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void IotWriteCommand(char cmd[],char date[]){ 4 | char buf[256] = {0}; 5 | 6 | if(cmd == NULL) 7 | sprintf(buf,"AT\r\n"); 8 | else if(date == NULL) 9 | sprintf(buf,"AT+%s\r\n",cmd); 10 | else 11 | sprintf(buf,"AT+%s=%s\r\n",cmd,date); 12 | 13 | Serial2.write(buf); 14 | } 15 | //AT+CSQ=? 16 | void get_time(void){ 17 | IotWriteCommand("CSQ=?",NULL); 18 | while(Serial2.available()){ 19 | uint8_t ch = Serial2.read(); 20 | Serial.write(ch); 21 | M5.Lcd.write(ch); 22 | } 23 | } 24 | 25 | void setup() { 26 | M5.begin(); 27 | 28 | Serial2.begin(115200, SERIAL_8N1, 16, 17); 29 | pinMode(5, OUTPUT); 30 | digitalWrite(5, 1); 31 | } 32 | 33 | void loop() { 34 | if(M5.BtnA.wasReleased()){ 35 | M5.Lcd.fillScreen(TFT_BLACK); 36 | M5.Lcd.setCursor(60,80,2); 37 | get_time(); 38 | } 39 | M5.update(); 40 | } 41 | -------------------------------------------------------------------------------- /Module/LEGO_PLUS/firmware_328p/m5_lego/.gitignore: -------------------------------------------------------------------------------- 1 | .pioenvs 2 | .piolibdeps 3 | .vscode/.browse.c_cpp.db* 4 | .vscode/c_cpp_properties.json 5 | .vscode/launch.json 6 | 7 | test -------------------------------------------------------------------------------- /Module/LEGO_PLUS/firmware_328p/m5_lego/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=827846 3 | // for the documentation about the extensions.json format 4 | "recommendations": [ 5 | "platformio.platformio-ide" 6 | ] 7 | } -------------------------------------------------------------------------------- /Module/LEGO_PLUS/firmware_328p/m5_lego/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "terminal.integrated.env.windows": { 3 | "PATH": "C:\\Users\\salahei\\.platformio\\penv\\Scripts;C:\\Users\\salahei\\.platformio\\penv;C:\\Program Files (x86)\\Python36-32\\Scripts\\;C:\\Program Files (x86)\\Python36-32\\;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Microsoft VS Code\\bin;C:\\Users\\salahei\\AppData\\Local\\Programs\\Python\\Python36\\Scripts\\;C:\\Users\\salahei\\AppData\\Local\\Programs\\Python\\Python36\\;C:\\Users\\salahei\\AppData\\Local\\Microsoft\\WindowsApps;;C:\\Program Files\\Microsoft VS Code\\bin;C:\\Program Files (x86)\\Python36-32\\Scripts\\;C:\\Program Files (x86)\\Python36-32\\;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Microsoft VS Code\\bin;C:\\Users\\salahei\\AppData\\Local\\Programs\\Python\\Python36\\Scripts\\;C:\\Users\\salahei\\AppData\\Local\\Programs\\Python\\Python36\\;C:\\Users\\salahei\\AppData\\Local\\Microsoft\\WindowsApps;;C:\\Program Files\\Microsoft VS Code\\bin", 4 | "PLATFORMIO_CALLER": "vscode" 5 | } 6 | } -------------------------------------------------------------------------------- /Module/LEGO_PLUS/firmware_328p/m5_lego/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 M5Stack 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Module/LEGO_PLUS/firmware_328p/m5_lego/lib/L293DDH_half/L293DDH_half.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * L293DDH.cpp - Library for using a L293DDH motor controller chip 3 | * Created by Tyler Sweat, May 25 2015 4 | * Released under the MIT License 5 | */ 6 | 7 | #include "Arduino.h" 8 | #include "L293DDH_half.h" 9 | 10 | L293DDH::L293DDH(int _pwm_pin, int _dir_pin) 11 | { 12 | pwm_pin = _pwm_pin; 13 | dir_pin = _dir_pin; 14 | pinMode(pwm_pin, OUTPUT); 15 | pinMode(dir_pin, OUTPUT); 16 | // Set initially to 0 17 | set(0); 18 | } 19 | 20 | void L293DDH::set(int value) 21 | { 22 | val = constrain(value, -255, 255); 23 | if(value == 0) 24 | { 25 | digitalWrite(dir_pin, 0); 26 | analogWrite(pwm_pin, 0); 27 | } 28 | else if(value > 0 && value <= 255) 29 | { 30 | digitalWrite(dir_pin, 0); 31 | analogWrite(pwm_pin, value); 32 | } 33 | else if(value < 0 && value >= -255) 34 | { 35 | digitalWrite(dir_pin, 1); 36 | analogWrite(pwm_pin, 255 + value); 37 | } 38 | } 39 | 40 | void L293DDH::stop() 41 | { 42 | set(0); 43 | } 44 | 45 | int L293DDH::get() 46 | { 47 | return val; 48 | } 49 | -------------------------------------------------------------------------------- /Module/LEGO_PLUS/firmware_328p/m5_lego/lib/L293DDH_half/L293DDH_half.h: -------------------------------------------------------------------------------- 1 | /* 2 | * L293D.h - Library for using a L293D motor controller chip 3 | * Created by Tyler Sweat, May 25 2015 4 | * Released under the MIT License 5 | */ 6 | 7 | #ifndef L293DD_HALF_H 8 | #define L293DD_HALF_H 9 | 10 | #include "Arduino.h" 11 | 12 | class L293DDH 13 | { 14 | public: 15 | L293DDH(int, int); 16 | void set(int); 17 | void stop(); 18 | int get(); 19 | private: 20 | int pwm_pin; 21 | int dir_pin; 22 | int val; 23 | }; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /Module/LEGO_PLUS/firmware_328p/m5_lego/lib/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for the project specific (private) libraries. 3 | PlatformIO will compile them to static libraries and link to executable file. 4 | 5 | The source code of each library should be placed in separate directory, like 6 | "lib/private_lib/[here are source files]". 7 | 8 | For example, see how can be organized `Foo` and `Bar` libraries: 9 | 10 | |--lib 11 | | | 12 | | |--Bar 13 | | | |--docs 14 | | | |--examples 15 | | | |--src 16 | | | |- Bar.c 17 | | | |- Bar.h 18 | | | |- library.json (optional, custom build options, etc) http://docs.platformio.org/page/librarymanager/config.html 19 | | | 20 | | |--Foo 21 | | | |- Foo.c 22 | | | |- Foo.h 23 | | | 24 | | |- readme.txt --> THIS FILE 25 | | 26 | |- platformio.ini 27 | |--src 28 | |- main.c 29 | 30 | Then in `src/main.c` you should use: 31 | 32 | #include 33 | #include 34 | 35 | // rest H/C/CPP code 36 | 37 | PlatformIO will find your libraries automatically, configure preprocessor's 38 | include paths and build them. 39 | 40 | More information about PlatformIO Library Dependency Finder 41 | - http://docs.platformio.org/page/librarymanager/ldf.html 42 | -------------------------------------------------------------------------------- /Module/LEGO_PLUS/firmware_328p/m5_lego/platformio.ini: -------------------------------------------------------------------------------- 1 | ; PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter 4 | ; Upload options: custom upload port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; Advanced options: extra scripting 7 | ; 8 | ; Please visit documentation for the other options and examples 9 | ; http://docs.platformio.org/page/projectconf.html 10 | 11 | [env:uno] 12 | platform = atmelavr 13 | board = uno 14 | framework = arduino 15 | 16 | lib_deps = 17 | Encoder 18 | 19 | 20 | ; pio run && cp .pioenvs/uno/firmware.hex ~/Desktop/m5bot_wheel.hex -------------------------------------------------------------------------------- /Module/LORAWAN/Arduino/LoRaWan Library for M5Stack.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m5stack/M5-ProductExampleCodes/1bc38736e61a362080d1dffc4020b3a2a1dff6ae/Module/LORAWAN/Arduino/LoRaWan Library for M5Stack.rar -------------------------------------------------------------------------------- /Module/PLUS/Arduino/plus_read_encoder/plus_read_enconder.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #define IrPin 13 5 | #define PLUS_ADDR 0x62 6 | 7 | int32_t number = 0; 8 | uint8_t press = 0; 9 | 10 | 11 | void setup() { 12 | M5.begin(true, false, false); 13 | M5.Lcd.setTextFont(6); 14 | M5.Lcd.clear(BLACK); 15 | M5.Lcd.setTextColor(ORANGE, BLACK); 16 | Wire.begin(); 17 | ledcSetup(1, 38000, 10); ledcAttachPin(IrPin, 1);// IR Pin setting 18 | } 19 | 20 | void plus_encode() { 21 | Wire.requestFrom(PLUS_ADDR, 2); 22 | while(Wire.available()) { 23 | int8_t encode = Wire.read(); 24 | uint8_t press_n = Wire.read(); 25 | number += encode; 26 | if(press_n == 0xff) { 27 | press = 0;//encoder was pressed 28 | } 29 | else { 30 | press = 1; 31 | } 32 | } 33 | } 34 | 35 | void loop() { 36 | char data[20]; 37 | 38 | plus_encode(); 39 | ledcWrite(1, ledcRead(1) ? 0 : 512); 40 | sprintf(data, "%d %d ", number, press); 41 | M5.Lcd.setCursor(100, 100); 42 | M5.Lcd.print(data); 43 | vTaskDelay(200); 44 | } -------------------------------------------------------------------------------- /Module/SERVO/Arduino/Servo/Servo.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define SERVO_ADDR 0x53 6 | void setup() { 7 | M5.begin(true, false, true); 8 | M5.Lcd.setTextFont(4); 9 | M5.Lcd.setCursor(70, 100); 10 | M5.Lcd.print("Servo Example"); 11 | 12 | Wire.begin(21, 22, 100000UL); 13 | } 14 | 15 | // addr 0x01 means "control the number 1 servo by us" 16 | void Servo_write_us(uint8_t number, uint16_t us) { 17 | Wire.beginTransmission(SERVO_ADDR); 18 | Wire.write(0x00 | number); 19 | Wire.write(us & 0x00ff); 20 | Wire.write(us >> 8 & 0x00ff); 21 | Wire.endTransmission(); 22 | } 23 | 24 | // addr 0x11 means "control the number 1 servo by angle" 25 | void Servo_write_angle(uint8_t number, uint8_t angle) { 26 | Wire.beginTransmission(SERVO_ADDR); 27 | Wire.write(0x10 | number); 28 | Wire.write(angle); 29 | Wire.endTransmission(); 30 | } 31 | 32 | void loop() { 33 | for (uint8_t i = 0; i < 12; i++) { 34 | Servo_write_us(i, 700); 35 | // Servo_write_angle(i, 0); 36 | } 37 | delay(1000); 38 | for (uint8_t i = 0; i < 12; i++) { 39 | Servo_write_us(i, 2300); 40 | // Servo_write_angle(i, 180); 41 | } 42 | delay(1000); 43 | } -------------------------------------------------------------------------------- /Module/SERVO/firmware_328p/Servo328/.vs/Servo328/v15/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m5stack/M5-ProductExampleCodes/1bc38736e61a362080d1dffc4020b3a2a1dff6ae/Module/SERVO/firmware_328p/Servo328/.vs/Servo328/v15/.suo -------------------------------------------------------------------------------- /Module/SERVO/firmware_328p/Servo328/Release/Servo/avr/Servo.cpp.d: -------------------------------------------------------------------------------- 1 | C:\Users\salahei\AppData\Local\Temp\VMBuilds\Servo328\nano_atmega328\Release\Servo\avr\Servo.cpp.o: \ 2 | C:\Program\ Files\ (x86)\Arduino\libraries\Servo\src\avr\Servo.cpp \ 3 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h \ 4 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\cores\arduino/binary.h \ 5 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\cores\arduino/WCharacter.h \ 6 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\cores\arduino/WString.h \ 7 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h \ 8 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\cores\arduino/Stream.h \ 9 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h \ 10 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\cores\arduino/Printable.h \ 11 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\cores\arduino/USBAPI.h \ 12 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h \ 13 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\variants\eightanaloginputs/pins_arduino.h \ 14 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\variants\eightanaloginputs/../standard/pins_arduino.h \ 15 | C:\Program\ Files\ (x86)\Arduino\libraries\Servo\src/Servo.h \ 16 | C:\Program\ Files\ (x86)\Arduino\libraries\Servo\src/avr/ServoTimers.h 17 | -------------------------------------------------------------------------------- /Module/SERVO/firmware_328p/Servo328/Release/Servo/avr/Servo.cpp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m5stack/M5-ProductExampleCodes/1bc38736e61a362080d1dffc4020b3a2a1dff6ae/Module/SERVO/firmware_328p/Servo328/Release/Servo/avr/Servo.cpp.o -------------------------------------------------------------------------------- /Module/SERVO/firmware_328p/Servo328/Release/Servo/nrf52/Servo.cpp.d: -------------------------------------------------------------------------------- 1 | C:\Users\salahei\AppData\Local\Temp\VMBuilds\Servo328\nano_atmega328\Release\Servo\nrf52\Servo.cpp.o: \ 2 | C:\Program\ Files\ (x86)\Arduino\libraries\Servo\src\nrf52\Servo.cpp 3 | -------------------------------------------------------------------------------- /Module/SERVO/firmware_328p/Servo328/Release/Servo/nrf52/Servo.cpp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m5stack/M5-ProductExampleCodes/1bc38736e61a362080d1dffc4020b3a2a1dff6ae/Module/SERVO/firmware_328p/Servo328/Release/Servo/nrf52/Servo.cpp.o -------------------------------------------------------------------------------- /Module/SERVO/firmware_328p/Servo328/Release/Servo/sam/Servo.cpp.d: -------------------------------------------------------------------------------- 1 | C:\Users\salahei\AppData\Local\Temp\VMBuilds\Servo328\nano_atmega328\Release\Servo\sam\Servo.cpp.o: \ 2 | C:\Program\ Files\ (x86)\Arduino\libraries\Servo\src\sam\Servo.cpp 3 | -------------------------------------------------------------------------------- /Module/SERVO/firmware_328p/Servo328/Release/Servo/sam/Servo.cpp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m5stack/M5-ProductExampleCodes/1bc38736e61a362080d1dffc4020b3a2a1dff6ae/Module/SERVO/firmware_328p/Servo328/Release/Servo/sam/Servo.cpp.o -------------------------------------------------------------------------------- /Module/SERVO/firmware_328p/Servo328/Release/Servo/samd/Servo.cpp.d: -------------------------------------------------------------------------------- 1 | C:\Users\salahei\AppData\Local\Temp\VMBuilds\Servo328\nano_atmega328\Release\Servo\samd\Servo.cpp.o: \ 2 | C:\Program\ Files\ (x86)\Arduino\libraries\Servo\src\samd\Servo.cpp 3 | -------------------------------------------------------------------------------- /Module/SERVO/firmware_328p/Servo328/Release/Servo/samd/Servo.cpp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m5stack/M5-ProductExampleCodes/1bc38736e61a362080d1dffc4020b3a2a1dff6ae/Module/SERVO/firmware_328p/Servo328/Release/Servo/samd/Servo.cpp.o -------------------------------------------------------------------------------- /Module/SERVO/firmware_328p/Servo328/Release/Servo/stm32f4/Servo.cpp.d: -------------------------------------------------------------------------------- 1 | C:\Users\salahei\AppData\Local\Temp\VMBuilds\Servo328\nano_atmega328\Release\Servo\stm32f4\Servo.cpp.o: \ 2 | C:\Program\ Files\ (x86)\Arduino\libraries\Servo\src\stm32f4\Servo.cpp 3 | -------------------------------------------------------------------------------- /Module/SERVO/firmware_328p/Servo328/Release/Servo/stm32f4/Servo.cpp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m5stack/M5-ProductExampleCodes/1bc38736e61a362080d1dffc4020b3a2a1dff6ae/Module/SERVO/firmware_328p/Servo328/Release/Servo/stm32f4/Servo.cpp.o -------------------------------------------------------------------------------- /Module/SERVO/firmware_328p/Servo328/Release/Servo328.cpp.d: -------------------------------------------------------------------------------- 1 | C:\Users\salahei\AppData\Local\Temp\VMBuilds\Servo328\nano_atmega328\Release\Servo328.cpp.o: \ 2 | C:\Users\salahei\AppData\Local\Temp\VMBuilds\Servo328\nano_atmega328\Release\Servo328.cpp \ 3 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\cores\arduino/arduino.h \ 4 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\cores\arduino/binary.h \ 5 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\cores\arduino/WCharacter.h \ 6 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\cores\arduino/WString.h \ 7 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h \ 8 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\cores\arduino/Stream.h \ 9 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h \ 10 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\cores\arduino/Printable.h \ 11 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\cores\arduino/USBAPI.h \ 12 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h \ 13 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\variants\eightanaloginputs/pins_arduino.h \ 14 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\variants\eightanaloginputs/../standard/pins_arduino.h \ 15 | C:\Program\ Files\ (x86)\Arduino\libraries\Servo\src/Servo.h \ 16 | C:\Program\ Files\ (x86)\Arduino\libraries\Servo\src/avr/ServoTimers.h \ 17 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src/Wire.h \ 18 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\cores\arduino/Stream.h 19 | -------------------------------------------------------------------------------- /Module/SERVO/firmware_328p/Servo328/Release/Servo328.cpp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m5stack/M5-ProductExampleCodes/1bc38736e61a362080d1dffc4020b3a2a1dff6ae/Module/SERVO/firmware_328p/Servo328/Release/Servo328.cpp.o -------------------------------------------------------------------------------- /Module/SERVO/firmware_328p/Servo328/Release/Servo328.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m5stack/M5-ProductExampleCodes/1bc38736e61a362080d1dffc4020b3a2a1dff6ae/Module/SERVO/firmware_328p/Servo328/Release/Servo328.elf -------------------------------------------------------------------------------- /Module/SERVO/firmware_328p/Servo328/Release/Servo328.ino.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m5stack/M5-ProductExampleCodes/1bc38736e61a362080d1dffc4020b3a2a1dff6ae/Module/SERVO/firmware_328p/Servo328/Release/Servo328.ino.elf -------------------------------------------------------------------------------- /Module/SERVO/firmware_328p/Servo328/Release/Wire/Wire.cpp.d: -------------------------------------------------------------------------------- 1 | C:\Users\salahei\AppData\Local\Temp\VMBuilds\Servo328\nano_atmega328\Release\Wire\Wire.cpp.o: \ 2 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src\Wire.cpp \ 3 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src\utility/twi.h \ 4 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src\Wire.h \ 5 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\cores\arduino/Stream.h \ 6 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h \ 7 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\cores\arduino/WString.h \ 8 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\cores\arduino/Printable.h 9 | -------------------------------------------------------------------------------- /Module/SERVO/firmware_328p/Servo328/Release/Wire/Wire.cpp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m5stack/M5-ProductExampleCodes/1bc38736e61a362080d1dffc4020b3a2a1dff6ae/Module/SERVO/firmware_328p/Servo328/Release/Wire/Wire.cpp.o -------------------------------------------------------------------------------- /Module/SERVO/firmware_328p/Servo328/Release/Wire/utility/twi.c.d: -------------------------------------------------------------------------------- 1 | C:\Users\salahei\AppData\Local\Temp\VMBuilds\Servo328\nano_atmega328\Release\Wire\utility\twi.c.o: \ 2 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src\utility\twi.c \ 3 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h \ 4 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\cores\arduino/binary.h \ 5 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\variants\eightanaloginputs/pins_arduino.h \ 6 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\variants\eightanaloginputs/../standard/pins_arduino.h \ 7 | C:\Program\ Files\ (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src\utility\twi.h 8 | -------------------------------------------------------------------------------- /Module/SERVO/firmware_328p/Servo328/Release/Wire/utility/twi.c.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m5stack/M5-ProductExampleCodes/1bc38736e61a362080d1dffc4020b3a2a1dff6ae/Module/SERVO/firmware_328p/Servo328/Release/Wire/utility/twi.c.o -------------------------------------------------------------------------------- /Module/SERVO/firmware_328p/Servo328/Servo328.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.27703.2035 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Servo328", "Servo328.vcxproj", "{C5F80730-F44F-4478-BDAE-6634EFC2CA88}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x86 = Debug|x86 11 | Release|x86 = Release|x86 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {C5F80730-F44F-4478-BDAE-6634EFC2CA88}.Debug|x86.ActiveCfg = Debug|Win32 15 | {C5F80730-F44F-4478-BDAE-6634EFC2CA88}.Debug|x86.Build.0 = Debug|Win32 16 | {C5F80730-F44F-4478-BDAE-6634EFC2CA88}.Release|x86.ActiveCfg = Release|Win32 17 | {C5F80730-F44F-4478-BDAE-6634EFC2CA88}.Release|x86.Build.0 = Release|Win32 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {92EA40BA-CE53-489A-B1B9-75E07C376402} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /Module/SERVO/firmware_328p/Servo328/Servo328.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | -------------------------------------------------------------------------------- /Module/SERVO/firmware_328p/Servo328/Servo328.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Module/USB/Arduino/Library/USB_Host_Shield_Library_2.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m5stack/M5-ProductExampleCodes/1bc38736e61a362080d1dffc4020b3a2a1dff6ae/Module/USB/Arduino/Library/USB_Host_Shield_Library_2.0.zip -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # M5-ProductExampleCodes 2 | 3 | 中文 | [English](README_en.md) | [日本語](README_ja.md) 4 | 5 | ## 此仓库已停止维护,今后产品所对应的示例会单独建仓或在放置在主机仓所对应的例程中,具体位置请看产品文档中的示例程序 6 | 7 | ~~*M5Stack的所有产品的例程和案例程序都会上传到这个仓库来管理.*~~ 8 | 9 | ~~**你可以在这个仓库中找到很多M5Stack产品相关的例程,参考这些例程之后,你可以更好的开发使用M5的产品。**~~ 10 | 11 | ~~**原理图仓库:**~~ 12 | 13 | ~~https://github.com/m5stack/M5-Schematic~~ 14 | 15 | 16 | -------------------------------------------------------------------------------- /README_en.md: -------------------------------------------------------------------------------- 1 | # M5-ProductExampleCodes 2 | 3 | [中文](README.md) | English | [日本語](README_ja.md) 4 | 5 | ## This warehouse has been discontinued, in the future, the examples corresponding to the products will be built separately or placed in the routines corresponding to the main warehouse, please see the example program in the product documentation for the specific location. 6 | 7 | ~~*All example codes of products supplied by M5Stack have been collected in this reposity.*~~ 8 | 9 | ~~**You can get some example codes for learning how to program products supplied by M5Stack(like M5Core, M5Stick, M5Camera, NODE, BALA, LidarBot....) with M5Flow, Arduino, ESP-IDF or MicroPython more familiarly.**~~ 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /README_ja.md: -------------------------------------------------------------------------------- 1 | # M5-ProductExampleCodes 2 | 3 | [中文](README.md) | [English](README_en.md) | 日本語 4 | 5 | ## 今後、製品のサンプルは別のリポジトリやメインリポジトリのルーチンに格納されます。サンプルについては、製品のドキュメントを参照してください。 6 | 7 | ~~*M5Stackから提供されるすべてのサンプルコードはこのリポジトリに集約されています。*~~ 8 | 9 | ~~**M5Stackより提供されている製品(M5Core, M5Stick, M5Camera, NODE, BALA, LidarBot…など)について、M5Flow や Arduino, ESP-IDF, MicroPythonなどを使ってプログラミングする方法を学習するためのサンプルコードがご利用いただけます。**~~ 10 | 11 | 12 | -------------------------------------------------------------------------------- /Unit/ANGLE/Arduino/potentiometer_read/potentiometer_read.ino: -------------------------------------------------------------------------------- 1 | #include 2 | // select the input pin for the potentiometer 3 | int sensorPin = 36; 4 | // last variable to store the value coming from the sensor 5 | int last_sensorValue = 0; 6 | // current variable to store the value coming from the sensor 7 | int cur_sensorValue = 0; 8 | 9 | void setup() { 10 | M5.begin(); 11 | pinMode(sensorPin, INPUT); 12 | M5.Lcd.setTextSize(2); 13 | M5.Lcd.setCursor(0, 0); 14 | M5.Lcd.print("the value of ANGLE: "); 15 | } 16 | 17 | void loop() { 18 | // read the value from the sensor: 19 | cur_sensorValue = analogRead(sensorPin); 20 | M5.Lcd.setCursor(0, 25); 21 | if(abs(cur_sensorValue - last_sensorValue) > 10){//debaunce 22 | M5.Lcd.fillRect(0, 25, 100, 25, BLACK); 23 | M5.Lcd.print(cur_sensorValue); 24 | last_sensorValue = cur_sensorValue; 25 | } 26 | delay(50); 27 | } 28 | -------------------------------------------------------------------------------- /Unit/BUTTON/Arduino/button/button.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int last_value = 0; 4 | int cur_value = 0; 5 | 6 | void setup() { 7 | // init lcd 8 | M5.begin(); 9 | Serial.begin(115200); 10 | pinMode(36, INPUT); 11 | M5.Lcd.clear(BLACK); 12 | M5.Lcd.setTextColor(YELLOW); 13 | M5.Lcd.setTextSize(2); 14 | M5.Lcd.setCursor(80, 0); M5.Lcd.println("Button example"); 15 | Serial.println("Button example: "); 16 | M5.Lcd.setTextColor(WHITE); 17 | } 18 | 19 | void loop() { 20 | cur_value = digitalRead(36);// read the value of BUTTON 21 | 22 | M5.Lcd.setCursor(0,25); M5.Lcd.print("Status: "); 23 | M5.Lcd.setCursor(0,45); M5.Lcd.print("Value: "); 24 | if(cur_value != last_value){ 25 | M5.Lcd.fillRect(95,25,100,25,BLACK); 26 | M5.Lcd.fillRect(95,45,100,25,BLACK); 27 | if(cur_value==0){ 28 | M5.Lcd.setCursor(95,25); M5.Lcd.print("pressed");// display the status 29 | M5.Lcd.setCursor(95,45); M5.Lcd.print("0"); 30 | Serial.println("Button Status: pressed"); 31 | Serial.println(" value: 0"); 32 | } 33 | else{ 34 | M5.Lcd.setCursor(95,25); M5.Lcd.print("released");// display the status 35 | M5.Lcd.setCursor(95,45); M5.Lcd.print("1"); 36 | Serial.println("Button Status: released"); 37 | Serial.println(" value: 1"); 38 | } 39 | last_value = cur_value; 40 | } 41 | M5.update(); 42 | } -------------------------------------------------------------------------------- /Unit/CAN/CAN_RECEIVE/ESP32CAN.cpp: -------------------------------------------------------------------------------- 1 | #include "ESP32CAN.h" 2 | 3 | int ESP32CAN::CANInit() 4 | { 5 | return CAN_init(); 6 | } 7 | int ESP32CAN::CANWriteFrame(const CAN_frame_t* p_frame) 8 | { 9 | return CAN_write_frame(p_frame); 10 | } 11 | int ESP32CAN::CANStop() 12 | { 13 | return CAN_stop(); 14 | } 15 | int ESP32CAN::CANConfigFilter(const CAN_filter_t* p_filter) 16 | { 17 | return CAN_config_filter(p_filter); 18 | } 19 | 20 | ESP32CAN ESP32Can; 21 | -------------------------------------------------------------------------------- /Unit/CAN/CAN_RECEIVE/ESP32CAN.h: -------------------------------------------------------------------------------- 1 | #ifndef ESP32CAN_H 2 | #define ESP32CAN_H 3 | 4 | #include "CAN_config.h" 5 | #include "CAN.h" 6 | 7 | class ESP32CAN 8 | { 9 | public: 10 | int CANInit(); 11 | int CANConfigFilter(const CAN_filter_t* p_filter); 12 | int CANWriteFrame(const CAN_frame_t* p_frame); 13 | int CANStop(); 14 | }; 15 | 16 | extern ESP32CAN ESP32Can; 17 | #endif 18 | -------------------------------------------------------------------------------- /Unit/CAN/CAN_SEND/ESP32CAN.cpp: -------------------------------------------------------------------------------- 1 | #include "ESP32CAN.h" 2 | 3 | int ESP32CAN::CANInit() 4 | { 5 | return CAN_init(); 6 | } 7 | int ESP32CAN::CANWriteFrame(const CAN_frame_t* p_frame) 8 | { 9 | return CAN_write_frame(p_frame); 10 | } 11 | int ESP32CAN::CANStop() 12 | { 13 | return CAN_stop(); 14 | } 15 | int ESP32CAN::CANConfigFilter(const CAN_filter_t* p_filter) 16 | { 17 | return CAN_config_filter(p_filter); 18 | } 19 | 20 | ESP32CAN ESP32Can; 21 | -------------------------------------------------------------------------------- /Unit/CAN/CAN_SEND/ESP32CAN.h: -------------------------------------------------------------------------------- 1 | #ifndef ESP32CAN_H 2 | #define ESP32CAN_H 3 | 4 | #include "CAN_config.h" 5 | #include "CAN.h" 6 | 7 | class ESP32CAN 8 | { 9 | public: 10 | int CANInit(); 11 | int CANConfigFilter(const CAN_filter_t* p_filter); 12 | int CANWriteFrame(const CAN_frame_t* p_frame); 13 | int CANStop(); 14 | }; 15 | 16 | extern ESP32CAN ESP32Can; 17 | #endif 18 | -------------------------------------------------------------------------------- /Unit/CARDKB/Arduino/CardKBTestM5/CardKBTestM5.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #define CARDKB_ADDR 0x5F 5 | 6 | void setup() 7 | { 8 | M5.begin(); 9 | Wire.begin(); 10 | pinMode(5, INPUT); 11 | digitalWrite(5, HIGH); 12 | M5.Lcd.fillScreen(BLACK); 13 | M5.Lcd.setCursor(1, 10); 14 | M5.Lcd.setTextColor(YELLOW); 15 | M5.Lcd.setTextSize(2); 16 | M5.Lcd.printf("IIC Address: 0x5F\n"); 17 | M5.Lcd.printf(">>"); 18 | } 19 | void loop() 20 | { 21 | Wire.requestFrom(CARDKB_ADDR, 1); 22 | while(Wire.available()) 23 | { 24 | char c = Wire.read(); // receive a byte as characterif 25 | if (c != 0) 26 | { 27 | M5.Lcd.printf("%c", c); 28 | Serial.println(c, HEX); 29 | // M5.Speaker.beep(); 30 | } 31 | } 32 | // delay(10); 33 | } 34 | -------------------------------------------------------------------------------- /Unit/CARDKB/cardkb_key_value.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m5stack/M5-ProductExampleCodes/1bc38736e61a362080d1dffc4020b3a2a1dff6ae/Unit/CARDKB/cardkb_key_value.xlsx -------------------------------------------------------------------------------- /Unit/CARDKB/firmware_328p/cardkb_sch_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m5stack/M5-ProductExampleCodes/1bc38736e61a362080d1dffc4020b3a2a1dff6ae/Unit/CARDKB/firmware_328p/cardkb_sch_01.png -------------------------------------------------------------------------------- /Unit/DAC/Arduino/DAC_MCP4725/DAC_MCP4725.ino: -------------------------------------------------------------------------------- 1 | /* 2 | hardware : m5stack uint dac 3 | 4 | please install adafruit MCP4725 lib 5 | */ 6 | #include 7 | #include 8 | 9 | #define DAC_ADDR 10 | Adafruit_MCP4725 dac; 11 | 12 | void setup(void) { 13 | Serial.begin(115200); 14 | Serial.println("Hello!"); 15 | 16 | // For Adafruit MCP4725A1 the address is 0x62 (default) or 0x63 (ADDR pin tied to VCC) 17 | // For MCP4725A0 the address is 0x60 or 0x61 18 | // For MCP4725A2 the address is 0x64 or 0x65 19 | dac.begin(0x60); 20 | 21 | Serial.println("Generating a triangle wave"); 22 | dac.setVoltage(2048, false); 23 | 24 | } 25 | 26 | void loop(void) { 27 | // 12bit value , false mean not write EEPROM 28 | dac.setVoltage(1024, false); 29 | delay(1000); 30 | dac.setVoltage(2048, false); 31 | delay(1000); 32 | } -------------------------------------------------------------------------------- /Unit/EARTH/Arduino/Earth/Earth.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void setup() { 4 | M5.begin(); 5 | //disable the speak noise 6 | dacWrite(25, 0); 7 | 8 | M5.Lcd.setTextColor(YELLOW); 9 | M5.Lcd.setTextSize(2); 10 | M5.Lcd.setCursor(65, 50); 11 | M5.Lcd.printf("UNIT_EARTH EXAMPLE\n"); 12 | pinMode(26, INPUT); 13 | M5.Lcd.setCursor(85, 80); 14 | M5.Lcd.print("GPIO36:"); 15 | M5.Lcd.setCursor(85, 100); 16 | M5.Lcd.print("GPIO26:"); 17 | } 18 | 19 | uint16_t analogRead_value = 0; 20 | uint16_t digitalRead_value = 0; 21 | void loop() { 22 | // put your main code here, to run repeatedly: 23 | M5.Lcd.setCursor(175, 80); 24 | M5.Lcd.setTextColor(BLACK); 25 | M5.Lcd.printf("%d\n", analogRead_value); 26 | M5.Lcd.setCursor(175, 100); 27 | M5.Lcd.printf("%d\n", digitalRead_value); 28 | analogRead_value = analogRead(36); 29 | digitalRead_value = digitalRead(26); 30 | M5.Lcd.setTextColor(YELLOW); 31 | M5.Lcd.setCursor(175, 80); 32 | M5.Lcd.printf("%d\n", analogRead_value); 33 | M5.Lcd.setCursor(175, 100); 34 | M5.Lcd.printf("%d\n", digitalRead_value); 35 | delay(10); 36 | } 37 | -------------------------------------------------------------------------------- /Unit/ENV/Arduino/ENV/DHT12.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | DHT12.cpp - Library for DHT12 sensor. 3 | v0.0.1 Beta 4 | Created by Bobadas, July 30,2016. 5 | Released into the public domain. 6 | */ 7 | #include "Arduino.h" 8 | #include "Wire.h" 9 | #include "DHT12.h" 10 | 11 | DHT12::DHT12(byte scale,byte id) 12 | { 13 | if (id==0 || id>126) _id=0x5c; 14 | else _id=id; 15 | if (scale==0 || scale>3) _scale=CELSIUS; 16 | else _scale=scale; 17 | } 18 | 19 | byte DHT12::read() 20 | { 21 | Wire.beginTransmission(_id); 22 | Wire.write(0); 23 | if (Wire.endTransmission()!=0) return 1; 24 | Wire.requestFrom(_id, 5); 25 | for (int i=0;i<5;i++) { 26 | datos[i]=Wire.read(); 27 | }; 28 | delay(50); 29 | if (Wire.available()!=0) return 2; 30 | if (datos[4]!=(datos[0]+datos[1]+datos[2]+datos[3])) return 3; 31 | return 0; 32 | } 33 | 34 | float DHT12::readTemperature(byte scale) 35 | { 36 | float resultado=0; 37 | byte error=read(); 38 | if (error!=0) return (float)error/100; 39 | if (scale==0) scale=_scale; 40 | switch(scale) { 41 | case CELSIUS: 42 | resultado=(datos[2]+(float)datos[3]/10); 43 | break; 44 | case FAHRENHEIT: 45 | resultado=((datos[2]+(float)datos[3]/10)*1.8+32); 46 | break; 47 | case KELVIN: 48 | resultado=(datos[2]+(float)datos[3]/10)+273.15; 49 | break; 50 | }; 51 | return resultado; 52 | } 53 | 54 | float DHT12::readHumidity() 55 | { 56 | float resultado; 57 | byte error=read(); 58 | if (error!=0) return (float)error/100; 59 | resultado=(datos[0]+(float)datos[1]/10); 60 | return resultado; 61 | } 62 | 63 | -------------------------------------------------------------------------------- /Unit/ENV/Arduino/ENV/DHT12.h: -------------------------------------------------------------------------------- 1 | /* 2 | DHT12.h - Library for DHT12 sensor. 3 | v0.0.1 Beta 4 | Created by Bobadas, July 30,2016. 5 | Released into the public domain. 6 | */ 7 | #ifndef DHT12_h 8 | #define DHT12_h 9 | #include "Arduino.h" 10 | #include "Wire.h" 11 | 12 | #define CELSIUS 1 13 | #define KELVIN 2 14 | #define FAHRENHEIT 3 15 | 16 | class DHT12 17 | { 18 | public: 19 | DHT12(byte scale=0,byte id=0); 20 | float readTemperature(byte scale=0); 21 | float readHumidity(); 22 | private: 23 | byte read(); 24 | byte datos[5]; 25 | byte _id; 26 | byte _scale; 27 | }; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /Unit/ENV/Arduino/ENV/ENV.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include "DHT12.h" 3 | #include //The DHT12 uses I2C comunication. 4 | #include "Adafruit_Sensor.h" 5 | #include 6 | DHT12 dht12; //Preset scale CELSIUS and ID 0x5c. 7 | Adafruit_BMP280 bme; 8 | 9 | void setup() { 10 | M5.begin(); 11 | Wire.begin(); 12 | 13 | M5.Lcd.setBrightness(10); 14 | 15 | Serial.println(F("ENV Unit(DHT12 and BMP280) test...")); 16 | 17 | if (!bme.begin(0x76)){ 18 | Serial.println("Could not find a valid BMP280 sensor, check wiring!"); 19 | while (1); 20 | } 21 | M5.Lcd.println("ENV Unit test..."); 22 | } 23 | 24 | void loop() { 25 | 26 | float tmp = dht12.readTemperature(); 27 | float hum = dht12.readHumidity(); 28 | float pressure = bme.readPressure(); 29 | Serial.printf("Temperatura: %2.2f*C Humedad: %0.2f%% Pressure: %0.2fPa\r\n", tmp, hum, pressure); 30 | 31 | M5.Lcd.setCursor(0, 0); 32 | M5.Lcd.setTextColor(WHITE, BLACK); 33 | M5.Lcd.setTextSize(3); 34 | M5.Lcd.printf("Temp: %2.1f \r\nHumi: %2.0f%% \r\nPressure:%2.0fPa\r\n", tmp, hum, pressure); 35 | 36 | delay(100); 37 | } 38 | -------------------------------------------------------------------------------- /Unit/ENV/Arduino/ENV/README.md: -------------------------------------------------------------------------------- 1 | # Example for ENV Unit 2 | 3 | *注意,编译例程前,需要将DHT12.h和DHT12.cpp文件放置在例程ENV.ino所在文件夹下,并且通过Arduino IDE的库管理安装[Adafruit BMP280](https://github.com/adafruit/Adafruit_BMP280_Library)库,然后下载这个[地址](https://github.com/adafruit/Adafruit_Sensor)的Adafruit_Sensor.h,并放置在Adafruit_BMP280_Library文件夹中。* 4 | 5 | ## Desc 6 | 7 | 从ENV Unit读取温湿度和压力值,然后通过串口0打印到串口终端,同时在M5Core的屏幕上显示这些数据。 8 | 9 | ## Result 10 | 11 | 串口终端显示结果: 12 | 13 | Temperatura: 25.40*C Humedad: 28.50% Pressure: 102137.55Pa 14 | 15 | Temperatura: 25.40*C Humedad: 28.50% Pressure: 102136.17Pa 16 | 17 | Temperatura: 25.50*C Humedad: 28.50% Pressure: 102139.25Pa 18 | 19 | Temperatura: 25.50*C Humedad: 28.50% Pressure: 102133.55Pa 20 | 21 | Temperatura: 25.50*C Humedad: 28.50% Pressure: 102137.08Pa 22 | 23 | Temperatura: 25.50*C Humedad: 28.50% Pressure: 102140.25Pa 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Unit/ENVII/Arduino/ENVII/ENVII.ino: -------------------------------------------------------------------------------- 1 | /*Please install the < Adafruit BMP280 Library > (https://github.com/adafruit/Adafruit_BMP280_Library) 2 | * from the library manager before use. 3 | *This code will display the temperature, humidity and air pressure information on the screen*/ 4 | 5 | #include 6 | #include 7 | #include "Adafruit_Sensor.h" 8 | #include 9 | #include "SHT3X.h" 10 | SHT3X sht30; 11 | Adafruit_BMP280 bme; 12 | 13 | float tmp = 0.0; 14 | float hum = 0.0; 15 | float pressure = 0.0; 16 | 17 | void setup() { 18 | M5.begin(); 19 | Wire.begin(); 20 | M5.Lcd.setBrightness(10); 21 | M5.Lcd.setTextSize(3); 22 | Serial.println(F("ENV Unit(SHT30 and BMP280) test...")); 23 | 24 | while (!bme.begin(0x76)){ 25 | Serial.println("Could not find a valid BMP280 sensor, check wiring!"); 26 | M5.Lcd.println("Could not find a valid BMP280 sensor, check wiring!"); 27 | } 28 | M5.Lcd.clear(BLACK); 29 | M5.Lcd.println("ENV Unit test..."); 30 | delay(100); 31 | M5.Lcd.fillRect(0, 0, 340, 30, BLACK); 32 | } 33 | 34 | void loop() { 35 | pressure = bme.readPressure(); 36 | if(sht30.get()==0){ 37 | tmp = sht30.cTemp; 38 | hum = sht30.humidity; 39 | } 40 | Serial.printf("Temperatura: %2.2f*C Humedad: %0.2f%% Pressure: %0.2fPa\r\n", tmp, hum, pressure); 41 | M5.Lcd.setCursor(0, 0); 42 | M5.Lcd.setTextColor(WHITE, BLACK); 43 | 44 | M5.Lcd.printf("Temp: %2.1f \r\nHumi: %2.0f%% \r\nPressure:%2.0fPa\r\n", tmp, hum, pressure); 45 | 46 | delay(100); 47 | 48 | } 49 | -------------------------------------------------------------------------------- /Unit/ENVII/Arduino/ENVII/SHT3X.cpp: -------------------------------------------------------------------------------- 1 | #include "SHT3X.h" 2 | 3 | /* Motor() 4 | 5 | */ 6 | SHT3X::SHT3X(uint8_t address) 7 | { 8 | Wire.begin(); 9 | _address=address; 10 | } 11 | 12 | 13 | 14 | byte SHT3X::get() 15 | { 16 | unsigned int data[6]; 17 | 18 | // Start I2C Transmission 19 | Wire.beginTransmission(_address); 20 | // Send measurement command 21 | Wire.write(0x2C); 22 | Wire.write(0x06); 23 | // Stop I2C transmission 24 | if (Wire.endTransmission()!=0) 25 | return 1; 26 | 27 | delay(500); 28 | 29 | // Request 6 bytes of data 30 | Wire.requestFrom(_address, 6); 31 | 32 | // Read 6 bytes of data 33 | // cTemp msb, cTemp lsb, cTemp crc, humidity msb, humidity lsb, humidity crc 34 | for (int i=0;i<6;i++) { 35 | data[i]=Wire.read(); 36 | }; 37 | 38 | delay(50); 39 | 40 | if (Wire.available()!=0) 41 | return 2; 42 | 43 | // Convert the data 44 | cTemp = ((((data[0] * 256.0) + data[1]) * 175) / 65535.0) - 45; 45 | fTemp = (cTemp * 1.8) + 32; 46 | humidity = ((((data[3] * 256.0) + data[4]) * 100) / 65535.0); 47 | 48 | return 0; 49 | } 50 | -------------------------------------------------------------------------------- /Unit/ENVII/Arduino/ENVII/SHT3X.h: -------------------------------------------------------------------------------- 1 | #ifndef __SHT3X_H 2 | #define __HT3X_H 3 | 4 | 5 | #if ARDUINO >= 100 6 | #include "Arduino.h" 7 | #else 8 | #include "WProgram.h" 9 | #endif 10 | 11 | #include "Wire.h" 12 | 13 | class SHT3X{ 14 | public: 15 | SHT3X(uint8_t address=0x44); 16 | byte get(void); 17 | float cTemp=0; 18 | float fTemp=0; 19 | float humidity=0; 20 | 21 | private: 22 | uint8_t _address; 23 | 24 | }; 25 | 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /Unit/EXTIO/Arduino/EXT_IO/PCA9554.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Title: PCA9554 3 | by: AD0ND 4 | 5 | This file is free software; you can redistribute it and/or modify 6 | it under the terms of either the GNU General Public License version 2 7 | or the GNU Lesser General Public License version 2.1, both as 8 | published by the Free Software Foundation. 9 | ***************************************************************************/ 10 | 11 | #ifndef PCA9554_h 12 | #define PCA9554_h 13 | 14 | #include 15 | #include 16 | 17 | //PCA9554 Command Byte 18 | #define INPUTPORT0 0x00 19 | #define OUTPUTPORT0 0x01 20 | #define POLINVPORT0 0x02 21 | #define CONFIGPORT0 0x03 22 | 23 | 24 | #define ALLOUTPUT 0x00 25 | #define ALLINPUT 0xFF 26 | 27 | class PCA9554 28 | { 29 | public : 30 | PCA9554(byte SlaveAddress); 31 | 32 | bool twiRead(byte ®isterAddress); 33 | bool twiWrite(byte registerAddress, byte dataWrite); 34 | 35 | bool pinMode0(byte pinNumber, bool state); 36 | bool portMode0(byte value); 37 | 38 | bool digitalWrite0(byte pinNumber, bool state); 39 | bool digitalWritePort0(byte value); 40 | 41 | bool digitalRead0(byte &pinNumber); 42 | bool digitalReadPort0(byte &value); 43 | 44 | private : 45 | int _SlaveAddress; 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /Unit/FAN/Arduino/FAN/FAN.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | const int motor_pin = 21; 4 | int freq = 10000; 5 | int ledChannel = 0; 6 | int resolution = 10; 7 | void setup() { 8 | // put your setup code here, to run once: 9 | M5.begin(); 10 | M5.Lcd.setCursor(120, 110, 4); 11 | M5.Lcd.println("MOTOR"); 12 | ledcSetup(ledChannel, freq, resolution); 13 | ledcAttachPin(motor_pin, ledChannel); 14 | 15 | } 16 | // 0 - 1024 17 | void loop() { 18 | // put your main code here, to run repeatedly: 19 | ledcWrite(ledChannel, 512);//0° 20 | delay(1000); 21 | ledcWrite(ledChannel, 0);//90° 22 | delay(1000); 23 | //ledcWrite(ledChannel, 30);//180° 24 | //delay(1000); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /Unit/GPS/Arduino/GPSRaw/GPSRaw.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | HardwareSerial GPSRaw(2); 4 | 5 | void setup() { 6 | 7 | M5.begin(); 8 | GPSRaw.begin(9600); 9 | 10 | Serial.println("hello"); 11 | termInit(); 12 | } 13 | 14 | void loop() { 15 | // put your main code here, to run repeatedly: 16 | if(Serial.available()) { 17 | int ch = Serial.read(); 18 | GPSRaw.write(ch); 19 | } 20 | 21 | if(GPSRaw.available()) { 22 | int ch = GPSRaw.read(); 23 | Serial.write(ch); 24 | termPutchar(ch); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Unit/GPS/TinyGPSPlus-1.0.2.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m5stack/M5-ProductExampleCodes/1bc38736e61a362080d1dffc4020b3a2a1dff6ae/Unit/GPS/TinyGPSPlus-1.0.2.zip -------------------------------------------------------------------------------- /Unit/HALL/HALL/HALL.ino: -------------------------------------------------------------------------------- 1 | //Low-level signal can be generated when the magnet S pole is close to the front of the sensor 2 | //OR the N pole is close to the back, and the internal LED indicator will light up, the screen wiil display 0. 3 | 4 | #include 5 | #define HALL 36 6 | 7 | void header(const char *string, uint16_t color) 8 | { 9 | M5.Lcd.fillScreen(color); 10 | M5.Lcd.setTextSize(1); 11 | M5.Lcd.setTextColor(TFT_WHITE, TFT_BLACK); 12 | M5.Lcd.fillRect(0, 0, 320, 30, TFT_BLACK); 13 | M5.Lcd.setTextDatum(TC_DATUM); 14 | M5.Lcd.drawString(string, 160, 3, 4); 15 | } 16 | 17 | void setup() { 18 | M5.begin(true, false, true); 19 | header("HALL Sensor", TFT_BLACK); 20 | pinMode(HALL, INPUT); 21 | } 22 | 23 | void loop() { 24 | bool status = digitalRead(HALL); 25 | M5.Lcd.setTextSize(2); 26 | M5.Lcd.setCursor(20, 80, 2); 27 | M5.Lcd.printf("Hall status : %d", status); 28 | } 29 | -------------------------------------------------------------------------------- /Unit/HEX/Arduino/hex/hex.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Install FastLED library first.(HEX is connected to GROVE A) 3 | */ 4 | #include 5 | #include "FastLED.h" 6 | 7 | #define Neopixel_PIN 21 8 | #define NUM_LEDS 37 9 | 10 | CRGB leds[NUM_LEDS]; 11 | uint8_t gHue = 0; 12 | 13 | void setup() { 14 | M5.begin(); 15 | M5.Lcd.clear(BLACK); 16 | M5.Lcd.setTextColor(YELLOW); M5.Lcd.setTextSize(2); M5.Lcd.setCursor(40, 0); 17 | M5.Lcd.println("HEX Example"); 18 | M5.Lcd.setTextColor(WHITE); 19 | M5.Lcd.setCursor(0, 25); 20 | M5.Lcd.println("Display rainbow effect"); 21 | 22 | // Neopixel initialization 23 | FastLED.addLeds(leds, NUM_LEDS).setCorrection(TypicalLEDStrip); 24 | FastLED.setBrightness(10); 25 | } 26 | 27 | void loop(){ 28 | fill_rainbow( leds, NUM_LEDS, gHue, 7); 29 | FastLED.show();// must be executed for neopixel becoming effective 30 | EVERY_N_MILLISECONDS( 20 ) { gHue++; } 31 | } 32 | -------------------------------------------------------------------------------- /Unit/IMU_Unit/IMU_Unit.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | 4 | #ifdef __cplusplus 5 | extern "C" 6 | { 7 | #include "IMU_6886.h" 8 | } 9 | #endif 10 | 11 | IMU_6886 imu6886; 12 | 13 | float accX = 0; 14 | float accY = 0; 15 | float accZ = 0; 16 | 17 | float gyroX = 0; 18 | float gyroY = 0; 19 | float gyroZ = 0; 20 | 21 | float temp = 0; 22 | 23 | void setup() { 24 | // put your setup code here, to run once: 25 | M5.begin(); 26 | M5.Power.begin(); 27 | M5.Lcd.fillScreen(BLACK); 28 | M5.Lcd.setTextSize(2); 29 | M5.Lcd.setCursor(100, 0); 30 | M5.Lcd.println("MPU6886 TEST"); 31 | M5.Lcd.setCursor(10, 25); 32 | M5.Lcd.println(" X Y Z"); 33 | imu6886.Init(21, 22); 34 | } 35 | 36 | void loop() { 37 | // put your main code here, to run repeatedly: 38 | imu6886.getGyroData(&gyroX,&gyroY,&gyroZ); 39 | imu6886.getAccelData(&accX,&accY,&accZ); 40 | imu6886.getTempData(&temp); 41 | 42 | M5.Lcd.setCursor(10, 70); 43 | M5.Lcd.printf("%.2f %.2f %.2f ", gyroX, gyroY,gyroZ); 44 | M5.Lcd.setCursor(270, 70); 45 | M5.Lcd.print("o/s"); 46 | M5.Lcd.setCursor(10, 140); 47 | M5.Lcd.printf("%.2f %.2f %.2f ",accX ,accY , accZ); 48 | M5.Lcd.setCursor(270, 140); 49 | M5.Lcd.print("G"); 50 | M5.Lcd.setCursor(10, 210); 51 | M5.Lcd.printf("Temperature : %.2f C", temp); 52 | delay(100); 53 | } 54 | -------------------------------------------------------------------------------- /Unit/IR/Arduino/ir_dectect/ir_dectect.ino: -------------------------------------------------------------------------------- 1 | #include 2 | // select the input pin for the potentiometer 3 | int ir_recv_pin = 36; 4 | int ir_send_pin = 26; 5 | int last_recv_value = 0; 6 | int cur_recv_value = 0; 7 | 8 | void setup() { 9 | M5.begin(); 10 | pinMode(ir_recv_pin, INPUT); 11 | pinMode(ir_send_pin, OUTPUT); 12 | //send infrared light 13 | //now, you can see the infrared light through mobile phone camera 14 | digitalWrite(ir_send_pin, 1); 15 | M5.Lcd.setTextSize(2); 16 | M5.Lcd.setCursor(0, 0); 17 | M5.Lcd.print("Test for IR receiver: "); 18 | } 19 | 20 | void loop() { 21 | //now, once you press the button on a remote controller to send infrared light 22 | //the screen will display "detected!" 23 | cur_recv_value = digitalRead(ir_recv_pin); 24 | if(last_recv_value != cur_recv_value){ 25 | M5.Lcd.setCursor(0, 25); 26 | M5.Lcd.fillRect(0, 25, 150, 25, BLACK); 27 | if(cur_recv_value == 0){//0: detected 1: not detected 28 | M5.Lcd.print("detected!"); 29 | } 30 | last_recv_value = cur_recv_value; 31 | } 32 | delay(100); 33 | } 34 | -------------------------------------------------------------------------------- /Unit/JOYSTICK/Arduino/Joystick/Joystick.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "Wire.h" 4 | 5 | #define JOY_ADDR 0x52 6 | void setup() { 7 | M5.begin(); 8 | M5.Lcd.clear(BLACK); 9 | M5.Lcd.setTextColor(YELLOW); 10 | M5.Lcd.setTextSize(2); 11 | M5.Lcd.setCursor(40, 0); 12 | M5.Lcd.println("Dual Button example"); 13 | M5.Lcd.setTextColor(WHITE); 14 | // disable the speak noise 15 | dacWrite(25, 0); 16 | 17 | Wire.begin(21, 22, 400000UL); 18 | } 19 | 20 | uint8_t x_data; 21 | uint8_t y_data; 22 | uint8_t button_data; 23 | char data[100]; 24 | void loop() { 25 | Wire.requestFrom(JOY_ADDR, 3); 26 | if (Wire.available()) { 27 | x_data = Wire.read(); // X(range: 10~250) 28 | y_data = Wire.read(); // Y(range: 10~250) 29 | button_data = Wire.read(); // Z(0: released 1: pressed) 30 | sprintf(data, "x:%d y:%d button:%d\n", x_data, y_data, button_data); 31 | Serial.print(data); 32 | M5.Lcd.fillRect(10, 100, 100, 25, BLACK); 33 | M5.Lcd.setCursor(10, 100); 34 | M5.Lcd.print(data); 35 | } 36 | delay(200); 37 | } 38 | -------------------------------------------------------------------------------- /Unit/LIGHT/Arduino/Light/Light.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void setup() { 4 | M5.begin(); 5 | //disable the speak noise 6 | dacWrite(25, 0); 7 | 8 | M5.Lcd.setTextColor(YELLOW); 9 | M5.Lcd.setTextSize(2); 10 | M5.Lcd.setCursor(65, 50); 11 | M5.Lcd.printf("UNIT_LIGHT EXAMPLE\n"); 12 | pinMode(26, INPUT); 13 | M5.Lcd.setCursor(85, 80); 14 | M5.Lcd.print("GPIO36:"); 15 | M5.Lcd.setCursor(85, 100); 16 | M5.Lcd.print("GPIO26:"); 17 | } 18 | 19 | uint16_t analogRead_value = 0; 20 | uint16_t digitalRead_value = 0; 21 | void loop() { 22 | // put your main code here, to run repeatedly: 23 | M5.Lcd.setCursor(175, 80); 24 | M5.Lcd.setTextColor(BLACK); 25 | M5.Lcd.printf("%d\n", analogRead_value); 26 | M5.Lcd.setCursor(175, 100); 27 | M5.Lcd.printf("%d\n", digitalRead_value); 28 | analogRead_value = analogRead(36); 29 | digitalRead_value = digitalRead(26); 30 | M5.Lcd.setTextColor(YELLOW); 31 | M5.Lcd.setCursor(175, 80); 32 | M5.Lcd.printf("%d\n", analogRead_value); 33 | M5.Lcd.setCursor(175, 100); 34 | M5.Lcd.printf("%d\n", digitalRead_value); 35 | delay(10); 36 | } 37 | -------------------------------------------------------------------------------- /Unit/MIC_Unit/MIC_Unit.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Free_Fonts.h" 3 | #define MIC_Unit 36 4 | #define MAX_LEN 320 5 | #define X_OFFSET 0 6 | #define Y_OFFSET 100 7 | #define X_SCALE 1 8 | 9 | static void draw_waveform() { 10 | 11 | static int16_t val_buf[MAX_LEN] = {0}; 12 | static int16_t pt = MAX_LEN - 1; 13 | int micValue = analogRead(MIC_Unit); 14 | val_buf[pt] = map((int16_t)(micValue * X_SCALE), 1800, 4095, 0, 100); 15 | 16 | 17 | if (--pt < 0) { 18 | pt = MAX_LEN - 1; 19 | } 20 | 21 | for (int i = 1; i < (MAX_LEN); i++) { 22 | uint16_t now_pt = (pt + i) % (MAX_LEN); 23 | M5.Lcd.drawLine(i + X_OFFSET, val_buf[(now_pt + 1) % MAX_LEN] + Y_OFFSET, i + 1 + X_OFFSET, val_buf[(now_pt + 2) % MAX_LEN] + Y_OFFSET, TFT_BLACK); 24 | if (i < MAX_LEN - 1) { 25 | M5.Lcd.drawLine(i + X_OFFSET, val_buf[now_pt] + Y_OFFSET, i + 1 + X_OFFSET, val_buf[(now_pt + 1) % MAX_LEN] + Y_OFFSET, TFT_GREEN); 26 | } 27 | } 28 | } 29 | 30 | void setup() { 31 | M5.begin(); 32 | M5.Lcd.setFreeFont(FSS12); 33 | M5.Lcd.setTextDatum(TC_DATUM); 34 | M5.Lcd.drawString("MIC Unit", 160, 0, GFXFF); 35 | 36 | dacWrite(25, 0); 37 | 38 | } 39 | 40 | void loop() { 41 | draw_waveform(); 42 | } 43 | -------------------------------------------------------------------------------- /Unit/NCIR/Arduino/NCIR/NCIR.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void setup() { 5 | Wire.begin(); 6 | Serial.begin(115200); 7 | M5.begin(); 8 | M5.Lcd.setTextColor(WHITE); 9 | M5.Lcd.setTextSize(3); 10 | M5.Lcd.clear(BLACK); 11 | M5.Lcd.setCursor(120, 100); 12 | } 13 | 14 | uint16_t result; 15 | float temperature; 16 | 17 | void loop() { 18 | Wire.beginTransmission(0x5A); // Send Initial Signal and I2C Bus Address 19 | Wire.write(0x07); // Send data only once and add one address automatically. 20 | Wire.endTransmission(false); // Stop signal 21 | Wire.requestFrom(0x5A, 2); // Get 2 consecutive data from 0x5A, and the data is stored only. 22 | result = Wire.read(); // Receive DATA 23 | result |= Wire.read() << 8; // Receive DATA 24 | 25 | temperature = result * 0.02 - 273.15; 26 | 27 | M5.Lcd.fillRect(120,100,120,100,BLACK); 28 | M5.Lcd.setCursor(120, 100); 29 | 30 | M5.Lcd.print(temperature); 31 | Serial.println(temperature); 32 | 33 | delay(500); 34 | M5.update(); 35 | } 36 | -------------------------------------------------------------------------------- /Unit/NEOFLASH/Arduino/neoflash_digitalclock/DisplayCurrentTime.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __DISPLATCURRENTTIME_H 3 | #define __DISPLATCURRENTTIME_H 4 | #include "FastLED.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | #define NUM_LEDS 192 11 | extern CRGB leds[NUM_LEDS]; 12 | extern void displayCurrentTime(uint16_t time4Day); 13 | extern void diaplayPoint(); 14 | extern void clearPoint(); 15 | extern void clearLeds(); 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | #endif 20 | -------------------------------------------------------------------------------- /Unit/NEOFLASH/Arduino/neoflash_digitalclock/README.md: -------------------------------------------------------------------------------- 1 | # Neopixel_board 2 | 本例程使用的是24x8阵列的Neopixel RGB LED 3 | 4 | 需使用M5Core + M5GO 底座驱动Neopixel灯板 5 | 6 | 主要功能是通过WIFI联网获取当前时间显示在灯板上 7 | -------------------------------------------------------------------------------- /Unit/NEOPIXEL/Arduino/display_rainbow/display_rainbow.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Install FastLED library first. 3 | */ 4 | #include 5 | #include "FastLED.h" 6 | 7 | #define Neopixel_PIN 21 8 | #define NUM_LEDS 30 9 | 10 | CRGB leds[NUM_LEDS]; 11 | uint8_t gHue = 0; 12 | static TaskHandle_t FastLEDshowTaskHandle = 0; 13 | static TaskHandle_t userTaskHandle = 0; 14 | 15 | void setup() { 16 | Serial.begin(115200); 17 | M5.begin(); 18 | M5.Lcd.clear(BLACK); 19 | M5.Lcd.setTextColor(YELLOW); M5.Lcd.setTextSize(2); M5.Lcd.setCursor(40, 0); 20 | M5.Lcd.println("Neopixel Example"); 21 | M5.Lcd.setTextColor(WHITE); 22 | M5.Lcd.setCursor(0, 25); 23 | M5.Lcd.println("Display rainbow effect"); 24 | 25 | // Neopixel initialization 26 | FastLED.addLeds(leds, NUM_LEDS).setCorrection(TypicalLEDStrip); 27 | FastLED.setBrightness(10); 28 | xTaskCreatePinnedToCore(FastLEDshowTask, "FastLEDshowTask", 2048, NULL, 2, NULL, 1); 29 | } 30 | 31 | void loop() 32 | { 33 | 34 | } 35 | 36 | void FastLEDshowESP32() 37 | { 38 | if (userTaskHandle == 0) { 39 | userTaskHandle = xTaskGetCurrentTaskHandle(); 40 | xTaskNotifyGive(FastLEDshowTaskHandle); 41 | const TickType_t xMaxBlockTime = pdMS_TO_TICKS( 200 ); 42 | ulTaskNotifyTake(pdTRUE, xMaxBlockTime); 43 | userTaskHandle = 0; 44 | } 45 | } 46 | 47 | void FastLEDshowTask(void *pvParameters) 48 | { 49 | for(;;) { 50 | fill_rainbow(leds, NUM_LEDS, gHue, 7);// rainbow effect 51 | FastLED.show();// must be executed for neopixel becoming effective 52 | EVERY_N_MILLISECONDS( 20 ) { gHue++; } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Unit/OP90.180/Arduino/OP90.180/OP90.180.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | 4 | void setup() { 5 | // put your setup code here, to run once: 6 | M5.begin(); 7 | //Wire.begin(); 8 | M5.Lcd.setCursor(120, 10, 4); 9 | M5.Lcd.println("90/180 OPTICAL"); 10 | 11 | pinMode(36,INPUT_PULLUP); 12 | 13 | } 14 | 15 | void loop() { 16 | // put your main code here, to run repeatedly: 17 | M5.Lcd.setCursor(80, 120, 4); 18 | M5.Lcd.printf("ir receive: %d",digitalRead(36)); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /Unit/PIR/Arduino/pir/pir.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void setup() { 4 | M5.begin(); 5 | Serial.begin(115200); 6 | M5.Lcd.clear(BLACK); 7 | M5.Lcd.setTextColor(YELLOW); 8 | M5.Lcd.setTextSize(2); 9 | M5.Lcd.setTextSize(2); 10 | M5.Lcd.setCursor(80, 0); 11 | M5.Lcd.println("PIR example"); 12 | Serial.println("PIR example: "); 13 | M5.Lcd.setCursor(65, 10); 14 | M5.Lcd.setTextColor(WHITE); 15 | pinMode(36, INPUT); 16 | } 17 | 18 | void loop() { 19 | M5.Lcd.setCursor(0,25); M5.Lcd.print("Status: "); 20 | M5.Lcd.setCursor(0,45); M5.Lcd.print("Value: "); 21 | 22 | M5.Lcd.fillRect(95,25,200,25,BLACK); 23 | M5.Lcd.fillRect(95,45,200,25,BLACK); 24 | 25 | if(digitalRead(36)==1){ 26 | M5.Lcd.setCursor(95, 25);M5.Lcd.print("Sensing"); 27 | M5.Lcd.setCursor(95, 45);M5.Lcd.print("1"); 28 | Serial.println("PIR Status: Sensing"); 29 | Serial.println(" value: 1"); 30 | } 31 | else{ 32 | M5.Lcd.setCursor(95, 25);M5.Lcd.print("Not Sensed"); 33 | M5.Lcd.setCursor(95, 45);M5.Lcd.print("0"); 34 | Serial.println("PIR Status: Not Sensed"); 35 | Serial.println(" value: 0"); 36 | } 37 | delay(500); 38 | M5.update(); 39 | } 40 | -------------------------------------------------------------------------------- /Unit/PaHUB/Arduino/PaHUB/PaHUB.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /*************************************************************************************** 5 | This example requires the device with the iic device to be inserted into the hub port, 6 | and the host will read the corresponding iic address. 7 | ****************************************************************************************/ 8 | #define PAHUB_ADDR 0X70 9 | 10 | void portselectall(uint8_t ports) { 11 | Wire.beginTransmission(PAHUB_ADDR); 12 | Wire.write(ports&0x3f); 13 | Wire.endTransmission(); 14 | } 15 | 16 | 17 | //Hub range is 0 to 5 18 | void portselect(uint8_t i) { 19 | if (i > 7) return; 20 | 21 | Wire.beginTransmission(PAHUB_ADDR); 22 | Wire.write(1 << i); 23 | Wire.endTransmission(); 24 | } 25 | 26 | 27 | void setup() { 28 | // put your setup code here, to run once: 29 | M5.begin(); 30 | Wire.begin(); 31 | } 32 | 33 | void loop() { 34 | // put your main code here, to run repeatedly: 35 | int error = 0; 36 | for(int i = 0; i < 6; i++){ 37 | portselect(i); 38 | M5.Lcd.setCursor(0, i * 40, 2); 39 | M5.Lcd.print("TCA Port"); M5.Lcd.print(i); 40 | for(uint8_t address = 1; address < 127; address++){ 41 | Wire.beginTransmission(address); 42 | error = Wire.endTransmission(); 43 | if(error == 0){ 44 | if((address == 0x70) || (address == 0x75)) continue; 45 | M5.Lcd.print(": Found I2C 0x");M5.Lcd.print(address,HEX);break; 46 | }else{ 47 | M5.Lcd.setCursor(100, i * 40); 48 | M5.Lcd.fillRect(100, i * 40, 280, 40, BLACK); 49 | } 50 | delay(1); 51 | } 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /Unit/RELAY/Arduino/Relay/Relay.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void setup() { 4 | M5.begin(); 5 | M5.Lcd.clear(BLACK); 6 | M5.Lcd.setTextFont(4); 7 | M5.Lcd.setTextColor(YELLOW, BLACK); 8 | //disable the speak noise 9 | dacWrite(25, 0); 10 | pinMode(26, OUTPUT); 11 | } 12 | 13 | void loop(void) { 14 | digitalWrite(26, HIGH); 15 | delay(500); 16 | digitalWrite(26, LOW); 17 | delay(500); 18 | } 19 | -------------------------------------------------------------------------------- /Unit/TRACE/Arduino/trace.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // #define VALUE_SPLIT 4 | 5 | uint8_t value; 6 | int SensorArray[4] = {0}; 7 | 8 | void setup() { 9 | m5.begin(); 10 | Serial.begin(115200); 11 | Wire.begin(); 12 | M5.Lcd.clear(BLACK); 13 | M5.Lcd.setTextColor(YELLOW); 14 | M5.Lcd.setTextSize(2); 15 | M5.Lcd.setCursor(40, 0); 16 | M5.Lcd.println("TRACE example"); 17 | M5.Lcd.setTextColor(WHITE); 18 | } 19 | 20 | void loop(){ 21 | SensorStatus(); 22 | delay(100); 23 | } 24 | 25 | void SensorStatus(void){ 26 | Wire.beginTransmission(0x5a); 27 | Wire.write(0x00); 28 | Wire.endTransmission(); 29 | Wire.requestFrom(0x5a,1); 30 | while(Wire.available()){ 31 | value = Wire.read(); 32 | } 33 | Serial.print(" value = ");Serial.println(value, HEX); 34 | #ifdef VALUE_SPLIT 35 | SensorArray[3] = (value&0x08)>>3; 36 | SensorArray[2] = (value&0x04)>>2; 37 | SensorArray[1] = (value&0x02)>>1; 38 | SensorArray[0] = (value&0x01)>>0; 39 | Serial.println("After splitting... "); 40 | Serial.print("SensorArray[0] = ");Serial.print(SensorArray[0]); 41 | Serial.print(" SensorArray[1] = ");Serial.print(SensorArray[1]); 42 | Serial.print(" SensorArray[2] = ");Serial.print(SensorArray[2]); 43 | Serial.print(" SensorArray[3] = ");Serial.print(SensorArray[3]); 44 | Serial.println(); 45 | #endif 46 | } -------------------------------------------------------------------------------- /Unit/ULTRA/Arduino/ULTRA/ULTRA.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | TFT_eSprite Terminalbuff = TFT_eSprite(&M5.Lcd); 4 | 5 | void setup() { 6 | // put your setup code here, to run once: 7 | M5.begin(); 8 | 9 | Wire.begin(21,22); 10 | 11 | Terminalbuff.createSprite(160, 80); 12 | Terminalbuff.fillRect(80,20,160,80,BLACK); 13 | 14 | Terminalbuff.pushSprite(80,20); 15 | Terminalbuff.setTextFont(4); 16 | M5.Lcd.setCursor(105, 0, 4); 17 | 18 | M5.Lcd.print("Ultrasonic"); 19 | } 20 | 21 | float readEUS() 22 | { 23 | uint32_t data; 24 | Wire.beginTransmission(0x57); 25 | Wire.write(0x01); 26 | Wire.endTransmission(); 27 | delay(120); 28 | Wire.requestFrom(0x57,3); 29 | data = Wire.read();data <<= 8; 30 | data |= Wire.read();data <<= 8; 31 | data |= Wire.read(); 32 | return float(data) / 1000; 33 | 34 | } 35 | 36 | void loop() { 37 | 38 | float newvalue = 0; 39 | 40 | while(1) 41 | { 42 | newvalue = readEUS(); 43 | 44 | Terminalbuff.fillRect(80,20,160,80,BLACK); 45 | Terminalbuff.setCursor(30,50); 46 | 47 | if(( newvalue < 1500 )&&( newvalue > 20 )) 48 | { 49 | Terminalbuff.printf("%.2fmm",newvalue); 50 | Terminalbuff.pushSprite(80,20); 51 | } 52 | delay(100); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /Unit/UNIT_CAM/CAM2CORE/CAM2CORE.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include "uart_frame.h" 3 | 4 | 5 | typedef struct _JpegFrame_t { 6 | uint8_t *buf; 7 | uint32_t size; 8 | } JpegFrame_t; 9 | 10 | 11 | static QueueHandle_t jpeg_fream_queue = NULL; 12 | 13 | void frame_recv_callback(int cmd, const uint8_t*buf, int len) { 14 | JpegFrame_t frame; 15 | frame.buf = (uint8_t *)malloc(sizeof(uint8_t) * len); 16 | memcpy(frame.buf, buf, len); 17 | frame.size = len; 18 | 19 | if (xQueueSend(jpeg_fream_queue, &frame, 0) != pdTRUE) { 20 | free(frame.buf); 21 | } 22 | } 23 | 24 | // the setup routine runs once when M5Stack starts up 25 | void setup(){ 26 | // Initialize the M5Stack object 27 | M5.begin(true, false, false, false); 28 | Serial.begin(1500000); 29 | uart_frame_init(36, 26, 1500000); 30 | jpeg_fream_queue = xQueueCreate(2, sizeof(JpegFrame_t)); 31 | } 32 | 33 | // the loop routine runs over and over again forever 34 | 35 | void loop() { 36 | JpegFrame_t frame; 37 | int time_last = 0; 38 | time_last = millis(); 39 | xQueueReceive(jpeg_fream_queue, &frame, portMAX_DELAY); 40 | M5.Lcd.drawJpg(frame.buf, frame.size, 0, 0); 41 | Serial.printf("--%ld--size--%d--\r\n", millis() - time_last, frame.size); 42 | free(frame.buf); 43 | } 44 | -------------------------------------------------------------------------------- /Unit/UNIT_CAM/CAM2CORE/uart_frame.h: -------------------------------------------------------------------------------- 1 | #ifndef _UART_FRAME_H 2 | #define _UART_FRAME_H 3 | 4 | #include 5 | #include "freertos/FreeRTOS.h" 6 | #include "freertos/queue.h" 7 | 8 | typedef enum { 9 | IDLE = 0x00, 10 | WAIT_FINISH , 11 | FINISH, 12 | } frame_state_n; 13 | 14 | extern volatile frame_state_n frame_state; 15 | 16 | void uart_frame_init(int32_t rx, int32_t tx, int baud); 17 | void uart_frame_send(uint8_t cmd, const uint8_t* frame, uint32_t len, bool wait_finish); 18 | void uart_update_pin(int32_t rx, int32_t tx); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /Unit/VIBRATOR/Arduino/VIBRATOR/VIBRATOR.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | const int motor_pin = 21; 4 | int freq = 10000; 5 | int ledChannel = 0; 6 | int resolution = 10; 7 | void setup() { 8 | // put your setup code here, to run once: 9 | M5.begin(); 10 | M5.Lcd.setCursor(120, 110, 4); 11 | M5.Lcd.println("MOTOR"); 12 | ledcSetup(ledChannel, freq, resolution); 13 | ledcAttachPin(motor_pin, ledChannel); 14 | 15 | } 16 | // 0 - 1024 17 | void loop() { 18 | // put your main code here, to run repeatedly: 19 | ledcWrite(ledChannel, 512);//0° 20 | delay(1000); 21 | ledcWrite(ledChannel, 0);//90° 22 | delay(1000); 23 | //ledcWrite(ledChannel, 30);//180° 24 | //delay(1000); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /Unit/V_Meter_Unit/voltmeter/.vscode/arduino.json: -------------------------------------------------------------------------------- 1 | { 2 | "sketch": "voltmeter.ino", 3 | "board": "esp32:esp32:m5stack-core-esp32", 4 | "configuration": "FlashMode=dio,FlashFreq=80,PartitionScheme=default,UploadSpeed=921600,DebugLevel=none", 5 | "port": "/dev/ttyUSB0", 6 | "output": "build" 7 | } --------------------------------------------------------------------------------