├── .gitattributes ├── .gitignore ├── ESP8266ArduinoIDE ├── Blink │ └── Blink.ino ├── DS18B20_temperature_sensor │ └── DS18B20_temperature_sensor.ino ├── ESP8266_di │ └── ESP8266_di.ino └── WiFiWebServer │ └── WiFiWebServer.ino ├── ESP8266lua └── doorwindow │ ├── init.lua │ └── lua_easyiot_doorwindow.lua ├── Esp8266EasyIoT ├── Esp8266EasyIoT.cpp ├── Esp8266EasyIoT.h ├── Esp8266EasyIoTConfig.h ├── Esp8266EasyIoTMsg.cpp ├── Esp8266EasyIoTMsg.h └── examples │ ├── clear_eeprom │ └── clear_eeprom.ino │ ├── esp8266_dimmer │ └── esp8266_dimmer.ino │ ├── esp8266_irrigator1 │ └── esp8266_irrigator1.ino │ ├── esp8266_leak │ └── esp8266_leak.ino │ ├── esp8266_pressure │ └── esp8266_pressure.ino │ ├── esp8266_relay │ └── esp8266_relay.ino │ ├── esp8266_time │ └── esp8266_time.ino │ ├── esp8266_touch_screen_thermostat │ └── esp8266_touch_screen_thermostat.ino │ └── esp8266easyiot_temperature_humidity │ └── esp8266easyiot_temperature_humidity.ino ├── README.md ├── external_libraries ├── DHT │ ├── DHT.cpp │ ├── DHT.h │ ├── README.md │ ├── examples │ │ └── DHT_Test │ │ │ └── DHT_Test.pde │ ├── keywords.txt │ ├── license.txt │ └── readme.pdf ├── DS1302RTC │ ├── DS1302RTC.cpp │ ├── DS1302RTC.h │ ├── README.TXT │ ├── examples │ │ ├── DS1302_LCD │ │ │ └── DS1302_LCD.ino │ │ ├── DS1302_RAM_Demo │ │ │ └── DS1302_RAM_Demo.ino │ │ ├── DS1302_Serial │ │ │ └── DS1302_Serial.ino │ │ └── SetSerial │ │ │ └── SetSerial.ino │ └── keywords.txt ├── HTU21D_Humidity │ ├── HTU21D.cpp │ ├── HTU21D.h │ └── examples │ │ └── Humidity │ │ └── Humidity.ino ├── Irrigation │ ├── Irrigation.cpp │ └── Irrigation.h ├── MySensors │ ├── MyConfig.h │ ├── MyGateway.cpp │ ├── MyGateway.h │ ├── MyMQTT.cpp │ ├── MyMQTT.h │ ├── MyMessage.cpp │ ├── MyMessage.h │ ├── MySensor.cpp │ ├── MySensor.h │ ├── Version.h │ ├── examples │ │ ├── AirQualitySensor │ │ │ └── AirQualitySensor.ino │ │ ├── BatteryPoweredSensor │ │ │ └── BatteryPoweredSensor.ino │ │ ├── BinarySwitchSensor │ │ │ └── BinarySwitchSensor.ino │ │ ├── BinarySwitchSleepSensor │ │ │ └── BinarySwitchSleepSensor.ino │ │ ├── ClearEepromConfig │ │ │ └── ClearEepromConfig.ino │ │ ├── DallasTemperatureSensor │ │ │ └── DallasTemperatureSensor.ino │ │ ├── DimmableLEDActuator │ │ │ └── DimmableLEDActuator.ino │ │ ├── DistanceSensor │ │ │ └── DistanceSensor.ino │ │ ├── DustSensor │ │ │ └── DustSensor.ino │ │ ├── EnergyMeterPulseSensor │ │ │ └── EnergyMeterPulseSensor.ino │ │ ├── EthernetGateway │ │ │ └── EthernetGateway.ino │ │ ├── HumiditySensor │ │ │ └── HumiditySensor.ino │ │ ├── IrSensor │ │ │ └── IrSensor.ino │ │ ├── LightLuxSensor │ │ │ └── LightLuxSensor.ino │ │ ├── LightSensor │ │ │ └── LightSensor.ino │ │ ├── MQTTGateway │ │ │ └── MQTTGateway.ino │ │ ├── MotionSensor │ │ │ └── MotionSensor.ino │ │ ├── PressureSensor │ │ │ └── PressureSensor.ino │ │ ├── RF433MhzSensor │ │ │ └── RF433MhzSensor.ino │ │ ├── RFIDLockSensor │ │ │ └── RFIDLockSensor.ino │ │ ├── RealTimeClockDisplaySensor │ │ │ └── RealTimeClockDisplaySensor.ino │ │ ├── RelayActuator │ │ │ └── RelayActuator.ino │ │ ├── RelayWithButtonActuator │ │ │ └── RelayWithButtonActuator.ino │ │ ├── RepeaterNode │ │ │ └── RepeaterNode.ino │ │ ├── SecretKnockSensor │ │ │ └── SecretKnockSensor.ino │ │ ├── SerialGateway │ │ │ └── SerialGateway.ino │ │ ├── ServoActuator │ │ │ └── ServoActuator.ino │ │ ├── SoilMoistSensor │ │ │ └── SoilMoistSensor.ino │ │ ├── TimeAwareSensor │ │ │ └── TimeAwareSensor.ino │ │ ├── TouchDisplaySceneControllerSensor │ │ │ ├── ArialNumFontPlus.c │ │ │ ├── TouchDisplaySceneControllerSensor.ino │ │ │ ├── Ubuntu.c │ │ │ ├── arial_bold.c │ │ │ └── logo.c │ │ ├── UVSensor │ │ │ └── UVSensor.ino │ │ └── WaterMeterPulseSensor │ │ │ └── WaterMeterPulseSensor.ino │ └── utility │ │ ├── LowPower.cpp │ │ ├── LowPower.h │ │ ├── MsTimer2.cpp │ │ ├── MsTimer2.h │ │ ├── PinChangeInt.h │ │ ├── RF24.cpp │ │ ├── RF24.h │ │ ├── RF24_config.h │ │ └── nRF24L01.h ├── SFE_BMP180 │ ├── SFE_BMP180.cpp │ ├── SFE_BMP180.h │ ├── examples │ │ ├── BMP180_altitude_example │ │ │ └── BMP180_altitude_example.ino │ │ └── SFE_BMP180_example │ │ │ └── SFE_BMP180_example.ino │ └── keywords.txt ├── Timezone │ ├── LICENSE.md │ ├── ReadMe.md │ ├── Timezone.cpp │ ├── Timezone.h │ ├── examples │ │ ├── Clock │ │ │ └── Clock.pde │ │ ├── HardwareRTC │ │ │ └── HardwareRTC.pde │ │ ├── WorldClock │ │ │ └── WorldClock.pde │ │ └── WriteRules │ │ │ └── WriteRules.pde │ └── keywords.txt ├── UTFT │ ├── ArialNumFontPlus.c │ ├── DefaultFonts.c │ ├── License - CC BY-NC-SA 3.0 - Legal.pdf │ ├── License - CC BY-NC-SA 3.0 - Summary.pdf │ ├── SevenSegNumFontPlus.c │ ├── SevenSeg_XXXL_Num.c │ ├── Tools │ │ ├── ImageConverter565.exe │ │ ├── ImgConv.exe │ │ ├── Online-tool - ImageConverter 565.url │ │ └── UTFT Image Converters.pdf │ ├── UTFT.cpp │ ├── UTFT.h │ ├── UTFT.pdf │ ├── UTFT_Requirements.pdf │ ├── UTFT_Supported_display_modules_&_controllers.pdf │ ├── arial_normal.c │ ├── examples │ │ ├── Arduino (ARM) + Teensy │ │ │ ├── UTFT_Bitmap │ │ │ │ ├── UTFT_Bitmap.ino │ │ │ │ ├── icon.c │ │ │ │ ├── info.c │ │ │ │ └── tux.c │ │ │ ├── UTFT_Bitmap_128x128 │ │ │ │ ├── UTFT_Bitmap_128x128.ino │ │ │ │ ├── icon1.c │ │ │ │ ├── icon2.c │ │ │ │ └── tux.c │ │ │ ├── UTFT_CPLD_PageSwitching │ │ │ │ └── UTFT_CPLD_PageSwitching.ino │ │ │ ├── UTFT_Demo_128x128_Serial │ │ │ │ └── UTFT_Demo_128x128_Serial.ino │ │ │ ├── UTFT_Demo_160x128_Serial │ │ │ │ └── UTFT_Demo_160x128_Serial.ino │ │ │ ├── UTFT_Demo_220x176 │ │ │ │ └── UTFT_Demo_220x176.ino │ │ │ ├── UTFT_Demo_220x176_Serial │ │ │ │ └── UTFT_Demo_220x176_Serial.ino │ │ │ ├── UTFT_Demo_320x240 │ │ │ │ └── UTFT_Demo_320x240.ino │ │ │ ├── UTFT_Demo_320x240_Serial │ │ │ │ └── UTFT_Demo_320x240_Serial.ino │ │ │ ├── UTFT_Demo_400x240 │ │ │ │ └── UTFT_Demo_400x240.ino │ │ │ ├── UTFT_Demo_480x272 │ │ │ │ └── UTFT_Demo_480x272.ino │ │ │ ├── UTFT_Demo_480x320 │ │ │ │ └── UTFT_Demo_480x320.ino │ │ │ ├── UTFT_Demo_800x480 │ │ │ │ └── UTFT_Demo_800x480.ino │ │ │ ├── UTFT_Rotate_Bitmap │ │ │ │ ├── UTFT_Rotate_Bitmap.ino │ │ │ │ └── biohazard.c │ │ │ ├── UTFT_Textrotation_Demo │ │ │ │ └── UTFT_Textrotation_Demo.ino │ │ │ └── UTFT_ViewFont │ │ │ │ └── UTFT_ViewFont.ino │ │ ├── Arduino (AVR) │ │ │ ├── UTFT_Bitmap │ │ │ │ ├── UTFT_Bitmap.ino │ │ │ │ ├── icon.c │ │ │ │ ├── info.c │ │ │ │ └── tux.c │ │ │ ├── UTFT_Bitmap_128x128 │ │ │ │ ├── UTFT_Bitmap_128x128.ino │ │ │ │ ├── icon1.c │ │ │ │ ├── icon2.c │ │ │ │ └── tux.c │ │ │ ├── UTFT_CPLD_PageSwitching │ │ │ │ └── UTFT_CPLD_PageSwitching.ino │ │ │ ├── UTFT_Demo_128x128_Serial │ │ │ │ └── UTFT_Demo_128x128_Serial.ino │ │ │ ├── UTFT_Demo_160x128_Serial │ │ │ │ └── UTFT_Demo_160x128_Serial.ino │ │ │ ├── UTFT_Demo_220x176 │ │ │ │ └── UTFT_Demo_220x176.ino │ │ │ ├── UTFT_Demo_220x176_Serial │ │ │ │ └── UTFT_Demo_220x176_Serial.ino │ │ │ ├── UTFT_Demo_320x240 │ │ │ │ └── UTFT_Demo_320x240.ino │ │ │ ├── UTFT_Demo_320x240_Serial │ │ │ │ └── UTFT_Demo_320x240_Serial.ino │ │ │ ├── UTFT_Demo_400x240 │ │ │ │ └── UTFT_Demo_400x240.ino │ │ │ ├── UTFT_Demo_480x272 │ │ │ │ └── UTFT_Demo_480x272.ino │ │ │ ├── UTFT_Demo_480x320 │ │ │ │ └── UTFT_Demo_480x320.ino │ │ │ ├── UTFT_Demo_800x480 │ │ │ │ └── UTFT_Demo_800x480.ino │ │ │ ├── UTFT_Leonardo_Demo_320x240 │ │ │ │ └── UTFT_Leonardo_Demo_320x240.ino │ │ │ ├── UTFT_Rotate_Bitmap │ │ │ │ ├── UTFT_Rotate_Bitmap.ino │ │ │ │ └── tux.c │ │ │ ├── UTFT_Textrotation_Demo │ │ │ │ └── UTFT_Textrotation_Demo.ino │ │ │ └── UTFT_ViewFont │ │ │ │ └── UTFT_ViewFont.ino │ │ └── chipKit │ │ │ ├── UTFT_Bitmap │ │ │ ├── UTFT_Bitmap.pde │ │ │ ├── icon.c │ │ │ ├── info.c │ │ │ └── tux.c │ │ │ ├── UTFT_Bitmap_128x128 │ │ │ ├── UTFT_Bitmap_128x128.pde │ │ │ ├── icon1.c │ │ │ ├── icon2.c │ │ │ └── tux.c │ │ │ ├── UTFT_Demo_128x128_Serial │ │ │ └── UTFT_Demo_128x128_Serial.pde │ │ │ ├── UTFT_Demo_160x128_Serial │ │ │ └── UTFT_Demo_160x128_Serial.pde │ │ │ ├── UTFT_Demo_220x176 │ │ │ └── UTFT_Demo_220x176.pde │ │ │ ├── UTFT_Demo_220x176_Serial │ │ │ └── UTFT_Demo_220x176_Serial.pde │ │ │ ├── UTFT_Demo_320x240 │ │ │ └── UTFT_Demo_320x240.pde │ │ │ ├── UTFT_Demo_320x240_Serial │ │ │ └── UTFT_Demo_320x240_Serial.pde │ │ │ ├── UTFT_Demo_400x240 │ │ │ └── UTFT_Demo_400x240.pde │ │ │ ├── UTFT_Demo_480x272 │ │ │ └── UTFT_Demo_480x272.pde │ │ │ ├── UTFT_Demo_480x320 │ │ │ └── UTFT_Demo_480x320.pde │ │ │ ├── UTFT_Demo_800x480 │ │ │ └── UTFT_Demo_800x480.pde │ │ │ ├── UTFT_Rotate_Bitmap │ │ │ ├── UTFT_Rotate_Bitmap.pde │ │ │ └── biohazard.c │ │ │ ├── UTFT_Textrotation_Demo │ │ │ └── UTFT_Textrotation_Demo.pde │ │ │ └── UTFT_ViewFont │ │ │ └── UTFT_ViewFont.pde │ ├── hardware │ │ ├── arm │ │ │ ├── HW_ARM.h │ │ │ ├── HW_ARM_defines.h │ │ │ ├── HW_MX20DX256.h │ │ │ └── HW_SAM3X8E.h │ │ ├── avr │ │ │ ├── HW_ATmega1280.h │ │ │ ├── HW_ATmega1284P.h │ │ │ ├── HW_ATmega328P.h │ │ │ ├── HW_ATmega32U4.h │ │ │ ├── HW_AVR.h │ │ │ └── HW_AVR_defines.h │ │ └── pic32 │ │ │ ├── HW_PIC32.h │ │ │ ├── HW_PIC32MX320F128H.h │ │ │ ├── HW_PIC32MX340F512H.h │ │ │ ├── HW_PIC32MX795F512L.h │ │ │ └── HW_PIC32_defines.h │ ├── keywords.txt │ ├── memorysaver.h │ ├── tft_drivers │ │ ├── cpld │ │ │ ├── initlcd.h │ │ │ └── setxy.h │ │ ├── hx8340b │ │ │ ├── 8 │ │ │ │ ├── initlcd.h │ │ │ │ └── setxy.h │ │ │ └── s │ │ │ │ ├── initlcd.h │ │ │ │ └── setxy.h │ │ ├── hx8347a │ │ │ ├── initlcd.h │ │ │ └── setxy.h │ │ ├── hx8352a │ │ │ ├── initlcd.h │ │ │ └── setxy.h │ │ ├── hx8353c │ │ │ ├── initlcd.h │ │ │ └── setxy.h │ │ ├── ili9320 │ │ │ ├── initlcd.h │ │ │ └── setxy.h │ │ ├── ili9325c │ │ │ ├── initlcd.h │ │ │ └── setxy.h │ │ ├── ili9325d │ │ │ ├── alt │ │ │ │ ├── initlcd.h │ │ │ │ └── setxy.h │ │ │ └── default │ │ │ │ ├── initlcd.h │ │ │ │ └── setxy.h │ │ ├── ili9327 │ │ │ ├── initlcd.h │ │ │ └── setxy.h │ │ ├── ili9341 │ │ │ ├── s4p │ │ │ │ ├── initlcd.h │ │ │ │ └── setxy.h │ │ │ └── s5p │ │ │ │ ├── initlcd.h │ │ │ │ └── setxy.h │ │ ├── ili9481 │ │ │ ├── initlcd.h │ │ │ └── setxy.h │ │ ├── ili9486 │ │ │ ├── initlcd.h │ │ │ └── setxy.h │ │ ├── pcf8833 │ │ │ ├── initlcd.h │ │ │ └── setxy.h │ │ ├── r61581 │ │ │ ├── initlcd.h │ │ │ └── setxy.h │ │ ├── s1d19122 │ │ │ ├── initlcd.h │ │ │ └── setxy.h │ │ ├── s6d0164 │ │ │ ├── initlcd.h │ │ │ └── setxy.h │ │ ├── s6d1121 │ │ │ ├── initlcd.h │ │ │ └── setxy.h │ │ ├── ssd1289 │ │ │ ├── initlcd.h │ │ │ └── setxy.h │ │ ├── ssd1963 │ │ │ ├── 480 │ │ │ │ ├── initlcd.h │ │ │ │ └── setxy.h │ │ │ ├── 800 │ │ │ │ ├── initlcd.h │ │ │ │ └── setxy.h │ │ │ └── 800alt │ │ │ │ ├── initlcd.h │ │ │ │ └── setxy.h │ │ ├── st7735 │ │ │ ├── initlcd.h │ │ │ └── setxy.h │ │ └── st7735s │ │ │ ├── initlcd.h │ │ │ └── setxy.h │ └── version.txt └── UTouch │ ├── License - CC BY-NC-SA 3.0 - Legal.pdf │ ├── License - CC BY-NC-SA 3.0 - Summary.pdf │ ├── UTouch.cpp │ ├── UTouch.h │ ├── UTouch.pdf │ ├── UTouchCD.h │ ├── UTouch_Supported_display_modules.pdf │ ├── examples │ ├── Arduino │ │ ├── UTouch_ButtonTest │ │ │ └── UTouch_ButtonTest.ino │ │ ├── UTouch_Calibration │ │ │ └── UTouch_Calibration.ino │ │ ├── UTouch_QuickDraw │ │ │ └── UTouch_QuickDraw.ino │ │ └── UTouch_QuickPaint │ │ │ └── UTouch_QuickPaint.ino │ └── chipKit │ │ ├── UTouch_ButtonTest │ │ └── UTouch_ButtonTest.pde │ │ ├── UTouch_Calibration │ │ └── UTouch_Calibration.pde │ │ ├── UTouch_QuickDraw │ │ └── UTouch_QuickDraw.pde │ │ └── UTouch_QuickPaint │ │ └── UTouch_QuickPaint.pde │ ├── hardware │ ├── arm │ │ ├── HW_ARM.inc │ │ └── HW_ARM_defines.h │ ├── avr │ │ ├── HW_AVR.inc │ │ └── HW_AVR_defines.h │ └── pic32 │ │ ├── HW_PIC32.inc │ │ └── HW_PIC32_defines.h │ ├── keywords.txt │ └── version.txt └── sensors └── NRF24L01 ├── balcony_irrigator └── balcony_irrigator.ino ├── clear_eeprom └── clear_eeprom.ino └── door_window_sensor └── door_window_sensor.ino /.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 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | 5 | # Folder config file 6 | Desktop.ini 7 | 8 | # Recycle Bin used on file shares 9 | $RECYCLE.BIN/ 10 | 11 | # Windows Installer files 12 | *.cab 13 | *.msi 14 | *.msm 15 | *.msp 16 | 17 | # ========================= 18 | # Operating System Files 19 | # ========================= 20 | 21 | # OSX 22 | # ========================= 23 | 24 | .DS_Store 25 | .AppleDouble 26 | .LSOverride 27 | 28 | # Icon must end with two \r 29 | Icon 30 | 31 | # Thumbnails 32 | ._* 33 | 34 | # Files that might appear on external disk 35 | .Spotlight-V100 36 | .Trashes 37 | 38 | # Directories potentially created on remote AFP share 39 | .AppleDB 40 | .AppleDesktop 41 | Network Trash Folder 42 | Temporary Items 43 | .apdisk 44 | -------------------------------------------------------------------------------- /ESP8266ArduinoIDE/Blink/Blink.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Blink 3 | Turns on an LED on for one second, then off for one second, repeatedly. 4 | 5 | Most Arduinos have an on-board LED you can control. On the Uno and 6 | Leonardo, it is attached to digital pin 13. If you're unsure what 7 | pin the on-board LED is connected to on your Arduino model, check 8 | the documentation at http://arduino.cc 9 | 10 | This example code is in the public domain. 11 | 12 | modified 8 May 2014 13 | by Scott Fitzgerald 14 | */ 15 | 16 | 17 | // the setup function runs once when you press reset or power the board 18 | void setup() { 19 | // initialize digital pin 13 as an output. 20 | pinMode(2, OUTPUT); 21 | } 22 | 23 | // the loop function runs over and over again forever 24 | void loop() { 25 | digitalWrite(2, HIGH); // turn the LED on (HIGH is the voltage level) 26 | delay(1000); // wait for a second 27 | digitalWrite(2, LOW); // turn the LED off by making the voltage LOW 28 | delay(1000); // wait for a second 29 | } 30 | -------------------------------------------------------------------------------- /ESP8266ArduinoIDE/ESP8266_di/ESP8266_di.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Created by Igor Jarc 3 | See http://iot-playground.com for details 4 | Please use community forum on website do not contact author directly 5 | 6 | External libraries: 7 | - https://github.com/adamvr/arduino-base64 8 | 9 | This program is free software; you can redistribute it and/or 10 | modify it under the terms of the GNU General Public License 11 | version 2 as published by the Free Software Foundation. 12 | */ 13 | #include 14 | #include 15 | 16 | //AP definitions 17 | #define AP_SSID "your AP SSID" 18 | #define AP_PASSWORD "your AP password" 19 | 20 | // EasyIoT server definitions 21 | #define EIOT_USERNAME "admin" 22 | #define EIOT_PASSWORD "test" 23 | #define EIOT_IP_ADDRESS "192.168.1.5" 24 | #define EIOT_PORT 80 25 | #define EIOT_NODE "N8S0" 26 | 27 | #define INPUT_PIN 2 28 | #define USER_PWD_LEN 40 29 | 30 | 31 | char unameenc[USER_PWD_LEN]; 32 | bool oldInputState; 33 | 34 | 35 | void setup() { 36 | Serial.begin(115200); 37 | pinMode(INPUT_PIN, INPUT); 38 | 39 | wifiConnect(); 40 | 41 | char uname[USER_PWD_LEN]; 42 | String str = String(EIOT_USERNAME)+":"+String(EIOT_PASSWORD); 43 | str.toCharArray(uname, USER_PWD_LEN); 44 | memset(unameenc,0,sizeof(unameenc)); 45 | base64_encode(unameenc, uname, strlen(uname)); 46 | 47 | oldInputState = !digitalRead(INPUT_PIN); 48 | } 49 | 50 | void loop() { 51 | int inputState = digitalRead(INPUT_PIN);; 52 | 53 | if (inputState != oldInputState) 54 | { 55 | sendInputState(inputState); 56 | oldInputState = inputState; 57 | } 58 | } 59 | 60 | void wifiConnect() 61 | { 62 | Serial.print("Connecting to AP"); 63 | WiFi.begin(AP_SSID, AP_PASSWORD); 64 | while (WiFi.status() != WL_CONNECTED) { 65 | delay(1000); 66 | Serial.print("."); 67 | } 68 | 69 | Serial.println(""); 70 | Serial.println("WiFi connected"); 71 | } 72 | 73 | void sendInputState(bool inputState) 74 | { 75 | WiFiClient client; 76 | 77 | while(!client.connect(EIOT_IP_ADDRESS, EIOT_PORT)) { 78 | Serial.println("connection failed"); 79 | wifiConnect(); 80 | } 81 | 82 | String url = ""; 83 | String command = ""; 84 | 85 | if (inputState) 86 | command = "ControlOn"; 87 | else 88 | command = "ControlOff"; 89 | 90 | url = "/Api/EasyIoT/Control/Module/Virtual/"+ String(EIOT_NODE) + "/"+command; // generate EasIoT server node URL 91 | 92 | Serial.print("POST data to URL: "); 93 | Serial.println(url); 94 | 95 | client.print(String("POST ") + url + " HTTP/1.1\r\n" + 96 | "Host: " + String(EIOT_IP_ADDRESS) + "\r\n" + 97 | "Connection: close\r\n" + 98 | "Authorization: Basic " + unameenc + " \r\n" + 99 | "Content-Length: 0\r\n" + 100 | "\r\n"); 101 | 102 | delay(100); 103 | while(client.available()){ 104 | String line = client.readStringUntil('\r'); 105 | Serial.print(line); 106 | } 107 | 108 | Serial.println(); 109 | Serial.println("Connection closed"); 110 | } 111 | 112 | -------------------------------------------------------------------------------- /ESP8266ArduinoIDE/WiFiWebServer/WiFiWebServer.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * This sketch demonstrates how to set up a simple HTTP-like server. 3 | * The server will set a GPIO pin depending on the request 4 | * http://server_ip/gpio/0 will set the GPIO2 low, 5 | * http://server_ip/gpio/1 will set the GPIO2 high 6 | * server_ip is the IP address of the ESP8266 module, will be 7 | * printed to Serial when the module is connected. 8 | */ 9 | 10 | #include 11 | 12 | const char* ssid = "your-ssid"; 13 | const char* password = "your-password"; 14 | 15 | // Create an instance of the server 16 | // specify the port to listen on as an argument 17 | WiFiServer server(80); 18 | 19 | void setup() { 20 | Serial.begin(115200); 21 | delay(10); 22 | 23 | // prepare GPIO2 24 | pinMode(2, OUTPUT); 25 | digitalWrite(2, 0); 26 | 27 | // Connect to WiFi network 28 | Serial.println(); 29 | Serial.println(); 30 | Serial.print("Connecting to "); 31 | Serial.println(ssid); 32 | 33 | WiFi.begin(ssid, password); 34 | 35 | while (WiFi.status() != WL_CONNECTED) { 36 | delay(500); 37 | Serial.print("."); 38 | } 39 | Serial.println(""); 40 | Serial.println("WiFi connected"); 41 | 42 | // Start the server 43 | server.begin(); 44 | Serial.println("Server started"); 45 | 46 | // Print the IP address 47 | Serial.println(WiFi.localIP()); 48 | } 49 | 50 | void loop() { 51 | // Check if a client has connected 52 | WiFiClient client = server.available(); 53 | if (!client) { 54 | return; 55 | } 56 | 57 | // Wait until the client sends some data 58 | Serial.println("new client"); 59 | while(!client.available()){ 60 | delay(1); 61 | } 62 | 63 | // Read the first line of the request 64 | String req = client.readStringUntil('\r'); 65 | Serial.println(req); 66 | client.flush(); 67 | 68 | // Match the request 69 | int val; 70 | if (req.indexOf("/gpio/0") != -1) 71 | val = 0; 72 | else if (req.indexOf("/gpio/1") != -1) 73 | val = 1; 74 | else { 75 | Serial.println("invalid request"); 76 | client.stop(); 77 | return; 78 | } 79 | 80 | // Set GPIO2 according to the request 81 | digitalWrite(2, val); 82 | 83 | client.flush(); 84 | 85 | // Prepare the response 86 | String s = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n\r\n\r\nGPIO is now "; 87 | s += (val)?"high":"low"; 88 | s += "\n"; 89 | 90 | // Send the response to the client 91 | client.print(s); 92 | delay(1); 93 | Serial.println("Client disonnected"); 94 | 95 | // The client will actually be disconnected 96 | // when the function returns and 'client' object is detroyed 97 | } 98 | 99 | -------------------------------------------------------------------------------- /ESP8266lua/doorwindow/init.lua: -------------------------------------------------------------------------------- 1 | print(wifi.sta.getip()) 2 | wifi.setmode(wifi.STATION) 3 | wifi.sta.config("AP","password") 4 | tmr.alarm(1, 8000, 0, function() print(wifi.sta.getip()) dofile('lua_easyiot_doorwindow.lua') end ) 5 | -------------------------------------------------------------------------------- /ESP8266lua/doorwindow/lua_easyiot_doorwindow.lua: -------------------------------------------------------------------------------- 1 | -- see http://iot-playgroud.com for details 2 | 3 | easyiot_username = "admin" 4 | easyiot_password = "test" 5 | easyiot_server = "192.168.1.5" 6 | easyiot_node_address = "N9S0" 7 | 8 | -- character table string 9 | local b='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' 10 | 11 | 12 | delay = 0 13 | gpio.mode(4,gpio.INT,gpio.PULLUP) 14 | 15 | function sendStatus(status) 16 | 17 | command = 'ControlOff' 18 | if (status == 1) then 19 | command = 'ControlOn' 20 | end 21 | 22 | conn = nil 23 | conn=net.createConnection(net.TCP, 0) 24 | 25 | -- send status to sensor node 26 | 27 | conn:on("receive", function(conn, payload) 28 | success = true 29 | print(payload) 30 | end) 31 | 32 | -- when connected, request page (send parameters to a script) 33 | conn:on("connection", function(conn, payload) 34 | print('\nConnected') 35 | conn:send("POST /Api/EasyIoT/Control/Module/Virtual/"..easyiot_node_address.."/"..command.." HTTP/1.1\r\n" 36 | .."Host: "..easyiot_server.."\r\n" 37 | .."Content-Length: 0\r\n" 38 | .."Connection: keep-alive\r\n" 39 | .."Authorization: Basic "..credentals.."\r\n" 40 | .."Accept: */*\r\n" 41 | .."User-Agent: Mozilla/4.0 (compatible; esp8266 Lua; Windows NT 5.1)\r\n" 42 | .."\r\n") 43 | end) 44 | -- when disconnected, let it be known 45 | conn:on("disconnection", function(conn, payload) print('\nSend status') end) 46 | 47 | conn:connect(80,easyiot_server) 48 | end 49 | 50 | 51 | 52 | function changestatus(level) 53 | x = tmr.now() 54 | if x > delay then 55 | delay = tmr.now()+250000 56 | sendStatus(level) 57 | print(level) 58 | end 59 | end 60 | 61 | 62 | -- encoding basic authorization 63 | function enc(data) 64 | return ((data:gsub('.', function(x) 65 | local r,b='',x:byte() 66 | for i=8,1,-1 do r=r..(b%2^i-b%2^(i-1)>0 and '1' or '0') end 67 | return r; 68 | end)..'0000'):gsub('%d%d%d?%d?%d?%d?', function(x) 69 | if (#x < 6) then return '' end 70 | local c=0 71 | for i=1,6 do c=c+(x:sub(i,i)=='1' and 2^(6-i) or 0) end 72 | return b:sub(c+1,c+1) 73 | end)..({ '', '==', '=' })[#data%3+1]) 74 | end 75 | 76 | 77 | credentals = enc(easyiot_username..":"..easyiot_password) 78 | 79 | level1 = gpio.read(4) 80 | sendStatus(level1) 81 | 82 | gpio.trig(4, "both",changestatus) 83 | 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /Esp8266EasyIoT/Esp8266EasyIoTConfig.h: -------------------------------------------------------------------------------- 1 | #ifndef EasyIoTEspConfig_h 2 | #define EasyIoTEspConfig_h 3 | 4 | #define AP_SSID "xxx" //ACCESS POINT ID 5 | #define AP_PASSWORD "xxxx" //ACCES POINT password 6 | #define SERVER_IP "192.168.1.8" //EasyIoT server IP address 7 | //#define SERVER_IP "192.168.1.5" //EasyIoT server IP address 8 | #define SERVER_PORT "37602" //EasyIoT server port 9 | 10 | 11 | #define DEBUG 12 | 13 | #endif -------------------------------------------------------------------------------- /Esp8266EasyIoT/examples/clear_eeprom/clear_eeprom.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void setup() 4 | { 5 | for (int i=0;i<512;i++) { 6 | EEPROM.write(i, 0xff); 7 | } 8 | } 9 | 10 | void loop() 11 | { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Esp8266EasyIoT/examples/esp8266_dimmer/esp8266_dimmer.ino: -------------------------------------------------------------------------------- 1 | /* 2 | V1.0 - first version 3 | 4 | Created by Igor Jarc 5 | See http://iot-playground.com for details 6 | 7 | This program is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | version 2 as published by the Free Software Foundation. 10 | */ 11 | #include 12 | #include 13 | 14 | Esp8266EasyIoT esp; 15 | 16 | SoftwareSerial serialEsp(10, 11); 17 | 18 | 19 | 20 | #define PWM_OUT 13 // 21 | #define FADE_DELAY 10 22 | 23 | 24 | static int currLevel = 0; 25 | static int newLevel = 0; 26 | Esp8266EasyIoTMsg dimmerMsg(0, V_DIMMER); 27 | Esp8266EasyIoTMsg lightMsg(0, V_DIGITAL_VALUE); 28 | 29 | 30 | void setup() 31 | { 32 | serialEsp.begin(9600); 33 | 34 | //Serial1.begin(9600); // ESP 35 | Serial.begin(115200); 36 | 37 | Serial.println("EasyIoTEsp LED dimmer example init"); 38 | 39 | esp.begin(incomingMessage, 3, &serialEsp, &Serial); 40 | //esp.begin(incomingMessage, 12, &Serial1, &Serial); 41 | //esp.begin(incomingMessage, 3, &serialEsp); 42 | 43 | esp.present(0, S_DIMMER ); 44 | // request last dimmer value 45 | esp.request( 0, V_DIMMER ); 46 | } 47 | 48 | void loop() 49 | { 50 | if (esp.process()) 51 | { 52 | if (newLevel != currLevel) 53 | { 54 | int dir = ( newLevel - currLevel ) < 0 ? -1 : 1; 55 | currLevel += dir; 56 | analogWrite( PWM_OUT, (int)(currLevel / 100. * 255) ); 57 | 58 | if (newLevel == currLevel) 59 | { 60 | esp.send(lightMsg.set(newLevel > 0 ? 1 : 0)); 61 | esp.send( dimmerMsg.set(newLevel) ); 62 | } 63 | delay( FADE_DELAY ); 64 | } 65 | } 66 | } 67 | 68 | void incomingMessage(const Esp8266EasyIoTMsg &message) { 69 | Serial.println("New message"); 70 | if (message.type==V_DIGITAL_VALUE || message.type == V_DIMMER) { 71 | newLevel = message.getInt(); 72 | 73 | newLevel *= ( message.type == V_DIGITAL_VALUE ? 100 : 1 ); 74 | 75 | newLevel = min(100, newLevel); 76 | newLevel = max(0, newLevel); 77 | 78 | 79 | Serial.print("Old level:"); 80 | Serial.print(currLevel); 81 | Serial.print(", New level: "); 82 | Serial.println(newLevel); 83 | } 84 | } 85 | 86 | void fadeToLevel(int newLevel) 87 | { 88 | int dir = ( newLevel - currLevel ) < 0 ? -1 : 1; 89 | 90 | while ( currLevel != newLevel ) { 91 | currLevel += dir; 92 | analogWrite( PWM_OUT, (int)(currLevel / 100. * 255) ); 93 | delay( FADE_DELAY ); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /Esp8266EasyIoT/examples/esp8266_leak/esp8266_leak.ino: -------------------------------------------------------------------------------- 1 | /* 2 | V1.0 - first version 3 | 4 | Created by Igor Jarc 5 | See http://iot-playground.com for details 6 | 7 | This program is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | version 2 as published by the Free Software Foundation. 10 | */ 11 | #include 12 | #include 13 | 14 | Esp8266EasyIoT esp; 15 | 16 | SoftwareSerial serialEsp(10, 11); 17 | 18 | #define LEAK_PIN 2 // Arduino Digital I/O pin number 19 | #define CHILD_ID_LEAK 0 20 | 21 | Esp8266EasyIoTMsg msgLeak(CHILD_ID_LEAK, V_DIGITAL_VALUE); 22 | //Esp8266EasyIoTMsg msgHum(CHILD_ID_LEAK, V_LEAK); // supported in esp >= V1.1 lib 23 | 24 | int lastLeakValue = -1; 25 | 26 | void setup() 27 | { 28 | serialEsp.begin(9600); 29 | Serial.begin(115200); 30 | 31 | Serial.println("EasyIoTEsp init"); 32 | esp.begin(NULL, 3, &serialEsp, &Serial); 33 | 34 | pinMode(LEAK_PIN, INPUT); 35 | 36 | esp.present(CHILD_ID_LEAK, S_LEAK); 37 | } 38 | 39 | void loop() 40 | { 41 | esp.process(); 42 | 43 | // Read digital pin value 44 | int leakValue = digitalRead(LEAK_PIN); 45 | // send if changed 46 | if (leakValue != lastLeakValue) { 47 | Serial.println(leakValue); 48 | esp.send(msgLeak.set(leakValue==0?0:1)); 49 | lastLeakValue = leakValue; 50 | } 51 | } 52 | 53 | 54 | -------------------------------------------------------------------------------- /Esp8266EasyIoT/examples/esp8266_relay/esp8266_relay.ino: -------------------------------------------------------------------------------- 1 | /* 2 | V1.0 - first version 3 | V1.1 - adopt to new library 4 | 5 | Created by Igor Jarc 6 | See http://iot-playground.com for details 7 | 8 | This program is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU General Public License 10 | version 2 as published by the Free Software Foundation. 11 | */ 12 | #include 13 | #include 14 | 15 | Esp8266EasyIoT esp; 16 | 17 | SoftwareSerial serialEsp(10, 11); 18 | 19 | 20 | 21 | #define RELAY_1 13 // Arduino Digital I/O pin number for first relay (second on pin+1 etc) 22 | #define RELAY_ON 1 // GPIO value to write to turn on attached relay 23 | #define RELAY_OFF 0 // GPIO value to write to turn off attached relay 24 | 25 | 26 | void setup() 27 | { 28 | serialEsp.begin(9600); 29 | Serial.begin(115200); 30 | 31 | Serial.println("EasyIoTEsp init"); 32 | 33 | esp.begin(incomingMessage, 3, &serialEsp, &Serial); 34 | //esp.begin(incomingMessage, 3, &serialEsp); 35 | 36 | pinMode(RELAY_1, OUTPUT); 37 | 38 | esp.present(1, S_DIGITAL_OUTPUT); 39 | } 40 | 41 | void loop() 42 | { 43 | esp.process(); 44 | } 45 | 46 | void incomingMessage(const Esp8266EasyIoTMsg &message) { 47 | // We only expect one type of message from controller. But we better check anyway. 48 | 49 | Serial.println("New message"); 50 | if (message.type==V_DIGITAL_VALUE) { 51 | // Change relay state 52 | digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF); 53 | 54 | Serial.print("Incoming change for sensor:"); 55 | Serial.print(message.sensor); 56 | Serial.print(", New status: "); 57 | Serial.println(message.getBool()); 58 | } 59 | } -------------------------------------------------------------------------------- /Esp8266EasyIoT/examples/esp8266easyiot_temperature_humidity/esp8266easyiot_temperature_humidity.ino: -------------------------------------------------------------------------------- 1 | /* 2 | V2.0 - small fix 3 | 4 | Created by Igor Jarc 5 | See http://iot-playground.com for details 6 | 7 | This program is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | version 2 as published by the Free Software Foundation. 10 | */ 11 | #include 12 | #include 13 | #include 14 | 15 | #define CHILD_ID_HUM 0 16 | #define CHILD_ID_TEMP 1 17 | #define HUMIDITY_SENSOR_DIGITAL_PIN 2 18 | 19 | 20 | #define SEND_INTERVAL 1000 * 30 // 30S 21 | 22 | 23 | Esp8266EasyIoT esp; 24 | 25 | SoftwareSerial serialEsp(10, 11); 26 | 27 | 28 | DHT dht; 29 | float lastTemp; 30 | float lastHum; 31 | 32 | Esp8266EasyIoTMsg msgHum(CHILD_ID_HUM, V_HUM); 33 | Esp8266EasyIoTMsg msgTemp(CHILD_ID_TEMP, V_TEMP); 34 | 35 | unsigned long startTime; 36 | 37 | void setup() 38 | { 39 | serialEsp.begin(9600); 40 | Serial.begin(115200); 41 | 42 | Serial.println("EasyIoTEsp init"); 43 | 44 | esp.begin(NULL, 3, &serialEsp, &Serial); 45 | //esp.begin(NULL, &serialEsp); 46 | dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); 47 | 48 | pinMode(13, OUTPUT); 49 | 50 | // Serial.println("present S_HUM"); 51 | esp.present(CHILD_ID_HUM, S_HUM); 52 | 53 | // Serial.println("present S_TEMP"); 54 | esp.present(CHILD_ID_TEMP, S_TEMP); 55 | 56 | 57 | startTime = millis()+SEND_INTERVAL; 58 | 59 | } 60 | 61 | void loop() 62 | { 63 | while(!esp.process()); 64 | 65 | if (IsTimeout()) 66 | { 67 | startTime = millis(); 68 | 69 | float temperature = dht.getTemperature(); 70 | if (isnan(temperature)) { 71 | Serial.println("Failed reading temperature from DHT"); 72 | } 73 | else if (temperature != lastTemp) 74 | { 75 | lastTemp = temperature; 76 | esp.send(msgTemp.set(temperature, 1)); 77 | Serial.print("T: "); 78 | Serial.println(temperature); 79 | } 80 | 81 | while(!esp.process()); 82 | 83 | float humidity = dht.getHumidity(); 84 | if (isnan(humidity)) { 85 | Serial.println("Failed reading humidity from DHT"); 86 | } 87 | else if (humidity != lastHum) 88 | { 89 | lastHum = humidity; 90 | esp.send(msgHum.set(humidity, 1)); 91 | Serial.print("H: "); 92 | Serial.println(humidity); 93 | } 94 | } 95 | } 96 | 97 | boolean IsTimeout() 98 | { 99 | unsigned long now = millis(); 100 | if (startTime <= now) 101 | { 102 | if ( (unsigned long)(now - startTime ) < SEND_INTERVAL ) 103 | return false; 104 | } 105 | else 106 | { 107 | if ( (unsigned long)(startTime - now) < SEND_INTERVAL ) 108 | return false; 109 | } 110 | 111 | return true; 112 | } 113 | 114 | 115 | 116 | 117 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ESP8266 EasyIoT library 2 | ======= 3 | See http://iot-playground.com/ for details 4 | 5 | IMPORTANT: use correct firmware version together with EasyIoTESP8266 Arduino library. 6 | Use ESP8266 firmware version 0.952. You can download fw on this link: 7 | http://iot-playground.com/2-uncategorised/35-esp8266-firmware-flashing 8 | If you are usning SW serial, set baudrate to 9600 (default is 115200) with AT+CIOBAUD=9600 9 | 10 | 11 | 12 | NRF24L01+ Arduino low power sensors 13 | ======= 14 | See http://iot-playground.com/ for details 15 | 16 | nRF24L01 is a single chip radio transceiver for the world wide 2.4 - 2.5 GHz ISM 17 | band. The transceiver consists of a fully integrated frequency synthesizer, a power 18 | amplifier, a crystal oscillator, a demodulator, modulator and Enhanced ShockBurst™ 19 | protocol engine. Output power, frequency channels, and protocol setup are easily 20 | programmable through a SPI interface. Current consumption is very low, only 9.0mA 21 | at an output power of -6dBm and 12.3mA in RX mode. Built-in Power Down and 22 | Standby modes makes power saving easily realizable. 23 | 24 | Minimum supply voltage 1.9 V 25 | 26 | Maximum output power 0 dBm 27 | 28 | Maximum data rate 2000 kbps 29 | 30 | Supply current in TX mode @ 0dBm output power 11.3 mA 31 | 32 | Supply current in RX mode @ 2000 kbps 12.3 mA 33 | 34 | Temperature range -40 to +85 °C 35 | 36 | Sensitivity @ 1000 kbps -85 dBm 37 | 38 | Supply current in Power Down mode 900 nA 39 | -------------------------------------------------------------------------------- /external_libraries/DHT/DHT.h: -------------------------------------------------------------------------------- 1 | /****************************************************************** 2 | DHT Temperature & Humidity Sensor library for Arduino. 3 | 4 | Features: 5 | - Support for DHT11 and DHT22/AM2302/RHT03 6 | - Auto detect sensor model 7 | - Very low memory footprint 8 | - Very small code 9 | 10 | http://www.github.com/markruys/arduino-DHT 11 | 12 | Written by Mark Ruys, mark@paracas.nl. 13 | 14 | BSD license, check license.txt for more information. 15 | All text above must be included in any redistribution. 16 | 17 | Datasheets: 18 | - http://www.micro4you.com/files/sensor/DHT11.pdf 19 | - http://www.adafruit.com/datasheets/DHT22.pdf 20 | - http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Sensors/Weather/RHT03.pdf 21 | - http://meteobox.tk/files/AM2302.pdf 22 | 23 | Changelog: 24 | 2013-06-10: Initial version 25 | 2013-06-12: Refactored code 26 | 2013-07-01: Add a resetTimer method 27 | ******************************************************************/ 28 | 29 | #ifndef dht_h 30 | #define dht_h 31 | 32 | #if ARDUINO < 100 33 | #include 34 | #else 35 | #include 36 | #endif 37 | 38 | class DHT 39 | { 40 | public: 41 | 42 | typedef enum { 43 | AUTO_DETECT, 44 | DHT11, 45 | DHT22, 46 | AM2302, // Packaged DHT22 47 | RHT03 // Equivalent to DHT22 48 | } 49 | DHT_MODEL_t; 50 | 51 | typedef enum { 52 | ERROR_NONE = 0, 53 | ERROR_TIMEOUT, 54 | ERROR_CHECKSUM 55 | } 56 | DHT_ERROR_t; 57 | 58 | void setup(uint8_t pin, DHT_MODEL_t model=AUTO_DETECT); 59 | void resetTimer(); 60 | 61 | float getTemperature(); 62 | float getHumidity(); 63 | 64 | DHT_ERROR_t getStatus() { return error; }; 65 | const char* getStatusString(); 66 | 67 | DHT_MODEL_t getModel() { return model; } 68 | 69 | int getMinimumSamplingPeriod() { return model == DHT11 ? 1000 : 2000; } 70 | 71 | int8_t getNumberOfDecimalsTemperature() { return model == DHT11 ? 0 : 1; }; 72 | int8_t getLowerBoundTemperature() { return model == DHT11 ? 0 : -40; }; 73 | int8_t getUpperBoundTemperature() { return model == DHT11 ? 50 : 125; }; 74 | 75 | int8_t getNumberOfDecimalsHumidity() { return 0; }; 76 | int8_t getLowerBoundHumidity() { return model == DHT11 ? 20 : 0; }; 77 | int8_t getUpperBoundHumidity() { return model == DHT11 ? 90 : 100; }; 78 | 79 | static float toFahrenheit(float fromCelcius) { return 1.8 * fromCelcius + 32.0; }; 80 | static float toCelsius(float fromFahrenheit) { return (fromFahrenheit - 32.0) / 1.8; }; 81 | 82 | protected: 83 | void readSensor(); 84 | 85 | float temperature; 86 | float humidity; 87 | 88 | uint8_t pin; 89 | 90 | private: 91 | DHT_MODEL_t model; 92 | DHT_ERROR_t error; 93 | unsigned long lastReadTime; 94 | }; 95 | 96 | #endif /*dht_h*/ 97 | -------------------------------------------------------------------------------- /external_libraries/DHT/README.md: -------------------------------------------------------------------------------- 1 | DHT 2 | === 3 | 4 | An Arduino library for reading the DHT family of temperature and humidity sensors. 5 | 6 | Written by Mark Ruys, . 7 | 8 | Features 9 | -------- 10 | - Support for DHT11 and DHT22, AM2302, RHT03 11 | - Auto detect sensor model 12 | - Low memory footprint 13 | - Very small code 14 | 15 | Usage 16 | ----- 17 | 18 | ``` 19 | #include "DHT.h" 20 | 21 | DHT dht; 22 | 23 | void setup() 24 | { 25 | Serial.begin(9600); 26 | 27 | dht.setup(2); // data pin 2 28 | } 29 | 30 | void loop() 31 | { 32 | delay(dht.getMinimumSamplingPeriod()); 33 | 34 | Serial.print(dht.getHumidity()); 35 | Serial.print("\t"); 36 | Serial.print(dht.getTemperature()); 37 | } 38 | ``` 39 | Also check out the [example] how to read out your sensor. For all the options, see [dht.h][header]. 40 | 41 | Installation 42 | ------------ 43 | 44 | Place the [DHT][download] library folder in your `/libraries/` folder. You may need to create the `libraries` subfolder if its your first library. Restart the Arduino IDE. 45 | 46 | [download]: https://github.com/markruys/arduino-DHT/archive/master.zip "Download DHT library" 47 | [example]: https://github.com/markruys/arduino-DHT/blob/master/examples/DHT_Test/DHT_Test.pde "Show DHT example" 48 | [header]: https://github.com/markruys/arduino-DHT/blob/master/DHT.h "Show header file" 49 | 50 | -------------------------------------------------------------------------------- /external_libraries/DHT/examples/DHT_Test/DHT_Test.pde: -------------------------------------------------------------------------------- 1 | #include "DHT.h" 2 | 3 | DHT dht; 4 | 5 | void setup() 6 | { 7 | Serial.begin(9600); 8 | Serial.println(); 9 | Serial.println("Status\tHumidity (%)\tTemperature (C)\t(F)"); 10 | 11 | dht.setup(2); // data pin 2 12 | } 13 | 14 | void loop() 15 | { 16 | delay(dht.getMinimumSamplingPeriod()); 17 | 18 | float humidity = dht.getHumidity(); 19 | float temperature = dht.getTemperature(); 20 | 21 | Serial.print(dht.getStatusString()); 22 | Serial.print("\t"); 23 | Serial.print(humidity, 1); 24 | Serial.print("\t\t"); 25 | Serial.print(temperature, 1); 26 | Serial.print("\t\t"); 27 | Serial.println(dht.toFahrenheit(temperature), 1); 28 | } 29 | 30 | -------------------------------------------------------------------------------- /external_libraries/DHT/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For DHT 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | DHT KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | setup KEYWORD2 16 | getTemperature KEYWORD2 17 | getHumidity KEYWORD2 18 | getStatus KEYWORD2 19 | getStatusString KEYWORD2 20 | getModel KEYWORD2 21 | getMinimumSamplingPeriod KEYWORD2 22 | toFahrenheit KEYWORD2 23 | toCelsius KEYWORD2 24 | 25 | ####################################### 26 | # Instances (KEYWORD2) 27 | ####################################### 28 | 29 | 30 | ####################################### 31 | # Constants (LITERAL1) 32 | ####################################### 33 | 34 | AUTO_DETECT LITERAL1 35 | DHT11 LITERAL1 36 | DHT22 LITERAL1 37 | AM2302 LITERAL1 38 | RHT03 LITERAL1 39 | 40 | ERROR_NONE LITERAL1 41 | ERROR_TIMEOUT LITERAL1 42 | ERROR_CHECKSUM LITERAL1 43 | -------------------------------------------------------------------------------- /external_libraries/DHT/license.txt: -------------------------------------------------------------------------------- 1 | Software License Agreement (BSD License) 2 | 3 | Copyright (c) 2013, Mark Ruys. All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | * Neither the name of the University of California, Berkeley nor the 14 | names of its contributors may be used to endorse or promote products 15 | derived from this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND ANY 18 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY 21 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /external_libraries/DHT/readme.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iot-playground/Arduino/bb29a5877258654a7afd3a210fe13fa2d9efde17/external_libraries/DHT/readme.pdf -------------------------------------------------------------------------------- /external_libraries/DS1302RTC/examples/DS1302_Serial/DS1302_Serial.ino: -------------------------------------------------------------------------------- 1 | // DS1302_Serial_Easy (C)2010 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // Adopted for DS1302RTC library by Timur Maksimov 2014 5 | // 6 | // A quick demo of how to use my DS1302-library to 7 | // quickly send time and date information over a serial link 8 | // 9 | // I assume you know how to connect the DS1302. 10 | // DS1302: CE pin -> Arduino Digital 27 11 | // I/O pin -> Arduino Digital 29 12 | // SCLK pin -> Arduino Digital 31 13 | // VCC pin -> Arduino Digital 33 14 | // GND pin -> Arduino Digital 35 15 | 16 | #include 17 | #include 18 | 19 | // Set pins: CE, IO,CLK 20 | DS1302RTC RTC(27, 29, 31); 21 | 22 | // Optional connection for RTC module 23 | #define DS1302_GND_PIN 33 24 | #define DS1302_VCC_PIN 35 25 | 26 | void setup() 27 | { 28 | 29 | // Setup Serial connection 30 | Serial.begin(9600); 31 | 32 | Serial.println("DS1302RTC Read Test"); 33 | Serial.println("-------------------"); 34 | 35 | // Activate RTC module 36 | digitalWrite(DS1302_GND_PIN, LOW); 37 | pinMode(DS1302_GND_PIN, OUTPUT); 38 | 39 | digitalWrite(DS1302_VCC_PIN, HIGH); 40 | pinMode(DS1302_VCC_PIN, OUTPUT); 41 | 42 | Serial.println("RTC module activated"); 43 | Serial.println(); 44 | delay(500); 45 | 46 | if (RTC.haltRTC()) { 47 | Serial.println("The DS1302 is stopped. Please run the SetTime"); 48 | Serial.println("example to initialize the time and begin running."); 49 | Serial.println(); 50 | } 51 | if (!RTC.writeEN()) { 52 | Serial.println("The DS1302 is write protected. This normal."); 53 | Serial.println(); 54 | } 55 | 56 | delay(5000); 57 | } 58 | 59 | void loop() 60 | { 61 | tmElements_t tm; 62 | 63 | Serial.print("UNIX Time: "); 64 | Serial.print(RTC.get()); 65 | 66 | if (! RTC.read(tm)) { 67 | Serial.print(" Time = "); 68 | print2digits(tm.Hour); 69 | Serial.write(':'); 70 | print2digits(tm.Minute); 71 | Serial.write(':'); 72 | print2digits(tm.Second); 73 | Serial.print(", Date (D/M/Y) = "); 74 | Serial.print(tm.Day); 75 | Serial.write('/'); 76 | Serial.print(tm.Month); 77 | Serial.write('/'); 78 | Serial.print(tmYearToCalendar(tm.Year)); 79 | Serial.print(", DoW = "); 80 | Serial.print(tm.Wday); 81 | Serial.println(); 82 | } else { 83 | Serial.println("DS1302 read error! Please check the circuitry."); 84 | Serial.println(); 85 | delay(9000); 86 | } 87 | 88 | // Wait one second before repeating :) 89 | delay (1000); 90 | } 91 | 92 | void print2digits(int number) { 93 | if (number >= 0 && number < 10) 94 | Serial.write('0'); 95 | Serial.print(number); 96 | } 97 | 98 | -------------------------------------------------------------------------------- /external_libraries/DS1302RTC/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For DS1302RTC 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | DS1302RTC KEYWORD1 9 | ####################################### 10 | # Methods and Functions (KEYWORD2) 11 | ####################################### 12 | get KEYWORD2 13 | set KEYWORD2 14 | read KEYWORD2 15 | write KEYWORD2 16 | 17 | readRTC KEYWORD2 18 | readRAM KEYWORD2 19 | writeRTC KEYWORD2 20 | writeRAM KEYWORD2 21 | 22 | haltRTC KEYWORD2 23 | writeEN KEYWORD2 24 | ####################################### 25 | # Instances (KEYWORD2) 26 | ####################################### 27 | RTC 28 | ####################################### 29 | # Constants (LITERAL1) 30 | ####################################### 31 | -------------------------------------------------------------------------------- /external_libraries/HTU21D_Humidity/HTU21D.h: -------------------------------------------------------------------------------- 1 | /* 2 | HTU21D Humidity Sensor Library 3 | By: Nathan Seidle 4 | SparkFun Electronics 5 | Date: September 22nd, 2013 6 | License: This code is public domain but you buy me a beer if you use this and we meet someday (Beerware license). 7 | 8 | Get humidity and temperature from the HTU21D sensor. 9 | 10 | */ 11 | 12 | 13 | #if defined(ARDUINO) && ARDUINO >= 100 14 | #include "Arduino.h" 15 | #else 16 | #include "WProgram.h" 17 | #endif 18 | 19 | #include 20 | 21 | #define HTDU21D_ADDRESS 0x40 //Unshifted 7-bit I2C address for the sensor 22 | 23 | #define TRIGGER_TEMP_MEASURE_HOLD 0xE3 24 | #define TRIGGER_HUMD_MEASURE_HOLD 0xE5 25 | #define TRIGGER_TEMP_MEASURE_NOHOLD 0xF3 26 | #define TRIGGER_HUMD_MEASURE_NOHOLD 0xF5 27 | #define WRITE_USER_REG 0xE6 28 | #define READ_USER_REG 0xE7 29 | #define SOFT_RESET 0xFE 30 | 31 | class HTU21D { 32 | 33 | public: 34 | HTU21D(); 35 | 36 | //Public Functions 37 | void begin(); 38 | float readHumidity(void); 39 | float readTemperature(void); 40 | void setResolution(byte resBits); 41 | 42 | //Public Variables 43 | 44 | private: 45 | //Private Functions 46 | 47 | byte read_user_register(void); 48 | byte check_crc(uint16_t message_from_sensor, uint8_t check_value_from_sensor); 49 | 50 | //Private Variables 51 | 52 | }; 53 | -------------------------------------------------------------------------------- /external_libraries/HTU21D_Humidity/examples/Humidity/Humidity.ino: -------------------------------------------------------------------------------- 1 | /* 2 | HTU21D Humidity Sensor Example Code 3 | By: Nathan Seidle 4 | SparkFun Electronics 5 | Date: September 15th, 2013 6 | License: This code is public domain but you buy me a beer if you use this and we meet someday (Beerware license). 7 | 8 | Uses the HTU21D library to display the current humidity and temperature 9 | 10 | Open serial monitor at 9600 baud to see readings. Errors 998 if not sensor is detected. Error 999 if CRC is bad. 11 | 12 | Hardware Connections (Breakoutboard to Arduino): 13 | -VCC = 3.3V 14 | -GND = GND 15 | -SDA = A4 (use inline 330 ohm resistor if your board is 5V) 16 | -SCL = A5 (use inline 330 ohm resistor if your board is 5V) 17 | 18 | */ 19 | 20 | #include 21 | #include "HTU21D.h" 22 | 23 | //Create an instance of the object 24 | HTU21D myHumidity; 25 | 26 | void setup() 27 | { 28 | Serial.begin(9600); 29 | Serial.println("HTU21D Example!"); 30 | 31 | myHumidity.begin(); 32 | } 33 | 34 | void loop() 35 | { 36 | float humd = myHumidity.readHumidity(); 37 | float temp = myHumidity.readTemperature(); 38 | 39 | Serial.print("Time:"); 40 | Serial.print(millis()); 41 | Serial.print(" Temperature:"); 42 | Serial.print(temp, 1); 43 | Serial.print("C"); 44 | Serial.print(" Humidity:"); 45 | Serial.print(humd, 1); 46 | Serial.print("%"); 47 | 48 | Serial.println(); 49 | delay(1000); 50 | } -------------------------------------------------------------------------------- /external_libraries/Irrigation/Irrigation.h: -------------------------------------------------------------------------------- 1 | /* 2 | V1.0 - first version 3 | 4 | Created by Igor Jarc 5 | See http://iot-playground.com for details 6 | Do not contact avtor dirrectly, use community forum on website. 7 | 8 | This program is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU General Public License 10 | version 2 as published by the Free Software Foundation. 11 | */ 12 | 13 | #ifndef Irrigation_h 14 | #define Irrigation_h 15 | 16 | 17 | #define MAX_IRRIGATORS 5 18 | 19 | 20 | #define MS_IN_SEC 1000 // 1S 21 | 22 | 23 | #define HUM_REPORT_DELAY 60 // S 24 | 25 | #define CHILD_ID_SWITCH_IRRIGATE 0 26 | #define CHILD_ID_AUTO_MODE 1 27 | #define CHILD_ID_SOIL_HUMIDITY 2 28 | #define CHILD_ID_SOIL_HUMIDITY_AO 3 29 | 30 | 31 | #define MAX_ANALOG_VAL 1023 32 | #define MIN_ANALOG_VAL 0 33 | #define IRRIGATION_TIME 15 // irrigation time in sec 34 | #define IRRIGATION_PAUSE_TIME 3600 // irrigation pause time in sec - only for auto irrigator 35 | 36 | 37 | 38 | 39 | // irrigator state 40 | typedef enum { 41 | s_idle = 0, // irrigation idle 42 | s_irrigation_start = 1, // start irrigation 43 | s_irrigation = 2, // irrigate 44 | s_irrigation_stop = 3, // irrigation stop 45 | } e_state; 46 | 47 | #ifdef __cplusplus 48 | class Irrigation 49 | { 50 | public: 51 | Irrigation(void); 52 | void begin(int (* aiReadCallback)(int), void (* humiditySetCallback)(int, int), void (* motorSetCallback)(int, bool)); 53 | void process(); 54 | void setAutoMode(int i, bool enable); 55 | void setIrrigate(int i, bool enable); 56 | void setSoilHumidityTreshold(int i, int treshold); 57 | int getIrrigatorsCount(); 58 | 59 | private: 60 | void processsingle(int i); 61 | bool IsTimeout(int i); 62 | int mapAiToPercent(int in); 63 | int (*_aiReadCallback)(int); 64 | void (* _motorSetCallback)(int, bool); 65 | void (* _humiditySetCallback)(int, int); 66 | 67 | 68 | e_state state[MAX_IRRIGATORS]; // state 69 | bool pumpMotor[MAX_IRRIGATORS]; // motor state 70 | unsigned long startTime[MAX_IRRIGATORS]; // 71 | int soilHum[MAX_IRRIGATORS]; // 72 | bool autoMode[MAX_IRRIGATORS]; 73 | int irrigatorCounter[MAX_IRRIGATORS]; 74 | int soilHumidityTreshold[MAX_IRRIGATORS]; 75 | int lastAnalogReading[MAX_IRRIGATORS]; 76 | int humReportCnt[MAX_IRRIGATORS]; 77 | 78 | }; 79 | 80 | #endif 81 | #endif -------------------------------------------------------------------------------- /external_libraries/MySensors/MyConfig.h: -------------------------------------------------------------------------------- 1 | #ifndef MyConfig_h 2 | #define MyConfig_h 3 | 4 | /*** 5 | * Configure Sensor Network 6 | */ 7 | //#define RF24_CHANNEL 90 //RF channel for the sensor net, 0-127 8 | #define RF24_DATARATE RF24_250KBPS //RF24_250KBPS for 250kbs, RF24_1MBPS for 1Mbps, or RF24_2MBPS for 2Mbps 9 | #define RF24_CHANNEL 95 //RF channel for the sensor net, 0-127 10 | #define RF24_PA_LEVEL RF24_PA_MAX //Sensor PA Level == RF24_PA_MIN=-18dBm, RF24_PA_LOW=-12dBm, RF24_PA_HIGH=-6dBM, and RF24_PA_MAX=0dBm 11 | #define RF24_PA_LEVEL_GW RF24_PA_LOW //Gateway PA Level, defaults to Sensor net PA Level. Tune here if using an amplified nRF2401+ in your gateway. 12 | #define BASE_RADIO_ID ((uint64_t)0xA8A8E1FC00LL) // This is also act as base value for sensor nodeId addresses. Change this (or channel) if you have more than one sensor network. 13 | 14 | // MySensors online examples defaults 15 | #define DEFAULT_CE_PIN 9 16 | #define DEFAULT_CS_PIN 10 17 | 18 | 19 | /*** 20 | * Enable/Disable debug logging 21 | */ 22 | //#define DEBUG 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /external_libraries/MySensors/MyGateway.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MySensors library adds a new layer on top of the RF24 library. 3 | It handles radio network routing, relaying and ids. 4 | 5 | Created by Henrik Ekblad 6 | 7 | This program is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | version 2 as published by the Free Software Foundation. 10 | */ 11 | 12 | #ifndef MyGateway_h 13 | #define MyGateway_h 14 | 15 | #include "MySensor.h" 16 | 17 | #define MAX_RECEIVE_LENGTH 100 // Max buffersize needed for messages coming from controller 18 | #define MAX_SEND_LENGTH 120 // Max buffersize needed for messages destined for controller 19 | 20 | class MyGateway : public MySensor 21 | { 22 | public: 23 | /** 24 | * Constructor 25 | * 26 | * Creates a new instance of MyGateway class. 27 | * If you don't use status leds and/or inclusion mode button on your arduino gateway 28 | * you can disable this functionality by calling the 2 argument constructor. 29 | * 30 | * @param _cepin The pin attached to RF24 Chip Enable on the RF module (default 9) 31 | * @param _cspin The pin attached to RF24 Chip Select (defualt 10) 32 | * @param _inclusion_time Time of inclusion mode (in minutes, default 1) 33 | * @param _inclusion_pin Digital pin that triggers inclusion mode 34 | * @param _rx Digital pin for receive led 35 | * @param _tx Digital pin for transfer led 36 | * @param _er Digital pin for error led 37 | * 38 | */ 39 | MyGateway(uint8_t _cepin=DEFAULT_CE_PIN, uint8_t _cspin=DEFAULT_CS_PIN, uint8_t _inclusion_time = 1, uint8_t _inclusion_pin = 3, uint8_t _rx=6, uint8_t _tx=5, uint8_t _er=4); 40 | 41 | /* Use this and pass a function that should be called when you want to process commands that arrive from radio network */ 42 | void begin(rf24_pa_dbm_e paLevel=RF24_PA_LEVEL_GW, uint8_t channel=RF24_CHANNEL, rf24_datarate_e dataRate=RF24_DATARATE, void (*dataCallback)(char *)=NULL); 43 | 44 | void processRadioMessage(); 45 | void parseAndSend(char *inputString); 46 | 47 | private: 48 | char convBuf[MAX_PAYLOAD*2+1]; 49 | char serialBuffer[MAX_SEND_LENGTH]; // Buffer for building string when sending data to vera 50 | unsigned long inclusionStartTime; 51 | boolean useWriteCallback; 52 | void (*dataCallback)(char *); 53 | uint8_t pinInclusion; 54 | uint8_t inclusionTime; 55 | 56 | uint8_t h2i(char c); 57 | 58 | void serial(const char *fmt, ... ); 59 | void serial(MyMessage &msg); 60 | void checkButtonTriggeredInclusion(); 61 | void setInclusionMode(boolean newMode); 62 | void checkInclusionFinished(); 63 | void ledTimers(); 64 | void rxBlink(uint8_t cnt); 65 | void txBlink(uint8_t cnt); 66 | void errBlink(uint8_t cnt); 67 | }; 68 | 69 | void ledTimersInterrupt(); 70 | void startInclusionInterrupt(); 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /external_libraries/MySensors/MyMQTT.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MySensors library adds a new layer on top of the RF24 library. 3 | It handles radio network routing, relaying and ids. 4 | 5 | Created by Henrik Ekblad 6 | Modified by Daniel Wiegert 7 | This program is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | version 2 as published by the Free Software Foundation. 10 | */ 11 | 12 | #ifndef MyMQTT_h 13 | #define MyMQTT_h 14 | 15 | #include "MySensor.h" 16 | 17 | 18 | ////////////////////////////////////////////////////////////////// 19 | 20 | #ifdef DEBUG 21 | #define TCPDUMP // Dump TCP packages. 22 | #endif 23 | 24 | #define MQTT_FIRST_SENSORID 20 // If you want manually configured nodes below this value. 255 = Disable 25 | #define MQTT_LAST_SENSORID 254 // 254 is max! 255 reserved. 26 | #define MQTT_BROKER_PREFIX "MyMQTT" // First prefix in MQTT tree, keep short! 27 | #define MQTT_SEND_SUBSCRIPTION 1 // Send empty payload (request) to node upon MQTT client subscribe request. 28 | // NOTE above : Beware to check if there is any length on payload in your incommingMessage code: 29 | // Example: if (msg.type==V_LIGHT && strlen(msg.getString())>0) otherwise the code might do strange things. 30 | 31 | ////////////////////////////////////////////////////////////////// 32 | 33 | #define EEPROM_LATEST_NODE_ADDRESS ((uint8_t)EEPROM_LOCAL_CONFIG_ADDRESS) 34 | #define MQTT_MAX_PACKET_SIZE 100 35 | 36 | #define MQTTPROTOCOLVERSION 3 37 | #define MQTTCONNECT 1 // Client request to connect to Server 38 | #define MQTTCONNACK 2 // Connect Acknowledgment 39 | #define MQTTPUBLISH 3 // Publish message 40 | #define MQTTPUBACK 4 // Publish Acknowledgment 41 | #define MQTTPUBREC 5 // Publish Received (assured delivery part 1) 42 | #define MQTTPUBREL 6 // Publish Release (assured delivery part 2) 43 | #define MQTTPUBCOMP 7 // Publish Complete (assured delivery part 3) 44 | #define MQTTSUBSCRIBE 8 // Client Subscribe request 45 | #define MQTTSUBACK 9 // Subscribe Acknowledgment 46 | #define MQTTUNSUBSCRIBE 10 // Client Unsubscribe request 47 | #define MQTTUNSUBACK 11 // Unsubscribe Acknowledgment 48 | #define MQTTPINGREQ 12 // PING Request 49 | #define MQTTPINGRESP 13 // PING Response 50 | #define MQTTDISCONNECT 14 // Client is Disconnecting 51 | #define MQTTReserved 15 // Reserved 52 | 53 | #define MQTTQOS0 (0 << 1) 54 | #define MQTTQOS1 (1 << 1) 55 | #define MQTTQOS2 (2 << 1) 56 | 57 | class MyMQTT : 58 | public MySensor { 59 | 60 | public: 61 | MyMQTT(uint8_t _cepin=5, uint8_t _cspin=6); 62 | void begin(rf24_pa_dbm_e paLevel=RF24_PA_LEVEL_GW, uint8_t channel=RF24_CHANNEL, rf24_datarate_e dataRate=RF24_DATARATE, void (*dataCallback) 63 | (const char *, uint8_t *)=NULL, uint8_t _rx=6, uint8_t _tx=5, uint8_t _er=4 ); 64 | void processRadioMessage(); 65 | void processMQTTMessage(char *inputString, uint8_t inputPos); 66 | private: 67 | void (*dataCallback)(const char *, uint8_t *); 68 | void SendMQTT(MyMessage &msg); 69 | void ledTimers(); 70 | void rxBlink(uint8_t cnt); 71 | void txBlink(uint8_t cnt); 72 | void errBlink(uint8_t cnt); 73 | 74 | bool MQTTClientConnected; 75 | char buffer[MQTT_MAX_PACKET_SIZE]; 76 | char convBuf[MAX_PAYLOAD*2+1]; 77 | uint8_t buffsize; 78 | char *getType(char *b, const char **index); 79 | }; 80 | 81 | extern void ledTimersInterrupt(); 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /external_libraries/MySensors/Version.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * This file defines the Sensor library version number 3 | * Normally, contributors should not modify this directly 4 | * as it is manaaged by the MySensors Bot. 5 | */ 6 | #ifndef Version_h 7 | #define Version_h 8 | 9 | #define LIBRARY_VERSION "1.4" 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /external_libraries/MySensors/examples/BatteryPoweredSensor/BatteryPoweredSensor.ino: -------------------------------------------------------------------------------- 1 | // This is an example that demonstrates how to report the battery level for a sensor 2 | // Instructions for measuring battery capacity on A0 are available in the follwoing forum 3 | // thread: http://forum.micasaverde.com/index.php/topic,20078.0.html 4 | 5 | #include 6 | #include 7 | 8 | int BATTERY_SENSE_PIN = A0; // select the input pin for the battery sense point 9 | 10 | MySensor gw; 11 | unsigned long SLEEP_TIME = 900000; // sleep time between reads (seconds * 1000 milliseconds) 12 | int oldBatteryPcnt = 0; 13 | 14 | void setup() 15 | { 16 | // use the 1.1 V internal reference 17 | analogReference(INTERNAL); 18 | gw.begin(); 19 | 20 | // Send the sketch version information to the gateway and Controller 21 | gw.sendSketchInfo("Battery Meter", "1.0"); 22 | } 23 | 24 | void loop() 25 | { 26 | // get the battery Voltage 27 | int sensorValue = analogRead(BATTERY_SENSE_PIN); 28 | Serial.println(sensorValue); 29 | 30 | // 1M, 470K divider across battery and using internal ADC ref of 1.1V 31 | // Sense point is bypassed with 0.1 uF cap to reduce noise at that point 32 | // ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts 33 | // 3.44/1023 = Volts per bit = 0.003363075 34 | float batteryV = sensorValue * 0.003363075; 35 | int batteryPcnt = sensorValue / 10; 36 | 37 | Serial.print("Battery Voltage: "); 38 | Serial.print(batteryV); 39 | Serial.println(" V"); 40 | 41 | Serial.print("Battery percent: "); 42 | Serial.print(batteryPcnt); 43 | Serial.println(" %"); 44 | 45 | if (oldBatteryPcnt != batteryPcnt) { 46 | // Power up radio after sleep 47 | gw.sendBatteryLevel(batteryPcnt); 48 | oldBatteryPcnt = batteryPcnt; 49 | } 50 | gw.sleep(SLEEP_TIME); 51 | } 52 | -------------------------------------------------------------------------------- /external_libraries/MySensors/examples/BinarySwitchSensor/BinarySwitchSensor.ino: -------------------------------------------------------------------------------- 1 | // Simple binary switch example 2 | // Connect button or door/window reed switch between 3 | // digitial I/O pin 3 (BUTTON_PIN below) and GND. 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #define CHILD_ID 3 10 | #define BUTTON_PIN 3 // Arduino Digital I/O pin for button/reed switch 11 | 12 | MySensor gw; 13 | Bounce debouncer = Bounce(); 14 | int oldValue=-1; 15 | 16 | // Change to V_LIGHT if you use S_LIGHT in presentation below 17 | MyMessage msg(CHILD_ID,V_TRIPPED); 18 | 19 | void setup() 20 | { 21 | gw.begin(); 22 | 23 | // Setup the button 24 | pinMode(BUTTON_PIN,INPUT); 25 | // Activate internal pull-up 26 | digitalWrite(BUTTON_PIN,HIGH); 27 | 28 | // After setting up the button, setup debouncer 29 | debouncer.attach(BUTTON_PIN); 30 | debouncer.interval(5); 31 | 32 | // Register binary input sensor to gw (they will be created as child devices) 33 | // You can use S_DOOR, S_MOTION or S_LIGHT here depending on your usage. 34 | // If S_LIGHT is used, remember to update variable type you send in. See "msg" above. 35 | gw.present(CHILD_ID, S_DOOR); 36 | } 37 | 38 | 39 | // Check if digital input has changed and send in new value 40 | void loop() 41 | { 42 | debouncer.update(); 43 | // Get the update value 44 | int value = debouncer.read(); 45 | 46 | if (value != oldValue) { 47 | // Send in the new value 48 | gw.send(msg.set(value==HIGH ? 1 : 0)); 49 | oldValue = value; 50 | } 51 | } 52 | 53 | -------------------------------------------------------------------------------- /external_libraries/MySensors/examples/BinarySwitchSleepSensor/BinarySwitchSleepSensor.ino: -------------------------------------------------------------------------------- 1 | // Interrupt driven binary switch example with dual interrupts 2 | // Author: Patrick 'Anticimex' Fallberg 3 | // Connect one button or door/window reed switch between 4 | // digitial I/O pin 3 (BUTTON_PIN below) and GND and the other 5 | // one in similar fashion on digital I/O pin 2. 6 | // This example is designed to fit Arduino Nano/Pro Mini 7 | 8 | #include 9 | #include 10 | 11 | #define SKETCH_NAME "Binary Sensor" 12 | #define SKETCH_MAJOR_VER "1" 13 | #define SKETCH_MINOR_VER "0" 14 | 15 | #define PRIMARY_CHILD_ID 3 16 | #define SECONDARY_CHILD_ID 4 17 | 18 | #define PRIMARY_BUTTON_PIN 2 // Arduino Digital I/O pin for button/reed switch 19 | #define SECONDARY_BUTTON_PIN 3 // Arduino Digital I/O pin for button/reed switch 20 | 21 | #if (PRIMARY_BUTTON_PIN < 2 || PRIMARY_BUTTON_PIN > 3) 22 | #error PRIMARY_BUTTON_PIN must be either 2 or 3 for interrupts to work 23 | #endif 24 | #if (SECONDARY_BUTTON_PIN < 2 || SECONDARY_BUTTON_PIN > 3) 25 | #error SECONDARY_BUTTON_PIN must be either 2 or 3 for interrupts to work 26 | #endif 27 | #if (PRIMARY_BUTTON_PIN == SECONDARY_BUTTON_PIN) 28 | #error PRIMARY_BUTTON_PIN and BUTTON_PIN2 cannot be the same 29 | #endif 30 | #if (PRIMARY_CHILD_ID == SECONDARY_CHILD_ID) 31 | #error PRIMARY_CHILD_ID and SECONDARY_CHILD_ID cannot be the same 32 | #endif 33 | 34 | MySensor sensor_node; 35 | 36 | // Change to V_LIGHT if you use S_LIGHT in presentation below 37 | MyMessage msg(PRIMARY_CHILD_ID, V_TRIPPED); 38 | MyMessage msg2(SECONDARY_CHILD_ID, V_TRIPPED); 39 | 40 | void setup() 41 | { 42 | sensor_node.begin(); 43 | 44 | // Setup the buttons 45 | pinMode(PRIMARY_BUTTON_PIN, INPUT); 46 | pinMode(SECONDARY_BUTTON_PIN, INPUT); 47 | 48 | // Activate internal pull-ups 49 | digitalWrite(PRIMARY_BUTTON_PIN, HIGH); 50 | digitalWrite(SECONDARY_BUTTON_PIN, HIGH); 51 | 52 | // Send the sketch version information to the gateway and Controller 53 | sensor_node.sendSketchInfo(SKETCH_NAME, SKETCH_MAJOR_VER"."SKETCH_MINOR_VER); 54 | 55 | // Register binary input sensor to sensor_node (they will be created as child devices) 56 | // You can use S_DOOR, S_MOTION or S_LIGHT here depending on your usage. 57 | // If S_LIGHT is used, remember to update variable type you send in. See "msg" above. 58 | sensor_node.present(PRIMARY_CHILD_ID, S_DOOR); 59 | sensor_node.present(SECONDARY_CHILD_ID, S_DOOR); 60 | } 61 | 62 | // Loop will iterate on changes on the BUTTON_PINs 63 | void loop() 64 | { 65 | uint8_t value; 66 | static uint8_t sentValue=2; 67 | static uint8_t sentValue2=2; 68 | 69 | // Short delay to allow buttons to properly settle 70 | sensor_node.sleep(5); 71 | 72 | value = digitalRead(PRIMARY_BUTTON_PIN); 73 | 74 | if (value != sentValue) { 75 | // Value has changed from last transmission, send the updated value 76 | sensor_node.send(msg.set(value==HIGH ? 1 : 0)); 77 | sentValue = value; 78 | } 79 | 80 | value = digitalRead(SECONDARY_BUTTON_PIN); 81 | 82 | if (value != sentValue2) { 83 | // Value has changed from last transmission, send the updated value 84 | sensor_node.send(msg2.set(value==HIGH ? 1 : 0)); 85 | sentValue2 = value; 86 | } 87 | 88 | // Sleep until something happens with the sensor 89 | sensor_node.sleep(PRIMARY_BUTTON_PIN-2, CHANGE, SECONDARY_BUTTON_PIN-2, CHANGE, 0); 90 | } 91 | -------------------------------------------------------------------------------- /external_libraries/MySensors/examples/ClearEepromConfig/ClearEepromConfig.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This sketch clears radioId, relayId and routing info in EEPROM 4 | * 5 | */ 6 | 7 | #include 8 | #include 9 | 10 | void setup() 11 | { 12 | for (int i=0;i<512;i++) { 13 | EEPROM.write(i, 0xff); 14 | } 15 | } 16 | 17 | void loop() 18 | { 19 | // Nothing to do here... 20 | } 21 | -------------------------------------------------------------------------------- /external_libraries/MySensors/examples/DallasTemperatureSensor/DallasTemperatureSensor.ino: -------------------------------------------------------------------------------- 1 | // Example sketch showing how to send in OneWire temperature readings 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected 8 | #define MAX_ATTACHED_DS18B20 16 9 | unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds) 10 | OneWire oneWire(ONE_WIRE_BUS); 11 | DallasTemperature sensors(&oneWire); 12 | MySensor gw; 13 | float lastTemperature[MAX_ATTACHED_DS18B20]; 14 | int numSensors=0; 15 | boolean receivedConfig = false; 16 | boolean metric = true; 17 | // Initialize temperature message 18 | MyMessage msg(0,V_TEMP); 19 | 20 | void setup() 21 | { 22 | // Startup OneWire 23 | sensors.begin(); 24 | 25 | // Startup and initialize MySensors library. Set callback for incoming messages. 26 | gw.begin(); 27 | 28 | // Send the sketch version information to the gateway and Controller 29 | gw.sendSketchInfo("Temperature Sensor", "1.0"); 30 | 31 | // Fetch the number of attached temperature sensors 32 | numSensors = sensors.getDeviceCount(); 33 | 34 | // Present all sensors to controller 35 | for (int i=0; i(static_cast((gw.getConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.; 54 | 55 | // Only send data if temperature has changed and no error 56 | if (lastTemperature[i] != temperature && temperature != -127.00) { 57 | 58 | // Send in the new temperature 59 | gw.send(msg.setSensor(i).set(temperature,1)); 60 | lastTemperature[i]=temperature; 61 | } 62 | } 63 | gw.sleep(SLEEP_TIME); 64 | } 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /external_libraries/MySensors/examples/DistanceSensor/DistanceSensor.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define CHILD_ID 1 6 | #define TRIGGER_PIN 6 // Arduino pin tied to trigger pin on the ultrasonic sensor. 7 | #define ECHO_PIN 5 // Arduino pin tied to echo pin on the ultrasonic sensor. 8 | #define MAX_DISTANCE 300 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm. 9 | unsigned long SLEEP_TIME = 5000; // Sleep time between reads (in milliseconds) 10 | 11 | MySensor gw; 12 | NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance. 13 | MyMessage msg(CHILD_ID, V_DISTANCE); 14 | int lastDist; 15 | boolean metric = true; 16 | 17 | void setup() 18 | { 19 | gw.begin(); 20 | 21 | // Send the sketch version information to the gateway and Controller 22 | gw.sendSketchInfo("Distance Sensor", "1.0"); 23 | 24 | // Register all sensors to gw (they will be created as child devices) 25 | gw.present(CHILD_ID, S_DISTANCE); 26 | boolean metric = gw.getConfig().isMetric; 27 | } 28 | 29 | void loop() 30 | { 31 | int dist = metric?sonar.ping_cm():sonar.ping_in(); 32 | Serial.print("Ping: "); 33 | Serial.print(dist); // Convert ping time to distance in cm and print result (0 = outside set distance range) 34 | Serial.println(metric?" cm":" in"); 35 | 36 | if (dist != lastDist) { 37 | gw.send(msg.set(dist)); 38 | lastDist = dist; 39 | } 40 | 41 | gw.sleep(SLEEP_TIME); 42 | } 43 | 44 | 45 | -------------------------------------------------------------------------------- /external_libraries/MySensors/examples/DustSensor/DustSensor.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Arduino Dust Sensort 3 | 4 | connect the sensor as follows : 5 | 6 | VCC >>> 5V 7 | A >>> A0 8 | GND >>> GND 9 | 10 | Based on: http://www.dfrobot.com/wiki/index.php/Sharp_GP2Y1010AU 11 | Authors: Cyrille Médard de Chardon (serialC), Christophe Trefois (Trefex) 12 | Contribution: epierre 13 | COnverted to 1.4 by Henrik Ekblad 14 | 15 | The dust sensor used (see purchase guide for latest link): 16 | http://rover.ebay.com/rover/1/711-53200-19255-0/1?icep_ff3=2&pub=5575069610&toolid=10001&campid=5337433187&customid=&icep_item=171259125886&ipn=psmain&icep_vectorid=229466&kwid=902099&mtid=824&kw=lg 17 | 18 | */ 19 | 20 | #include 21 | #include 22 | 23 | #define CHILD_ID_DUST 0 24 | #define DUST_SENSOR_ANALOG_PIN 1 25 | 26 | unsigned long SLEEP_TIME = 30*1000; // Sleep time between reads (in milliseconds) 27 | //VARIABLES 28 | int val = 0; // variable to store the value coming from the sensor 29 | float valDUST =0.0; 30 | float lastDUST =0.0; 31 | int samplingTime = 280; 32 | int deltaTime = 40; 33 | int sleepTime = 9680; 34 | float voMeasured = 0; 35 | float calcVoltage = 0; 36 | float dustDensity = 0; 37 | 38 | MySensor gw; 39 | MyMessage dustMsg(CHILD_ID_DUST, V_DUST_LEVEL); 40 | 41 | void setup() 42 | { 43 | gw.begin(); 44 | 45 | // Send the sketch version information to the gateway and Controller 46 | gw.sendSketchInfo("Dust Sensor", "1.1"); 47 | 48 | // Register all sensors to gateway (they will be created as child devices) 49 | gw.present(CHILD_ID_DUST, S_DUST); 50 | 51 | } 52 | 53 | void loop() 54 | { 55 | uint16_t voMeasured = analogRead(DUST_SENSOR_ANALOG_PIN);// Get DUST value 56 | 57 | // 0 - 5V mapped to 0 - 1023 integer values 58 | // recover voltage 59 | calcVoltage = voMeasured * (5.0 / 1024.0); 60 | 61 | // linear eqaution taken from http://www.howmuchsnow.com/arduino/airquality/ 62 | // Chris Nafis (c) 2012 63 | dustDensity = (0.17 * calcVoltage - 0.1)*1000; 64 | 65 | Serial.print("Raw Signal Value (0-1023): "); 66 | Serial.print(voMeasured); 67 | 68 | Serial.print(" - Voltage: "); 69 | Serial.print(calcVoltage); 70 | 71 | Serial.print(" - Dust Density: "); 72 | Serial.println(dustDensity); // unit: ug/m3 73 | 74 | if (ceil(dustDensity) != lastDUST) { 75 | gw.send(dustMsg.set((int)ceil(dustDensity))); 76 | lastDUST = ceil(dustDensity); 77 | } 78 | 79 | gw.sleep(SLEEP_TIME); 80 | } 81 | -------------------------------------------------------------------------------- /external_libraries/MySensors/examples/HumiditySensor/HumiditySensor.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define CHILD_ID_HUM 0 6 | #define CHILD_ID_TEMP 1 7 | #define HUMIDITY_SENSOR_DIGITAL_PIN 3 8 | unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds) 9 | 10 | MySensor gw; 11 | DHT dht; 12 | float lastTemp; 13 | float lastHum; 14 | boolean metric = true; 15 | MyMessage msgHum(CHILD_ID_HUM, V_HUM); 16 | MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP); 17 | 18 | 19 | void setup() 20 | { 21 | gw.begin(); 22 | dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); 23 | 24 | // Send the Sketch Version Information to the Gateway 25 | gw.sendSketchInfo("Humidity", "1.0"); 26 | 27 | // Register all sensors to gw (they will be created as child devices) 28 | gw.present(CHILD_ID_HUM, S_HUM); 29 | gw.present(CHILD_ID_TEMP, S_TEMP); 30 | 31 | metric = gw.getConfig().isMetric; 32 | } 33 | 34 | void loop() 35 | { 36 | delay(dht.getMinimumSamplingPeriod()); 37 | 38 | float temperature = dht.getTemperature(); 39 | if (isnan(temperature)) { 40 | Serial.println("Failed reading temperature from DHT"); 41 | } else if (temperature != lastTemp) { 42 | lastTemp = temperature; 43 | if (!metric) { 44 | temperature = dht.toFahrenheit(temperature); 45 | } 46 | gw.send(msgTemp.set(temperature, 1)); 47 | Serial.print("T: "); 48 | Serial.println(temperature); 49 | } 50 | 51 | float humidity = dht.getHumidity(); 52 | if (isnan(humidity)) { 53 | Serial.println("Failed reading humidity from DHT"); 54 | } else if (humidity != lastHum) { 55 | lastHum = humidity; 56 | gw.send(msgHum.set(humidity, 1)); 57 | Serial.print("H: "); 58 | Serial.println(humidity); 59 | } 60 | 61 | gw.sleep(SLEEP_TIME); //sleep a bit 62 | } 63 | 64 | 65 | -------------------------------------------------------------------------------- /external_libraries/MySensors/examples/LightLuxSensor/LightLuxSensor.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Vera Arduino BH1750FVI Light sensor 3 | communicate using I2C Protocol 4 | this library enable 2 slave device addresses 5 | Main address 0x23 6 | secondary address 0x5C 7 | connect the sensor as follows : 8 | 9 | VCC >>> 5V 10 | Gnd >>> Gnd 11 | ADDR >>> NC or GND 12 | SCL >>> A5 13 | SDA >>> A4 14 | 15 | Contribution: idefix 16 | 17 | */ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | #define CHILD_ID_LIGHT 0 25 | #define LIGHT_SENSOR_ANALOG_PIN 0 26 | unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds) 27 | 28 | BH1750 lightSensor; 29 | MySensor gw; 30 | MyMessage msg(CHILD_ID_LIGHT, V_LIGHT_LEVEL); 31 | uint16_t lastlux; 32 | 33 | void setup() 34 | { 35 | gw.begin(); 36 | 37 | // Send the sketch version information to the gateway and Controller 38 | gw.sendSketchInfo("Light Lux Sensor", "1.0"); 39 | 40 | // Register all sensors to gateway (they will be created as child devices) 41 | gw.present(CHILD_ID_LIGHT, S_LIGHT_LEVEL); 42 | 43 | lightSensor.begin(); 44 | } 45 | 46 | void loop() 47 | { 48 | uint16_t lux = lightSensor.readLightLevel();// Get Lux value 49 | Serial.println(lux); 50 | if (lux != lastlux) { 51 | gw.send(msg.set(lux)); 52 | lastlux = lux; 53 | } 54 | 55 | gw.sleep(SLEEP_TIME); 56 | } 57 | -------------------------------------------------------------------------------- /external_libraries/MySensors/examples/LightSensor/LightSensor.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #define CHILD_ID_LIGHT 0 5 | #define LIGHT_SENSOR_ANALOG_PIN 0 6 | 7 | unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds) 8 | 9 | MySensor gw; 10 | MyMessage msg(CHILD_ID_LIGHT, V_LIGHT_LEVEL); 11 | int lastLightLevel; 12 | 13 | void setup() 14 | { 15 | gw.begin(); 16 | 17 | // Send the sketch version information to the gateway and Controller 18 | gw.sendSketchInfo("Light Sensor", "1.0"); 19 | 20 | // Register all sensors to gateway (they will be created as child devices) 21 | gw.present(CHILD_ID_LIGHT, S_LIGHT_LEVEL); 22 | } 23 | 24 | void loop() 25 | { 26 | int lightLevel = (1023-analogRead(LIGHT_SENSOR_ANALOG_PIN))/10.23; 27 | Serial.println(lightLevel); 28 | if (lightLevel != lastLightLevel) { 29 | gw.send(msg.set(lightLevel)); 30 | lastLightLevel = lightLevel; 31 | } 32 | gw.sleep(SLEEP_TIME); 33 | } 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /external_libraries/MySensors/examples/MotionSensor/MotionSensor.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | unsigned long SLEEP_TIME = 120000; // Sleep time between reports (in milliseconds) 5 | #define DIGITAL_INPUT_SENSOR 3 // The digital input you attached your motion sensor. (Only 2 and 3 generates interrupt!) 6 | #define INTERRUPT DIGITAL_INPUT_SENSOR-2 // Usually the interrupt = pin -2 (on uno/nano anyway) 7 | #define CHILD_ID 1 // Id of the sensor child 8 | 9 | MySensor gw; 10 | // Initialize motion message 11 | MyMessage msg(CHILD_ID, V_TRIPPED); 12 | 13 | void setup() 14 | { 15 | gw.begin(); 16 | 17 | // Send the sketch version information to the gateway and Controller 18 | gw.sendSketchInfo("Motion Sensor", "1.0"); 19 | 20 | pinMode(DIGITAL_INPUT_SENSOR, INPUT); // sets the motion sensor digital pin as input 21 | // Register all sensors to gw (they will be created as child devices) 22 | gw.present(CHILD_ID, S_MOTION); 23 | 24 | } 25 | 26 | void loop() 27 | { 28 | // Read digital motion value 29 | boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; 30 | 31 | Serial.println(tripped); 32 | gw.send(msg.set(tripped?"1":"0")); // Send tripped value to gw 33 | 34 | // Sleep until interrupt comes in on motion sensor. Send update every two minute. 35 | gw.sleep(INTERRUPT,CHANGE, SLEEP_TIME); 36 | } 37 | 38 | 39 | -------------------------------------------------------------------------------- /external_libraries/MySensors/examples/RelayActuator/RelayActuator.ino: -------------------------------------------------------------------------------- 1 | // Example sketch showing how to control physical relays. 2 | // This example will remember relay state even after power failure. 3 | 4 | #include 5 | #include 6 | 7 | #define RELAY_1 3 // Arduino Digital I/O pin number for first relay (second on pin+1 etc) 8 | #define NUMBER_OF_RELAYS 1 // Total number of attached relays 9 | #define RELAY_ON 1 // GPIO value to write to turn on attached relay 10 | #define RELAY_OFF 0 // GPIO value to write to turn off attached relay 11 | 12 | MySensor gw; 13 | 14 | void setup() 15 | { 16 | // Initialize library and add callback for incoming messages 17 | gw.begin(incomingMessage, AUTO, true); 18 | // Send the sketch version information to the gateway and Controller 19 | gw.sendSketchInfo("Relay", "1.0"); 20 | 21 | // Fetch relay status 22 | for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS;sensor++, pin++) { 23 | // Register all sensors to gw (they will be created as child devices) 24 | gw.present(sensor, S_LIGHT); 25 | // Then set relay pins in output mode 26 | pinMode(pin, OUTPUT); 27 | // Set relay to last known state (using eeprom storage) 28 | digitalWrite(pin, gw.loadState(sensor)?RELAY_ON:RELAY_OFF); 29 | } 30 | } 31 | 32 | 33 | void loop() 34 | { 35 | // Alway process incoming messages whenever possible 36 | gw.process(); 37 | } 38 | 39 | void incomingMessage(const MyMessage &message) { 40 | // We only expect one type of message from controller. But we better check anyway. 41 | if (message.type==V_LIGHT) { 42 | // Change relay state 43 | digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF); 44 | // Store state in eeprom 45 | gw.saveState(message.sensor, message.getBool()); 46 | // Write some debug info 47 | Serial.print("Incoming change for sensor:"); 48 | Serial.print(message.sensor); 49 | Serial.print(", New status: "); 50 | Serial.println(message.getBool()); 51 | } 52 | } 53 | 54 | -------------------------------------------------------------------------------- /external_libraries/MySensors/examples/RelayWithButtonActuator/RelayWithButtonActuator.ino: -------------------------------------------------------------------------------- 1 | // Example sketch för a "light switch" where you can control light or something 2 | // else from both vera and a local physical button (connected between digital 3 | // pin 3 and GND). 4 | // This node also works as a repeader for other nodes 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #define RELAY_PIN 4 // Arduino Digital I/O pin number for relay 11 | #define BUTTON_PIN 3 // Arduino Digital I/O pin number for button 12 | #define CHILD_ID 1 // Id of the sensor child 13 | #define RELAY_ON 1 14 | #define RELAY_OFF 0 15 | 16 | Bounce debouncer = Bounce(); 17 | int oldValue=0; 18 | bool state; 19 | MySensor gw; 20 | MyMessage msg(CHILD_ID,V_LIGHT); 21 | 22 | void setup() 23 | { 24 | gw.begin(incomingMessage, AUTO, true); 25 | 26 | // Send the sketch version information to the gateway and Controller 27 | gw.sendSketchInfo("Relay & Button", "1.0"); 28 | 29 | // Setup the button 30 | pinMode(BUTTON_PIN,INPUT); 31 | // Activate internal pull-up 32 | digitalWrite(BUTTON_PIN,HIGH); 33 | 34 | // After setting up the button, setup debouncer 35 | debouncer.attach(BUTTON_PIN); 36 | debouncer.interval(5); 37 | 38 | // Register all sensors to gw (they will be created as child devices) 39 | gw.present(CHILD_ID, S_LIGHT); 40 | 41 | // Make sure relays are off when starting up 42 | digitalWrite(RELAY_PIN, RELAY_OFF); 43 | // Then set relay pins in output mode 44 | pinMode(RELAY_PIN, OUTPUT); 45 | 46 | // Set relay to last known state (using eeprom storage) 47 | state = gw.loadState(CHILD_ID); 48 | digitalWrite(RELAY_PIN, state?RELAY_ON:RELAY_OFF); 49 | } 50 | 51 | 52 | /* 53 | * Example on how to asynchronously check for new messages from gw 54 | */ 55 | void loop() 56 | { 57 | gw.process(); 58 | debouncer.update(); 59 | // Get the update value 60 | int value = debouncer.read(); 61 | if (value != oldValue && value==0) { 62 | gw.send(msg.set(state?false:true), true); // Send new state and request ack back 63 | } 64 | oldValue = value; 65 | } 66 | 67 | void incomingMessage(const MyMessage &message) { 68 | // We only expect one type of message from controller. But we better check anyway. 69 | if (message.isAck()) { 70 | Serial.println("This is an ack from gateway"); 71 | } 72 | 73 | if (message.type == V_LIGHT) { 74 | // Change relay state 75 | state = message.getBool(); 76 | digitalWrite(RELAY_PIN, state?RELAY_ON:RELAY_OFF); 77 | // Store state in eeprom 78 | gw.saveState(CHILD_ID, state); 79 | 80 | // Write some debug info 81 | Serial.print("Incoming change for sensor:"); 82 | Serial.print(message.sensor); 83 | Serial.print(", New status: "); 84 | Serial.println(message.getBool()); 85 | } 86 | } 87 | 88 | -------------------------------------------------------------------------------- /external_libraries/MySensors/examples/RepeaterNode/RepeaterNode.ino: -------------------------------------------------------------------------------- 1 | // Example sketch showing how to create a node thay repeates messages 2 | // from nodes far from gateway back to gateway. 3 | // It is important that nodes that has enabled repeater mode calls 4 | // gw.preocess() frequently. This node should never sleep. 5 | 6 | #include 7 | #include 8 | 9 | MySensor gw; 10 | 11 | void setup() 12 | { 13 | // The third argument enables repeater mode. 14 | gw.begin(NULL, AUTO, true); 15 | 16 | //Send the sensor node sketch version information to the gateway 17 | gw.sendSketchInfo("Repeater Node", "1.0"); 18 | } 19 | 20 | void loop() 21 | { 22 | // By calling process() you route messages in the background 23 | gw.process(); 24 | } 25 | 26 | -------------------------------------------------------------------------------- /external_libraries/MySensors/examples/SerialGateway/SerialGateway.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Henrik Ekblad 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * version 2 as published by the Free Software Foundation. 7 | * 8 | * DESCRIPTION 9 | * The ArduinoGateway prints data received from sensors on the serial link. 10 | * The gateway accepts input on seral which will be sent out on radio network. 11 | * 12 | * The GW code is designed for Arduino Nano 328p / 16MHz 13 | * 14 | * Wire connections (OPTIONAL): 15 | * - Inclusion button should be connected between digital pin 3 and GND 16 | * - RX/TX/ERR leds need to be connected between +5V (anode) and digital ping 6/5/4 with resistor 270-330R in a series 17 | * 18 | * LEDs (OPTIONAL): 19 | * - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved 20 | * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly 21 | * - ERR (red) - fast blink on error during transmission error or recieve crc error 22 | */ 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #define INCLUSION_MODE_TIME 1 // Number of minutes inclusion mode is enabled 30 | #define INCLUSION_MODE_PIN 3 // Digital pin used for inclusion mode button 31 | 32 | 33 | MyGateway gw(DEFAULT_CE_PIN, DEFAULT_CS_PIN, INCLUSION_MODE_TIME, INCLUSION_MODE_PIN, 6, 5, 4); 34 | 35 | char inputString[MAX_RECEIVE_LENGTH] = ""; // A string to hold incoming commands from serial/ethernet interface 36 | int inputPos = 0; 37 | boolean commandComplete = false; // whether the string is complete 38 | 39 | void setup() 40 | { 41 | gw.begin(); 42 | } 43 | 44 | void loop() 45 | { 46 | gw.processRadioMessage(); 47 | if (commandComplete) { 48 | // A command wass issued from serial interface 49 | // We will now try to send it to the actuator 50 | gw.parseAndSend(inputString); 51 | commandComplete = false; 52 | inputPos = 0; 53 | } 54 | } 55 | 56 | 57 | /* 58 | SerialEvent occurs whenever a new data comes in the 59 | hardware serial RX. This routine is run between each 60 | time loop() runs, so using delay inside loop can delay 61 | response. Multiple bytes of data may be available. 62 | */ 63 | void serialEvent() { 64 | while (Serial.available()) { 65 | // get the new byte: 66 | char inChar = (char)Serial.read(); 67 | // if the incoming character is a newline, set a flag 68 | // so the main loop can do something about it: 69 | if (inputPos 10 | #include 11 | #include 12 | 13 | #define SERVO_DIGITAL_OUT_PIN 3 14 | #define SERVO_MIN 0 // Fine tune your servos min. 0-180 15 | #define SERVO_MAX 180 // Fine tune your servos max. 0-180 16 | #define DETACH_DELAY 900 // Tune this to let your movement finish before detaching the servo 17 | #define CHILD_ID 10 // Id of the sensor child 18 | 19 | MySensor gw; 20 | MyMessage msg(CHILD_ID, V_DIMMER); 21 | Servo myservo; // create servo object to control a servo 22 | // a maximum of eight servo objects can be created Sensor gw(9,10); 23 | unsigned long timeOfLastChange = 0; 24 | bool attachedServo = false; 25 | 26 | void setup() 27 | { 28 | // Attach method for incoming messages 29 | gw.begin(incomingMessage); 30 | 31 | // Send the sketch version information to the gateway and Controller 32 | gw.sendSketchInfo("Servo", "1.0"); 33 | 34 | // Register all sensors to gw (they will be created as child devices) 35 | gw.present(CHILD_ID, S_COVER); 36 | 37 | // Request last servo state at startup 38 | gw.request(CHILD_ID, V_DIMMER); 39 | } 40 | 41 | void loop() 42 | { 43 | gw.process(); 44 | if (attachedServo && millis() - timeOfLastChange > DETACH_DELAY) { 45 | myservo.detach(); 46 | attachedServo = false; 47 | } 48 | } 49 | 50 | void incomingMessage(const MyMessage &message) { 51 | myservo.attach(SERVO_DIGITAL_OUT_PIN); 52 | attachedServo = true; 53 | if (message.type==V_DIMMER) { // This could be M_ACK_VARIABLE or M_SET_VARIABLE 54 | int val = message.getInt(); 55 | myservo.write(SERVO_MAX + (SERVO_MIN-SERVO_MAX)/100 * val); // sets the servo position 0-180 56 | // Write some debug info 57 | Serial.print("Servo changed. new state: "); 58 | Serial.println(val); 59 | } else if (message.type==V_UP) { 60 | Serial.println("Servo UP command"); 61 | myservo.write(SERVO_MIN); 62 | gw.send(msg.set(100)); 63 | } else if (message.type==V_DOWN) { 64 | Serial.println("Servo DOWN command"); 65 | myservo.write(SERVO_MAX); 66 | gw.send(msg.set(0)); 67 | } else if (message.type==V_STOP) { 68 | Serial.println("Servo STOP command"); 69 | myservo.detach(); 70 | attachedServo = false; 71 | 72 | } 73 | timeOfLastChange = millis(); 74 | } 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /external_libraries/MySensors/examples/SoilMoistSensor/SoilMoistSensor.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #define DIGITAL_INPUT_SOIL_SENSOR 3 // Digital input did you attach your soil sensor. 5 | #define INTERRUPT DIGITAL_INPUT_SOIL_SENSOR-2 // Usually the interrupt = pin -2 (on uno/nano anyway) 6 | #define CHILD_ID 0 // Id of the sensor child 7 | 8 | MySensor gw; 9 | MyMessage msg(CHILD_ID, V_TRIPPED); 10 | int lastSoilValue = -1; 11 | 12 | void setup() 13 | { 14 | gw.begin(); 15 | 16 | // Send the sketch version information to the gateway and Controller 17 | gw.sendSketchInfo("Soil Moisture Sensor", "1.0"); 18 | // sets the soil sensor digital pin as input 19 | pinMode(DIGITAL_INPUT_SOIL_SENSOR, INPUT); 20 | // Register all sensors to gw (they will be created as child devices) 21 | gw.present(CHILD_ID, S_MOTION); 22 | } 23 | 24 | void loop() 25 | { 26 | // Read digital soil value 27 | int soilValue = digitalRead(DIGITAL_INPUT_SOIL_SENSOR); // 1 = Not triggered, 0 = In soil with water 28 | if (soilValue != lastSoilValue) { 29 | Serial.println(soilValue); 30 | gw.send(msg.set(soilValue==0?1:0)); // Send the inverse to gw as tripped should be when no water in soil 31 | lastSoilValue = soilValue; 32 | } 33 | // Power down the radio and arduino until digital input changes. 34 | gw.sleep(INTERRUPT,CHANGE); 35 | } 36 | 37 | 38 | -------------------------------------------------------------------------------- /external_libraries/MySensors/examples/TimeAwareSensor/TimeAwareSensor.ino: -------------------------------------------------------------------------------- 1 | 2 | // Example sketch showing how to request time from controller. 3 | // Created by Henrik Ekblad 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | MySensor gw; 10 | boolean timeReceived = false; 11 | unsigned long lastUpdate=0, lastRequest=0; 12 | 13 | void setup() 14 | { 15 | gw.begin(); 16 | 17 | // Send the sketch version information to the gateway and Controller 18 | gw.sendSketchInfo("Clock", "1.0"); 19 | 20 | // Request time from controller. 21 | gw.requestTime(receiveTime); 22 | } 23 | 24 | // This is called when a new time value was received 25 | void receiveTime(unsigned long time) { 26 | // Ok, set incoming time 27 | setTime(time); 28 | timeReceived = true; 29 | } 30 | 31 | void loop() 32 | { 33 | unsigned long now = millis(); 34 | gw.process(); 35 | 36 | // If no time has been received yet, request it every 10 second from controller 37 | // When time has been received, request update every hour 38 | if ((!timeReceived && now-lastRequest > 10*1000) 39 | || (timeReceived && now-lastRequest > 60*1000*60)) { 40 | // Request time from controller. 41 | Serial.println("requesting time"); 42 | gw.requestTime(receiveTime); 43 | lastRequest = now; 44 | } 45 | 46 | // Print time every second 47 | if (timeReceived && now-lastUpdate > 1000) { 48 | Serial.print(hour()); 49 | printDigits(minute()); 50 | printDigits(second()); 51 | Serial.print(" "); 52 | Serial.print(day()); 53 | Serial.print(" "); 54 | Serial.print(month()); 55 | Serial.print(" "); 56 | Serial.print(year()); 57 | Serial.println(); 58 | lastUpdate = now; 59 | } 60 | } 61 | 62 | void printDigits(int digits){ 63 | // utility function for digital clock display: prints preceding colon and leading 0 64 | Serial.print(":"); 65 | if(digits < 10) 66 | Serial.print('0'); 67 | Serial.print(digits); 68 | } 69 | 70 | 71 | -------------------------------------------------------------------------------- /external_libraries/MySensors/examples/UVSensor/UVSensor.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Vera Arduino UVM-30A 3 | 4 | connect the sensor as follows : 5 | 6 | + >>> 5V 7 | - >>> GND 8 | out >>> A0 9 | 10 | Contribution: epierre, bulldoglowell 11 | Converted to 1.4 by Henrik Ekblad 12 | 13 | License: Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0) 14 | 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | #define CHILD_ID_UV 0 21 | #define UV_SENSOR_ANALOG_PIN 0 22 | unsigned long SLEEP_TIME = 30*1000; // Sleep time between reads (in milliseconds) 23 | 24 | MySensor gw; 25 | MyMessage uvMsg(CHILD_ID_UV, V_UV); 26 | int lastUV = -1; 27 | int uvIndexValue [13] = { 50, 227, 318, 408, 503, 606, 696, 795, 881, 976, 1079, 1170, 3000}; 28 | int uvIndex; 29 | 30 | void setup() 31 | { 32 | gw.begin(); 33 | 34 | // Send the sketch version information to the gateway and Controller 35 | gw.sendSketchInfo("UV Sensor", "1.1"); 36 | 37 | // Register all sensors to gateway (they will be created as child devices) 38 | gw.present(CHILD_ID_UV, S_UV); 39 | 40 | } 41 | 42 | void loop() 43 | { 44 | uint16_t uv = analogRead(0);// Get UV value 45 | Serial.print("Uv reading: "); 46 | Serial.println(uv); 47 | for (int i = 0; i < 13; i++) 48 | { 49 | if (uv <= uvIndexValue[i]) 50 | { 51 | uvIndex = i; 52 | break; 53 | } 54 | } 55 | Serial.print("Uv index: "); 56 | Serial.println(uvIndex); 57 | 58 | if (uvIndex != lastUV) { 59 | gw.send(uvMsg.set(uvIndex)); 60 | lastUV = uvIndex; 61 | } 62 | 63 | gw.sleep(SLEEP_TIME); 64 | } 65 | -------------------------------------------------------------------------------- /external_libraries/MySensors/utility/LowPower.h: -------------------------------------------------------------------------------- 1 | #ifndef LowPower_h 2 | #define LowPower_h 3 | 4 | enum period_t 5 | { 6 | SLEEP_15Ms, 7 | SLEEP_30MS, 8 | SLEEP_60MS, 9 | SLEEP_120MS, 10 | SLEEP_250MS, 11 | SLEEP_500MS, 12 | SLEEP_1S, 13 | SLEEP_2S, 14 | SLEEP_4S, 15 | SLEEP_8S, 16 | SLEEP_FOREVER 17 | }; 18 | 19 | enum bod_t 20 | { 21 | BOD_OFF, 22 | BOD_ON 23 | }; 24 | 25 | enum adc_t 26 | { 27 | ADC_OFF, 28 | ADC_ON 29 | }; 30 | 31 | enum timer5_t 32 | { 33 | TIMER5_OFF, 34 | TIMER5_ON 35 | }; 36 | 37 | enum timer4_t 38 | { 39 | TIMER4_OFF, 40 | TIMER4_ON 41 | }; 42 | 43 | enum timer3_t 44 | { 45 | TIMER3_OFF, 46 | TIMER3_ON 47 | }; 48 | 49 | enum timer2_t 50 | { 51 | TIMER2_OFF, 52 | TIMER2_ON 53 | }; 54 | 55 | enum timer1_t 56 | { 57 | TIMER1_OFF, 58 | TIMER1_ON 59 | }; 60 | 61 | enum timer0_t 62 | { 63 | TIMER0_OFF, 64 | TIMER0_ON 65 | }; 66 | 67 | enum spi_t 68 | { 69 | SPI_OFF, 70 | SPI_ON 71 | }; 72 | 73 | enum usart0_t 74 | { 75 | USART0_OFF, 76 | USART0_ON 77 | }; 78 | 79 | enum usart1_t 80 | { 81 | USART1_OFF, 82 | USART1_ON 83 | }; 84 | 85 | enum usart2_t 86 | { 87 | USART2_OFF, 88 | USART2_ON 89 | }; 90 | 91 | enum usart3_t 92 | { 93 | USART3_OFF, 94 | USART3_ON 95 | }; 96 | 97 | enum twi_t 98 | { 99 | TWI_OFF, 100 | TWI_ON 101 | }; 102 | 103 | enum usb_t 104 | { 105 | USB_OFF, 106 | USB_ON 107 | }; 108 | 109 | class LowPowerClass 110 | { 111 | public: 112 | #if defined (__AVR_ATmega328P__) || defined (__AVR_ATmega168__) 113 | void idle(period_t period, adc_t adc, timer2_t timer2, 114 | timer1_t timer1, timer0_t timer0, spi_t spi, 115 | usart0_t usart0, twi_t twi); 116 | #elif defined __AVR_ATmega2560__ 117 | void idle(period_t period, adc_t adc, timer5_t timer5, 118 | timer4_t timer4, timer3_t timer3, timer2_t timer2, 119 | timer1_t timer1, timer0_t timer0, spi_t spi, 120 | usart3_t usart3, usart2_t usart2, usart1_t usart1, 121 | usart0_t usart0, twi_t twi); 122 | #elif defined __AVR_ATmega32U4__ 123 | void idle(period_t period, adc_t adc, timer4_t timer4, timer3_t timer3, 124 | timer1_t timer1, timer0_t timer0, spi_t spi, 125 | usart1_t usart1, twi_t twi, usb_t usb); 126 | #else 127 | #error "Please ensure chosen MCU is either 328P, 32U4 or 2560." 128 | #endif 129 | void adcNoiseReduction(period_t period, adc_t adc, timer2_t timer2); 130 | void powerDown(period_t period, adc_t adc, bod_t bod); 131 | void powerSave(period_t period, adc_t adc, bod_t bod, timer2_t timer2); 132 | void powerStandby(period_t period, adc_t adc, bod_t bod); 133 | void powerExtStandby(period_t period, adc_t adc, bod_t bod, timer2_t timer2); 134 | }; 135 | 136 | extern LowPowerClass LowPower; 137 | #endif -------------------------------------------------------------------------------- /external_libraries/MySensors/utility/MsTimer2.h: -------------------------------------------------------------------------------- 1 | #ifndef MsTimer2_h 2 | #define MsTimer2_h 3 | 4 | #ifdef __AVR__ 5 | #include 6 | #else 7 | #error MsTimer2 library only works on AVR architecture 8 | #endif 9 | 10 | namespace MsTimer2 { 11 | extern unsigned long msecs; 12 | extern void (*func)(); 13 | extern volatile unsigned long count; 14 | extern volatile char overflowing; 15 | extern volatile unsigned int tcnt2; 16 | 17 | void set(unsigned long ms, void (*f)()); 18 | void start(); 19 | void stop(); 20 | void _overflow(); 21 | } 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /external_libraries/SFE_BMP180/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map for SFE_BMP180 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | SFE_BMP180 KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | begin KEYWORD2 16 | startTemperature KEYWORD2 17 | getTemperature KEYWORD2 18 | startPressure KEYWORD2 19 | getPressure KEYWORD2 20 | sealevel KEYWORD2 21 | altitude KEYWORD2 22 | 23 | ####################################### 24 | # Constants (LITERAL1) 25 | ####################################### 26 | 27 | BMP180_ADDR LITERAL1 -------------------------------------------------------------------------------- /external_libraries/Timezone/LICENSE.md: -------------------------------------------------------------------------------- 1 | #Arduino Timezone Library v1.0 2 | https://github.com/JChristensen/Timezone 3 | LICENSE file 4 | Jack Christensen Mar 2012 5 | 6 | ![CC BY-SA](http://mirrors.creativecommons.org/presskit/buttons/88x31/png/by-sa.png) 7 | ##CC BY-SA 8 | Arduino Timezone Library by Jack Christensen is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to: 9 | Creative Commons 10 | 444 Castro Street, Suite 900 11 | Mountain View, CA 94041 12 | -------------------------------------------------------------------------------- /external_libraries/Timezone/Timezone.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------* 2 | * Arduino Timezone Library v1.0 * 3 | * Jack Christensen Mar 2012 * 4 | * * 5 | * This work is licensed under the Creative Commons Attribution- * 6 | * ShareAlike 3.0 Unported License. To view a copy of this license, * 7 | * visit http://creativecommons.org/licenses/by-sa/3.0/ or send a * 8 | * letter to Creative Commons, 171 Second Street, Suite 300, * 9 | * San Francisco, California, 94105, USA. * 10 | *----------------------------------------------------------------------*/ 11 | 12 | #ifndef Timezone_h 13 | #define Timezone_h 14 | #if ARDUINO >= 100 15 | #include 16 | #else 17 | #include 18 | #endif 19 | #include //http://www.arduino.cc/playground/Code/Time 20 | 21 | //convenient constants for dstRules 22 | enum week_t {Last, First, Second, Third, Fourth}; 23 | enum dow_t {Sun=1, Mon, Tue, Wed, Thu, Fri, Sat}; 24 | enum month_t {Jan=1, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec}; 25 | 26 | //structure to describe rules for when daylight/summer time begins, 27 | //or when standard time begins. 28 | struct TimeChangeRule 29 | { 30 | char abbrev[6]; //five chars max 31 | uint8_t week; //First, Second, Third, Fourth, or Last week of the month 32 | uint8_t dow; //day of week, 1=Sun, 2=Mon, ... 7=Sat 33 | uint8_t month; //1=Jan, 2=Feb, ... 12=Dec 34 | uint8_t hour; //0-23 35 | int offset; //offset from UTC in minutes 36 | }; 37 | 38 | class Timezone 39 | { 40 | public: 41 | Timezone(TimeChangeRule dstStart, TimeChangeRule stdStart); 42 | Timezone(int address); 43 | time_t toLocal(time_t utc); 44 | time_t toLocal(time_t utc, TimeChangeRule **tcr); 45 | time_t toUTC(time_t local); 46 | boolean utcIsDST(time_t utc); 47 | boolean locIsDST(time_t local); 48 | void readRules(int address); 49 | void writeRules(int address); 50 | 51 | private: 52 | void calcTimeChanges(int yr); 53 | time_t toTime_t(TimeChangeRule r, int yr); 54 | TimeChangeRule _dst; //rule for start of dst or summer time for any year 55 | TimeChangeRule _std; //rule for start of standard time for any year 56 | time_t _dstUTC; //dst start for given/current year, given in UTC 57 | time_t _stdUTC; //std time start for given/current year, given in UTC 58 | time_t _dstLoc; //dst start for given/current year, given in local time 59 | time_t _stdLoc; //std time start for given/current year, given in local time 60 | }; 61 | #endif 62 | -------------------------------------------------------------------------------- /external_libraries/Timezone/examples/WriteRules/WriteRules.pde: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------* 2 | * Timezone library example sketch. * 3 | * Write TimeChangeRules to EEPROM. * 4 | * Jack Christensen Mar 2012 * 5 | * * 6 | * This work is licensed under the Creative Commons Attribution- * 7 | * ShareAlike 3.0 Unported License. To view a copy of this license, * 8 | * visit http://creativecommons.org/licenses/by-sa/3.0/ or send a * 9 | * letter to Creative Commons, 171 Second Street, Suite 300, * 10 | * San Francisco, California, 94105, USA. * 11 | *----------------------------------------------------------------------*/ 12 | 13 | #include //http://www.arduino.cc/playground/Code/Time 14 | #include //https://github.com/JChristensen/Timezone 15 | 16 | //US Eastern Time Zone (New York, Detroit) 17 | TimeChangeRule usEdt = {"EDT", Second, Sun, Mar, 2, -240}; //UTC - 4 hours 18 | TimeChangeRule usEst = {"EST", First, Sun, Nov, 2, -300}; //UTC - 5 hours 19 | Timezone usEastern(usEdt, usEst); 20 | 21 | void setup(void) 22 | { 23 | pinMode(13, OUTPUT); 24 | usEastern.writeRules(100); //write rules to EEPROM address 100 25 | } 26 | 27 | void loop(void) 28 | { 29 | //fast blink to indicate EEPROM write is complete 30 | digitalWrite(13, HIGH); 31 | delay(100); 32 | digitalWrite(13, LOW); 33 | delay(100); 34 | } 35 | -------------------------------------------------------------------------------- /external_libraries/Timezone/keywords.txt: -------------------------------------------------------------------------------- 1 | TimeChangeRule KEYWORD1 2 | Timezone KEYWORD1 3 | toLocal KEYWORD2 4 | toUTC KEYWORD2 5 | utcIsDST KEYWORD2 6 | locIsDST KEYWORD2 7 | readRules KEYWORD2 8 | writeRules KEYWORD2 -------------------------------------------------------------------------------- /external_libraries/UTFT/License - CC BY-NC-SA 3.0 - Legal.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iot-playground/Arduino/bb29a5877258654a7afd3a210fe13fa2d9efde17/external_libraries/UTFT/License - CC BY-NC-SA 3.0 - Legal.pdf -------------------------------------------------------------------------------- /external_libraries/UTFT/License - CC BY-NC-SA 3.0 - Summary.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iot-playground/Arduino/bb29a5877258654a7afd3a210fe13fa2d9efde17/external_libraries/UTFT/License - CC BY-NC-SA 3.0 - Summary.pdf -------------------------------------------------------------------------------- /external_libraries/UTFT/Tools/ImageConverter565.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iot-playground/Arduino/bb29a5877258654a7afd3a210fe13fa2d9efde17/external_libraries/UTFT/Tools/ImageConverter565.exe -------------------------------------------------------------------------------- /external_libraries/UTFT/Tools/ImgConv.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iot-playground/Arduino/bb29a5877258654a7afd3a210fe13fa2d9efde17/external_libraries/UTFT/Tools/ImgConv.exe -------------------------------------------------------------------------------- /external_libraries/UTFT/Tools/Online-tool - ImageConverter 565.url: -------------------------------------------------------------------------------- 1 | [InternetShortcut] 2 | URL=http://www.henningkarlsen.com/electronics/t_imageconverter565.php 3 | IDList= 4 | IconFile=http://www.henningkarlsen.com/favicon.ico 5 | IconIndex=1 6 | [{000214A0-0000-0000-C000-000000000046}] 7 | Prop3=19,2 8 | -------------------------------------------------------------------------------- /external_libraries/UTFT/Tools/UTFT Image Converters.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iot-playground/Arduino/bb29a5877258654a7afd3a210fe13fa2d9efde17/external_libraries/UTFT/Tools/UTFT Image Converters.pdf -------------------------------------------------------------------------------- /external_libraries/UTFT/UTFT.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iot-playground/Arduino/bb29a5877258654a7afd3a210fe13fa2d9efde17/external_libraries/UTFT/UTFT.pdf -------------------------------------------------------------------------------- /external_libraries/UTFT/UTFT_Requirements.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iot-playground/Arduino/bb29a5877258654a7afd3a210fe13fa2d9efde17/external_libraries/UTFT/UTFT_Requirements.pdf -------------------------------------------------------------------------------- /external_libraries/UTFT/UTFT_Supported_display_modules_&_controllers.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iot-playground/Arduino/bb29a5877258654a7afd3a210fe13fa2d9efde17/external_libraries/UTFT/UTFT_Supported_display_modules_&_controllers.pdf -------------------------------------------------------------------------------- /external_libraries/UTFT/examples/Arduino (ARM) + Teensy/UTFT_Bitmap/UTFT_Bitmap.ino: -------------------------------------------------------------------------------- 1 | // UTFT_Bitmap (C)2014 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of the drawBitmap()-function. 5 | // 6 | // This demo was made to work on the 320x240 modules. 7 | // Any other size displays may cause strange behaviour. 8 | // 9 | // This program requires the UTFT library. 10 | // 11 | 12 | #include 13 | 14 | // Declare which fonts we will be using 15 | extern uint8_t SmallFont[]; 16 | 17 | // Set the pins to the correct ones for your development shield 18 | // ------------------------------------------------------------ 19 | // Standard Arduino Mega/Due shield : ,38,39,40,41 20 | // CTE TFT LCD/SD Shield for Arduino Due : ,25,26,27,28 21 | // Teensy 3.x TFT Test Board : ,23,22, 3, 4 22 | // ElecHouse TFT LCD/SD Shield for Arduino Due : ,22,23,31,33 23 | // 24 | // Remember to change the model parameter to suit your display module! 25 | UTFT myGLCD(ITDB32S,38,39,40,41); 26 | 27 | extern unsigned short info[0x400]; 28 | extern unsigned short icon[0x400]; 29 | extern unsigned short tux[0x400]; 30 | 31 | void setup() 32 | { 33 | myGLCD.InitLCD(); 34 | myGLCD.setFont(SmallFont); 35 | } 36 | 37 | void loop() 38 | { 39 | myGLCD.fillScr(255, 255, 255); 40 | myGLCD.setColor(255, 255, 255); 41 | myGLCD.print(" *** A 10 by 7 grid of a 32x32 icon *** ", CENTER, 228); 42 | for (int x=0; x<10; x++) 43 | for (int y=0; y<7; y++) 44 | myGLCD.drawBitmap (x*32, y*32, 32, 32, info); 45 | 46 | delay(5000); 47 | 48 | myGLCD.fillScr(255, 255, 255); 49 | myGLCD.setColor(255, 255, 255); 50 | myGLCD.print(" Two different icons in scale 1 to 4 ", CENTER, 228); 51 | int x=0; 52 | for (int s=0; s<4; s++) 53 | { 54 | x+=(s*32); 55 | myGLCD.drawBitmap (x, 0, 32, 32, tux, s+1); 56 | } 57 | x=0; 58 | for (int s=4; s>0; s--) 59 | { 60 | myGLCD.drawBitmap (x, 224-(s*32), 32, 32, icon, s); 61 | x+=(s*32); 62 | } 63 | 64 | delay(5000); 65 | } 66 | 67 | -------------------------------------------------------------------------------- /external_libraries/UTFT/examples/Arduino (ARM) + Teensy/UTFT_Bitmap_128x128/UTFT_Bitmap_128x128.ino: -------------------------------------------------------------------------------- 1 | // UTFT_Bitmap_128x128 (C)2013 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of the drawBitmap()-function. 5 | // 6 | // This demo was made to work on the 128x128 modules. 7 | // Any other size displays may cause strange behaviour. 8 | // 9 | // This program requires the UTFT library. 10 | // 11 | 12 | #include 13 | 14 | UTFT myGLCD(LPH9135,6,5,2,3,4); // Remember to change the model parameter to suit your display module! 15 | 16 | extern unsigned short icon1[0x400]; 17 | extern unsigned short icon2[0x400]; 18 | extern unsigned short tux[0x1000]; 19 | 20 | void setup() 21 | { 22 | myGLCD.InitLCD(PORTRAIT); 23 | } 24 | 25 | void loop() 26 | { 27 | // Draw a 4 by 4 grid of a 32x32 icon. 28 | myGLCD.fillScr(255, 255, 255); 29 | for (int x=0; x<4; x++) 30 | for (int y=0; y<4; y++) 31 | myGLCD.drawBitmap (x*32, y*32, 32, 32, icon1); 32 | 33 | delay(5000); 34 | 35 | // Draw a 64x64 icon in double size. 36 | myGLCD.fillScr(255, 255, 255); 37 | myGLCD.drawBitmap (0, 0, 64, 64, tux, 2); 38 | 39 | delay(5000); 40 | 41 | // Draw a 2 by 2 grid of a 32x32 icon in double size. 42 | myGLCD.fillScr(255, 255, 255); 43 | for (int x=0; x<2; x++) 44 | for (int y=0; y<2; y++) 45 | myGLCD.drawBitmap (x*64, y*64, 32, 32, icon2, 2); 46 | 47 | delay(5000); 48 | } 49 | 50 | -------------------------------------------------------------------------------- /external_libraries/UTFT/examples/Arduino (ARM) + Teensy/UTFT_CPLD_PageSwitching/UTFT_CPLD_PageSwitching.ino: -------------------------------------------------------------------------------- 1 | // UTFT_CPLD_PageSwitching (C)2014 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of page switching on CPLD-based display modules.. 5 | // 6 | // This demo was made for modules with a screen resolution 7 | // of 800x480 pixels. 8 | // 9 | // This program requires the UTFT library. 10 | // 11 | // NOTE: The display will be black for a short while during the start 12 | // 13 | 14 | #include 15 | 16 | // Declare which fonts we will be using 17 | extern uint8_t BigFont[]; 18 | extern uint8_t SevenSegNumFont[]; 19 | 20 | // Set the pins to the correct ones for your development shield 21 | // ------------------------------------------------------------ 22 | // Standard Arduino Mega/Due shield : ,38,39,40,41 23 | // CTE TFT LCD/SD Shield for Arduino Due : ,25,26,27,28 24 | // Teensy 3.x TFT Test Board : ,23,22, 3, 4 25 | // ElecHouse TFT LCD/SD Shield for Arduino Due : ,22,23,31,33 26 | // 27 | // Remember to change the model parameter to suit your display module! 28 | UTFT myGLCD(EHOUSE50CPLD,22,23,31,33); 29 | 30 | void setup() 31 | { 32 | myGLCD.InitLCD(); 33 | } 34 | 35 | void loop() 36 | { 37 | myGLCD.setBackColor(VGA_TRANSPARENT); 38 | 39 | myGLCD.setBrightness(0); 40 | for (byte pg=0; pg<8; pg++) 41 | { 42 | myGLCD.setWritePage(pg); 43 | myGLCD.clrScr(); 44 | for (int ln=0; ln<480; ln+=2) 45 | { 46 | switch (pg) 47 | { 48 | case 0: 49 | myGLCD.setColor(ln/2, 0, 0); 50 | break; 51 | case 1: 52 | myGLCD.setColor(0, ln/2, 0); 53 | break; 54 | case 2: 55 | myGLCD.setColor(0, 0, ln/2); 56 | break; 57 | case 3: 58 | myGLCD.setColor(ln/4, ln/2, 0); 59 | break; 60 | case 4: 61 | myGLCD.setColor(0, ln/2, ln/2); 62 | break; 63 | case 5: 64 | myGLCD.setColor(ln/2, 0, ln/2); 65 | break; 66 | case 6: 67 | myGLCD.setColor(ln/2, ln/2, 0); 68 | break; 69 | case 7: 70 | myGLCD.setColor(0, ln/2, ln/4); 71 | break; 72 | } 73 | myGLCD.drawLine(0, ln, 799, ln); 74 | myGLCD.drawLine(0, ln+1, 799, ln+1); 75 | } 76 | myGLCD.setColor(VGA_WHITE); 77 | myGLCD.setFont(BigFont); 78 | myGLCD.print("This is page:", CENTER, 200); 79 | myGLCD.setFont(SevenSegNumFont); 80 | myGLCD.printNumI(pg, CENTER, 240); 81 | } 82 | myGLCD.setBrightness(16); 83 | 84 | while(1) 85 | { 86 | for (byte pg=0; pg<8; pg++) 87 | { 88 | myGLCD.setDisplayPage(pg); 89 | delay(500); 90 | } 91 | } 92 | } 93 | 94 | -------------------------------------------------------------------------------- /external_libraries/UTFT/examples/Arduino (ARM) + Teensy/UTFT_Rotate_Bitmap/UTFT_Rotate_Bitmap.ino: -------------------------------------------------------------------------------- 1 | // UTFT_Rotate_Bitmap (C)2014 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of the drawBitmap()-function. 5 | // 6 | // This program requires the UTFT library. 7 | // 8 | 9 | #include 10 | 11 | // Set the pins to the correct ones for your development shield 12 | // ------------------------------------------------------------ 13 | // Standard Arduino Mega/Due shield : ,38,39,40,41 14 | // CTE TFT LCD/SD Shield for Arduino Due : ,25,26,27,28 15 | // Teensy 3.x TFT Test Board : ,23,22, 3, 4 16 | // ElecHouse TFT LCD/SD Shield for Arduino Due : ,22,23,31,33 17 | // 18 | // Remember to change the model parameter to suit your display module! 19 | UTFT myGLCD(ITDB32S,38,39,40,41); 20 | 21 | extern unsigned short biohazard[0x1000]; 22 | 23 | void setup() 24 | { 25 | myGLCD.InitLCD(LANDSCAPE); 26 | myGLCD.fillScr(255, 255, 255); 27 | myGLCD.setColor(0, 0, 0); 28 | } 29 | 30 | void loop() 31 | { 32 | for (int i=0; i<360; i+=5) 33 | { 34 | myGLCD.drawBitmap (10, 10, 64, 64, biohazard, i, 32, 32); 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /external_libraries/UTFT/examples/Arduino (ARM) + Teensy/UTFT_Textrotation_Demo/UTFT_Textrotation_Demo.ino: -------------------------------------------------------------------------------- 1 | // UTFT_Textrotation_Demo (C)2014 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of the textrotation-functions. 5 | // 6 | // This demo was made for modules with a screen resolution 7 | // of 320x240 pixels. 8 | // 9 | // This program requires the UTFT library. 10 | // 11 | 12 | #include 13 | 14 | // Declare which fonts we will be using 15 | extern uint8_t BigFont[]; 16 | extern uint8_t SevenSegNumFont[]; 17 | 18 | // Set the pins to the correct ones for your development shield 19 | // ------------------------------------------------------------ 20 | // Standard Arduino Mega/Due shield : ,38,39,40,41 21 | // CTE TFT LCD/SD Shield for Arduino Due : ,25,26,27,28 22 | // Teensy 3.x TFT Test Board : ,23,22, 3, 4 23 | // ElecHouse TFT LCD/SD Shield for Arduino Due : ,22,23,31,33 24 | // 25 | // Remember to change the model parameter to suit your display module! 26 | UTFT myGLCD(ITDB32S,38,39,40,41); 27 | 28 | void setup() 29 | { 30 | myGLCD.InitLCD(); 31 | myGLCD.clrScr(); 32 | myGLCD.setFont(BigFont); 33 | } 34 | 35 | void loop() 36 | { 37 | myGLCD.print("Text rotation", 0, 0); 38 | myGLCD.setColor(0, 0, 255); 39 | myGLCD.print("0 degrees", 0, 16, 0); 40 | myGLCD.print("90 degrees", 319, 0, 90); 41 | myGLCD.print("180 degrees", 319, 239, 180); 42 | myGLCD.print("270 degrees", 0, 239, 270); 43 | 44 | myGLCD.setFont(SevenSegNumFont); 45 | myGLCD.setColor(0, 255, 0); 46 | myGLCD.print("45", 90, 100, 45); 47 | myGLCD.print("90", 200, 50, 90); 48 | myGLCD.print("180", 300, 200, 180); 49 | 50 | while (true) {}; 51 | } 52 | 53 | -------------------------------------------------------------------------------- /external_libraries/UTFT/examples/Arduino (ARM) + Teensy/UTFT_ViewFont/UTFT_ViewFont.ino: -------------------------------------------------------------------------------- 1 | // UTFT_ViewFont (C)2014 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of the included fonts. 5 | // 6 | // This demo was made for modules with a screen resolution 7 | // of 320x240 pixels. 8 | // 9 | // This program requires the UTFT library. 10 | // 11 | 12 | #include 13 | 14 | // Declare which fonts we will be using 15 | extern uint8_t SmallFont[]; 16 | extern uint8_t BigFont[]; 17 | extern uint8_t SevenSegNumFont[]; 18 | 19 | // Set the pins to the correct ones for your development shield 20 | // ------------------------------------------------------------ 21 | // Standard Arduino Mega/Due shield : ,38,39,40,41 22 | // CTE TFT LCD/SD Shield for Arduino Due : ,25,26,27,28 23 | // Teensy 3.x TFT Test Board : ,23,22, 3, 4 24 | // ElecHouse TFT LCD/SD Shield for Arduino Due : ,22,23,31,33 25 | // 26 | // Remember to change the model parameter to suit your display module! 27 | UTFT myGLCD(ITDB32S,38,39,40,41); 28 | 29 | void setup() 30 | { 31 | myGLCD.InitLCD(); 32 | 33 | myGLCD.clrScr(); 34 | } 35 | 36 | void loop() 37 | { 38 | myGLCD.setColor(0, 255, 0); 39 | myGLCD.setBackColor(0, 0, 0); 40 | 41 | myGLCD.setFont(BigFont); 42 | myGLCD.print(" !\"#$%&'()*+,-./", CENTER, 0); 43 | myGLCD.print("0123456789:;<=>?", CENTER, 16); 44 | myGLCD.print("@ABCDEFGHIJKLMNO", CENTER, 32); 45 | myGLCD.print("PQRSTUVWXYZ[\\]^_", CENTER, 48); 46 | myGLCD.print("`abcdefghijklmno", CENTER, 64); 47 | myGLCD.print("pqrstuvwxyz{|}~ ", CENTER, 80); 48 | 49 | myGLCD.setFont(SmallFont); 50 | myGLCD.print(" !\"#$%&'()*+,-./0123456789:;<=>?", CENTER, 120); 51 | myGLCD.print("@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_", CENTER, 132); 52 | myGLCD.print("`abcdefghijklmnopqrstuvwxyz{|}~ ", CENTER, 144); 53 | 54 | myGLCD.setFont(SevenSegNumFont); 55 | myGLCD.print("0123456789", CENTER, 190); 56 | 57 | while(1) {}; 58 | } 59 | 60 | -------------------------------------------------------------------------------- /external_libraries/UTFT/examples/Arduino (AVR)/UTFT_Bitmap/UTFT_Bitmap.ino: -------------------------------------------------------------------------------- 1 | // UTFT_Bitmap (C)2014 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of the drawBitmap()-function. 5 | // 6 | // This demo was made to work on the 320x240 modules. 7 | // Any other size displays may cause strange behaviour. 8 | // 9 | // This program requires the UTFT library. 10 | // 11 | 12 | #include 13 | #include 14 | 15 | // Declare which fonts we will be using 16 | extern uint8_t SmallFont[]; 17 | 18 | // Set the pins to the correct ones for your development shield 19 | // ------------------------------------------------------------ 20 | // Arduino Uno / 2009: 21 | // ------------------- 22 | // Standard Arduino Uno/2009 shield : ,A5,A4,A3,A2 23 | // DisplayModule Arduino Uno TFT shield : ,A5,A4,A3,A2 24 | // 25 | // Arduino Mega: 26 | // ------------------- 27 | // Standard Arduino Mega/Due shield : ,38,39,40,41 28 | // CTE TFT LCD/SD Shield for Arduino Mega : ,38,39,40,41 29 | // 30 | // Remember to change the model parameter to suit your display module! 31 | UTFT myGLCD(ITDB32S,A5,A4,A3,A2); 32 | 33 | extern unsigned int info[0x400]; 34 | extern unsigned int icon[0x400]; 35 | extern unsigned int tux[0x400]; 36 | 37 | void setup() 38 | { 39 | myGLCD.InitLCD(); 40 | myGLCD.setFont(SmallFont); 41 | } 42 | 43 | void loop() 44 | { 45 | myGLCD.fillScr(255, 255, 255); 46 | myGLCD.setColor(255, 255, 255); 47 | myGLCD.print(" *** A 10 by 7 grid of a 32x32 icon *** ", CENTER, 228); 48 | for (int x=0; x<10; x++) 49 | for (int y=0; y<7; y++) 50 | myGLCD.drawBitmap (x*32, y*32, 32, 32, info); 51 | 52 | delay(5000); 53 | 54 | myGLCD.fillScr(255, 255, 255); 55 | myGLCD.setColor(255, 255, 255); 56 | myGLCD.print(" Two different icons in scale 1 to 4 ", CENTER, 228); 57 | int x=0; 58 | for (int s=0; s<4; s++) 59 | { 60 | x+=(s*32); 61 | myGLCD.drawBitmap (x, 0, 32, 32, tux, s+1); 62 | } 63 | x=0; 64 | for (int s=4; s>0; s--) 65 | { 66 | myGLCD.drawBitmap (x, 224-(s*32), 32, 32, icon, s); 67 | x+=(s*32); 68 | } 69 | 70 | delay(5000); 71 | } 72 | -------------------------------------------------------------------------------- /external_libraries/UTFT/examples/Arduino (AVR)/UTFT_Bitmap_128x128/UTFT_Bitmap_128x128.ino: -------------------------------------------------------------------------------- 1 | // UTFT_Bitmap_128x128 (C)2012 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of the drawBitmap()-function. 5 | // 6 | // This demo was made to work on the 128x128 modules. 7 | // Any other size displays may cause strange behaviour. 8 | // 9 | // This program requires the UTFT library. 10 | // 11 | 12 | #include 13 | #include 14 | 15 | UTFT myGLCD(LPH9135,6,5,2,3,4); // Remember to change the model parameter to suit your display module! 16 | 17 | extern unsigned int icon1[0x400]; 18 | extern unsigned int icon2[0x400]; 19 | extern unsigned int tux[0x1000]; 20 | 21 | void setup() 22 | { 23 | myGLCD.InitLCD(PORTRAIT); 24 | } 25 | 26 | void loop() 27 | { 28 | // Draw a 4 by 4 grid of a 32x32 icon. 29 | myGLCD.fillScr(255, 255, 255); 30 | for (int x=0; x<4; x++) 31 | for (int y=0; y<4; y++) 32 | myGLCD.drawBitmap (x*32, y*32, 32, 32, icon1); 33 | 34 | delay(5000); 35 | 36 | // Draw a 64x64 icon in double size. 37 | myGLCD.fillScr(255, 255, 255); 38 | myGLCD.drawBitmap (0, 0, 64, 64, tux, 2); 39 | 40 | delay(5000); 41 | 42 | // Draw a 2 by 2 grid of a 32x32 icon in double size. 43 | myGLCD.fillScr(255, 255, 255); 44 | for (int x=0; x<2; x++) 45 | for (int y=0; y<2; y++) 46 | myGLCD.drawBitmap (x*64, y*64, 32, 32, icon2, 2); 47 | 48 | delay(5000); 49 | } 50 | 51 | -------------------------------------------------------------------------------- /external_libraries/UTFT/examples/Arduino (AVR)/UTFT_CPLD_PageSwitching/UTFT_CPLD_PageSwitching.ino: -------------------------------------------------------------------------------- 1 | // UTFT_CPLD_PageSwitching (C)2014 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of page switching on CPLD-based display modules.. 5 | // 6 | // This demo was made for modules with a screen resolution 7 | // of 800x480 pixels. 8 | // 9 | // This program requires the UTFT library. 10 | // 11 | // NOTE: The display will be black for 10-15 seconds during the start 12 | // 13 | 14 | #include 15 | 16 | // Declare which fonts we will be using 17 | extern uint8_t BigFont[]; 18 | extern uint8_t SevenSegNumFont[]; 19 | 20 | // Set the pins to the correct ones for your development shield 21 | // ------------------------------------------------------------ 22 | // Arduino Mega: 23 | // ------------------- 24 | // Standard Arduino Mega/Due shield : ,38,39,40,41 25 | // CTE TFT LCD/SD Shield for Arduino Mega : ,38,39,40,41 26 | // 27 | // Remember to change the model parameter to suit your display module! 28 | UTFT myGLCD(CPLD,38,39,40,41); 29 | 30 | void setup() 31 | { 32 | myGLCD.InitLCD(); 33 | } 34 | 35 | void loop() 36 | { 37 | myGLCD.setBackColor(VGA_TRANSPARENT); 38 | 39 | myGLCD.setBrightness(0); 40 | for (byte pg=0; pg<8; pg++) 41 | { 42 | myGLCD.setWritePage(pg); 43 | myGLCD.clrScr(); 44 | for (int ln=0; ln<480; ln+=2) 45 | { 46 | switch (pg) 47 | { 48 | case 0: 49 | myGLCD.setColor(ln/2, 0, 0); 50 | break; 51 | case 1: 52 | myGLCD.setColor(0, ln/2, 0); 53 | break; 54 | case 2: 55 | myGLCD.setColor(0, 0, ln/2); 56 | break; 57 | case 3: 58 | myGLCD.setColor(ln/4, ln/2, 0); 59 | break; 60 | case 4: 61 | myGLCD.setColor(0, ln/2, ln/2); 62 | break; 63 | case 5: 64 | myGLCD.setColor(ln/2, 0, ln/2); 65 | break; 66 | case 6: 67 | myGLCD.setColor(ln/2, ln/2, 0); 68 | break; 69 | case 7: 70 | myGLCD.setColor(0, ln/2, ln/4); 71 | break; 72 | } 73 | myGLCD.drawLine(0, ln, 799, ln); 74 | myGLCD.drawLine(0, ln+1, 799, ln+1); 75 | } 76 | myGLCD.setColor(VGA_WHITE); 77 | myGLCD.setFont(BigFont); 78 | myGLCD.print("This is page:", CENTER, 200); 79 | myGLCD.setFont(SevenSegNumFont); 80 | myGLCD.printNumI(pg, CENTER, 240); 81 | } 82 | myGLCD.setBrightness(16); 83 | 84 | while(1) 85 | { 86 | for (byte pg=0; pg<8; pg++) 87 | { 88 | myGLCD.setDisplayPage(pg); 89 | delay(500); 90 | } 91 | } 92 | } 93 | 94 | -------------------------------------------------------------------------------- /external_libraries/UTFT/examples/Arduino (AVR)/UTFT_Rotate_Bitmap/UTFT_Rotate_Bitmap.ino: -------------------------------------------------------------------------------- 1 | // UTFT_Rotate_Bitmap (C)2014 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of the drawBitmap()-function. 5 | // 6 | // This program requires the UTFT library. 7 | // 8 | 9 | #include 10 | #include 11 | 12 | // Set the pins to the correct ones for your development shield 13 | // ------------------------------------------------------------ 14 | // Arduino Uno / 2009: 15 | // ------------------- 16 | // Standard Arduino Uno/2009 shield : ,A5,A4,A3,A2 17 | // DisplayModule Arduino Uno TFT shield : ,A5,A4,A3,A2 18 | // 19 | // Arduino Mega: 20 | // ------------------- 21 | // Standard Arduino Mega/Due shield : ,38,39,40,41 22 | // CTE TFT LCD/SD Shield for Arduino Mega : ,38,39,40,41 23 | // 24 | // Remember to change the model parameter to suit your display module! 25 | UTFT myGLCD(ITDB32S,38,39,40,41); 26 | 27 | extern unsigned int tux[0x400]; 28 | 29 | void setup() 30 | { 31 | myGLCD.InitLCD(LANDSCAPE); 32 | myGLCD.fillScr(255, 255, 255); 33 | myGLCD.setColor(0, 0, 0); 34 | } 35 | 36 | void loop() 37 | { 38 | for (int i=0; i<360; i+=5) 39 | { 40 | myGLCD.drawBitmap (10, 10, 32, 32, tux, i, 16, 16); 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /external_libraries/UTFT/examples/Arduino (AVR)/UTFT_Textrotation_Demo/UTFT_Textrotation_Demo.ino: -------------------------------------------------------------------------------- 1 | // UTFT_Textrotation_Demo (C)2014 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of the textrotation-functions. 5 | // 6 | // This demo was made for modules with a screen resolution 7 | // of 320x240 pixels. 8 | // 9 | // This program requires the UTFT library. 10 | // 11 | 12 | #include 13 | 14 | // Declare which fonts we will be using 15 | extern uint8_t BigFont[]; 16 | extern uint8_t SevenSegNumFont[]; 17 | 18 | // Set the pins to the correct ones for your development shield 19 | // ------------------------------------------------------------ 20 | // Arduino Uno / 2009: 21 | // ------------------- 22 | // Standard Arduino Uno/2009 shield : ,A5,A4,A3,A2 23 | // DisplayModule Arduino Uno TFT shield : ,A5,A4,A3,A2 24 | // 25 | // Arduino Mega: 26 | // ------------------- 27 | // Standard Arduino Mega/Due shield : ,38,39,40,41 28 | // CTE TFT LCD/SD Shield for Arduino Mega : ,38,39,40,41 29 | // 30 | // Remember to change the model parameter to suit your display module! 31 | UTFT myGLCD(ITDB32S,38,39,40,41); 32 | 33 | void setup() 34 | { 35 | myGLCD.InitLCD(); 36 | myGLCD.clrScr(); 37 | myGLCD.setFont(BigFont); 38 | } 39 | 40 | void loop() 41 | { 42 | myGLCD.print("Text rotation", 0, 0); 43 | myGLCD.setColor(0, 0, 255); 44 | myGLCD.print("0 degrees", 0, 16, 0); 45 | myGLCD.print("90 degrees", 319, 0, 90); 46 | myGLCD.print("180 degrees", 319, 239, 180); 47 | myGLCD.print("270 degrees", 0, 239, 270); 48 | 49 | myGLCD.setFont(SevenSegNumFont); 50 | myGLCD.setColor(0, 255, 0); 51 | myGLCD.print("45", 90, 100, 45); 52 | myGLCD.print("90", 200, 50, 90); 53 | myGLCD.print("180", 300, 200, 180); 54 | 55 | while (true) {}; 56 | } 57 | 58 | -------------------------------------------------------------------------------- /external_libraries/UTFT/examples/Arduino (AVR)/UTFT_ViewFont/UTFT_ViewFont.ino: -------------------------------------------------------------------------------- 1 | // UTFT_ViewFont (C)2014 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of the included fonts. 5 | // 6 | // This demo was made for modules with a screen resolution 7 | // of 320x240 pixels. 8 | // 9 | // This program requires the UTFT library. 10 | // 11 | 12 | #include 13 | 14 | // Declare which fonts we will be using 15 | extern uint8_t SmallFont[]; 16 | extern uint8_t BigFont[]; 17 | extern uint8_t SevenSegNumFont[]; 18 | 19 | // Set the pins to the correct ones for your development shield 20 | // ------------------------------------------------------------ 21 | // Arduino Uno / 2009: 22 | // ------------------- 23 | // Standard Arduino Uno/2009 shield : ,A5,A4,A3,A2 24 | // DisplayModule Arduino Uno TFT shield : ,A5,A4,A3,A2 25 | // 26 | // Arduino Mega: 27 | // ------------------- 28 | // Standard Arduino Mega/Due shield : ,38,39,40,41 29 | // CTE TFT LCD/SD Shield for Arduino Mega : ,38,39,40,41 30 | // 31 | // Remember to change the model parameter to suit your display module! 32 | UTFT myGLCD(ITDB32S,38,39,40,41); 33 | 34 | void setup() 35 | { 36 | myGLCD.InitLCD(); 37 | 38 | myGLCD.clrScr(); 39 | } 40 | 41 | void loop() 42 | { 43 | myGLCD.setColor(0, 255, 0); 44 | myGLCD.setBackColor(0, 0, 0); 45 | 46 | myGLCD.setFont(BigFont); 47 | myGLCD.print(" !\"#$%&'()*+,-./", CENTER, 0); 48 | myGLCD.print("0123456789:;<=>?", CENTER, 16); 49 | myGLCD.print("@ABCDEFGHIJKLMNO", CENTER, 32); 50 | myGLCD.print("PQRSTUVWXYZ[\\]^_", CENTER, 48); 51 | myGLCD.print("`abcdefghijklmno", CENTER, 64); 52 | myGLCD.print("pqrstuvwxyz{|}~ ", CENTER, 80); 53 | 54 | myGLCD.setFont(SmallFont); 55 | myGLCD.print(" !\"#$%&'()*+,-./0123456789:;<=>?", CENTER, 120); 56 | myGLCD.print("@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_", CENTER, 132); 57 | myGLCD.print("`abcdefghijklmnopqrstuvwxyz{|}~ ", CENTER, 144); 58 | 59 | myGLCD.setFont(SevenSegNumFont); 60 | myGLCD.print("0123456789", CENTER, 190); 61 | 62 | while(1) {}; 63 | } 64 | 65 | -------------------------------------------------------------------------------- /external_libraries/UTFT/examples/chipKit/UTFT_Bitmap/UTFT_Bitmap.pde: -------------------------------------------------------------------------------- 1 | // UTFT_Bitmap (C)2014 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of the drawBitmap()-function. 5 | // 6 | // This demo was made to work on the 320x240 modules. 7 | // Any other size displays may cause strange behaviour. 8 | // 9 | // This program requires the UTFT library. 10 | // 11 | 12 | #include 13 | 14 | // Declare which fonts we will be using 15 | extern uint8_t SmallFont[]; 16 | 17 | // Set the pins to the correct ones for your development shield 18 | // ------------------------------------------------------------ 19 | // My chipKit Uno32/uC32 shield : ,38,39,40,41 20 | // My chipKit Max32 shield : ,82,83,84,85 21 | // AquaLEDSource All in One Super Screw Shield : ,82,83,84,85 22 | // 23 | // Remember to change the model parameter to suit your display module! 24 | UTFT myGLCD(ITDB32S,82,83,84,85); 25 | 26 | extern unsigned short info[0x400]; 27 | extern unsigned short icon[0x400]; 28 | extern unsigned short tux[0x400]; 29 | 30 | void setup() 31 | { 32 | myGLCD.InitLCD(); 33 | myGLCD.setFont(SmallFont); 34 | } 35 | 36 | void loop() 37 | { 38 | myGLCD.fillScr(255, 255, 255); 39 | myGLCD.setColor(255, 255, 255); 40 | myGLCD.print(" *** A 10 by 7 grid of a 32x32 icon *** ", CENTER, 228); 41 | for (int x=0; x<10; x++) 42 | for (int y=0; y<7; y++) 43 | myGLCD.drawBitmap (x*32, y*32, 32, 32, info); 44 | 45 | delay(5000); 46 | 47 | myGLCD.fillScr(255, 255, 255); 48 | myGLCD.setColor(255, 255, 255); 49 | myGLCD.print(" Two different icons in scale 1 to 4 ", CENTER, 228); 50 | int x=0; 51 | for (int s=0; s<4; s++) 52 | { 53 | x+=(s*32); 54 | myGLCD.drawBitmap (x, 0, 32, 32, tux, s+1); 55 | } 56 | x=0; 57 | for (int s=4; s>0; s--) 58 | { 59 | myGLCD.drawBitmap (x, 224-(s*32), 32, 32, icon, s); 60 | x+=(s*32); 61 | } 62 | 63 | delay(5000); 64 | } 65 | 66 | -------------------------------------------------------------------------------- /external_libraries/UTFT/examples/chipKit/UTFT_Bitmap_128x128/UTFT_Bitmap_128x128.pde: -------------------------------------------------------------------------------- 1 | // UTFT_Bitmap_128x128 (C)2012 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of the drawBitmap()-function. 5 | // 6 | // This demo was made to work on the 128x128 modules. 7 | // Any other size displays may cause strange behaviour. 8 | // 9 | // This program requires the UTFT library. 10 | // 11 | 12 | #include 13 | 14 | UTFT myGLCD(LPH9135,6,5,2,3,4); // Remember to change the model parameter to suit your display module! 15 | 16 | extern unsigned short icon1[0x400]; 17 | extern unsigned short icon2[0x400]; 18 | extern unsigned short tux[0x1000]; 19 | 20 | void setup() 21 | { 22 | myGLCD.InitLCD(PORTRAIT); 23 | } 24 | 25 | void loop() 26 | { 27 | // Draw a 4 by 4 grid of a 32x32 icon. 28 | myGLCD.fillScr(255, 255, 255); 29 | for (int x=0; x<4; x++) 30 | for (int y=0; y<4; y++) 31 | myGLCD.drawBitmap (x*32, y*32, 32, 32, icon1); 32 | 33 | delay(5000); 34 | 35 | // Draw a 64x64 icon in double size. 36 | myGLCD.fillScr(255, 255, 255); 37 | myGLCD.drawBitmap (0, 0, 64, 64, tux, 2); 38 | 39 | delay(5000); 40 | 41 | // Draw a 2 by 2 grid of a 32x32 icon in double size. 42 | myGLCD.fillScr(255, 255, 255); 43 | for (int x=0; x<2; x++) 44 | for (int y=0; y<2; y++) 45 | myGLCD.drawBitmap (x*64, y*64, 32, 32, icon2, 2); 46 | 47 | delay(5000); 48 | } 49 | 50 | -------------------------------------------------------------------------------- /external_libraries/UTFT/examples/chipKit/UTFT_Rotate_Bitmap/UTFT_Rotate_Bitmap.pde: -------------------------------------------------------------------------------- 1 | // UTFT_Rotate_Bitmap (C)2014 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of the drawBitmap()-function. 5 | // 6 | // This program requires the UTFT library. 7 | // 8 | 9 | #include 10 | 11 | // Set the pins to the correct ones for your development shield 12 | // ------------------------------------------------------------ 13 | // My chipKit Uno32/uC32 shield : ,38,39,40,41 14 | // My chipKit Max32 shield : ,82,83,84,85 15 | // AquaLEDSource All in One Super Screw Shield : ,82,83,84,85 16 | // 17 | // Remember to change the model parameter to suit your display module! 18 | UTFT myGLCD(ITDB32S,82,83,84,85); 19 | 20 | extern unsigned short biohazard[0x1000]; 21 | 22 | void setup() 23 | { 24 | myGLCD.InitLCD(LANDSCAPE); 25 | myGLCD.fillScr(255, 255, 255); 26 | myGLCD.setColor(0, 0, 0); 27 | } 28 | 29 | void loop() 30 | { 31 | for (int i=0; i<360; i+=5) 32 | { 33 | myGLCD.drawBitmap (10, 10, 64, 64, biohazard, i, 32, 32); 34 | } 35 | } 36 | 37 | -------------------------------------------------------------------------------- /external_libraries/UTFT/examples/chipKit/UTFT_Textrotation_Demo/UTFT_Textrotation_Demo.pde: -------------------------------------------------------------------------------- 1 | // UTFT_Textrotation_Demo (C)2014 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of the textrotation-functions. 5 | // 6 | // This demo was made for modules with a screen resolution 7 | // of 320x240 pixels. 8 | // 9 | // This program requires the UTFT library. 10 | // 11 | 12 | #include 13 | 14 | // Declare which fonts we will be using 15 | extern uint8_t BigFont[]; 16 | extern uint8_t SevenSegNumFont[]; 17 | 18 | // Set the pins to the correct ones for your development shield 19 | // ------------------------------------------------------------ 20 | // My chipKit Uno32/uC32 shield : ,38,39,40,41 21 | // My chipKit Max32 shield : ,82,83,84,85 22 | // AquaLEDSource All in One Super Screw Shield : ,82,83,84,85 23 | // 24 | // Remember to change the model parameter to suit your display module! 25 | UTFT myGLCD(ITDB32S,82,83,84,85); 26 | 27 | void setup() 28 | { 29 | myGLCD.InitLCD(); 30 | myGLCD.clrScr(); 31 | myGLCD.setFont(BigFont); 32 | } 33 | 34 | void loop() 35 | { 36 | myGLCD.print("Text rotation", 0, 0); 37 | myGLCD.setColor(0, 0, 255); 38 | myGLCD.print("0 degrees", 0, 16, 0); 39 | myGLCD.print("90 degrees", 319, 0, 90); 40 | myGLCD.print("180 degrees", 319, 239, 180); 41 | myGLCD.print("270 degrees", 0, 239, 270); 42 | 43 | myGLCD.setFont(SevenSegNumFont); 44 | myGLCD.setColor(0, 255, 0); 45 | myGLCD.print("45", 90, 100, 45); 46 | myGLCD.print("90", 200, 50, 90); 47 | myGLCD.print("180", 300, 200, 180); 48 | 49 | while (true) {}; 50 | } 51 | 52 | -------------------------------------------------------------------------------- /external_libraries/UTFT/examples/chipKit/UTFT_ViewFont/UTFT_ViewFont.pde: -------------------------------------------------------------------------------- 1 | // UTFT_ViewFont (C)2014 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of the included fonts. 5 | // 6 | // This demo was made for modules with a screen resolution 7 | // of 320x240 pixels. 8 | // 9 | // This program requires the UTFT library. 10 | // 11 | 12 | #include 13 | 14 | // Declare which fonts we will be using 15 | extern uint8_t SmallFont[]; 16 | extern uint8_t BigFont[]; 17 | extern uint8_t SevenSegNumFont[]; 18 | 19 | // Set the pins to the correct ones for your development shield 20 | // ------------------------------------------------------------ 21 | // My chipKit Uno32/uC32 shield : ,38,39,40,41 22 | // My chipKit Max32 shield : ,82,83,84,85 23 | // AquaLEDSource All in One Super Screw Shield : ,82,83,84,85 24 | // 25 | // Remember to change the model parameter to suit your display module! 26 | UTFT myGLCD(ITDB32S,82,83,84,85); 27 | 28 | void setup() 29 | { 30 | myGLCD.InitLCD(); 31 | 32 | myGLCD.clrScr(); 33 | } 34 | 35 | void loop() 36 | { 37 | myGLCD.setColor(0, 255, 0); 38 | myGLCD.setBackColor(0, 0, 0); 39 | 40 | myGLCD.setFont(BigFont); 41 | myGLCD.print(" !\"#$%&'()*+,-./", CENTER, 0); 42 | myGLCD.print("0123456789:;<=>?", CENTER, 16); 43 | myGLCD.print("@ABCDEFGHIJKLMNO", CENTER, 32); 44 | myGLCD.print("PQRSTUVWXYZ[\\]^_", CENTER, 48); 45 | myGLCD.print("`abcdefghijklmno", CENTER, 64); 46 | myGLCD.print("pqrstuvwxyz{|}~ ", CENTER, 80); 47 | 48 | myGLCD.setFont(SmallFont); 49 | myGLCD.print(" !\"#$%&'()*+,-./0123456789:;<=>?", CENTER, 120); 50 | myGLCD.print("@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_", CENTER, 132); 51 | myGLCD.print("`abcdefghijklmnopqrstuvwxyz{|}~ ", CENTER, 144); 52 | 53 | myGLCD.setFont(SevenSegNumFont); 54 | myGLCD.print("0123456789", CENTER, 190); 55 | 56 | while(1) {}; 57 | } 58 | 59 | -------------------------------------------------------------------------------- /external_libraries/UTFT/hardware/arm/HW_ARM.h: -------------------------------------------------------------------------------- 1 | void UTFT::_convert_float(char *buf, double num, int width, byte prec) 2 | { 3 | char format[10]; 4 | 5 | sprintf(format, "%%%i.%if", width, prec); 6 | sprintf(buf, format, num); 7 | } 8 | -------------------------------------------------------------------------------- /external_libraries/UTFT/hardware/arm/HW_ARM_defines.h: -------------------------------------------------------------------------------- 1 | // CTE TFT LCD/SD Shield for Arduino Due 2 | // ------------------------------------- 3 | // Uncomment the following line if you are using this shield 4 | //#define CTE_DUE_SHIELD 1 5 | // 6 | // For this shield: RS=25, WR=26, CS=27, RST=28 7 | //******************************************************************** 8 | 9 | // ElecHouse TFT LCD/SD Shield for Arduino Due 10 | // ------------------------------------- 11 | // Uncomment the following line if you are using this shield 12 | //#define EHOUSE_DUE_SHIELD 1 13 | // 14 | // For this shield: RS=22, WR=23, CS=31, RST=33 15 | //******************************************************************** 16 | 17 | // *** Hardwarespecific defines *** 18 | #define cbi(reg, bitmask) *reg &= ~bitmask 19 | #define sbi(reg, bitmask) *reg |= bitmask 20 | #define pulse_high(reg, bitmask) sbi(reg, bitmask); cbi(reg, bitmask); 21 | #define pulse_low(reg, bitmask) cbi(reg, bitmask); sbi(reg, bitmask); 22 | 23 | #define cport(port, data) port &= data 24 | #define sport(port, data) port |= data 25 | 26 | #define swap(type, i, j) {type t = i; i = j; j = t;} 27 | 28 | #define fontbyte(x) cfont.font[x] 29 | 30 | #define pgm_read_word(data) *data 31 | #define pgm_read_byte(data) *data 32 | #define bitmapdatatype unsigned short* 33 | 34 | #if defined(TEENSYDUINO) && TEENSYDUINO >= 117 35 | #define regtype volatile uint8_t 36 | #define regsize uint8_t 37 | #else 38 | #define regtype volatile uint32_t 39 | #define regsize uint32_t 40 | #endif 41 | -------------------------------------------------------------------------------- /external_libraries/UTFT/hardware/avr/HW_AVR.h: -------------------------------------------------------------------------------- 1 | void UTFT::_convert_float(char *buf, double num, int width, byte prec) 2 | { 3 | dtostrf(num, width, prec, buf); 4 | } 5 | -------------------------------------------------------------------------------- /external_libraries/UTFT/hardware/avr/HW_AVR_defines.h: -------------------------------------------------------------------------------- 1 | // Enable or disable the use of a display shield designed for use on 2 | // an Arduino Uno (or compatible) on an Arduino Mega 3 | // 4 | // ** Currently only available for 8bit display shields ** 5 | // 6 | // Uncomment the following line to enable this feature 7 | //#define USE_UNO_SHIELD_ON_MEGA 1 8 | //******************************************************************** 9 | 10 | // *** Hardwarespecific defines *** 11 | #define cbi(reg, bitmask) *reg &= ~bitmask 12 | #define sbi(reg, bitmask) *reg |= bitmask 13 | #define pulse_high(reg, bitmask) sbi(reg, bitmask); cbi(reg, bitmask); 14 | #define pulse_low(reg, bitmask) cbi(reg, bitmask); sbi(reg, bitmask); 15 | 16 | #define cport(port, data) port &= data 17 | #define sport(port, data) port |= data 18 | 19 | #define swap(type, i, j) {type t = i; i = j; j = t;} 20 | 21 | #define fontbyte(x) pgm_read_byte(&cfont.font[x]) 22 | 23 | #define regtype volatile uint8_t 24 | #define regsize uint8_t 25 | #define bitmapdatatype unsigned int* 26 | -------------------------------------------------------------------------------- /external_libraries/UTFT/hardware/pic32/HW_PIC32.h: -------------------------------------------------------------------------------- 1 | void UTFT::_convert_float(char *buf, double num, int width, byte prec) 2 | { 3 | char format[10]; 4 | 5 | sprintf(format, "%%%i.%if", width, prec); 6 | sprintf(buf, format, num); 7 | } 8 | -------------------------------------------------------------------------------- /external_libraries/UTFT/hardware/pic32/HW_PIC32_defines.h: -------------------------------------------------------------------------------- 1 | // AquaLEDSource All in One Super Screw Shield 2 | // ------------------------------------------- 3 | // Uncomment the following line if you are using this shield 4 | //#define AQUALED_SHIELD 1 5 | // 6 | // For this shield: RS=82, WR=83, CS=84, RST=85 (Standard for chipKit Max32) 7 | //************************************************************************** 8 | 9 | // *** Hardwarespecific defines *** 10 | #define cbi(reg, bitmask) (*(reg + 1)) = bitmask 11 | #define sbi(reg, bitmask) (*(reg + 2)) = bitmask 12 | #define pulse_high(reg, bitmask) sbi(reg, bitmask); cbi(reg, bitmask); 13 | #define pulse_low(reg, bitmask) cbi(reg, bitmask); sbi(reg, bitmask); 14 | 15 | #define cport(port, data) port &= data 16 | #define sport(port, data) port |= data 17 | 18 | #define swap(type, i, j) {type t = i; i = j; j = t;} 19 | 20 | #define fontbyte(x) cfont.font[x] 21 | 22 | #define PROGMEM 23 | #define regtype volatile uint32_t 24 | #define regsize uint16_t 25 | #define bitmapdatatype unsigned short* 26 | 27 | -------------------------------------------------------------------------------- /external_libraries/UTFT/memorysaver.h: -------------------------------------------------------------------------------- 1 | // UTFT Memory Saver 2 | // ----------------- 3 | // 4 | // Since most people have only one or possibly two different display modules a lot 5 | // of memory has been wasted to keep support for many unneeded controller chips. 6 | // You now have the option to remove this unneeded code from the library with 7 | // this file. 8 | // By disabling the controllers you don't need you can reduce the memory footprint 9 | // of the library by several Kb. 10 | // 11 | // Uncomment the lines for the displaycontrollers that you don't use to save 12 | // some flash memory by not including the init code for that particular 13 | // controller. 14 | 15 | //#define DISABLE_CPLD 1 // EHOUSE50CPLD 16 | 17 | //#define DISABLE_HX8340B_8 1 // ITDB22 8bit mode / GEEE22 18 | //#define DISABLE_HX8340B_S 1 // ITDB22 Serial mode 19 | //#define DISABLE_HX8347A 1 // ITDB32 20 | //#define DISABLE_HX8352A 1 // ITDB32WD / TFT01_32WD / CTE32W 21 | //#define DISABLE_HX8353C 1 // DMTFT18101 22 | 23 | //#define DISABLE_ILI9320 1 // GEEE24 / GEEE28 - This single define will disable both 8bit and 16bit mode for this controller 24 | //#define DISABLE_ILI9325C 1 // ITDB24 25 | //#define DISABLE_ILI9325D 1 // ITDB24D / ITDB24DWOT / ITDB28 / TFT01_24_8 / TFT01_24_16 / DMTFT24104 / DMTFT28103 - This single define will disable both 8bit and 16bit mode for this controller 26 | //#define DISABLE_ILI9325D_ALT 1 // CTE28 27 | //#define DISABLE_ILI9327 1 // ITDB32WC / TFT01_32W 28 | //#define DISABLE_ILI9341_S4P 1 // MI0283QT9 29 | //#define DISABLE_ILI9341_S5P 1 // TFT01_22SP / DMTFT28105 30 | //#define DISABLE_ILI9481 1 // CTE32HR 31 | //#define DISABLE_ILI9486 1 // CTE40 32 | 33 | //#define DISABLE_PCF8833 1 // LPH9135 34 | 35 | //#define DISABLE_R61581 1 // CTE35IPS 36 | 37 | //#define DISABLE_S1D19122 1 // ITDB25H 38 | //#define DISABLE_S6D0164 1 // CTE22 / DMTFT22102 39 | //#define DISABLE_S6D1121 1 // ITDB24E - This single define will disable both 8bit and 16bit mode for this controller 40 | //#define DISABLE_SSD1289 1 // ITDB32S / TFT01_32 / GEEE32 / ELEE32_REVA / ELEE32_REVB / CTE32 - This single define will disable both 8bit, 16bit and latched mode for this controller 41 | //#define DISABLE_SSD1963_480 1 // ITDB43 / TFT01_43 42 | //#define DISABLE_SSD1963_800 1 // ITDB50 / TFT01_50 / CTE50 / EHOUSE50 43 | //#define DISABLE_SSD1963_800_ALT 1 // TFT01_70 / CTE70 / EHOUSE70 44 | //#define DISABLE_ST7735 1 // ITDB18SP 45 | //#define DISABLE_ST7735S 1 // TFT01_18SP 46 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/cpld/initlcd.h: -------------------------------------------------------------------------------- 1 | case CPLD: 2 | if (orient==LANDSCAPE) 3 | orient = PORTRAIT; 4 | else 5 | orient = LANDSCAPE; 6 | 7 | LCD_Write_COM(0x0F); 8 | LCD_Write_COM_DATA(0x01,0x0010); 9 | LCD_Write_COM(0x0F); 10 | break; 11 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/cpld/setxy.h: -------------------------------------------------------------------------------- 1 | case CPLD: 2 | LCD_Write_COM_DATA(0x02, y1); 3 | LCD_Write_COM_DATA(0x03, x1); 4 | LCD_Write_COM_DATA(0x06, y2); 5 | LCD_Write_COM_DATA(0x07, x2); 6 | LCD_Write_COM(0x0F); 7 | break; 8 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/hx8340b/8/initlcd.h: -------------------------------------------------------------------------------- 1 | case HX8340B_8: 2 | LCD_Write_COM_DATA(0x26,0x0084); //PT=10,GON=0, DTE=0, D=0100 3 | delay(40); 4 | LCD_Write_COM_DATA(0x26,0x00B8); //PT=10,GON=1, DTE=1, D=1000 5 | delay(40); 6 | LCD_Write_COM_DATA(0x26,0x00BC); //PT=10,GON=1, DTE=1, D=1100 7 | delay(20); 8 | // LCD_Write_COM_DATA(0x0001,0x0000); // PTL='1' Enter Partail mode 9 | 10 | //Driving ability Setting 11 | LCD_Write_COM_DATA(0x60,0x0000); 12 | LCD_Write_COM_DATA(0x61,0x0006); 13 | LCD_Write_COM_DATA(0x62,0x0000); 14 | LCD_Write_COM_DATA(0x63,0x00C8); 15 | delay(20); 16 | 17 | //Gamma Setting 18 | LCD_Write_COM_DATA(0x73,0x0070); 19 | LCD_Write_COM_DATA(0x40,0x0000); 20 | LCD_Write_COM_DATA(0x41,0x0040); 21 | LCD_Write_COM_DATA(0x42,0x0045); 22 | LCD_Write_COM_DATA(0x43,0x0001); 23 | LCD_Write_COM_DATA(0x44,0x0060); 24 | LCD_Write_COM_DATA(0x45,0x0005); 25 | LCD_Write_COM_DATA(0x46,0x000C); 26 | LCD_Write_COM_DATA(0x47,0x00D1); 27 | LCD_Write_COM_DATA(0x48,0x0005); 28 | 29 | LCD_Write_COM_DATA(0x50,0x0075); 30 | LCD_Write_COM_DATA(0x51,0x0001); 31 | LCD_Write_COM_DATA(0x52,0x0067); 32 | LCD_Write_COM_DATA(0x53,0x0014); 33 | LCD_Write_COM_DATA(0x54,0x00F2); 34 | LCD_Write_COM_DATA(0x55,0x0007); 35 | LCD_Write_COM_DATA(0x56,0x0003); 36 | LCD_Write_COM_DATA(0x57,0x0049); 37 | delay(20); 38 | 39 | //Power Setting 40 | LCD_Write_COM_DATA(0x1F,0x0003); //VRH=4.65V VREG1?GAMMA? 00~1E 080421 41 | LCD_Write_COM_DATA(0x20,0x0000); //BT (VGH~15V,VGL~-12V,DDVDH~5V) 42 | LCD_Write_COM_DATA(0x24,0x0024); //VCOMH(VCOM High voltage3.2V) 0024/12 080421 11~40 43 | LCD_Write_COM_DATA(0x25,0x0034); //VCOML(VCOM Low voltage -1.2V) 0034/4A 080421 29~3F 44 | //****VCOM offset**/// 45 | LCD_Write_COM_DATA(0x23,0x002F); //VMF(no offset) 46 | delay(20); 47 | 48 | //################################################################## 49 | // Power Supply Setting 50 | LCD_Write_COM_DATA(0x18,0x0044); //I/P_RADJ,N/P_RADJ Noraml mode 60Hz 51 | LCD_Write_COM_DATA(0x21,0x0001); //OSC_EN='1' start osc 52 | LCD_Write_COM_DATA(0x01,0x0000); //SLP='0' out sleep 53 | LCD_Write_COM_DATA(0x1C,0x0003); //AP=011 54 | LCD_Write_COM_DATA(0x19,0x0006); // VOMG=1,PON=1, DK=0, 55 | delay(20); 56 | 57 | //################################################################## 58 | // Display ON Setting 59 | LCD_Write_COM_DATA(0x26,0x0084); //PT=10,GON=0, DTE=0, D=0100 60 | delay(40); 61 | LCD_Write_COM_DATA(0x26,0x00B8); //PT=10,GON=1, DTE=1, D=1000 62 | delay(40); 63 | LCD_Write_COM_DATA(0x26,0x00BC); //PT=10,GON=1, DTE=1, D=1100 64 | delay(20); 65 | 66 | //SET GRAM AREA 67 | LCD_Write_COM_DATA(0x02,0x0000); 68 | LCD_Write_COM_DATA(0x03,0x0000); 69 | LCD_Write_COM_DATA(0x04,0x0000); 70 | LCD_Write_COM_DATA(0x05,0x00AF); 71 | LCD_Write_COM_DATA(0x06,0x0000); 72 | LCD_Write_COM_DATA(0x07,0x0000); 73 | LCD_Write_COM_DATA(0x08,0x0000); 74 | LCD_Write_COM_DATA(0x09,0x00DB); 75 | delay(20); 76 | LCD_Write_COM_DATA(0x16,0x0008); //MV MX MY ML SET 0028 77 | LCD_Write_COM_DATA(0x17,0x0005);//COLMOD Control Register (R17h) 78 | LCD_Write_COM(0x21); 79 | LCD_Write_COM(0x22); 80 | break; 81 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/hx8340b/8/setxy.h: -------------------------------------------------------------------------------- 1 | case HX8340B_8: 2 | LCD_Write_COM_DATA(0x02,0x0000); 3 | LCD_Write_COM_DATA(0x03,x1); 4 | LCD_Write_COM_DATA(0x04,0x0000); 5 | LCD_Write_COM_DATA(0x05,x2); 6 | LCD_Write_COM_DATA(0x06,0x0000); 7 | LCD_Write_COM_DATA(0x07,y1); 8 | LCD_Write_COM_DATA(0x08,0x0000); 9 | LCD_Write_COM_DATA(0x09,y2); 10 | LCD_Write_COM(0x22); 11 | break; 12 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/hx8340b/s/initlcd.h: -------------------------------------------------------------------------------- 1 | case HX8340B_S: 2 | LCD_Write_COM(0xC1); 3 | LCD_Write_DATA(0xFF); 4 | LCD_Write_DATA(0x83); 5 | LCD_Write_DATA(0x40); 6 | LCD_Write_COM(0x11); 7 | delay(100); 8 | LCD_Write_COM(0xCA); 9 | LCD_Write_DATA(0x70); 10 | LCD_Write_DATA(0x00); 11 | LCD_Write_DATA(0xD9); 12 | LCD_Write_DATA(0x01); 13 | LCD_Write_DATA(0x11); 14 | 15 | LCD_Write_COM(0xC9); 16 | LCD_Write_DATA(0x90); 17 | LCD_Write_DATA(0x49); 18 | LCD_Write_DATA(0x10); 19 | LCD_Write_DATA(0x28); 20 | LCD_Write_DATA(0x28); 21 | LCD_Write_DATA(0x10); 22 | LCD_Write_DATA(0x00); 23 | LCD_Write_DATA(0x06); 24 | delay(20); 25 | LCD_Write_COM(0xC2); 26 | LCD_Write_DATA(0x60); 27 | LCD_Write_DATA(0x71); 28 | LCD_Write_DATA(0x01); 29 | LCD_Write_DATA(0x0E); 30 | LCD_Write_DATA(0x05); 31 | LCD_Write_DATA(0x02); 32 | LCD_Write_DATA(0x09); 33 | LCD_Write_DATA(0x31); 34 | LCD_Write_DATA(0x0A); 35 | 36 | LCD_Write_COM(0xc3); 37 | LCD_Write_DATA(0x67); 38 | LCD_Write_DATA(0x30); 39 | LCD_Write_DATA(0x61); 40 | LCD_Write_DATA(0x17); 41 | LCD_Write_DATA(0x48); 42 | LCD_Write_DATA(0x07); 43 | LCD_Write_DATA(0x05); 44 | LCD_Write_DATA(0x33); 45 | delay(10); 46 | LCD_Write_COM(0xB5); 47 | LCD_Write_DATA(0x35); 48 | LCD_Write_DATA(0x20); 49 | LCD_Write_DATA(0x45); 50 | 51 | LCD_Write_COM(0xB4); 52 | LCD_Write_DATA(0x33); 53 | LCD_Write_DATA(0x25); 54 | LCD_Write_DATA(0x4c); 55 | delay(10); 56 | LCD_Write_COM(0x3a); 57 | LCD_Write_DATA(0x05); 58 | LCD_Write_COM(0x29); 59 | delay(10); 60 | LCD_Write_COM(0x2a); 61 | LCD_Write_DATA(0x00); 62 | LCD_Write_DATA(0x00); 63 | LCD_Write_DATA(0x00); 64 | LCD_Write_DATA(0xaf); 65 | LCD_Write_COM(0x2b); 66 | LCD_Write_DATA(0x00); 67 | LCD_Write_DATA(0x00); 68 | LCD_Write_DATA(0x00); 69 | LCD_Write_DATA(0xdb); 70 | LCD_Write_COM(0x2c); 71 | break; 72 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/hx8340b/s/setxy.h: -------------------------------------------------------------------------------- 1 | case HX8340B_S: 2 | LCD_Write_COM(0x2a); 3 | LCD_Write_DATA(x1>>8); 4 | LCD_Write_DATA(x1); 5 | LCD_Write_DATA(x2>>8); 6 | LCD_Write_DATA(x2); 7 | LCD_Write_COM(0x2b); 8 | LCD_Write_DATA(y1>>8); 9 | LCD_Write_DATA(y1); 10 | LCD_Write_DATA(y2>>8); 11 | LCD_Write_DATA(y2); 12 | LCD_Write_COM(0x2c); 13 | break; 14 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/hx8347a/setxy.h: -------------------------------------------------------------------------------- 1 | case HX8347A: 2 | LCD_Write_COM_DATA(0x02,x1>>8); 3 | LCD_Write_COM_DATA(0x03,x1); 4 | LCD_Write_COM_DATA(0x04,x2>>8); 5 | LCD_Write_COM_DATA(0x05,x2); 6 | LCD_Write_COM_DATA(0x06,y1>>8); 7 | LCD_Write_COM_DATA(0x07,y1); 8 | LCD_Write_COM_DATA(0x08,y2>>8); 9 | LCD_Write_COM_DATA(0x09,y2); 10 | LCD_Write_COM(0x22); 11 | break; 12 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/hx8352a/setxy.h: -------------------------------------------------------------------------------- 1 | case HX8352A: 2 | LCD_Write_COM_DATA(0x02,x1>>8); 3 | LCD_Write_COM_DATA(0x03,x1); 4 | LCD_Write_COM_DATA(0x04,x2>>8); 5 | LCD_Write_COM_DATA(0x05,x2); 6 | LCD_Write_COM_DATA(0x06,y1>>8); 7 | LCD_Write_COM_DATA(0x07,y1); 8 | LCD_Write_COM_DATA(0x08,y2>>8); 9 | LCD_Write_COM_DATA(0x09,y2); 10 | LCD_Write_COM(0x22); 11 | break; 12 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/hx8353c/initlcd.h: -------------------------------------------------------------------------------- 1 | case HX8353C: 2 | LCD_Write_COM(0xB9);//SETEXTC 3 | LCD_Write_DATA(0xFF); 4 | LCD_Write_DATA(0x83); 5 | LCD_Write_DATA(0x53); 6 | 7 | LCD_Write_COM(0xB0);//RADJ 8 | LCD_Write_DATA(0x3C); 9 | LCD_Write_DATA(0x01); 10 | 11 | LCD_Write_COM(0xB6);//VCOM 12 | LCD_Write_DATA(0x94); 13 | LCD_Write_DATA(0x6C); 14 | LCD_Write_DATA(0x50); 15 | 16 | LCD_Write_COM(0xB1);//PWR 17 | LCD_Write_DATA(0x00); 18 | LCD_Write_DATA(0x01); 19 | LCD_Write_DATA(0x1B); 20 | LCD_Write_DATA(0x03); 21 | LCD_Write_DATA(0x01); 22 | LCD_Write_DATA(0x08); 23 | LCD_Write_DATA(0x77); 24 | LCD_Write_DATA(0x89); 25 | 26 | LCD_Write_COM(0xE0); //Gamma setting for tpo Panel 27 | LCD_Write_DATA(0x50); 28 | LCD_Write_DATA(0x77); 29 | LCD_Write_DATA(0x40); 30 | LCD_Write_DATA(0x08); 31 | LCD_Write_DATA(0xBF); 32 | LCD_Write_DATA(0x00); 33 | LCD_Write_DATA(0x03); 34 | LCD_Write_DATA(0x0F); 35 | LCD_Write_DATA(0x00); 36 | LCD_Write_DATA(0x01); 37 | LCD_Write_DATA(0x73); 38 | LCD_Write_DATA(0x00); 39 | LCD_Write_DATA(0x72); 40 | LCD_Write_DATA(0x03); 41 | LCD_Write_DATA(0xB0); 42 | LCD_Write_DATA(0x0F); 43 | LCD_Write_DATA(0x08); 44 | LCD_Write_DATA(0x00); 45 | LCD_Write_DATA(0x0F); 46 | 47 | LCD_Write_COM(0x3A); 48 | LCD_Write_DATA(0x05); //05 49 | LCD_Write_COM(0x36); 50 | LCD_Write_DATA(0xC0); //83 //0B 51 | 52 | LCD_Write_COM(0x11); // SLPOUT 53 | delay(150); 54 | 55 | LCD_Write_COM(0x29); // display on 56 | 57 | delay(150); 58 | LCD_Write_COM(0x2D); //Look up table 59 | 60 | for(int j=0;j<32;j++) 61 | { LCD_Write_DATA(2*j); } //Red 62 | for(int j=0;j<64;j++) 63 | { LCD_Write_DATA(1*j); } //Green 64 | for(int j=0;j<32;j++) 65 | { LCD_Write_DATA(2*j); } //Blue 66 | 67 | LCD_Write_COM(0x2c); 68 | delay(150); 69 | break; 70 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/hx8353c/setxy.h: -------------------------------------------------------------------------------- 1 | case HX8353C: 2 | LCD_Write_COM(0x2a); 3 | LCD_Write_DATA(x1>>8); 4 | LCD_Write_DATA(x1); 5 | LCD_Write_DATA(x2>>8); 6 | LCD_Write_DATA(x2); 7 | LCD_Write_COM(0x2b); 8 | LCD_Write_DATA(y1>>8); 9 | LCD_Write_DATA(y1); 10 | LCD_Write_DATA(y2>>8); 11 | LCD_Write_DATA(y2); 12 | LCD_Write_COM(0x2c); 13 | break; 14 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/ili9320/initlcd.h: -------------------------------------------------------------------------------- 1 | case ILI9320_8: 2 | case ILI9320_16: 3 | LCD_Write_COM_DATA(0xe5, 0x8000); 4 | LCD_Write_COM_DATA(0x00, 0x0001); 5 | LCD_Write_COM_DATA(0x01, 0x0100); 6 | LCD_Write_COM_DATA(0x02, 0x0700); 7 | LCD_Write_COM_DATA(0x03, 0x1030); 8 | LCD_Write_COM_DATA(0x04, 0x0000); 9 | LCD_Write_COM_DATA(0x08, 0x0202); 10 | LCD_Write_COM_DATA(0x09, 0x0000); 11 | LCD_Write_COM_DATA(0x0A, 0x0000); 12 | LCD_Write_COM_DATA(0x0C, 0x0000); 13 | LCD_Write_COM_DATA(0x0D, 0x0000); 14 | LCD_Write_COM_DATA(0x0F, 0x0000); 15 | //-----Power On sequence----------------------- 16 | LCD_Write_COM_DATA(0x10, 0x0000); 17 | LCD_Write_COM_DATA(0x11, 0x0007); 18 | LCD_Write_COM_DATA(0x12, 0x0000); 19 | LCD_Write_COM_DATA(0x13, 0x0000); 20 | delay(50); 21 | LCD_Write_COM_DATA(0x10, 0x17B0); 22 | LCD_Write_COM_DATA(0x11, 0x0007); 23 | delay(10); 24 | LCD_Write_COM_DATA(0x12, 0x013A); 25 | delay(10); 26 | LCD_Write_COM_DATA(0x13, 0x1A00); 27 | LCD_Write_COM_DATA(0x29, 0x000c); 28 | delay(10); 29 | //-----Gamma control----------------------- 30 | LCD_Write_COM_DATA(0x30, 0x0000); 31 | LCD_Write_COM_DATA(0x31, 0x0505); 32 | LCD_Write_COM_DATA(0x32, 0x0004); 33 | LCD_Write_COM_DATA(0x35, 0x0006); 34 | LCD_Write_COM_DATA(0x36, 0x0707); 35 | LCD_Write_COM_DATA(0x37, 0x0105); 36 | LCD_Write_COM_DATA(0x38, 0x0002); 37 | LCD_Write_COM_DATA(0x39, 0x0707); 38 | LCD_Write_COM_DATA(0x3C, 0x0704); 39 | LCD_Write_COM_DATA(0x3D, 0x0807); 40 | //-----Set RAM area----------------------- 41 | LCD_Write_COM_DATA(0x50, 0x0000); 42 | LCD_Write_COM_DATA(0x51, 0x00EF); 43 | LCD_Write_COM_DATA(0x52, 0x0000); 44 | LCD_Write_COM_DATA(0x53, 0x013F); 45 | LCD_Write_COM_DATA(0x60, 0x2700); 46 | LCD_Write_COM_DATA(0x61, 0x0001); 47 | LCD_Write_COM_DATA(0x6A, 0x0000); 48 | LCD_Write_COM_DATA(0x21, 0x0000); 49 | LCD_Write_COM_DATA(0x20, 0x0000); 50 | //-----Partial Display Control------------ 51 | LCD_Write_COM_DATA(0x80, 0x0000); 52 | LCD_Write_COM_DATA(0x81, 0x0000); 53 | LCD_Write_COM_DATA(0x82, 0x0000); 54 | LCD_Write_COM_DATA(0x83, 0x0000); 55 | LCD_Write_COM_DATA(0x84, 0x0000); 56 | LCD_Write_COM_DATA(0x85, 0x0000); 57 | //-----Panel Control---------------------- 58 | LCD_Write_COM_DATA(0x90, 0x0010); 59 | LCD_Write_COM_DATA(0x92, 0x0000); 60 | LCD_Write_COM_DATA(0x93, 0x0003); 61 | LCD_Write_COM_DATA(0x95, 0x0110); 62 | LCD_Write_COM_DATA(0x97, 0x0000); 63 | LCD_Write_COM_DATA(0x98, 0x0000); 64 | //-----Display on----------------------- 65 | LCD_Write_COM_DATA(0x07, 0x0173); 66 | delay(50); 67 | break; 68 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/ili9320/setxy.h: -------------------------------------------------------------------------------- 1 | case ILI9320_8: 2 | case ILI9320_16: 3 | LCD_Write_COM_DATA(0x20,x1); 4 | LCD_Write_COM_DATA(0x21,y1); 5 | LCD_Write_COM_DATA(0x50,x1); 6 | LCD_Write_COM_DATA(0x52,y1); 7 | LCD_Write_COM_DATA(0x51,x2); 8 | LCD_Write_COM_DATA(0x53,y2); 9 | LCD_Write_COM(0x22); 10 | break; 11 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/ili9325c/initlcd.h: -------------------------------------------------------------------------------- 1 | case ILI9325C: 2 | LCD_Write_COM_DATA(0xE5, 0x78F0); // set SRAM internal timing 3 | LCD_Write_COM_DATA(0x01, 0x0100); // set Driver Output Control 4 | LCD_Write_COM_DATA(0x02, 0x0700); // set 1 line inversion 5 | LCD_Write_COM_DATA(0x03, 0x1030); // set GRAM write direction and BGR=1. 6 | LCD_Write_COM_DATA(0x04, 0x0000); // Resize register 7 | LCD_Write_COM_DATA(0x08, 0x0207); // set the back porch and front porch 8 | LCD_Write_COM_DATA(0x09, 0x0000); // set non-display area refresh cycle ISC[3:0] 9 | LCD_Write_COM_DATA(0x0A, 0x0000); // FMARK function 10 | LCD_Write_COM_DATA(0x0C, 0x0000); // RGB interface setting 11 | LCD_Write_COM_DATA(0x0D, 0x0000); // Frame marker Position 12 | LCD_Write_COM_DATA(0x0F, 0x0000); // RGB interface polarity 13 | //*************Power On sequence ****************// 14 | LCD_Write_COM_DATA(0x10, 0x0000); // SAP, BT[3:0], AP, DSTB, SLP, STB 15 | LCD_Write_COM_DATA(0x11, 0x0007); // DC1[2:0], DC0[2:0], VC[2:0] 16 | LCD_Write_COM_DATA(0x12, 0x0000); // VREG1OUT voltage 17 | LCD_Write_COM_DATA(0x13, 0x0000); // VDV[4:0] for VCOM amplitude 18 | LCD_Write_COM_DATA(0x07, 0x0001); 19 | delay(200); // Dis-charge capacitor power voltage 20 | LCD_Write_COM_DATA(0x10, 0x1090); // SAP, BT[3:0], AP, DSTB, SLP, STB 21 | LCD_Write_COM_DATA(0x11, 0x0227); // Set DC1[2:0], DC0[2:0], VC[2:0] 22 | delay(50); // Delay 50ms 23 | LCD_Write_COM_DATA(0x12, 0x001F); // 0012 24 | delay(50); // Delay 50ms 25 | LCD_Write_COM_DATA(0x13, 0x1500); // VDV[4:0] for VCOM amplitude 26 | LCD_Write_COM_DATA(0x29, 0x0027); // 04 VCM[5:0] for VCOMH 27 | LCD_Write_COM_DATA(0x2B, 0x000D); // Set Frame Rate 28 | delay(50); // Delay 50ms 29 | LCD_Write_COM_DATA(0x20, 0x0000); // GRAM horizontal Address 30 | LCD_Write_COM_DATA(0x21, 0x0000); // GRAM Vertical Address 31 | // ----------- Adjust the Gamma Curve ----------// 32 | LCD_Write_COM_DATA(0x30, 0x0000); 33 | LCD_Write_COM_DATA(0x31, 0x0707); 34 | LCD_Write_COM_DATA(0x32, 0x0307); 35 | LCD_Write_COM_DATA(0x35, 0x0200); 36 | LCD_Write_COM_DATA(0x36, 0x0008); 37 | LCD_Write_COM_DATA(0x37, 0x0004); 38 | LCD_Write_COM_DATA(0x38, 0x0000); 39 | LCD_Write_COM_DATA(0x39, 0x0707); 40 | LCD_Write_COM_DATA(0x3C, 0x0002); 41 | LCD_Write_COM_DATA(0x3D, 0x1D04); 42 | //------------------ Set GRAM area ---------------// 43 | LCD_Write_COM_DATA(0x50, 0x0000); // Horizontal GRAM Start Address 44 | LCD_Write_COM_DATA(0x51, 0x00EF); // Horizontal GRAM End Address 45 | LCD_Write_COM_DATA(0x52, 0x0000); // Vertical GRAM Start Address 46 | LCD_Write_COM_DATA(0x53, 0x013F); // Vertical GRAM Start Address 47 | LCD_Write_COM_DATA(0x60, 0xA700); // Gate Scan Line 48 | LCD_Write_COM_DATA(0x61, 0x0001); // NDL,VLE, REV 49 | LCD_Write_COM_DATA(0x6A, 0x0000); // set scrolling line 50 | //-------------- Partial Display Control ---------// 51 | LCD_Write_COM_DATA(0x80, 0x0000); 52 | LCD_Write_COM_DATA(0x81, 0x0000); 53 | LCD_Write_COM_DATA(0x82, 0x0000); 54 | LCD_Write_COM_DATA(0x83, 0x0000); 55 | LCD_Write_COM_DATA(0x84, 0x0000); 56 | LCD_Write_COM_DATA(0x85, 0x0000); 57 | //-------------- Panel Control -------------------// 58 | LCD_Write_COM_DATA(0x90, 0x0010); 59 | LCD_Write_COM_DATA(0x92, 0x0600); 60 | LCD_Write_COM_DATA(0x07, 0x0133); // 262K color and display ON 61 | break; 62 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/ili9325c/setxy.h: -------------------------------------------------------------------------------- 1 | case ILI9325C: 2 | LCD_Write_COM_DATA(0x20,x1); 3 | LCD_Write_COM_DATA(0x21,y1); 4 | LCD_Write_COM_DATA(0x50,x1); 5 | LCD_Write_COM_DATA(0x52,y1); 6 | LCD_Write_COM_DATA(0x51,x2); 7 | LCD_Write_COM_DATA(0x53,y2); 8 | LCD_Write_COM(0x22); 9 | break; 10 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/ili9325d/alt/initlcd.h: -------------------------------------------------------------------------------- 1 | case ILI9325D_16ALT: 2 | LCD_Write_COM_DATA(0xE5, 0x78F0); // set SRAM internal timing 3 | LCD_Write_COM_DATA(0x01, 0x0100); // set Driver Output Control 4 | LCD_Write_COM_DATA(0x02, 0x0700); // set 1 line inversion 5 | LCD_Write_COM_DATA(0x03, 0x1030); // set GRAM write direction and BGR=1. 6 | LCD_Write_COM_DATA(0x04, 0x0000); // Resize register 7 | LCD_Write_COM_DATA(0x08, 0x0207); // set the back porch and front porch 8 | LCD_Write_COM_DATA(0x09, 0x0000); // set non-display area refresh cycle ISC[3:0] 9 | LCD_Write_COM_DATA(0x0A, 0x0000); // FMARK function 10 | LCD_Write_COM_DATA(0x0C, 0x0000); // RGB interface setting 11 | LCD_Write_COM_DATA(0x0D, 0x0000); // Frame marker Position 12 | LCD_Write_COM_DATA(0x0F, 0x0000); // RGB interface polarity 13 | //*************Power On sequence ****************// 14 | LCD_Write_COM_DATA(0x10, 0x0000); // SAP, BT[3:0], AP, DSTB, SLP, STB 15 | LCD_Write_COM_DATA(0x11, 0x0007); // DC1[2:0], DC0[2:0], VC[2:0] 16 | LCD_Write_COM_DATA(0x12, 0x0000); // VREG1OUT voltage 17 | LCD_Write_COM_DATA(0x13, 0x0000); // VDV[4:0] for VCOM amplitude 18 | LCD_Write_COM_DATA(0x07, 0x0001); 19 | delay(200); // Dis-charge capacitor power voltage 20 | LCD_Write_COM_DATA(0x10, 0x1590); // SAP, BT[3:0], AP, DSTB, SLP, STB 21 | LCD_Write_COM_DATA(0x11, 0x0227); // Set DC1[2:0], DC0[2:0], VC[2:0] 22 | delay(50); // Delay 50ms 23 | LCD_Write_COM_DATA(0x12, 0x009C); // 0012 24 | delay(50); // Delay 50ms 25 | LCD_Write_COM_DATA(0x13, 0x1900); // VDV[4:0] for VCOM amplitude 26 | LCD_Write_COM_DATA(0x29, 0x0023); // 04 VCM[5:0] for VCOMH 27 | LCD_Write_COM_DATA(0x2B, 0x000E); // Set Frame Rate 28 | delay(50); // Delay 50ms 29 | LCD_Write_COM_DATA(0x20, 0x0000); // GRAM horizontal Address 30 | LCD_Write_COM_DATA(0x21, 0x0000); // GRAM Vertical Address 31 | // ----------- Adjust the Gamma Curve ----------// 32 | LCD_Write_COM_DATA(0x30, 0x0000); 33 | LCD_Write_COM_DATA(0x31, 0x0404); 34 | LCD_Write_COM_DATA(0x32, 0x0003); 35 | LCD_Write_COM_DATA(0x35, 0x0405); 36 | LCD_Write_COM_DATA(0x36, 0x0808); 37 | LCD_Write_COM_DATA(0x37, 0x0407); 38 | LCD_Write_COM_DATA(0x38, 0x0303); 39 | LCD_Write_COM_DATA(0x39, 0x0707); 40 | LCD_Write_COM_DATA(0x3C, 0x0504); 41 | LCD_Write_COM_DATA(0x3D, 0x0808); 42 | //------------------ Set GRAM area ---------------// 43 | LCD_Write_COM_DATA(0x50, 0x0000); // Horizontal GRAM Start Address 44 | LCD_Write_COM_DATA(0x51, 0x00EF); // Horizontal GRAM End Address 45 | LCD_Write_COM_DATA(0x52, 0x0000); // Vertical GRAM Start Address 46 | LCD_Write_COM_DATA(0x53, 0x013F); // Vertical GRAM Start Address 47 | LCD_Write_COM_DATA(0x60, 0xA700); // Gate Scan Line 48 | LCD_Write_COM_DATA(0x61, 0x0001); // NDL,VLE, REV 49 | LCD_Write_COM_DATA(0x6A, 0x0000); // set scrolling line 50 | //-------------- Partial Display Control ---------// 51 | LCD_Write_COM_DATA(0x80, 0x0000); 52 | LCD_Write_COM_DATA(0x81, 0x0000); 53 | LCD_Write_COM_DATA(0x82, 0x0000); 54 | LCD_Write_COM_DATA(0x83, 0x0000); 55 | LCD_Write_COM_DATA(0x84, 0x0000); 56 | LCD_Write_COM_DATA(0x85, 0x0000); 57 | //-------------- Panel Control -------------------// 58 | LCD_Write_COM_DATA(0x90, 0x0010); 59 | LCD_Write_COM_DATA(0x92, 0x0000); 60 | LCD_Write_COM_DATA(0x07, 0x0133); // 262K color and display ON 61 | break; 62 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/ili9325d/alt/setxy.h: -------------------------------------------------------------------------------- 1 | case ILI9325D_16ALT: 2 | LCD_Write_COM_DATA(0x20,x1); 3 | LCD_Write_COM_DATA(0x21,y1); 4 | LCD_Write_COM_DATA(0x50,x1); 5 | LCD_Write_COM_DATA(0x52,y1); 6 | LCD_Write_COM_DATA(0x51,x2); 7 | LCD_Write_COM_DATA(0x53,y2); 8 | LCD_Write_COM(0x22); 9 | break; 10 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/ili9325d/default/initlcd.h: -------------------------------------------------------------------------------- 1 | case ILI9325D_8: 2 | case ILI9325D_16: 3 | LCD_Write_COM_DATA(0xE5, 0x78F0); // set SRAM internal timing 4 | LCD_Write_COM_DATA(0x01, 0x0100); // set Driver Output Control 5 | LCD_Write_COM_DATA(0x02, 0x0200); // set 1 line inversion 6 | LCD_Write_COM_DATA(0x03, 0x1030); // set GRAM write direction and BGR=1. 7 | LCD_Write_COM_DATA(0x04, 0x0000); // Resize register 8 | LCD_Write_COM_DATA(0x08, 0x0207); // set the back porch and front porch 9 | LCD_Write_COM_DATA(0x09, 0x0000); // set non-display area refresh cycle ISC[3:0] 10 | LCD_Write_COM_DATA(0x0A, 0x0000); // FMARK function 11 | LCD_Write_COM_DATA(0x0C, 0x0000); // RGB interface setting 12 | LCD_Write_COM_DATA(0x0D, 0x0000); // Frame marker Position 13 | LCD_Write_COM_DATA(0x0F, 0x0000); // RGB interface polarity 14 | //*************Power On sequence ****************// 15 | LCD_Write_COM_DATA(0x10, 0x0000); // SAP, BT[3:0], AP, DSTB, SLP, STB 16 | LCD_Write_COM_DATA(0x11, 0x0007); // DC1[2:0], DC0[2:0], VC[2:0] 17 | LCD_Write_COM_DATA(0x12, 0x0000); // VREG1OUT voltage 18 | LCD_Write_COM_DATA(0x13, 0x0000); // VDV[4:0] for VCOM amplitude 19 | LCD_Write_COM_DATA(0x07, 0x0001); 20 | delay(200); // Dis-charge capacitor power voltage 21 | LCD_Write_COM_DATA(0x10, 0x1690); // SAP, BT[3:0], AP, DSTB, SLP, STB 22 | LCD_Write_COM_DATA(0x11, 0x0227); // Set DC1[2:0], DC0[2:0], VC[2:0] 23 | delay(50); // Delay 50ms 24 | LCD_Write_COM_DATA(0x12, 0x000D); // 0012 25 | delay(50); // Delay 50ms 26 | LCD_Write_COM_DATA(0x13, 0x1200); // VDV[4:0] for VCOM amplitude 27 | LCD_Write_COM_DATA(0x29, 0x000A); // 04 VCM[5:0] for VCOMH 28 | LCD_Write_COM_DATA(0x2B, 0x000D); // Set Frame Rate 29 | delay(50); // Delay 50ms 30 | LCD_Write_COM_DATA(0x20, 0x0000); // GRAM horizontal Address 31 | LCD_Write_COM_DATA(0x21, 0x0000); // GRAM Vertical Address 32 | // ----------- Adjust the Gamma Curve ----------// 33 | LCD_Write_COM_DATA(0x30, 0x0000); 34 | LCD_Write_COM_DATA(0x31, 0x0404); 35 | LCD_Write_COM_DATA(0x32, 0x0003); 36 | LCD_Write_COM_DATA(0x35, 0x0405); 37 | LCD_Write_COM_DATA(0x36, 0x0808); 38 | LCD_Write_COM_DATA(0x37, 0x0407); 39 | LCD_Write_COM_DATA(0x38, 0x0303); 40 | LCD_Write_COM_DATA(0x39, 0x0707); 41 | LCD_Write_COM_DATA(0x3C, 0x0504); 42 | LCD_Write_COM_DATA(0x3D, 0x0808); 43 | //------------------ Set GRAM area ---------------// 44 | LCD_Write_COM_DATA(0x50, 0x0000); // Horizontal GRAM Start Address 45 | LCD_Write_COM_DATA(0x51, 0x00EF); // Horizontal GRAM End Address 46 | LCD_Write_COM_DATA(0x52, 0x0000); // Vertical GRAM Start Address 47 | LCD_Write_COM_DATA(0x53, 0x013F); // Vertical GRAM Start Address 48 | LCD_Write_COM_DATA(0x60, 0xA700); // Gate Scan Line 49 | LCD_Write_COM_DATA(0x61, 0x0001); // NDL,VLE, REV 50 | LCD_Write_COM_DATA(0x6A, 0x0000); // set scrolling line 51 | //-------------- Partial Display Control ---------// 52 | LCD_Write_COM_DATA(0x80, 0x0000); 53 | LCD_Write_COM_DATA(0x81, 0x0000); 54 | LCD_Write_COM_DATA(0x82, 0x0000); 55 | LCD_Write_COM_DATA(0x83, 0x0000); 56 | LCD_Write_COM_DATA(0x84, 0x0000); 57 | LCD_Write_COM_DATA(0x85, 0x0000); 58 | //-------------- Panel Control -------------------// 59 | LCD_Write_COM_DATA(0x90, 0x0010); 60 | LCD_Write_COM_DATA(0x92, 0x0000); 61 | LCD_Write_COM_DATA(0x07, 0x0133); // 262K color and display ON 62 | break; 63 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/ili9325d/default/setxy.h: -------------------------------------------------------------------------------- 1 | case ILI9325D_8: 2 | case ILI9325D_16: 3 | LCD_Write_COM_DATA(0x20,x1); 4 | LCD_Write_COM_DATA(0x21,y1); 5 | LCD_Write_COM_DATA(0x50,x1); 6 | LCD_Write_COM_DATA(0x52,y1); 7 | LCD_Write_COM_DATA(0x51,x2); 8 | LCD_Write_COM_DATA(0x53,y2); 9 | LCD_Write_COM(0x22); 10 | break; 11 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/ili9327/initlcd.h: -------------------------------------------------------------------------------- 1 | case ILI9327: 2 | LCD_Write_COM(0xE9); 3 | LCD_Write_DATA(0x00,0x20); 4 | LCD_Write_COM(0x11); //Exit Sleep 5 | delay(100); 6 | LCD_Write_COM(0xD1); 7 | LCD_Write_DATA(0x00,0x00); 8 | LCD_Write_DATA(0x00,0x71); 9 | LCD_Write_DATA(0x00,0x19); 10 | LCD_Write_COM(0xD0); 11 | LCD_Write_DATA(0x00,0x07); 12 | LCD_Write_DATA(0x00,0x01); 13 | LCD_Write_DATA(0x00,0x08); 14 | LCD_Write_COM(0x36); 15 | LCD_Write_DATA(0x00,0x48); 16 | LCD_Write_COM(0x3A); 17 | LCD_Write_DATA(0x00,0x05); 18 | LCD_Write_COM(0xC1); 19 | LCD_Write_DATA(0x00,0x10); 20 | LCD_Write_DATA(0x00,0x10); 21 | LCD_Write_DATA(0x00,0x02); 22 | LCD_Write_DATA(0x00,0x02); 23 | LCD_Write_COM(0xC0); //Set Default Gamma 24 | LCD_Write_DATA(0x00,0x00); 25 | LCD_Write_DATA(0x00,0x35); 26 | LCD_Write_DATA(0x00,0x00); 27 | LCD_Write_DATA(0x00,0x00); 28 | LCD_Write_DATA(0x00,0x01); 29 | LCD_Write_DATA(0x00,0x02); 30 | LCD_Write_COM(0xC5); //Set frame rate 31 | LCD_Write_DATA(0x00,0x04); 32 | LCD_Write_COM(0xD2); //power setting 33 | LCD_Write_DATA(0x00,0x01); 34 | LCD_Write_DATA(0x00,0x44); 35 | LCD_Write_COM(0xC8); //Set Gamma 36 | LCD_Write_DATA(0x00,0x04); 37 | LCD_Write_DATA(0x00,0x67); 38 | LCD_Write_DATA(0x00,0x35); 39 | LCD_Write_DATA(0x00,0x04); 40 | LCD_Write_DATA(0x00,0x08); 41 | LCD_Write_DATA(0x00,0x06); 42 | LCD_Write_DATA(0x00,0x24); 43 | LCD_Write_DATA(0x00,0x01); 44 | LCD_Write_DATA(0x00,0x37); 45 | LCD_Write_DATA(0x00,0x40); 46 | LCD_Write_DATA(0x00,0x03); 47 | LCD_Write_DATA(0x00,0x10); 48 | LCD_Write_DATA(0x00,0x08); 49 | LCD_Write_DATA(0x00,0x80); 50 | LCD_Write_DATA(0x00,0x00); 51 | LCD_Write_COM(0x2A); 52 | LCD_Write_DATA(0x00,0x00); 53 | LCD_Write_DATA(0x00,0x00); 54 | LCD_Write_DATA(0x00,0x00); 55 | LCD_Write_DATA(0x00,0xeF); 56 | LCD_Write_COM(0x2B); 57 | LCD_Write_DATA(0x00,0x00); 58 | LCD_Write_DATA(0x00,0x00); 59 | LCD_Write_DATA(0x00,0x01); 60 | LCD_Write_DATA(0x00,0x8F); 61 | LCD_Write_COM(0x29); //display on 62 | LCD_Write_COM(0x2C); //display on 63 | break; 64 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/ili9327/setxy.h: -------------------------------------------------------------------------------- 1 | case ILI9327: 2 | LCD_Write_COM(0x2a); 3 | LCD_Write_DATA(0x00,x1>>8); 4 | LCD_Write_DATA(0x00,x1); 5 | LCD_Write_DATA(0x00,x2>>8); 6 | LCD_Write_DATA(0x00,x2); 7 | LCD_Write_COM(0x2b); 8 | LCD_Write_DATA(0x00,y1>>8); 9 | LCD_Write_DATA(0x00,y1); 10 | LCD_Write_DATA(0x00,y2>>8); 11 | LCD_Write_DATA(0x00,y2); 12 | LCD_Write_COM(0x2c); 13 | break; 14 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/ili9341/s4p/initlcd.h: -------------------------------------------------------------------------------- 1 | case ILI9341_S4P: 2 | LCD_Write_COM(0x11);//sleep out 3 | delay(20); 4 | //LCD_Write_COM(0x01); //reset 5 | //delay(15); 6 | LCD_Write_COM(0x28); //display off 7 | delay(5); 8 | LCD_Write_COM(0xCF); //power control b 9 | LCD_Write_DATA(0x00); 10 | LCD_Write_DATA(0x83); //83 81 AA 11 | LCD_Write_DATA(0x30); 12 | LCD_Write_COM(0xED); //power on seq control 13 | LCD_Write_DATA(0x64); //64 67 14 | LCD_Write_DATA(0x03); 15 | LCD_Write_DATA(0x12); 16 | LCD_Write_DATA(0x81); 17 | LCD_Write_COM(0xE8); //timing control a 18 | LCD_Write_DATA(0x85); 19 | LCD_Write_DATA(0x01); 20 | LCD_Write_DATA(0x79); //79 78 21 | LCD_Write_COM(0xCB); //power control a 22 | LCD_Write_DATA(0x39); 23 | LCD_Write_DATA(0X2C); 24 | LCD_Write_DATA(0x00); 25 | LCD_Write_DATA(0x34); 26 | LCD_Write_DATA(0x02); 27 | LCD_Write_COM(0xF7); //pump ratio control 28 | LCD_Write_DATA(0x20); 29 | LCD_Write_COM(0xEA); //timing control b 30 | LCD_Write_DATA(0x00); 31 | LCD_Write_DATA(0x00); 32 | LCD_Write_COM(0xC0); //power control 2 33 | LCD_Write_DATA(0x26); //26 25 34 | LCD_Write_COM(0xC1); //power control 2 35 | LCD_Write_DATA(0x11); 36 | LCD_Write_COM(0xC5); //vcom control 1 37 | LCD_Write_DATA(0x35); 38 | LCD_Write_DATA(0x3E); 39 | LCD_Write_COM(0xC7); //vcom control 2 40 | LCD_Write_DATA(0xBE); //BE 94 41 | LCD_Write_COM(0xB1); //frame control 42 | LCD_Write_DATA(0x00); 43 | LCD_Write_DATA(0x1B); //1B 70 44 | LCD_Write_COM(0xB6); //display control 45 | LCD_Write_DATA(0x0A); 46 | LCD_Write_DATA(0x82); 47 | LCD_Write_DATA(0x27); 48 | LCD_Write_DATA(0x00); 49 | LCD_Write_COM(0xB7); //emtry mode 50 | LCD_Write_DATA(0x07); 51 | LCD_Write_COM(0x3A); //pixel format 52 | LCD_Write_DATA(0x55); //16bit 53 | LCD_Write_COM(0x36); //mem access 54 | LCD_Write_DATA((1<<3)|(1<<6)); 55 | //LCD_Write_DATA((1<<3)|(1<<7)); //rotate 180 56 | LCD_Write_COM(0x29); //display on 57 | delay(5); 58 | break; 59 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/ili9341/s4p/setxy.h: -------------------------------------------------------------------------------- 1 | case ILI9341_S4P: 2 | LCD_Write_COM(0x2A); //column 3 | LCD_Write_DATA(x1>>8); 4 | LCD_Write_DATA(x1); 5 | LCD_Write_DATA(x2>>8); 6 | LCD_Write_DATA(x2); 7 | LCD_Write_COM(0x2B); //page 8 | LCD_Write_DATA(y1>>8); 9 | LCD_Write_DATA(y1); 10 | LCD_Write_DATA(y2>>8); 11 | LCD_Write_DATA(y2); 12 | LCD_Write_COM(0x2C); //write 13 | break; 14 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/ili9341/s5p/initlcd.h: -------------------------------------------------------------------------------- 1 | case ILI9341_S5P: 2 | LCD_Write_COM(0xCB); 3 | LCD_Write_DATA(0x39); 4 | LCD_Write_DATA(0x2C); 5 | LCD_Write_DATA(0x00); 6 | LCD_Write_DATA(0x34); 7 | LCD_Write_DATA(0x02); 8 | 9 | LCD_Write_COM(0xCF); 10 | LCD_Write_DATA(0x00); 11 | LCD_Write_DATA(0XC1); 12 | LCD_Write_DATA(0X30); 13 | 14 | LCD_Write_COM(0xE8); 15 | LCD_Write_DATA(0x85); 16 | LCD_Write_DATA(0x00); 17 | LCD_Write_DATA(0x78); 18 | 19 | LCD_Write_COM(0xEA); 20 | LCD_Write_DATA(0x00); 21 | LCD_Write_DATA(0x00); 22 | 23 | LCD_Write_COM(0xED); 24 | LCD_Write_DATA(0x64); 25 | LCD_Write_DATA(0x03); 26 | LCD_Write_DATA(0X12); 27 | LCD_Write_DATA(0X81); 28 | 29 | LCD_Write_COM(0xF7); 30 | LCD_Write_DATA(0x20); 31 | 32 | LCD_Write_COM(0xC0); //Power control 33 | LCD_Write_DATA(0x23); //VRH[5:0] 34 | 35 | LCD_Write_COM(0xC1); //Power control 36 | LCD_Write_DATA(0x10); //SAP[2:0];BT[3:0] 37 | 38 | LCD_Write_COM(0xC5); //VCM control 39 | LCD_Write_DATA(0x3e); //Contrast 40 | LCD_Write_DATA(0x28); 41 | 42 | LCD_Write_COM(0xC7); //VCM control2 43 | LCD_Write_DATA(0x86); //-- 44 | 45 | LCD_Write_COM(0x36); // Memory Access Control 46 | LCD_Write_DATA(0x48); 47 | 48 | LCD_Write_COM(0x3A); 49 | LCD_Write_DATA(0x55); 50 | 51 | LCD_Write_COM(0xB1); 52 | LCD_Write_DATA(0x00); 53 | LCD_Write_DATA(0x18); 54 | 55 | LCD_Write_COM(0xB6); // Display Function Control 56 | LCD_Write_DATA(0x08); 57 | LCD_Write_DATA(0x82); 58 | LCD_Write_DATA(0x27); 59 | /* 60 | LCD_Write_COM(0xF2); // 3Gamma Function Disable 61 | LCD_Write_DATA(0x00); 62 | 63 | LCD_Write_COM(0x26); //Gamma curve selected 64 | LCD_Write_DATA(0x01); 65 | 66 | LCD_Write_COM(0xE0); //Set Gamma 67 | LCD_Write_DATA(0x0F); 68 | LCD_Write_DATA(0x31); 69 | LCD_Write_DATA(0x2B); 70 | LCD_Write_DATA(0x0C); 71 | LCD_Write_DATA(0x0E); 72 | LCD_Write_DATA(0x08); 73 | LCD_Write_DATA(0x4E); 74 | LCD_Write_DATA(0xF1); 75 | LCD_Write_DATA(0x37); 76 | LCD_Write_DATA(0x07); 77 | LCD_Write_DATA(0x10); 78 | LCD_Write_DATA(0x03); 79 | LCD_Write_DATA(0x0E); 80 | LCD_Write_DATA(0x09); 81 | LCD_Write_DATA(0x00); 82 | 83 | LCD_Write_COM(0XE1); //Set Gamma 84 | LCD_Write_DATA(0x00); 85 | LCD_Write_DATA(0x0E); 86 | LCD_Write_DATA(0x14); 87 | LCD_Write_DATA(0x03); 88 | LCD_Write_DATA(0x11); 89 | LCD_Write_DATA(0x07); 90 | LCD_Write_DATA(0x31); 91 | LCD_Write_DATA(0xC1); 92 | LCD_Write_DATA(0x48); 93 | LCD_Write_DATA(0x08); 94 | LCD_Write_DATA(0x0F); 95 | LCD_Write_DATA(0x0C); 96 | LCD_Write_DATA(0x31); 97 | LCD_Write_DATA(0x36); 98 | LCD_Write_DATA(0x0F); 99 | */ 100 | LCD_Write_COM(0x11); //Exit Sleep 101 | delay(120); 102 | 103 | LCD_Write_COM(0x29); //Display on 104 | LCD_Write_COM(0x2c); 105 | break; 106 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/ili9341/s5p/setxy.h: -------------------------------------------------------------------------------- 1 | case ILI9341_S5P: 2 | LCD_Write_COM(0x2a); 3 | LCD_Write_DATA(x1>>8); 4 | LCD_Write_DATA(x1); 5 | LCD_Write_DATA(x2>>8); 6 | LCD_Write_DATA(x2); 7 | LCD_Write_COM(0x2b); 8 | LCD_Write_DATA(y1>>8); 9 | LCD_Write_DATA(y1); 10 | LCD_Write_DATA(y2>>8); 11 | LCD_Write_DATA(y2); 12 | LCD_Write_COM(0x2c); 13 | break; 14 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/ili9481/initlcd.h: -------------------------------------------------------------------------------- 1 | case ILI9481: 2 | LCD_Write_COM(0x11); 3 | delay(20); 4 | LCD_Write_COM(0xD0); 5 | LCD_Write_DATA(0x07); 6 | LCD_Write_DATA(0x42); 7 | LCD_Write_DATA(0x18); 8 | 9 | LCD_Write_COM(0xD1); 10 | LCD_Write_DATA(0x00); 11 | LCD_Write_DATA(0x07); 12 | LCD_Write_DATA(0x10); 13 | 14 | LCD_Write_COM(0xD2); 15 | LCD_Write_DATA(0x01); 16 | LCD_Write_DATA(0x02); 17 | 18 | LCD_Write_COM(0xC0); 19 | LCD_Write_DATA(0x10); 20 | LCD_Write_DATA(0x3B); 21 | LCD_Write_DATA(0x00); 22 | LCD_Write_DATA(0x02); 23 | LCD_Write_DATA(0x11); 24 | 25 | LCD_Write_COM(0xC5); 26 | LCD_Write_DATA(0x03); 27 | 28 | LCD_Write_COM(0xC8); 29 | LCD_Write_DATA(0x00); 30 | LCD_Write_DATA(0x32); 31 | LCD_Write_DATA(0x36); 32 | LCD_Write_DATA(0x45); 33 | LCD_Write_DATA(0x06); 34 | LCD_Write_DATA(0x16); 35 | LCD_Write_DATA(0x37); 36 | LCD_Write_DATA(0x75); 37 | LCD_Write_DATA(0x77); 38 | LCD_Write_DATA(0x54); 39 | LCD_Write_DATA(0x0C); 40 | LCD_Write_DATA(0x00); 41 | 42 | LCD_Write_COM(0x36); 43 | LCD_Write_DATA(0x0A); 44 | 45 | 46 | LCD_Write_COM(0x3A); 47 | LCD_Write_DATA(0x55); 48 | 49 | LCD_Write_COM(0x2A); 50 | LCD_Write_DATA(0x00); 51 | LCD_Write_DATA(0x00); 52 | LCD_Write_DATA(0x01); 53 | LCD_Write_DATA(0x3F); 54 | 55 | LCD_Write_COM(0x2B); 56 | LCD_Write_DATA(0x00); 57 | LCD_Write_DATA(0x00); 58 | LCD_Write_DATA(0x01); 59 | LCD_Write_DATA(0xE0); 60 | delay(120); 61 | LCD_Write_COM(0x29); 62 | break; 63 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/ili9481/setxy.h: -------------------------------------------------------------------------------- 1 | case ILI9481: 2 | LCD_Write_COM(0x2a); 3 | LCD_Write_DATA(x1>>8); 4 | LCD_Write_DATA(x1); 5 | LCD_Write_DATA(x2>>8); 6 | LCD_Write_DATA(x2); 7 | LCD_Write_COM(0x2b); 8 | LCD_Write_DATA(y1>>8); 9 | LCD_Write_DATA(y1); 10 | LCD_Write_DATA(y2>>8); 11 | LCD_Write_DATA(y2); 12 | LCD_Write_COM(0x2c); 13 | break; 14 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/ili9486/initlcd.h: -------------------------------------------------------------------------------- 1 | case ILI9486: 2 | LCD_Write_COM(0x11); // Sleep OUT 3 | delay(50); 4 | 5 | LCD_Write_COM(0xF2); // ????? 6 | LCD_Write_DATA(0x1C); 7 | LCD_Write_DATA(0xA3); 8 | LCD_Write_DATA(0x32); 9 | LCD_Write_DATA(0x02); 10 | LCD_Write_DATA(0xb2); 11 | LCD_Write_DATA(0x12); 12 | LCD_Write_DATA(0xFF); 13 | LCD_Write_DATA(0x12); 14 | LCD_Write_DATA(0x00); 15 | 16 | LCD_Write_COM(0xF1); // ????? 17 | LCD_Write_DATA(0x36); 18 | LCD_Write_DATA(0xA4); 19 | 20 | LCD_Write_COM(0xF8); // ????? 21 | LCD_Write_DATA(0x21); 22 | LCD_Write_DATA(0x04); 23 | 24 | LCD_Write_COM(0xF9); // ????? 25 | LCD_Write_DATA(0x00); 26 | LCD_Write_DATA(0x08); 27 | 28 | LCD_Write_COM(0xC0); // Power Control 1 29 | LCD_Write_DATA(0x0d); 30 | LCD_Write_DATA(0x0d); 31 | 32 | LCD_Write_COM(0xC1); // Power Control 2 33 | LCD_Write_DATA(0x43); 34 | LCD_Write_DATA(0x00); 35 | 36 | LCD_Write_COM(0xC2); // Power Control 3 37 | LCD_Write_DATA(0x00); 38 | 39 | LCD_Write_COM(0xC5); // VCOM Control 40 | LCD_Write_DATA(0x00); 41 | LCD_Write_DATA(0x48); 42 | 43 | LCD_Write_COM(0xB6); // Display Function Control 44 | LCD_Write_DATA(0x00); 45 | LCD_Write_DATA(0x22); // 0x42 = Rotate display 180 deg. 46 | LCD_Write_DATA(0x3B); 47 | 48 | LCD_Write_COM(0xE0); // PGAMCTRL (Positive Gamma Control) 49 | LCD_Write_DATA(0x0f); 50 | LCD_Write_DATA(0x24); 51 | LCD_Write_DATA(0x1c); 52 | LCD_Write_DATA(0x0a); 53 | LCD_Write_DATA(0x0f); 54 | LCD_Write_DATA(0x08); 55 | LCD_Write_DATA(0x43); 56 | LCD_Write_DATA(0x88); 57 | LCD_Write_DATA(0x32); 58 | LCD_Write_DATA(0x0f); 59 | LCD_Write_DATA(0x10); 60 | LCD_Write_DATA(0x06); 61 | LCD_Write_DATA(0x0f); 62 | LCD_Write_DATA(0x07); 63 | LCD_Write_DATA(0x00); 64 | 65 | LCD_Write_COM(0xE1); // NGAMCTRL (Negative Gamma Control) 66 | LCD_Write_DATA(0x0F); 67 | LCD_Write_DATA(0x38); 68 | LCD_Write_DATA(0x30); 69 | LCD_Write_DATA(0x09); 70 | LCD_Write_DATA(0x0f); 71 | LCD_Write_DATA(0x0f); 72 | LCD_Write_DATA(0x4e); 73 | LCD_Write_DATA(0x77); 74 | LCD_Write_DATA(0x3c); 75 | LCD_Write_DATA(0x07); 76 | LCD_Write_DATA(0x10); 77 | LCD_Write_DATA(0x05); 78 | LCD_Write_DATA(0x23); 79 | LCD_Write_DATA(0x1b); 80 | LCD_Write_DATA(0x00); 81 | 82 | LCD_Write_COM(0x20); // Display Inversion OFF 83 | LCD_Write_DATA(0x00);//C8 84 | 85 | LCD_Write_COM(0x36); // Memory Access Control 86 | LCD_Write_DATA(0x0A); 87 | 88 | LCD_Write_COM(0x3A); // Interface Pixel Format 89 | LCD_Write_DATA(0x55); 90 | 91 | LCD_Write_COM(0x2A); // Column Addess Set 92 | LCD_Write_DATA(0x00); 93 | LCD_Write_DATA(0x00); 94 | LCD_Write_DATA(0x01); 95 | LCD_Write_DATA(0xDF); 96 | 97 | LCD_Write_COM(0x002B); // Page Address Set 98 | LCD_Write_DATA(0x00); 99 | LCD_Write_DATA(0x00); 100 | LCD_Write_DATA(0x01); 101 | LCD_Write_DATA(0x3f); 102 | delay(50); 103 | LCD_Write_COM(0x0029); // Display ON 104 | LCD_Write_COM(0x002C); // Memory Write 105 | break; 106 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/ili9486/setxy.h: -------------------------------------------------------------------------------- 1 | case ILI9486: 2 | LCD_Write_COM(0x2a); 3 | LCD_Write_DATA(x1>>8); 4 | LCD_Write_DATA(x1); 5 | LCD_Write_DATA(x2>>8); 6 | LCD_Write_DATA(x2); 7 | LCD_Write_COM(0x2b); 8 | LCD_Write_DATA(y1>>8); 9 | LCD_Write_DATA(y1); 10 | LCD_Write_DATA(y2>>8); 11 | LCD_Write_DATA(y2); 12 | LCD_Write_COM(0x2c); 13 | break; 14 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/pcf8833/initlcd.h: -------------------------------------------------------------------------------- 1 | case PCF8833: 2 | LCD_Write_COM(0x01); 3 | LCD_Write_COM(0x25); 4 | LCD_Write_DATA(0x40); 5 | LCD_Write_COM(0x11); 6 | delay(10); 7 | LCD_Write_COM(0x20); 8 | LCD_Write_COM(0x38); 9 | LCD_Write_COM(0x29); 10 | LCD_Write_COM(0x13); 11 | LCD_Write_COM(0x36); 12 | LCD_Write_DATA(0x60); 13 | LCD_Write_COM(0x3A); 14 | LCD_Write_DATA(0x05); 15 | LCD_Write_COM(0x2A); 16 | LCD_Write_DATA(0x00); 17 | LCD_Write_DATA(0x7F); 18 | LCD_Write_COM(0xB4); 19 | LCD_Write_DATA(0x03); 20 | LCD_Write_DATA(0x08); 21 | LCD_Write_DATA(0x0b); 22 | LCD_Write_DATA(0x0e); 23 | LCD_Write_COM(0xBA); 24 | LCD_Write_DATA(0x07); 25 | LCD_Write_DATA(0x0D); 26 | LCD_Write_COM(0x2B); 27 | LCD_Write_DATA(0x00); 28 | LCD_Write_DATA(0x7F); 29 | LCD_Write_COM(0x2C); 30 | break; 31 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/pcf8833/setxy.h: -------------------------------------------------------------------------------- 1 | case PCF8833: 2 | LCD_Write_COM(0x2a); 3 | LCD_Write_DATA(x1); 4 | LCD_Write_DATA(x2); 5 | LCD_Write_COM(0x2b); 6 | LCD_Write_DATA(y1); 7 | LCD_Write_DATA(y2); 8 | LCD_Write_COM(0x2c); 9 | break; 10 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/r61581/initlcd.h: -------------------------------------------------------------------------------- 1 | case R61581: 2 | LCD_Write_COM(0xB0); 3 | LCD_Write_DATA(0x1E); 4 | 5 | LCD_Write_COM(0xB0); 6 | LCD_Write_DATA(0x00); 7 | 8 | LCD_Write_COM(0xB3); 9 | LCD_Write_DATA(0x02); 10 | LCD_Write_DATA(0x00); 11 | LCD_Write_DATA(0x00); 12 | LCD_Write_DATA(0x10); 13 | 14 | LCD_Write_COM(0xB4); 15 | LCD_Write_DATA(0x00);//0X10 16 | 17 | // LCD_Write_COM(0xB9); //PWM Settings for Brightness Control 18 | // LCD_Write_DATA(0x01);// Disabled by default. 19 | // LCD_Write_DATA(0xFF); //0xFF = Max brightness 20 | // LCD_Write_DATA(0xFF); 21 | // LCD_Write_DATA(0x18); 22 | 23 | LCD_Write_COM(0xC0); 24 | LCD_Write_DATA(0x03); 25 | LCD_Write_DATA(0x3B);// 26 | LCD_Write_DATA(0x00); 27 | LCD_Write_DATA(0x00); 28 | LCD_Write_DATA(0x00); 29 | LCD_Write_DATA(0x01); 30 | LCD_Write_DATA(0x00);//NW 31 | LCD_Write_DATA(0x43); 32 | 33 | LCD_Write_COM(0xC1); 34 | LCD_Write_DATA(0x08); 35 | LCD_Write_DATA(0x15);//CLOCK 36 | LCD_Write_DATA(0x08); 37 | LCD_Write_DATA(0x08); 38 | 39 | LCD_Write_COM(0xC4); 40 | LCD_Write_DATA(0x15); 41 | LCD_Write_DATA(0x03); 42 | LCD_Write_DATA(0x03); 43 | LCD_Write_DATA(0x01); 44 | 45 | LCD_Write_COM(0xC6); 46 | LCD_Write_DATA(0x02); 47 | 48 | LCD_Write_COM(0xC8); 49 | LCD_Write_DATA(0x0c); 50 | LCD_Write_DATA(0x05); 51 | LCD_Write_DATA(0x0A);//0X12 52 | LCD_Write_DATA(0x6B);//0x7D 53 | LCD_Write_DATA(0x04); 54 | LCD_Write_DATA(0x06);//0x08 55 | LCD_Write_DATA(0x15);//0x0A 56 | LCD_Write_DATA(0x10); 57 | LCD_Write_DATA(0x00); 58 | LCD_Write_DATA(0x60);//0x23 59 | 60 | LCD_Write_COM(0x36); 61 | LCD_Write_DATA(0x0A); 62 | 63 | LCD_Write_COM(0x0C); 64 | LCD_Write_DATA(0x55); 65 | 66 | LCD_Write_COM(0x3A); 67 | LCD_Write_DATA(0x55); 68 | 69 | LCD_Write_COM(0x38); 70 | 71 | LCD_Write_COM(0xD0); 72 | LCD_Write_DATA(0x07); 73 | LCD_Write_DATA(0x07);//VCI1 74 | LCD_Write_DATA(0x14);//VRH 0x1D 75 | LCD_Write_DATA(0xA2);//BT 0x06 76 | 77 | LCD_Write_COM(0xD1); 78 | LCD_Write_DATA(0x03); 79 | LCD_Write_DATA(0x5A);//VCM 0x5A 80 | LCD_Write_DATA(0x10);//VDV 81 | 82 | LCD_Write_COM(0xD2); 83 | LCD_Write_DATA(0x03); 84 | LCD_Write_DATA(0x04);//0x24 85 | LCD_Write_DATA(0x04); 86 | 87 | LCD_Write_COM(0x11); 88 | delay(150); 89 | 90 | LCD_Write_COM(0x2A); 91 | LCD_Write_DATA(0x00); 92 | LCD_Write_DATA(0x00); 93 | LCD_Write_DATA(0x01); 94 | LCD_Write_DATA(0xDF);//320 95 | 96 | LCD_Write_COM(0x2B); 97 | LCD_Write_DATA(0x00); 98 | LCD_Write_DATA(0x00); 99 | LCD_Write_DATA(0x01); 100 | LCD_Write_DATA(0x3F);//480 101 | 102 | 103 | delay(100); 104 | 105 | LCD_Write_COM(0x29); 106 | delay(30); 107 | 108 | LCD_Write_COM(0x2C); 109 | delay(30); 110 | break; 111 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/r61581/setxy.h: -------------------------------------------------------------------------------- 1 | case R61581: 2 | LCD_Write_COM(0x2a); 3 | LCD_Write_DATA(x1>>8); 4 | LCD_Write_DATA(x1); 5 | LCD_Write_DATA(x2>>8); 6 | LCD_Write_DATA(x2); 7 | LCD_Write_COM(0x2b); 8 | LCD_Write_DATA(y1>>8); 9 | LCD_Write_DATA(y1); 10 | LCD_Write_DATA(y2>>8); 11 | LCD_Write_DATA(y2); 12 | LCD_Write_COM(0x2c); 13 | break; 14 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/s1d19122/setxy.h: -------------------------------------------------------------------------------- 1 | case S1D19122: 2 | LCD_Write_COM(0x2a); 3 | LCD_Write_DATA(x1>>8); 4 | LCD_Write_DATA(x1); 5 | LCD_Write_DATA(x2>>8); 6 | LCD_Write_DATA(x2); 7 | LCD_Write_COM(0x2b); 8 | LCD_Write_DATA(y1>>8); 9 | LCD_Write_DATA(y1); 10 | LCD_Write_DATA(y2>>8); 11 | LCD_Write_DATA(y2); 12 | LCD_Write_COM(0x2c); 13 | break; 14 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/s6d0164/initlcd.h: -------------------------------------------------------------------------------- 1 | case S6D0164: 2 | LCD_Write_COM_DATA(0x11,0x001A); 3 | LCD_Write_COM_DATA(0x12,0x3121); 4 | LCD_Write_COM_DATA(0x13,0x006C); 5 | LCD_Write_COM_DATA(0x14,0x4249); 6 | 7 | LCD_Write_COM_DATA(0x10,0x0800); 8 | delay(10); 9 | LCD_Write_COM_DATA(0x11,0x011A); 10 | delay(10); 11 | LCD_Write_COM_DATA(0x11,0x031A); 12 | delay(10); 13 | LCD_Write_COM_DATA(0x11,0x071A); 14 | delay(10); 15 | LCD_Write_COM_DATA(0x11,0x0F1A); 16 | delay(10); 17 | LCD_Write_COM_DATA(0x11,0x0F3A); 18 | delay(30); 19 | 20 | LCD_Write_COM_DATA(0x01,0x011C); 21 | LCD_Write_COM_DATA(0x02,0x0100); 22 | LCD_Write_COM_DATA(0x03,0x1030); 23 | LCD_Write_COM_DATA(0x07,0x0000); 24 | LCD_Write_COM_DATA(0x08,0x0808); 25 | LCD_Write_COM_DATA(0x0B,0x1100); 26 | LCD_Write_COM_DATA(0x0C,0x0000); 27 | 28 | LCD_Write_COM_DATA(0x0F,0x1401); 29 | LCD_Write_COM_DATA(0x15,0x0000); 30 | LCD_Write_COM_DATA(0x20,0x0000); 31 | LCD_Write_COM_DATA(0x21,0x0000); 32 | 33 | 34 | LCD_Write_COM_DATA(0x36,0x00AF); 35 | LCD_Write_COM_DATA(0x37,0x0000); 36 | LCD_Write_COM_DATA(0x38,0x00DB); 37 | LCD_Write_COM_DATA(0x39,0x0000); 38 | 39 | LCD_Write_COM_DATA(0x0F,0x0B01); 40 | LCD_Write_COM_DATA(0x07,0x0016); 41 | LCD_Write_COM_DATA(0x07,0x0017); 42 | 43 | LCD_Write_COM(0x22); 44 | break; 45 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/s6d0164/setxy.h: -------------------------------------------------------------------------------- 1 | case S6D0164: 2 | LCD_Write_COM_DATA(0x36,x2); 3 | LCD_Write_COM_DATA(0x37,x1); 4 | LCD_Write_COM_DATA(0x38,y2); 5 | LCD_Write_COM_DATA(0x39,y1); 6 | LCD_Write_COM_DATA(0x20,x1); 7 | LCD_Write_COM_DATA(0x21,y1); 8 | LCD_Write_COM(0x22); 9 | break; 10 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/s6d1121/initlcd.h: -------------------------------------------------------------------------------- 1 | case S6D1121_8: 2 | case S6D1121_16: 3 | LCD_Write_COM_DATA(0x11,0x2004); 4 | LCD_Write_COM_DATA(0x13,0xCC00); 5 | LCD_Write_COM_DATA(0x15,0x2600); 6 | LCD_Write_COM_DATA(0x14,0x252A); 7 | LCD_Write_COM_DATA(0x12,0x0033); 8 | LCD_Write_COM_DATA(0x13,0xCC04); 9 | LCD_Write_COM_DATA(0x13,0xCC06); 10 | LCD_Write_COM_DATA(0x13,0xCC4F); 11 | LCD_Write_COM_DATA(0x13,0x674F); 12 | LCD_Write_COM_DATA(0x11,0x2003); 13 | LCD_Write_COM_DATA(0x30,0x2609); 14 | LCD_Write_COM_DATA(0x31,0x242C); 15 | LCD_Write_COM_DATA(0x32,0x1F23); 16 | LCD_Write_COM_DATA(0x33,0x2425); 17 | LCD_Write_COM_DATA(0x34,0x2226); 18 | LCD_Write_COM_DATA(0x35,0x2523); 19 | LCD_Write_COM_DATA(0x36,0x1C1A); 20 | LCD_Write_COM_DATA(0x37,0x131D); 21 | LCD_Write_COM_DATA(0x38,0x0B11); 22 | LCD_Write_COM_DATA(0x39,0x1210); 23 | LCD_Write_COM_DATA(0x3A,0x1315); 24 | LCD_Write_COM_DATA(0x3B,0x3619); 25 | LCD_Write_COM_DATA(0x3C,0x0D00); 26 | LCD_Write_COM_DATA(0x3D,0x000D); 27 | LCD_Write_COM_DATA(0x16,0x0007); 28 | LCD_Write_COM_DATA(0x02,0x0013); 29 | LCD_Write_COM_DATA(0x03,0x0003); 30 | LCD_Write_COM_DATA(0x01,0x0127); 31 | LCD_Write_COM_DATA(0x08,0x0303); 32 | LCD_Write_COM_DATA(0x0A,0x000B); 33 | LCD_Write_COM_DATA(0x0B,0x0003); 34 | LCD_Write_COM_DATA(0x0C,0x0000); 35 | LCD_Write_COM_DATA(0x41,0x0000); 36 | LCD_Write_COM_DATA(0x50,0x0000); 37 | LCD_Write_COM_DATA(0x60,0x0005); 38 | LCD_Write_COM_DATA(0x70,0x000B); 39 | LCD_Write_COM_DATA(0x71,0x0000); 40 | LCD_Write_COM_DATA(0x78,0x0000); 41 | LCD_Write_COM_DATA(0x7A,0x0000); 42 | LCD_Write_COM_DATA(0x79,0x0007); 43 | LCD_Write_COM_DATA(0x07,0x0051); 44 | LCD_Write_COM_DATA(0x07,0x0053); 45 | LCD_Write_COM_DATA(0x79,0x0000); 46 | LCD_Write_COM(0x22); 47 | break; 48 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/s6d1121/setxy.h: -------------------------------------------------------------------------------- 1 | case S6D1121_8: 2 | case S6D1121_16: 3 | LCD_Write_COM_DATA(0x46,(x2 << 8) | x1); 4 | LCD_Write_COM_DATA(0x47,y2); 5 | LCD_Write_COM_DATA(0x48,y1); 6 | LCD_Write_COM_DATA(0x20,x1); 7 | LCD_Write_COM_DATA(0x21,y1); 8 | LCD_Write_COM(0x22); 9 | break; 10 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/ssd1289/initlcd.h: -------------------------------------------------------------------------------- 1 | case SSD1289: 2 | case SSD1289_8: 3 | case SSD1289LATCHED: 4 | LCD_Write_COM_DATA(0x00,0x0001); 5 | LCD_Write_COM_DATA(0x03,0xA8A4); 6 | LCD_Write_COM_DATA(0x0C,0x0000); 7 | LCD_Write_COM_DATA(0x0D,0x080C); 8 | LCD_Write_COM_DATA(0x0E,0x2B00); 9 | LCD_Write_COM_DATA(0x1E,0x00B7); 10 | LCD_Write_COM_DATA(0x01,0x2B3F); 11 | LCD_Write_COM_DATA(0x02,0x0600); 12 | LCD_Write_COM_DATA(0x10,0x0000); 13 | LCD_Write_COM_DATA(0x11,0x6070); 14 | LCD_Write_COM_DATA(0x05,0x0000); 15 | LCD_Write_COM_DATA(0x06,0x0000); 16 | LCD_Write_COM_DATA(0x16,0xEF1C); 17 | LCD_Write_COM_DATA(0x17,0x0003); 18 | LCD_Write_COM_DATA(0x07,0x0233); 19 | LCD_Write_COM_DATA(0x0B,0x0000); 20 | LCD_Write_COM_DATA(0x0F,0x0000); 21 | LCD_Write_COM_DATA(0x41,0x0000); 22 | LCD_Write_COM_DATA(0x42,0x0000); 23 | LCD_Write_COM_DATA(0x48,0x0000); 24 | LCD_Write_COM_DATA(0x49,0x013F); 25 | LCD_Write_COM_DATA(0x4A,0x0000); 26 | LCD_Write_COM_DATA(0x4B,0x0000); 27 | LCD_Write_COM_DATA(0x44,0xEF00); 28 | LCD_Write_COM_DATA(0x45,0x0000); 29 | LCD_Write_COM_DATA(0x46,0x013F); 30 | LCD_Write_COM_DATA(0x30,0x0707); 31 | LCD_Write_COM_DATA(0x31,0x0204); 32 | LCD_Write_COM_DATA(0x32,0x0204); 33 | LCD_Write_COM_DATA(0x33,0x0502); 34 | LCD_Write_COM_DATA(0x34,0x0507); 35 | LCD_Write_COM_DATA(0x35,0x0204); 36 | LCD_Write_COM_DATA(0x36,0x0204); 37 | LCD_Write_COM_DATA(0x37,0x0502); 38 | LCD_Write_COM_DATA(0x3A,0x0302); 39 | LCD_Write_COM_DATA(0x3B,0x0302); 40 | LCD_Write_COM_DATA(0x23,0x0000); 41 | LCD_Write_COM_DATA(0x24,0x0000); 42 | LCD_Write_COM_DATA(0x25,0x8000); 43 | LCD_Write_COM_DATA(0x4f,0x0000); 44 | LCD_Write_COM_DATA(0x4e,0x0000); 45 | LCD_Write_COM(0x22); 46 | break; 47 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/ssd1289/setxy.h: -------------------------------------------------------------------------------- 1 | case SSD1289: 2 | case SSD1289_8: 3 | case SSD1289LATCHED: 4 | LCD_Write_COM_DATA(0x44,(x2<<8)+x1); 5 | LCD_Write_COM_DATA(0x45,y1); 6 | LCD_Write_COM_DATA(0x46,y2); 7 | LCD_Write_COM_DATA(0x4e,x1); 8 | LCD_Write_COM_DATA(0x4f,y1); 9 | LCD_Write_COM(0x22); 10 | break; 11 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/ssd1963/480/initlcd.h: -------------------------------------------------------------------------------- 1 | case SSD1963_480: 2 | LCD_Write_COM(0xE2); //PLL multiplier, set PLL clock to 120M 3 | LCD_Write_DATA(0x23); //N=0x36 for 6.5M, 0x23 for 10M crystal 4 | LCD_Write_DATA(0x02); 5 | LCD_Write_DATA(0x54); 6 | LCD_Write_COM(0xE0); // PLL enable 7 | LCD_Write_DATA(0x01); 8 | delay(10); 9 | LCD_Write_COM(0xE0); 10 | LCD_Write_DATA(0x03); 11 | delay(10); 12 | LCD_Write_COM(0x01); // software reset 13 | delay(100); 14 | LCD_Write_COM(0xE6); //PLL setting for PCLK, depends on resolution 15 | LCD_Write_DATA(0x01); 16 | LCD_Write_DATA(0x1F); 17 | LCD_Write_DATA(0xFF); 18 | 19 | LCD_Write_COM(0xB0); //LCD SPECIFICATION 20 | LCD_Write_DATA(0x20); 21 | LCD_Write_DATA(0x00); 22 | LCD_Write_DATA(0x01); //Set HDP 479 23 | LCD_Write_DATA(0xDF); 24 | LCD_Write_DATA(0x01); //Set VDP 271 25 | LCD_Write_DATA(0x0F); 26 | LCD_Write_DATA(0x00); 27 | 28 | LCD_Write_COM(0xB4); //HSYNC 29 | LCD_Write_DATA(0x02); //Set HT 531 30 | LCD_Write_DATA(0x13); 31 | LCD_Write_DATA(0x00); //Set HPS 8 32 | LCD_Write_DATA(0x08); 33 | LCD_Write_DATA(0x2B); //Set HPW 43 34 | LCD_Write_DATA(0x00); //Set LPS 2 35 | LCD_Write_DATA(0x02); 36 | LCD_Write_DATA(0x00); 37 | 38 | LCD_Write_COM(0xB6); //VSYNC 39 | LCD_Write_DATA(0x01); //Set VT 288 40 | LCD_Write_DATA(0x20); 41 | LCD_Write_DATA(0x00); //Set VPS 4 42 | LCD_Write_DATA(0x04); 43 | LCD_Write_DATA(0x0c); //Set VPW 12 44 | LCD_Write_DATA(0x00); //Set FPS 2 45 | LCD_Write_DATA(0x02); 46 | 47 | LCD_Write_COM(0xBA); 48 | LCD_Write_DATA(0x0F); //GPIO[3:0] out 1 49 | 50 | LCD_Write_COM(0xB8); 51 | LCD_Write_DATA(0x07); //GPIO3=input, GPIO[2:0]=output 52 | LCD_Write_DATA(0x01); //GPIO0 normal 53 | 54 | LCD_Write_COM(0x36); //rotation 55 | LCD_Write_DATA(0x22); 56 | 57 | LCD_Write_COM(0xF0); //pixel data interface 58 | LCD_Write_DATA(0x03); 59 | 60 | 61 | delay(1); 62 | 63 | setXY(0, 0, 479, 271); 64 | LCD_Write_COM(0x29); //display on 65 | 66 | LCD_Write_COM(0xBE); //set PWM for B/L 67 | LCD_Write_DATA(0x06); 68 | LCD_Write_DATA(0xf0); 69 | LCD_Write_DATA(0x01); 70 | LCD_Write_DATA(0xf0); 71 | LCD_Write_DATA(0x00); 72 | LCD_Write_DATA(0x00); 73 | 74 | LCD_Write_COM(0xd0); 75 | LCD_Write_DATA(0x0d); 76 | 77 | LCD_Write_COM(0x2C); 78 | break; 79 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/ssd1963/480/setxy.h: -------------------------------------------------------------------------------- 1 | case SSD1963_480: 2 | swap(word, x1, y1); 3 | swap(word, x2, y2); 4 | LCD_Write_COM(0x2a); 5 | LCD_Write_DATA(x1>>8); 6 | LCD_Write_DATA(x1); 7 | LCD_Write_DATA(x2>>8); 8 | LCD_Write_DATA(x2); 9 | LCD_Write_COM(0x2b); 10 | LCD_Write_DATA(y1>>8); 11 | LCD_Write_DATA(y1); 12 | LCD_Write_DATA(y2>>8); 13 | LCD_Write_DATA(y2); 14 | LCD_Write_COM(0x2c); 15 | break; 16 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/ssd1963/800/initlcd.h: -------------------------------------------------------------------------------- 1 | case SSD1963_800: 2 | LCD_Write_COM(0xE2); //PLL multiplier, set PLL clock to 120M 3 | LCD_Write_DATA(0x1E); //N=0x36 for 6.5M, 0x23 for 10M crystal 4 | LCD_Write_DATA(0x02); 5 | LCD_Write_DATA(0x54); 6 | LCD_Write_COM(0xE0); // PLL enable 7 | LCD_Write_DATA(0x01); 8 | delay(10); 9 | LCD_Write_COM(0xE0); 10 | LCD_Write_DATA(0x03); 11 | delay(10); 12 | LCD_Write_COM(0x01); // software reset 13 | delay(100); 14 | LCD_Write_COM(0xE6); //PLL setting for PCLK, depends on resolution 15 | LCD_Write_DATA(0x03); 16 | LCD_Write_DATA(0xFF); 17 | LCD_Write_DATA(0xFF); 18 | 19 | LCD_Write_COM(0xB0); //LCD SPECIFICATION 20 | LCD_Write_DATA(0x24); 21 | LCD_Write_DATA(0x00); 22 | LCD_Write_DATA(0x03); //Set HDP 799 23 | LCD_Write_DATA(0x1F); 24 | LCD_Write_DATA(0x01); //Set VDP 479 25 | LCD_Write_DATA(0xDF); 26 | LCD_Write_DATA(0x00); 27 | 28 | LCD_Write_COM(0xB4); //HSYNC 29 | LCD_Write_DATA(0x03); //Set HT 928 30 | LCD_Write_DATA(0xA0); 31 | LCD_Write_DATA(0x00); //Set HPS 46 32 | LCD_Write_DATA(0x2E); 33 | LCD_Write_DATA(0x30); //Set HPW 48 34 | LCD_Write_DATA(0x00); //Set LPS 15 35 | LCD_Write_DATA(0x0F); 36 | LCD_Write_DATA(0x00); 37 | 38 | LCD_Write_COM(0xB6); //VSYNC 39 | LCD_Write_DATA(0x02); //Set VT 525 40 | LCD_Write_DATA(0x0D); 41 | LCD_Write_DATA(0x00); //Set VPS 16 42 | LCD_Write_DATA(0x10); 43 | LCD_Write_DATA(0x10); //Set VPW 16 44 | LCD_Write_DATA(0x00); //Set FPS 8 45 | LCD_Write_DATA(0x08); 46 | 47 | LCD_Write_COM(0xBA); 48 | LCD_Write_DATA(0x0F); //GPIO[3:0] out 1 49 | 50 | LCD_Write_COM(0xB8); 51 | LCD_Write_DATA(0x07); //GPIO3=input, GPIO[2:0]=output 52 | LCD_Write_DATA(0x01); //GPIO0 normal 53 | 54 | LCD_Write_COM(0x36); //rotation 55 | LCD_Write_DATA(0x22); 56 | 57 | LCD_Write_COM(0xF0); //pixel data interface 58 | LCD_Write_DATA(0x03); 59 | 60 | 61 | delay(1); 62 | 63 | setXY(0, 0, 799, 479); 64 | LCD_Write_COM(0x29); //display on 65 | 66 | LCD_Write_COM(0xBE); //set PWM for B/L 67 | LCD_Write_DATA(0x06); 68 | LCD_Write_DATA(0xf0); 69 | LCD_Write_DATA(0x01); 70 | LCD_Write_DATA(0xf0); 71 | LCD_Write_DATA(0x00); 72 | LCD_Write_DATA(0x00); 73 | 74 | LCD_Write_COM(0xd0); 75 | LCD_Write_DATA(0x0d); 76 | 77 | LCD_Write_COM(0x2C); 78 | break; 79 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/ssd1963/800/setxy.h: -------------------------------------------------------------------------------- 1 | case SSD1963_800: 2 | swap(word, x1, y1); 3 | swap(word, x2, y2); 4 | LCD_Write_COM(0x2a); 5 | LCD_Write_DATA(x1>>8); 6 | LCD_Write_DATA(x1); 7 | LCD_Write_DATA(x2>>8); 8 | LCD_Write_DATA(x2); 9 | LCD_Write_COM(0x2b); 10 | LCD_Write_DATA(y1>>8); 11 | LCD_Write_DATA(y1); 12 | LCD_Write_DATA(y2>>8); 13 | LCD_Write_DATA(y2); 14 | LCD_Write_COM(0x2c); 15 | break; 16 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/ssd1963/800alt/initlcd.h: -------------------------------------------------------------------------------- 1 | case SSD1963_800ALT: 2 | LCD_Write_COM(0xE2); //PLL multiplier, set PLL clock to 120M 3 | LCD_Write_DATA(0x23); //N=0x36 for 6.5M, 0x23 for 10M crystal 4 | LCD_Write_DATA(0x02); 5 | LCD_Write_DATA(0x04); 6 | LCD_Write_COM(0xE0); // PLL enable 7 | LCD_Write_DATA(0x01); 8 | delay(10); 9 | LCD_Write_COM(0xE0); 10 | LCD_Write_DATA(0x03); 11 | delay(10); 12 | LCD_Write_COM(0x01); // software reset 13 | delay(100); 14 | LCD_Write_COM(0xE6); //PLL setting for PCLK, depends on resolution 15 | LCD_Write_DATA(0x04); 16 | LCD_Write_DATA(0x93); 17 | LCD_Write_DATA(0xE0); 18 | 19 | LCD_Write_COM(0xB0); //LCD SPECIFICATION 20 | LCD_Write_DATA(0x00); // 0x24 21 | LCD_Write_DATA(0x00); 22 | LCD_Write_DATA(0x03); //Set HDP 799 23 | LCD_Write_DATA(0x1F); 24 | LCD_Write_DATA(0x01); //Set VDP 479 25 | LCD_Write_DATA(0xDF); 26 | LCD_Write_DATA(0x00); 27 | 28 | LCD_Write_COM(0xB4); //HSYNC 29 | LCD_Write_DATA(0x03); //Set HT 928 30 | LCD_Write_DATA(0xA0); 31 | LCD_Write_DATA(0x00); //Set HPS 46 32 | LCD_Write_DATA(0x2E); 33 | LCD_Write_DATA(0x30); //Set HPW 48 34 | LCD_Write_DATA(0x00); //Set LPS 15 35 | LCD_Write_DATA(0x0F); 36 | LCD_Write_DATA(0x00); 37 | 38 | LCD_Write_COM(0xB6); //VSYNC 39 | LCD_Write_DATA(0x02); //Set VT 525 40 | LCD_Write_DATA(0x0D); 41 | LCD_Write_DATA(0x00); //Set VPS 16 42 | LCD_Write_DATA(0x10); 43 | LCD_Write_DATA(0x10); //Set VPW 16 44 | LCD_Write_DATA(0x00); //Set FPS 8 45 | LCD_Write_DATA(0x08); 46 | 47 | LCD_Write_COM(0xBA); 48 | LCD_Write_DATA(0x05); //GPIO[3:0] out 1 49 | 50 | LCD_Write_COM(0xB8); 51 | LCD_Write_DATA(0x07); //GPIO3=input, GPIO[2:0]=output 52 | LCD_Write_DATA(0x01); //GPIO0 normal 53 | 54 | LCD_Write_COM(0x36); //rotation 55 | LCD_Write_DATA(0x22); // -- Set to 0x21 to rotate 180 degrees 56 | 57 | LCD_Write_COM(0xF0); //pixel data interface 58 | LCD_Write_DATA(0x03); 59 | 60 | 61 | delay(10); 62 | 63 | setXY(0, 0, 799, 479); 64 | LCD_Write_COM(0x29); //display on 65 | 66 | LCD_Write_COM(0xBE); //set PWM for B/L 67 | LCD_Write_DATA(0x06); 68 | LCD_Write_DATA(0xF0); 69 | LCD_Write_DATA(0x01); 70 | LCD_Write_DATA(0xF0); 71 | LCD_Write_DATA(0x00); 72 | LCD_Write_DATA(0x00); 73 | 74 | LCD_Write_COM(0xD0); 75 | LCD_Write_DATA(0x0D); 76 | 77 | LCD_Write_COM(0x2C); 78 | break; 79 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/ssd1963/800alt/setxy.h: -------------------------------------------------------------------------------- 1 | case SSD1963_800ALT: 2 | swap(word, x1, y1); 3 | swap(word, x2, y2); 4 | LCD_Write_COM(0x2a); 5 | LCD_Write_DATA(x1>>8); 6 | LCD_Write_DATA(x1); 7 | LCD_Write_DATA(x2>>8); 8 | LCD_Write_DATA(x2); 9 | LCD_Write_COM(0x2b); 10 | LCD_Write_DATA(y1>>8); 11 | LCD_Write_DATA(y1); 12 | LCD_Write_DATA(y2>>8); 13 | LCD_Write_DATA(y2); 14 | LCD_Write_COM(0x2c); 15 | break; 16 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/st7735/initlcd.h: -------------------------------------------------------------------------------- 1 | case ST7735: 2 | LCD_Write_COM(0x11);//Sleep exit 3 | delay(12); 4 | 5 | //ST7735R Frame Rate 6 | LCD_Write_COM(0xB1); 7 | LCD_Write_DATA(0x01); 8 | LCD_Write_DATA(0x2C); 9 | LCD_Write_DATA(0x2D); 10 | LCD_Write_COM(0xB2); 11 | LCD_Write_DATA(0x01); 12 | LCD_Write_DATA(0x2C); 13 | LCD_Write_DATA(0x2D); 14 | LCD_Write_COM(0xB3); 15 | LCD_Write_DATA(0x01); 16 | LCD_Write_DATA(0x2C); 17 | LCD_Write_DATA(0x2D); 18 | LCD_Write_DATA(0x01); 19 | LCD_Write_DATA(0x2C); 20 | LCD_Write_DATA(0x2D); 21 | 22 | LCD_Write_COM(0xB4); //Column inversion 23 | LCD_Write_DATA(0x07); 24 | 25 | //ST7735R Power Sequence 26 | LCD_Write_COM(0xC0); 27 | LCD_Write_DATA(0xA2); 28 | LCD_Write_DATA(0x02); 29 | LCD_Write_DATA(0x84); 30 | LCD_Write_COM(0xC1); 31 | LCD_Write_DATA(0xC5); 32 | LCD_Write_COM(0xC2); 33 | LCD_Write_DATA(0x0A); 34 | LCD_Write_DATA(0x00); 35 | LCD_Write_COM(0xC3); 36 | LCD_Write_DATA(0x8A); 37 | LCD_Write_DATA(0x2A); 38 | LCD_Write_COM(0xC4); 39 | LCD_Write_DATA(0x8A); 40 | LCD_Write_DATA(0xEE); 41 | 42 | LCD_Write_COM(0xC5); //VCOM 43 | LCD_Write_DATA(0x0E); 44 | 45 | LCD_Write_COM(0x36); //MX, MY, RGB mode 46 | LCD_Write_DATA(0xC8); 47 | 48 | //ST7735R Gamma Sequence 49 | LCD_Write_COM(0xe0); 50 | LCD_Write_DATA(0x0f); 51 | LCD_Write_DATA(0x1a); 52 | LCD_Write_DATA(0x0f); 53 | LCD_Write_DATA(0x18); 54 | LCD_Write_DATA(0x2f); 55 | LCD_Write_DATA(0x28); 56 | LCD_Write_DATA(0x20); 57 | LCD_Write_DATA(0x22); 58 | LCD_Write_DATA(0x1f); 59 | LCD_Write_DATA(0x1b); 60 | LCD_Write_DATA(0x23); 61 | LCD_Write_DATA(0x37); 62 | LCD_Write_DATA(0x00); 63 | 64 | LCD_Write_DATA(0x07); 65 | LCD_Write_DATA(0x02); 66 | LCD_Write_DATA(0x10); 67 | LCD_Write_COM(0xe1); 68 | LCD_Write_DATA(0x0f); 69 | LCD_Write_DATA(0x1b); 70 | LCD_Write_DATA(0x0f); 71 | LCD_Write_DATA(0x17); 72 | LCD_Write_DATA(0x33); 73 | LCD_Write_DATA(0x2c); 74 | LCD_Write_DATA(0x29); 75 | LCD_Write_DATA(0x2e); 76 | LCD_Write_DATA(0x30); 77 | LCD_Write_DATA(0x30); 78 | LCD_Write_DATA(0x39); 79 | LCD_Write_DATA(0x3f); 80 | LCD_Write_DATA(0x00); 81 | LCD_Write_DATA(0x07); 82 | LCD_Write_DATA(0x03); 83 | LCD_Write_DATA(0x10); 84 | 85 | LCD_Write_COM(0x2a); 86 | LCD_Write_DATA(0x00); 87 | LCD_Write_DATA(0x00); 88 | LCD_Write_DATA(0x00); 89 | LCD_Write_DATA(0x7f); 90 | LCD_Write_COM(0x2b); 91 | LCD_Write_DATA(0x00); 92 | LCD_Write_DATA(0x00); 93 | LCD_Write_DATA(0x00); 94 | LCD_Write_DATA(0x9f); 95 | 96 | LCD_Write_COM(0xF0); //Enable test command 97 | LCD_Write_DATA(0x01); 98 | LCD_Write_COM(0xF6); //Disable ram power save mode 99 | LCD_Write_DATA(0x00); 100 | 101 | LCD_Write_COM(0x3A); //65k mode 102 | LCD_Write_DATA(0x05); 103 | LCD_Write_COM(0x29);//Display on 104 | break; 105 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/st7735/setxy.h: -------------------------------------------------------------------------------- 1 | case ST7735: 2 | LCD_Write_COM(0x2a); 3 | LCD_Write_DATA(x1>>8); 4 | LCD_Write_DATA(x1); 5 | LCD_Write_DATA(x2>>8); 6 | LCD_Write_DATA(x2); 7 | LCD_Write_COM(0x2b); 8 | LCD_Write_DATA(y1>>8); 9 | LCD_Write_DATA(y1); 10 | LCD_Write_DATA(y2>>8); 11 | LCD_Write_DATA(y2); 12 | LCD_Write_COM(0x2c); 13 | break; 14 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/st7735s/initlcd.h: -------------------------------------------------------------------------------- 1 | case ST7735S: 2 | LCD_Write_COM(0x11);//Sleep exit 3 | delay(120); 4 | 5 | //ST7735R Frame Rate 6 | LCD_Write_COM(0xB1); 7 | LCD_Write_DATA(0x05); 8 | LCD_Write_DATA(0x3C); 9 | LCD_Write_DATA(0x3C); 10 | LCD_Write_COM(0xB2); 11 | LCD_Write_DATA(0x05); 12 | LCD_Write_DATA(0x3C); 13 | LCD_Write_DATA(0x3C); 14 | LCD_Write_COM(0xB3); 15 | LCD_Write_DATA(0x05); 16 | LCD_Write_DATA(0x3C); 17 | LCD_Write_DATA(0x3C); 18 | LCD_Write_DATA(0x05); 19 | LCD_Write_DATA(0x3C); 20 | LCD_Write_DATA(0x3C); 21 | 22 | LCD_Write_COM(0xB4); //Column inversion 23 | LCD_Write_DATA(0x03); 24 | 25 | //ST7735R Power Sequence 26 | LCD_Write_COM(0xC0); 27 | LCD_Write_DATA(0x28); 28 | LCD_Write_DATA(0x08); 29 | LCD_Write_DATA(0x04); 30 | LCD_Write_COM(0xC1); 31 | LCD_Write_DATA(0xC0); 32 | LCD_Write_COM(0xC2); 33 | LCD_Write_DATA(0x0D); 34 | LCD_Write_DATA(0x00); 35 | LCD_Write_COM(0xC3); 36 | LCD_Write_DATA(0x8D); 37 | LCD_Write_DATA(0x2A); 38 | LCD_Write_COM(0xC4); 39 | LCD_Write_DATA(0x8D); 40 | LCD_Write_DATA(0xEE); 41 | 42 | LCD_Write_COM(0xC5); //VCOM 43 | LCD_Write_DATA(0x1A); 44 | 45 | LCD_Write_COM(0x36); //MX, MY, RGB mode 46 | LCD_Write_DATA(0xC0); 47 | 48 | //ST7735R Gamma Sequence 49 | LCD_Write_COM(0xE0); 50 | LCD_Write_DATA(0x03); 51 | LCD_Write_DATA(0x22); 52 | LCD_Write_DATA(0x07); 53 | LCD_Write_DATA(0x0A); 54 | LCD_Write_DATA(0x2E); 55 | LCD_Write_DATA(0x30); 56 | LCD_Write_DATA(0x25); 57 | LCD_Write_DATA(0x2A); 58 | LCD_Write_DATA(0x28); 59 | LCD_Write_DATA(0x26); 60 | LCD_Write_DATA(0x2E); 61 | LCD_Write_DATA(0x3A); 62 | LCD_Write_DATA(0x00); 63 | LCD_Write_DATA(0x01); 64 | LCD_Write_DATA(0x03); 65 | LCD_Write_DATA(0x13); 66 | LCD_Write_COM(0xE1); 67 | LCD_Write_DATA(0x04); 68 | LCD_Write_DATA(0x16); 69 | LCD_Write_DATA(0x06); 70 | LCD_Write_DATA(0x0D); 71 | LCD_Write_DATA(0x2D); 72 | LCD_Write_DATA(0x26); 73 | LCD_Write_DATA(0x23); 74 | LCD_Write_DATA(0x27); 75 | LCD_Write_DATA(0x27); 76 | LCD_Write_DATA(0x25); 77 | LCD_Write_DATA(0x2D); 78 | LCD_Write_DATA(0x3B); 79 | LCD_Write_DATA(0x00); 80 | LCD_Write_DATA(0x01); 81 | LCD_Write_DATA(0x04); 82 | LCD_Write_DATA(0x13); 83 | 84 | //LCD_Write_COM(0x2A); 85 | //LCD_Write_DATA(0x00); 86 | //LCD_Write_DATA(0x00); 87 | //LCD_Write_DATA(0x00); 88 | //LCD_Write_DATA(0x7F); 89 | //LCD_Write_COM(0x2B); 90 | //LCD_Write_DATA(0x00); 91 | //LCD_Write_DATA(0x00); 92 | //LCD_Write_DATA(0x00); 93 | //LCD_Write_DATA(0x9F); 94 | 95 | LCD_Write_COM(0x3A); //65k mode 96 | LCD_Write_DATA(0x05); 97 | LCD_Write_COM(0x29);//Display on 98 | break; 99 | -------------------------------------------------------------------------------- /external_libraries/UTFT/tft_drivers/st7735s/setxy.h: -------------------------------------------------------------------------------- 1 | case ST7735S: 2 | LCD_Write_COM(0x2a); 3 | LCD_Write_DATA(x1>>8); 4 | LCD_Write_DATA(x1); 5 | LCD_Write_DATA(x2>>8); 6 | LCD_Write_DATA(x2); 7 | LCD_Write_COM(0x2b); 8 | LCD_Write_DATA(y1>>8); 9 | LCD_Write_DATA(y1); 10 | LCD_Write_DATA(y2>>8); 11 | LCD_Write_DATA(y2); 12 | LCD_Write_COM(0x2c); 13 | break; 14 | -------------------------------------------------------------------------------- /external_libraries/UTouch/License - CC BY-NC-SA 3.0 - Legal.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iot-playground/Arduino/bb29a5877258654a7afd3a210fe13fa2d9efde17/external_libraries/UTouch/License - CC BY-NC-SA 3.0 - Legal.pdf -------------------------------------------------------------------------------- /external_libraries/UTouch/License - CC BY-NC-SA 3.0 - Summary.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iot-playground/Arduino/bb29a5877258654a7afd3a210fe13fa2d9efde17/external_libraries/UTouch/License - CC BY-NC-SA 3.0 - Summary.pdf -------------------------------------------------------------------------------- /external_libraries/UTouch/UTouch.h: -------------------------------------------------------------------------------- 1 | /* 2 | UTouch.h - Arduino/chipKit library support for Color TFT LCD Touch screens 3 | Copyright (C)2010-2014 Henning Karlsen. All right reserved 4 | 5 | Basic functionality of this library are based on the demo-code provided by 6 | ITead studio. You can find the latest version of the library at 7 | http://www.henningkarlsen.com/electronics 8 | 9 | If you make any modifications or improvements to the code, I would appreciate 10 | that you share the code with me so that I might include it in the next release. 11 | I can be contacted through http://www.henningkarlsen.com/electronics/contact.php 12 | 13 | This library is free software; you can redistribute it and/or 14 | modify it under the terms of the CC BY-NC-SA 3.0 license. 15 | Please see the included documents for further information. 16 | 17 | Commercial use of this library requires you to buy a license that 18 | will allow commercial use. This includes using the library, 19 | modified or not, as a tool to sell products. 20 | 21 | The license applies to all part of the library including the 22 | examples and tools supplied with the library. 23 | */ 24 | 25 | #ifndef UTouch_h 26 | #define UTouch_h 27 | 28 | #define UTOUCH_VERSION 124 29 | 30 | #if defined(__AVR__) 31 | #include "Arduino.h" 32 | #include "hardware/avr/HW_AVR_defines.h" 33 | #elif defined(__PIC32MX__) 34 | #include "WProgram.h" 35 | #include "hardware/pic32/HW_PIC32_defines.h" 36 | #elif defined(__arm__) 37 | #include "Arduino.h" 38 | #include "hardware/arm/HW_ARM_defines.h" 39 | #endif 40 | 41 | #define PORTRAIT 0 42 | #define LANDSCAPE 1 43 | 44 | #define PREC_LOW 1 45 | #define PREC_MEDIUM 2 46 | #define PREC_HI 3 47 | #define PREC_EXTREME 4 48 | 49 | class UTouch 50 | { 51 | public: 52 | int16_t TP_X ,TP_Y; 53 | 54 | UTouch(byte tclk, byte tcs, byte tdin, byte dout, byte irq); 55 | 56 | void InitTouch(byte orientation = LANDSCAPE); 57 | void read(); 58 | bool dataAvailable(); 59 | int16_t getX(); 60 | int16_t getY(); 61 | void setPrecision(byte precision); 62 | 63 | void calibrateRead(); 64 | 65 | private: 66 | regtype *P_CLK, *P_CS, *P_DIN, *P_DOUT, *P_IRQ; 67 | regsize B_CLK, B_CS, B_DIN, B_DOUT, B_IRQ; 68 | byte T_CLK, T_CS, T_DIN, T_DOUT, T_IRQ; 69 | long _default_orientation; 70 | byte orient; 71 | byte prec; 72 | byte display_model; 73 | long disp_x_size, disp_y_size, default_orientation; 74 | long touch_x_left, touch_x_right, touch_y_top, touch_y_bottom; 75 | 76 | void touch_WriteData(byte data); 77 | word touch_ReadData(); 78 | }; 79 | 80 | #endif -------------------------------------------------------------------------------- /external_libraries/UTouch/UTouch.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iot-playground/Arduino/bb29a5877258654a7afd3a210fe13fa2d9efde17/external_libraries/UTouch/UTouch.pdf -------------------------------------------------------------------------------- /external_libraries/UTouch/UTouchCD.h: -------------------------------------------------------------------------------- 1 | // UTouchCD.h 2 | // ---------- 3 | // 4 | // Since there are slight deviations in all touch screens you should run a 5 | // calibration on your display module. Run the UTouch_Calibration sketch 6 | // that came with this library and follow the on-screen instructions to 7 | // update this file. 8 | // 9 | // Remember that is you have multiple display modules they will probably 10 | // require different calibration data so you should run the calibration 11 | // every time you switch to another module. 12 | // You can, of course, store calibration data for all your modules here 13 | // and comment out the ones you dont need at the moment. 14 | // 15 | 16 | // These calibration settings works with my ITDB02-3.2S. 17 | // They MIGHT work on your display module, but you should run the 18 | // calibration sketch anyway. 19 | #define CAL_X 0x00378F66UL 20 | #define CAL_Y 0x03C34155UL 21 | #define CAL_S 0x000EF13FUL 22 | -------------------------------------------------------------------------------- /external_libraries/UTouch/UTouch_Supported_display_modules.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iot-playground/Arduino/bb29a5877258654a7afd3a210fe13fa2d9efde17/external_libraries/UTouch/UTouch_Supported_display_modules.pdf -------------------------------------------------------------------------------- /external_libraries/UTouch/examples/Arduino/UTouch_QuickDraw/UTouch_QuickDraw.ino: -------------------------------------------------------------------------------- 1 | // UTouch_QuickDraw (C)2010-2014 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a quick demo of how to use the library. 5 | // 6 | // This program requires the UTFT library. 7 | // 8 | // It is assumed that the display module is connected to an 9 | // appropriate shield or that you know how to change the pin 10 | // numbers in the setup. 11 | // 12 | 13 | #include 14 | #include 15 | 16 | // Initialize display 17 | // ------------------ 18 | // Set the pins to the correct ones for your development board 19 | // ----------------------------------------------------------- 20 | // Standard Arduino Uno/2009 Shield : ,19,18,17,16 21 | // Standard Arduino Mega/Due shield : ,38,39,40,41 22 | // CTE TFT LCD/SD Shield for Arduino Due : ,25,26,27,28 23 | // Teensy 3.x TFT Test Board : ,23,22, 3, 4 24 | // ElecHouse TFT LCD/SD Shield for Arduino Due : ,22,23,31,33 25 | // 26 | // Remember to change the model parameter to suit your display module! 27 | UTFT myGLCD(ITDB32S,38,39,40,41); 28 | 29 | // Initialize touchscreen 30 | // ---------------------- 31 | // Set the pins to the correct ones for your development board 32 | // ----------------------------------------------------------- 33 | // Standard Arduino Uno/2009 Shield : 15,10,14, 9, 8 34 | // Standard Arduino Mega/Due shield : 6, 5, 4, 3, 2 35 | // CTE TFT LCD/SD Shield for Arduino Due : 6, 5, 4, 3, 2 36 | // Teensy 3.x TFT Test Board : 26,31,27,28,29 37 | // ElecHouse TFT LCD/SD Shield for Arduino Due : 25,26,27,29,30 38 | // 39 | UTouch myTouch( 6, 5, 4, 3, 2); 40 | 41 | void setup() 42 | { 43 | myGLCD.InitLCD(); 44 | myGLCD.clrScr(); 45 | 46 | myTouch.InitTouch(); 47 | myTouch.setPrecision(PREC_MEDIUM); 48 | } 49 | 50 | void loop() 51 | { 52 | long x, y; 53 | 54 | while (myTouch.dataAvailable() == true) 55 | { 56 | myTouch.read(); 57 | x = myTouch.getX(); 58 | y = myTouch.getY(); 59 | if ((x!=-1) and (y!=-1)) 60 | { 61 | myGLCD.drawPixel (x, y); 62 | } 63 | } 64 | } 65 | 66 | -------------------------------------------------------------------------------- /external_libraries/UTouch/examples/chipKit/UTouch_QuickDraw/UTouch_QuickDraw.pde: -------------------------------------------------------------------------------- 1 | // UTouch_QuickDraw (C)2010-2012 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a quick demo of how to use the library. 5 | // 6 | // This program requires the UTFT library. 7 | // 8 | // It is assumed that the display module is connected to an 9 | // appropriate shield or that you know how to change the pin 10 | // numbers in the setup. 11 | // 12 | 13 | #include 14 | #include 15 | 16 | // Uncomment the next line for chipKit Uno32 17 | //UTFT myGLCD(ITDB24D,34,35,36,37); // Remember to change the model parameter to suit your display module! 18 | //UTouch myTouch(20,21,22,23,24); 19 | 20 | // Uncomment the next line for chipKit Max32 21 | UTFT myGLCD(ITDB32S,82,83,84,85); // Remember to change the model parameter to suit your display module! 22 | UTouch myTouch(62,63,64,65,66); 23 | 24 | void setup() 25 | { 26 | myGLCD.InitLCD(); 27 | myGLCD.clrScr(); 28 | 29 | myTouch.InitTouch(); 30 | myTouch.setPrecision(PREC_MEDIUM); 31 | } 32 | 33 | void loop() 34 | { 35 | long x, y; 36 | 37 | while (myTouch.dataAvailable() == true) 38 | { 39 | myTouch.read(); 40 | x = myTouch.getX(); 41 | y = myTouch.getY(); 42 | if ((x!=-1) and (y!=-1)) 43 | myGLCD.drawPixel (x, y); 44 | } 45 | } 46 | 47 | -------------------------------------------------------------------------------- /external_libraries/UTouch/hardware/arm/HW_ARM.inc: -------------------------------------------------------------------------------- 1 | // Results becomes inaccurate if direct port manipulation is used hence the use of digitalWrite() and digitalRead() 2 | 3 | void UTouch::touch_WriteData(byte data) 4 | { 5 | byte temp; 6 | 7 | temp=data; 8 | cbi(P_CLK, B_CLK); 9 | 10 | for(byte count=0; count<8; count++) 11 | { 12 | if(temp & 0x80) 13 | digitalWrite(T_DIN, HIGH); 14 | else 15 | digitalWrite(T_DIN, LOW); 16 | temp = temp << 1; 17 | digitalWrite(T_CLK, LOW); 18 | digitalWrite(T_CLK, HIGH); 19 | } 20 | } 21 | 22 | word UTouch::touch_ReadData() 23 | { 24 | word data = 0; 25 | 26 | for(byte count=0; count<12; count++) 27 | { 28 | data <<= 1; 29 | digitalWrite(T_CLK, HIGH); 30 | digitalWrite(T_CLK, LOW); 31 | if (digitalRead(T_DOUT)) 32 | data++; 33 | } 34 | return(data); 35 | } 36 | 37 | -------------------------------------------------------------------------------- /external_libraries/UTouch/hardware/arm/HW_ARM_defines.h: -------------------------------------------------------------------------------- 1 | // *** Hardwarespecific defines *** 2 | #define cbi(reg, bitmask) *reg &= ~bitmask 3 | #define sbi(reg, bitmask) *reg |= bitmask 4 | #define rbi(reg, bitmask) ((*reg) & bitmask) 5 | 6 | #define pulse_high(reg, bitmask) sbi(reg, bitmask); cbi(reg, bitmask); 7 | #define pulse_low(reg, bitmask) cbi(reg, bitmask); sbi(reg, bitmask); 8 | 9 | #define swap(type, i, j) {type t = i; i = j; j = t;} 10 | 11 | #if defined(TEENSYDUINO) && TEENSYDUINO >= 117 12 | #define regtype volatile uint8_t 13 | #define regsize uint8_t 14 | #else 15 | #define regtype volatile uint32_t 16 | #define regsize uint32_t 17 | #endif 18 | -------------------------------------------------------------------------------- /external_libraries/UTouch/hardware/avr/HW_AVR.inc: -------------------------------------------------------------------------------- 1 | void UTouch::touch_WriteData(byte data) 2 | { 3 | byte temp; 4 | 5 | temp=data; 6 | cbi(P_CLK, B_CLK); 7 | 8 | for(byte count=0; count<8; count++) 9 | { 10 | if(temp & 0x80) 11 | sbi(P_DIN, B_DIN); 12 | else 13 | cbi(P_DIN, B_DIN); 14 | temp = temp << 1; 15 | cbi(P_CLK, B_CLK); 16 | sbi(P_CLK, B_CLK); 17 | } 18 | } 19 | 20 | word UTouch::touch_ReadData() 21 | { 22 | word data = 0; 23 | 24 | for(byte count=0; count<12; count++) 25 | { 26 | data <<= 1; 27 | sbi(P_CLK, B_CLK); 28 | cbi(P_CLK, B_CLK); 29 | if (rbi(P_DOUT, B_DOUT)) 30 | data++; 31 | } 32 | return(data); 33 | } 34 | 35 | -------------------------------------------------------------------------------- /external_libraries/UTouch/hardware/avr/HW_AVR_defines.h: -------------------------------------------------------------------------------- 1 | // *** Hardwarespecific defines *** 2 | #define cbi(reg, bitmask) *reg &= ~bitmask 3 | #define sbi(reg, bitmask) *reg |= bitmask 4 | #define rbi(reg, bitmask) ((*reg) & bitmask) 5 | 6 | #define pulse_high(reg, bitmask) sbi(reg, bitmask); cbi(reg, bitmask); 7 | #define pulse_low(reg, bitmask) cbi(reg, bitmask); sbi(reg, bitmask); 8 | 9 | #define swap(type, i, j) {type t = i; i = j; j = t;} 10 | 11 | #define regtype volatile uint8_t 12 | #define regsize uint8_t 13 | -------------------------------------------------------------------------------- /external_libraries/UTouch/hardware/pic32/HW_PIC32.inc: -------------------------------------------------------------------------------- 1 | // Direct port manipulation does not work at the moment, hence the use of digitalWrite() and digitalRead() 2 | 3 | void UTouch::touch_WriteData(byte data) 4 | { 5 | byte temp; 6 | 7 | temp=data; 8 | cbi(P_CLK, B_CLK); 9 | 10 | for(byte count=0; count<8; count++) 11 | { 12 | if(temp & 0x80) 13 | digitalWrite(T_DIN, HIGH); 14 | else 15 | digitalWrite(T_DIN, LOW); 16 | temp = temp << 1; 17 | digitalWrite(T_CLK, LOW); 18 | digitalWrite(T_CLK, HIGH); 19 | } 20 | } 21 | 22 | word UTouch::touch_ReadData() 23 | { 24 | word data = 0; 25 | 26 | for(byte count=0; count<12; count++) 27 | { 28 | data <<= 1; 29 | digitalWrite(T_CLK, HIGH); 30 | digitalWrite(T_CLK, LOW); 31 | if (digitalRead(T_DOUT)) 32 | data++; 33 | } 34 | return(data); 35 | } 36 | 37 | -------------------------------------------------------------------------------- /external_libraries/UTouch/hardware/pic32/HW_PIC32_defines.h: -------------------------------------------------------------------------------- 1 | // *** Hardwarespecific defines *** 2 | #define cbi(reg, bitmask) (*(reg + 1)) = bitmask 3 | #define sbi(reg, bitmask) (*(reg + 2)) = bitmask 4 | #define rbi(reg, bitmask) (*(reg) & bitmask) 5 | 6 | #define pulse_high(reg, bitmask) sbi(reg, bitmask); cbi(reg, bitmask); 7 | #define pulse_low(reg, bitmask) cbi(reg, bitmask); sbi(reg, bitmask); 8 | 9 | #define swap(type, i, j) {type t = i; i = j; j = t;} 10 | 11 | #define regtype volatile uint32_t 12 | #define regsize uint16_t 13 | -------------------------------------------------------------------------------- /external_libraries/UTouch/keywords.txt: -------------------------------------------------------------------------------- 1 | UTouch KEYWORD1 2 | 3 | InitTouch KEYWORD2 4 | read KEYWORD2 5 | dataAvailable KEYWORD2 6 | getX KEYWORD2 7 | getY KEYWORD2 8 | setPrecision KEYWORD2 9 | 10 | PREC_LOW LITERAL1 11 | PREC_MEDIUM LITERAL1 12 | PREC_HI LITERAL1 13 | PREC_EXTREME LITERAL1 14 | PORTRAIT LITERAL1 15 | LANDSCAPE LITERAL1 16 | TP_X LITERAL1 17 | TP_Y LITERAL1 18 | -------------------------------------------------------------------------------- /external_libraries/UTouch/version.txt: -------------------------------------------------------------------------------- 1 | Version: 2 | 1.0 1 Dec 2012 - initial release 3 | 1.1 23 May 2013 - added support for more display modules 4 | modified calibration to try to compensate for slight flaws in some (larger) touchscreens 5 | changed license to CC BY-NC-SA 3.0 6 | 1.2 22 Sep 2013 - general optimization 7 | fixed some issues with calibration 8 | made modifications to reduce erroneous readings 9 | added support for more display modules 10 | added UTouch_QuickPaint example 11 | 1.21 06 Dec 2013 - added support for ElecFreaks TFT01-4.3 12 | added support for Coldtears 3.5" and 4.0" modules 13 | 1.22 18 Feb 2014 - added support for Teensy 3.x Boards 14 | added support for three display modules from ElecHouse 15 | made some modifications to improve accuracy when precision is set to medium or higher 16 | 1.23 16 Mar 2014 - fixed a bug that were introduced in v1.22 17 | 1.24 05 May 2014 - added support for DisplayModule DM-TFT24-104 and DM-TFT28-103 18 | added support for Coldtears 5" and 7" CPLD modules 19 | -------------------------------------------------------------------------------- /sensors/NRF24L01/clear_eeprom/clear_eeprom.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This sketch clears radioId, relayId and routing info in EEPROM 4 | * 5 | */ 6 | 7 | #include 8 | #include 9 | 10 | void setup() 11 | { 12 | for (int i=0;i<512;i++) { 13 | EEPROM.write(i, 0xff); 14 | } 15 | } 16 | 17 | void loop() 18 | { 19 | // Nothing to do here... 20 | } 21 | -------------------------------------------------------------------------------- /sensors/NRF24L01/door_window_sensor/door_window_sensor.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Door/Window sensor 3 | 4 | V1.0 - first version 5 | 6 | Created by Igor Jarc 7 | See http://iot-playground.com for details 8 | 9 | This program is free software; you can redistribute it and/or 10 | modify it under the terms of the GNU General Public License 11 | version 2 as published by the Free Software Foundation. 12 | */ 13 | #include // Sleep Modes 14 | #include 15 | #include 16 | 17 | 18 | #define CHILD_ID 3 19 | #define BUTTON_PIN 3 // Arduino Digital I/O pin for button/reed switch 20 | MySensor gw; 21 | 22 | #define INTERRUPT_SENSOR 1 // Interrupt 1 is on DIGITAL PIN 3! 23 | #define BATTERY_SENSE_PIN 24 | #define SLEEP_IN_MS 86400000 // 1 day 25 | 26 | byte val; 27 | int oldBatLevel; 28 | 29 | // Change to V_LIGHT if you use S_LIGHT in presentation below 30 | MyMessage msg(CHILD_ID,V_TRIPPED); 31 | 32 | void setup() 33 | { 34 | gw.begin(); 35 | 36 | pinMode(BUTTON_PIN,INPUT); 37 | digitalWrite (BUTTON_PIN, LOW); 38 | 39 | pinMode(2,INPUT); 40 | digitalWrite (2, LOW); 41 | 42 | pinMode(4,INPUT); 43 | digitalWrite (4, LOW); 44 | 45 | pinMode(5,INPUT); 46 | digitalWrite (5, LOW); 47 | 48 | pinMode(6,INPUT); 49 | digitalWrite (6, LOW); 50 | 51 | pinMode(7,INPUT); 52 | digitalWrite (7, LOW); 53 | 54 | pinMode(8,INPUT); 55 | digitalWrite (8, LOW); 56 | 57 | gw.present(CHILD_ID, S_DOOR); 58 | 59 | val = digitalRead(BUTTON_PIN); 60 | oldBatLevel = -1; 61 | 62 | sendValue(); 63 | } 64 | 65 | void loop () 66 | { 67 | gw.sleep(INTERRUPT_SENSOR, CHANGE, SLEEP_IN_MS); 68 | val = digitalRead(BUTTON_PIN); 69 | 70 | sendValue(); 71 | 72 | gw.sleep(200); 73 | } // end of loop 74 | 75 | void sendValue() 76 | { 77 | //gw.powerUp(); 78 | gw.send(msg.set(val==HIGH ? 1 : 0)); 79 | 80 | gw.powerDown(); 81 | 82 | int batLevel = getBatteryLevel(); 83 | if (oldBatLevel != batLevel) 84 | { 85 | //gw.powerUp(); 86 | gw.sendBatteryLevel(batLevel); 87 | oldBatLevel = batLevel; 88 | } 89 | } 90 | 91 | // Battery measure 92 | int getBatteryLevel () 93 | { 94 | int results = (readVcc() - 2000) / 10; 95 | 96 | if (results > 100) 97 | results = 100; 98 | if (results < 0) 99 | results = 0; 100 | return results; 101 | } // end of getBandgap 102 | 103 | // when ADC completed, take an interrupt 104 | EMPTY_INTERRUPT (ADC_vect); 105 | 106 | long readVcc() { 107 | long result; 108 | // Read 1.1V reference against AVcc 109 | ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1); 110 | delay(2); // Wait for Vref to settle 111 | noInterrupts (); 112 | // start the conversion 113 | ADCSRA |= _BV (ADSC) | _BV (ADIE); 114 | set_sleep_mode (SLEEP_MODE_ADC); // sleep during sample 115 | interrupts (); 116 | sleep_mode (); 117 | // reading should be done, but better make sure 118 | // maybe the timer interrupt fired 119 | while (bit_is_set(ADCSRA,ADSC)); 120 | result = ADCL; 121 | result |= ADCH<<8; 122 | result = 1126400L / result; // Back-calculate AVcc in mV 123 | 124 | return result; 125 | } 126 | --------------------------------------------------------------------------------