├── EIoTCloudRestApi ├── EIoTCloudRestApi.cpp ├── EIoTCloudRestApi.h ├── EIoTCloudRestApiConfig.h └── examples │ ├── ESP8266_DHT22_humidity_sensor_REST_1 │ └── ESP8266_DHT22_humidity_sensor_REST_1.ino │ ├── ESP8266_DS18B20_temperature_sensor_REST_1 │ └── ESP8266_DS18B20_temperature_sensor_REST_1.ino │ ├── ESP8266_PIR_sensor_REST.ino │ └── ESP8266_PIR_sensor_REST.ino.ino │ └── ESP8266_doorwindow_sensor_REST_1.ino │ └── ESP8266_doorwindow_sensor_REST_1.ino.ino ├── EIoTCloudRestApiV1.0 ├── EIoTCloudRestApiConfig.h ├── EIoTCloudRestApiV1.0.cpp ├── EIoTCloudRestApiV1.0.h └── examples │ ├── ESP8266_DHT22_humidity_sensor_REST_V1_0 │ └── ESP8266_DHT22_humidity_sensor_REST_V1_0.ino │ ├── ESP8266_DS18B20_temperature_sensor_REST_v1_0.ino │ └── ESP8266_DS18B20_temperature_sensor_REST_v1_0.ino.ino │ ├── ESP8266_door_window_REST_V1_0 │ └── ESP8266_door_window_REST_V1_0.ino │ └── ESP8266_light_sensor_REST_V1_0 │ └── ESP8266_light_sensor_REST_V1_0.ino ├── ESP8266_DHT22_humidity_sensor_REST └── ESP8266_DHT22_humidity_sensor_REST.ino ├── ESP8266_DS18B20_temperature_sensor_REST └── ESP8266_DS18B20_temperature_sensor_REST.ino ├── ESP8266_LCD_touchscreen_thermostat └── ESP8266_LCD_touchscreen_thermostat.ino ├── ESP8266_mqtt_4_relay_switch └── ESP8266_mqtt_4_relay_switch.ino ├── ESP8266_mqtt_irrigator └── ESP8266_mqtt_irrigator.ino ├── ESP8266_mqtt_serial_gw └── ESP8266_mqtt_serial_gw.ino ├── ESP8266_mqtt_termostat_fan └── ESP8266_mqtt_termostat_fan.ino ├── ESP8266_relay_switch_MQTT └── ESP8266_relay_switch_MQTT.ino ├── README.md ├── esp8266_mqtt_switch1 └── esp8266_mqtt_switch1.ino └── 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 ├── DallasTemperature ├── .gitignore ├── DallasTemperature.cpp ├── DallasTemperature.h ├── README.md ├── change.txt ├── examples │ ├── Alarm │ │ └── Alarm.pde │ ├── AlarmHandler │ │ └── AlarmHandler.pde │ ├── Multiple │ │ └── Multiple.pde │ ├── Simple │ │ └── Simple.pde │ ├── Single │ │ └── Single.pde │ ├── Tester │ │ └── Tester.pde │ ├── WaitForConversion │ │ └── WaitForConversion.pde │ └── WaitForConversion2 │ │ └── WaitForConversion2.pde ├── keywords.txt └── library.json ├── EasyTransfer ├── EasyTransfer.cpp ├── EasyTransfer.h ├── I2C_Wiring.png ├── README.txt ├── UARTS_Wiring.png ├── examples │ ├── EasyTransfer_2Way_wPot_Example │ │ └── EasyTransfer_2Way_wPot_Example.pde │ ├── EasyTransfer_2Way_wServo_Example │ │ └── EasyTransfer_2Way_wServo_Example.pde │ ├── EasyTransfer_RX_Example │ │ └── EasyTransfer_RX_Example.pde │ └── EasyTransfer_TX_Example │ │ └── EasyTransfer_TX_Example.pde └── keywords.txt ├── 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 ├── SoftEasyTransfer ├── SoftEasyTransfer.cpp ├── SoftEasyTransfer.h ├── examples │ ├── SoftEasyTransfer_RX_Example │ │ └── SoftEasyTransfer_RX_Example.pde │ └── SoftEasyTransfer_TX_Example │ │ └── SoftEasyTransfer_TX_Example.pde └── keywords.txt ├── Time ├── DateStrings.cpp ├── Readme.md ├── Time.cpp ├── Time.h ├── TimeLib.h ├── examples │ ├── Processing │ │ └── SyncArduinoClock │ │ │ ├── SyncArduinoClock.pde │ │ │ └── readme.txt │ ├── TimeArduinoDue │ │ └── TimeArduinoDue.ino │ ├── TimeGPS │ │ └── TimeGPS.ino │ ├── TimeNTP │ │ └── TimeNTP.ino │ ├── TimeNTP_ESP8266WiFi │ │ └── TimeNTP_ESP8266WiFi.ino │ ├── TimeRTC │ │ └── TimeRTC.ino │ ├── TimeRTCLog │ │ └── TimeRTCLog.ino │ ├── TimeRTCSet │ │ └── TimeRTCSet.ino │ ├── TimeSerial │ │ └── TimeSerial.ino │ ├── TimeSerialDateStrings │ │ └── TimeSerialDateStrings.ino │ └── TimeTeensy3 │ │ └── TimeTeensy3.ino ├── keywords.txt ├── library.json └── library.properties ├── 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.h ├── DefaultFonts.c ├── Documentation │ ├── UTFT.pdf │ ├── UTFT_Requirements.pdf │ ├── UTFT_Supported_display_modules_&_controllers.pdf │ └── version.txt ├── License │ ├── License - CC BY-NC-SA 3.0 - Legal.pdf │ └── License - CC BY-NC-SA 3.0 - Summary.pdf ├── SevenSegNumFontPlus.h ├── SevenSeg_XXXL_Num.h ├── Tools │ ├── ImageConverter565.exe │ ├── ImgConv.exe │ └── UTFT Image Converters.pdf ├── UTFT.cpp ├── UTFT.h ├── arial_normal.h ├── 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 │ ├── TI LaunchPads (Energia) │ │ ├── UTFT_Bitmap │ │ │ ├── UTFT_Bitmap.ino │ │ │ ├── icon.c │ │ │ ├── info.c │ │ │ └── tux.c │ │ ├── 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_400x240 │ │ │ └── UTFT_Demo_400x240.ino │ │ ├── UTFT_Demo_480x320 │ │ │ └── UTFT_Demo_480x320.ino │ │ ├── UTFT_Rotate_Bitmap │ │ │ ├── UTFT_Rotate_Bitmap.ino │ │ │ └── biohazard.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_CC3200.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 │ ├── ili9325c │ ├── initlcd.h │ └── setxy.h │ ├── ili9325d │ ├── alt │ │ ├── initlcd.h │ │ └── setxy.h │ └── default │ │ ├── initlcd.h │ │ └── setxy.h │ ├── ili9327 │ ├── initlcd.h │ └── setxy.h │ ├── ili9341 │ ├── 16 │ │ ├── initlcd.h │ │ └── setxy.h │ ├── 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 │ ├── alt │ │ ├── initlcd.h │ │ └── setxy.h │ └── std │ │ ├── initlcd.h │ │ └── setxy.h │ └── st7735s │ ├── initlcd.h │ └── setxy.h └── esp-mqtt ├── .gitignore ├── README.md ├── examples ├── mqtt_pub │ └── mqtt_pub.ino └── mqtt_sub │ └── mqtt_sub.ino ├── keywords.txt ├── library.properties └── src ├── MQTT.cpp ├── MQTT.h └── mqtt ├── debug.h ├── mqtt.c ├── mqtt.h ├── mqtt_config.h ├── mqtt_msg.c ├── mqtt_msg.h ├── proto.c ├── proto.h ├── queue.c ├── queue.h ├── ringbuf.c ├── ringbuf.h ├── typedef.h ├── utils.c └── utils.h /EIoTCloudRestApi/EIoTCloudRestApi.cpp: -------------------------------------------------------------------------------- 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 | 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 | #include "EIoTCloudRestApi.h" 13 | #include 14 | 15 | 16 | 17 | EIoTCloudRestApi::EIoTCloudRestApi() { 18 | } 19 | 20 | 21 | void EIoTCloudRestApi::begin() { 22 | wifiConnect(); 23 | } 24 | 25 | void EIoTCloudRestApi::sendParameter(const char * instaceParamId, bool value) 26 | { 27 | if (value) 28 | sendParameter(instaceParamId, "1"); 29 | else 30 | sendParameter(instaceParamId, "0"); 31 | } 32 | 33 | void EIoTCloudRestApi::sendParameter(const char * instaceParamId, int value) 34 | { 35 | sendParameter(instaceParamId, String(value)); 36 | } 37 | 38 | void EIoTCloudRestApi::sendParameter(const char * instaceParamId, float value) 39 | { 40 | sendParameter(instaceParamId, String(value)); 41 | } 42 | 43 | void EIoTCloudRestApi::sendParameter(const char * instaceParamId, const char * value) 44 | { 45 | sendParameter(instaceParamId, String(value)); 46 | } 47 | 48 | void EIoTCloudRestApi::sendParameter(const char * instaceParamId, String value) 49 | { 50 | WiFiClient client; 51 | 52 | while(!client.connect(EIOT_CLOUD_ADDRESS, EIOT_CLOUD_PORT)) { 53 | debug("connection failed"); 54 | wifiConnect(); 55 | } 56 | 57 | String url = ""; 58 | // URL: /RestApi/SetParameter/[instance id]/[parameter id]/[value] 59 | url += "/RestApi/SetParameter/" + String(instaceParamId) + "/" + value; // generate EasIoT cloud update parameter URL 60 | 61 | debug("POST data to URL: "); 62 | #ifdef DEBUG 63 | char buff[300]; 64 | url.toCharArray(buff, 300); 65 | debug(buff); 66 | #endif 67 | 68 | client.print(String("POST ") + url + " HTTP/1.1\r\n" + 69 | "Host: " + String(EIOT_CLOUD_ADDRESS) + "\r\n" + 70 | "Connection: close\r\n" + 71 | "Content-Length: 0\r\n" + 72 | "\r\n"); 73 | 74 | delay(100); 75 | while(client.available()){ 76 | #ifdef DEBUG 77 | String line = client.readStringUntil('\r'); 78 | line.toCharArray(buff, 300); 79 | debug(buff); 80 | #endif 81 | } 82 | } 83 | 84 | 85 | 86 | void EIoTCloudRestApi::wifiConnect() 87 | { 88 | debug("Connecting to AP"); 89 | WiFi.begin(AP_SSID, AP_PASSWORD); 90 | while (WiFi.status() != WL_CONNECTED) { 91 | delay(1000); 92 | Serial.print("."); 93 | } 94 | 95 | debug(""); 96 | debug("WiFi connected"); 97 | } 98 | 99 | 100 | 101 | #ifdef DEBUG 102 | void EIoTCloudRestApi::printDebug(const char *fmt, ...) { 103 | char buff[300]; 104 | 105 | va_list args; 106 | va_start(args, fmt); 107 | va_end(args); 108 | 109 | vsnprintf_P(buff, 299, fmt, args); 110 | 111 | va_end(args); 112 | Serial.print(buff); 113 | Serial.flush(); 114 | } 115 | #endif -------------------------------------------------------------------------------- /EIoTCloudRestApi/EIoTCloudRestApi.h: -------------------------------------------------------------------------------- 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 | 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 | Changelog 12 | ---------------- 13 | 15.10.2015 - first version 14 | 15 | */ 16 | #ifndef EIoTCloudRestApi_h 17 | #define EIoTCloudRestApi_h 18 | 19 | #include "EIoTCloudRestApiConfig.h" 20 | #include 21 | 22 | #ifdef DEBUG 23 | #define debug(x,...) printDebug(x, ##__VA_ARGS__) 24 | #else 25 | #define debug(x,...) 26 | #endif 27 | 28 | 29 | #define EIOT_CLOUD_ADDRESS "cloud.iot-playground.com" 30 | #define EIOT_CLOUD_PORT 40404 31 | 32 | 33 | class EIoTCloudRestApi 34 | { 35 | public: 36 | EIoTCloudRestApi(); 37 | void begin(); 38 | 39 | void sendParameter(const char * instaceParamId, bool value); 40 | void sendParameter(const char * instaceParamId, int value); 41 | void sendParameter(const char * instaceParamId, float value); 42 | void sendParameter(const char * instaceParamId, String value); 43 | void sendParameter(const char * instaceParamId, const char * value); 44 | 45 | #ifdef DEBUG 46 | void printDebug(const char *fmt, ...); 47 | #endif 48 | protected: 49 | void wifiConnect(); 50 | 51 | }; 52 | 53 | #endif 54 | 55 | -------------------------------------------------------------------------------- /EIoTCloudRestApi/EIoTCloudRestApiConfig.h: -------------------------------------------------------------------------------- 1 | #ifndef EIoTCloudRestApiConfig_h 2 | #define EIoTCloudRestApiConfigi_h 3 | 4 | // define your access point username and password 5 | #define AP_SSID "xxx" 6 | #define AP_PASSWORD "xxx" 7 | 8 | 9 | // uncomentwhen debugging 10 | #define DEBUG 11 | 12 | #endif 13 | 14 | -------------------------------------------------------------------------------- /EIoTCloudRestApi/examples/ESP8266_DHT22_humidity_sensor_REST_1/ESP8266_DHT22_humidity_sensor_REST_1.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Created by Igor Jarc 3 | See http://iot-playground.com for details 4 | Please use community fourum on website do not contact author directly 5 | 6 | External libraries: 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 "DHT.h" 14 | #include "EIoTCloudRestApi.h" 15 | 16 | 17 | 18 | // EasyIoT Cloud definitions - change EIOT_CLOUD_TEMP_INSTANCE_PARAM_ID and EIOT_CLOUD_HUM_INSTANCE_PARAM_ID 19 | #define EIOT_CLOUD_TEMP_INSTANCE_PARAM_ID "xxxx" 20 | #define EIOT_CLOUD_HUM_INSTANCE_PARAM_ID "xxxx" 21 | #define REPORT_INTERVAL 60 // in sec 22 | 23 | 24 | #define DHT22_PIN 2 // DHT22 pin 25 | 26 | 27 | float oldTemp; 28 | float oldHum; 29 | 30 | DHT dht; 31 | EIoTCloudRestApi eiotcloud; 32 | 33 | void setup() { 34 | Serial.begin(115200); 35 | eiotcloud.begin(); 36 | 37 | Serial.println(); 38 | Serial.println("Status\tHumidity (%)\tTemperature (C)\t(F)"); 39 | 40 | dht.setup(DHT22_PIN); // 41 | 42 | oldTemp = -1; 43 | oldHum = -1; 44 | } 45 | 46 | void loop() { 47 | delay(dht.getMinimumSamplingPeriod()); 48 | 49 | float hum = dht.getHumidity(); 50 | float temp = dht.getTemperature(); 51 | 52 | Serial.print(dht.getStatusString()); 53 | Serial.print("\t"); 54 | Serial.print(hum, 1); 55 | Serial.print("\t\t"); 56 | Serial.print(temp, 1); 57 | Serial.print("\t\t"); 58 | Serial.println(dht.toFahrenheit(temp), 1); 59 | 60 | if (temp != oldTemp) 61 | { 62 | eiotcloud.sendParameter(EIOT_CLOUD_TEMP_INSTANCE_PARAM_ID, temp); 63 | oldTemp = temp; 64 | } 65 | 66 | if (hum != oldHum) 67 | { 68 | eiotcloud.sendParameter(EIOT_CLOUD_HUM_INSTANCE_PARAM_ID, hum); 69 | oldHum = hum; 70 | } 71 | 72 | int cnt = REPORT_INTERVAL; 73 | 74 | while(cnt--) 75 | delay(1000); 76 | } 77 | -------------------------------------------------------------------------------- /EIoTCloudRestApi/examples/ESP8266_DS18B20_temperature_sensor_REST_1/ESP8266_DS18B20_temperature_sensor_REST_1.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Created by Igor Jarc 3 | See http://iot-playground.com for details 4 | Please use community fourum on website do not contact author directly 5 | 6 | Code based on https://github.com/DennisSc/easyIoT-ESPduino/blob/master/sketches/ds18b20.ino 7 | 8 | External libraries: 9 | - https://github.com/milesburton/Arduino-Temperature-Control-Library 10 | 11 | This program is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU General Public License 13 | version 2 as published by the Free Software Foundation. 14 | */ 15 | #include 16 | #include 17 | #include 18 | #include "EIoTCloudRestApi.h" 19 | 20 | 21 | // EasyIoT Cloud definitions - change EIOT_CLOUD_INSTANCE_PARAM_ID 22 | #define EIOT_CLOUD_INSTANCE_PARAM_ID "xxxxx" 23 | #define REPORT_INTERVAL 60 // in sec 24 | 25 | 26 | 27 | #define ONE_WIRE_BUS 2 // DS18B20 pin 28 | OneWire oneWire(ONE_WIRE_BUS); 29 | DallasTemperature DS18B20(&oneWire); 30 | EIoTCloudRestApi eiotcloud; 31 | 32 | 33 | float oldTemp; 34 | 35 | 36 | void setup() { 37 | Serial.begin(115200); 38 | 39 | eiotcloud.begin(); 40 | 41 | oldTemp = -1; 42 | } 43 | 44 | void loop() { 45 | float temp; 46 | 47 | do { 48 | DS18B20.requestTemperatures(); 49 | temp = DS18B20.getTempCByIndex(0); 50 | Serial.print("Temperature: "); 51 | Serial.println(temp); 52 | } while (temp == 85.0 || temp == (-127.0)); 53 | 54 | if (temp != oldTemp) 55 | { 56 | eiotcloud.sendParameter(EIOT_CLOUD_INSTANCE_PARAM_ID, temp); 57 | oldTemp = temp; 58 | } 59 | 60 | int cnt = REPORT_INTERVAL; 61 | 62 | while(cnt--) 63 | delay(1000); 64 | } 65 | -------------------------------------------------------------------------------- /EIoTCloudRestApi/examples/ESP8266_PIR_sensor_REST.ino/ESP8266_PIR_sensor_REST.ino.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 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | version 2 as published by the Free Software Foundation. 9 | */ 10 | #include 11 | #include "EIoTCloudRestApi.h" 12 | 13 | // EasyIoT Cloud definitions - change EIOT_CLOUD_INSTANCE_PARAM_ID 14 | #define EIOT_CLOUD_INSTANCE_PARAM_ID "xxxx" 15 | 16 | #define INPUT_PIN 2 17 | 18 | EIoTCloudRestApi eiotcloud; 19 | bool oldInputState; 20 | 21 | void setup() { 22 | Serial.begin(115200); 23 | eiotcloud.begin(); 24 | 25 | pinMode(INPUT_PIN, INPUT_PULLUP); 26 | 27 | oldInputState = !digitalRead(INPUT_PIN); 28 | } 29 | 30 | void loop() { 31 | int inputState = digitalRead(INPUT_PIN);; 32 | 33 | if (inputState != oldInputState) 34 | { 35 | eiotcloud.sendParameter(EIOT_CLOUD_INSTANCE_PARAM_ID, (inputState == 1)); 36 | oldInputState = inputState; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /EIoTCloudRestApi/examples/ESP8266_doorwindow_sensor_REST_1.ino/ESP8266_doorwindow_sensor_REST_1.ino.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 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | version 2 as published by the Free Software Foundation. 9 | */ 10 | #include 11 | #include "EIoTCloudRestApi.h" 12 | 13 | // EasyIoT Cloud definitions - change EIOT_CLOUD_INSTANCE_PARAM_ID 14 | #define EIOT_CLOUD_INSTANCE_PARAM_ID "xxxx" 15 | 16 | #define INPUT_PIN 5 17 | 18 | EIoTCloudRestApi eiotcloud; 19 | bool oldInputState; 20 | 21 | void setup() { 22 | Serial.begin(115200); 23 | eiotcloud.begin(); 24 | 25 | pinMode(INPUT_PIN, INPUT_PULLUP); 26 | 27 | oldInputState = !digitalRead(INPUT_PIN); 28 | } 29 | 30 | void loop() { 31 | int inputState = digitalRead(INPUT_PIN);; 32 | 33 | if (inputState != oldInputState) 34 | { 35 | eiotcloud.sendParameter(EIOT_CLOUD_INSTANCE_PARAM_ID, (inputState == 1)); 36 | oldInputState = inputState; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /EIoTCloudRestApiV1.0/EIoTCloudRestApiConfig.h: -------------------------------------------------------------------------------- 1 | #ifndef EIoTCloudRestApiConfig_h 2 | #define EIoTCloudRestApiConfigi_h 3 | 4 | 5 | // uncomentwhen debugging 6 | //#define DEBUG 7 | 8 | #endif 9 | 10 | -------------------------------------------------------------------------------- /ESP8266_DS18B20_temperature_sensor_REST/ESP8266_DS18B20_temperature_sensor_REST.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Created by Igor Jarc 3 | See http://iot-playground.com for details 4 | Please use community fourum on website do not contact author directly 5 | 6 | Code based on https://github.com/DennisSc/easyIoT-ESPduino/blob/master/sketches/ds18b20.ino 7 | 8 | External libraries: 9 | - https://github.com/milesburton/Arduino-Temperature-Control-Library 10 | 11 | This program is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU General Public License 13 | version 2 as published by the Free Software Foundation. 14 | */ 15 | #include 16 | #include 17 | #include 18 | 19 | //AP definitions - update this 20 | #define AP_SSID "xxxxx" 21 | #define AP_PASSWORD "xxxxx" 22 | 23 | // EasyIoT Cloud definitions - change EIOT_CLOUD_INSTANCE_PARAM_ID 24 | #define EIOT_CLOUD_INSTANCE_PARAM_ID "xxxxx" 25 | #define REPORT_INTERVAL 60 // in sec 26 | 27 | 28 | #define EIOT_CLOUD_ADDRESS "cloud.iot-playground.com" 29 | #define EIOT_CLOUD_PORT 40404 30 | 31 | 32 | 33 | 34 | #define ONE_WIRE_BUS 2 // DS18B20 pin 35 | OneWire oneWire(ONE_WIRE_BUS); 36 | DallasTemperature DS18B20(&oneWire); 37 | 38 | 39 | float oldTemp; 40 | 41 | 42 | void setup() { 43 | Serial.begin(115200); 44 | 45 | wifiConnect(); 46 | 47 | oldTemp = -1; 48 | } 49 | 50 | void loop() { 51 | float temp; 52 | 53 | do { 54 | DS18B20.requestTemperatures(); 55 | temp = DS18B20.getTempCByIndex(0); 56 | Serial.print("Temperature: "); 57 | Serial.println(temp); 58 | } while (temp == 85.0 || temp == (-127.0)); 59 | 60 | if (temp != oldTemp) 61 | { 62 | sendTeperature(temp); 63 | oldTemp = temp; 64 | } 65 | 66 | int cnt = REPORT_INTERVAL; 67 | 68 | while(cnt--) 69 | delay(1000); 70 | } 71 | 72 | void wifiConnect() 73 | { 74 | Serial.print("Connecting to AP"); 75 | WiFi.begin(AP_SSID, AP_PASSWORD); 76 | while (WiFi.status() != WL_CONNECTED) { 77 | delay(1000); 78 | Serial.print("."); 79 | } 80 | 81 | Serial.println(""); 82 | Serial.println("WiFi connected"); 83 | } 84 | 85 | void sendTeperature(float temp) 86 | { 87 | WiFiClient client; 88 | 89 | while(!client.connect(EIOT_CLOUD_ADDRESS, EIOT_CLOUD_PORT)) { 90 | Serial.println("connection failed"); 91 | wifiConnect(); 92 | } 93 | 94 | String url = ""; 95 | // URL: /RestApi/SetParameter/[instance id]/[parameter id]/[value] 96 | url += "/RestApi/SetParameter/"+ String(EIOT_CLOUD_INSTANCE_PARAM_ID) + "/"+String(temp); // generate EasIoT cloud update parameter URL 97 | 98 | Serial.print("POST data to URL: "); 99 | Serial.println(url); 100 | 101 | client.print(String("POST ") + url + " HTTP/1.1\r\n" + 102 | "Host: " + String(EIOT_CLOUD_ADDRESS) + "\r\n" + 103 | "Connection: close\r\n" + 104 | "Content-Length: 0\r\n" + 105 | "\r\n"); 106 | 107 | delay(100); 108 | while(client.available()){ 109 | String line = client.readStringUntil('\r'); 110 | Serial.print(line); 111 | } 112 | 113 | Serial.println(); 114 | Serial.println("Connection closed"); 115 | } 116 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # EasyIoT-Cloud 2 | EasyIoT Cloud source code examples and libraries. More at http://iot-playground.com/ 3 | -------------------------------------------------------------------------------- /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 | Update: Igor Jarc 15 | This library is ported to Arduino ESP8266 IDE. 16 | http://iot-playground.com/2-uncategorised/70-esp8266-wifi-dht22-humidity-sensor-easyiot-cloud-rest-api 17 | https://github.com/iot-playground/EasyIoT-Cloud 18 | 19 | 20 | BSD license, check license.txt for more information. 21 | All text above must be included in any redistribution. 22 | 23 | Datasheets: 24 | - http://www.micro4you.com/files/sensor/DHT11.pdf 25 | - http://www.adafruit.com/datasheets/DHT22.pdf 26 | - http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Sensors/Weather/RHT03.pdf 27 | - http://meteobox.tk/files/AM2302.pdf 28 | 29 | Changelog: 30 | 2013-06-10: Initial version 31 | 2013-06-12: Refactored code 32 | 2013-07-01: Add a resetTimer method 33 | 2015-10-13: Ported to Arduino ESP8266 IDE Igor Jarc http://iot-playground.com 34 | ******************************************************************/ 35 | 36 | #ifndef dht_h 37 | #define dht_h 38 | 39 | #if ARDUINO < 100 40 | #include 41 | #else 42 | #include 43 | #endif 44 | 45 | class DHT 46 | { 47 | public: 48 | 49 | typedef enum { 50 | AUTO_DETECT, 51 | DHT11, 52 | DHT22, 53 | AM2302, // Packaged DHT22 54 | RHT03 // Equivalent to DHT22 55 | } 56 | DHT_MODEL_t; 57 | 58 | typedef enum { 59 | ERROR_NONE = 0, 60 | ERROR_TIMEOUT, 61 | ERROR_CHECKSUM 62 | } 63 | DHT_ERROR_t; 64 | 65 | void setup(uint8_t pin, DHT_MODEL_t model=AUTO_DETECT); 66 | void resetTimer(); 67 | 68 | float getTemperature(); 69 | float getHumidity(); 70 | 71 | DHT_ERROR_t getStatus() { return error; }; 72 | const char* getStatusString(); 73 | 74 | DHT_MODEL_t getModel() { return model; } 75 | 76 | int getMinimumSamplingPeriod() { return model == DHT11 ? 1000 : 2000; } 77 | 78 | int8_t getNumberOfDecimalsTemperature() { return model == DHT11 ? 0 : 1; }; 79 | int8_t getLowerBoundTemperature() { return model == DHT11 ? 0 : -40; }; 80 | int8_t getUpperBoundTemperature() { return model == DHT11 ? 50 : 125; }; 81 | 82 | int8_t getNumberOfDecimalsHumidity() { return 0; }; 83 | int8_t getLowerBoundHumidity() { return model == DHT11 ? 20 : 0; }; 84 | int8_t getUpperBoundHumidity() { return model == DHT11 ? 90 : 100; }; 85 | 86 | static float toFahrenheit(float fromCelcius) { return 1.8 * fromCelcius + 32.0; }; 87 | static float toCelsius(float fromFahrenheit) { return (fromFahrenheit - 32.0) / 1.8; }; 88 | 89 | protected: 90 | void readSensor(); 91 | 92 | float temperature; 93 | float humidity; 94 | 95 | uint8_t pin; 96 | 97 | uint32_t detectState(bool level); 98 | 99 | private: 100 | DHT_MODEL_t model; 101 | DHT_ERROR_t error; 102 | unsigned long lastReadTime; 103 | }; 104 | 105 | #endif /*dht_h*/ 106 | -------------------------------------------------------------------------------- /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 | Update: Igor Jarc 9 | 10 | This library is ported to Arduino ESP8266 IDE. 11 | 12 | http://iot-playground.com/2-uncategorised/70-esp8266-wifi-dht22-humidity-sensor-easyiot-cloud-rest-api 13 | 14 | https://github.com/iot-playground/EasyIoT-Cloud 15 | 16 | Features 17 | -------- 18 | - Support for DHT11 and DHT22, AM2302, RHT03 19 | - Auto detect sensor model 20 | - Low memory footprint 21 | - Very small code 22 | 23 | Usage 24 | ----- 25 | 26 | ``` 27 | #include "DHT.h" 28 | 29 | DHT dht; 30 | 31 | void setup() 32 | { 33 | Serial.begin(9600); 34 | 35 | dht.setup(2); // data pin 2 36 | } 37 | 38 | void loop() 39 | { 40 | delay(dht.getMinimumSamplingPeriod()); 41 | 42 | Serial.print(dht.getHumidity()); 43 | Serial.print("\t"); 44 | Serial.print(dht.getTemperature()); 45 | } 46 | ``` 47 | Also check out the [example] how to read out your sensor. For all the options, see [dht.h][header]. 48 | 49 | Installation 50 | ------------ 51 | 52 | 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. 53 | 54 | [download]: https://github.com/markruys/arduino-DHT/archive/master.zip "Download DHT library" 55 | [example]: https://github.com/markruys/arduino-DHT/blob/master/examples/DHT_Test/DHT_Test.pde "Show DHT example" 56 | [header]: https://github.com/markruys/arduino-DHT/blob/master/DHT.h "Show header file" 57 | 58 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /libraries/DHT/readme.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iot-playground/EasyIoT-Cloud/982c29112186ee6e5fe6864fefa8acbc7e88a906/libraries/DHT/readme.pdf -------------------------------------------------------------------------------- /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 | #include 19 | 20 | // Set pins: CE, IO,CLK 21 | //DS1302RTC RTC(27, 29, 31); 22 | DS1302RTC RTC(11, 10, 9); 23 | 24 | 25 | // Optional connection for RTC module 26 | #define DS1302_GND_PIN 33 27 | #define DS1302_VCC_PIN 35 28 | 29 | void setup() 30 | { 31 | 32 | // Setup Serial connection 33 | Serial.begin(9600); 34 | 35 | Serial.println("DS1302RTC Read Test"); 36 | Serial.println("-------------------"); 37 | 38 | // Activate RTC module 39 | digitalWrite(DS1302_GND_PIN, LOW); 40 | pinMode(DS1302_GND_PIN, OUTPUT); 41 | 42 | digitalWrite(DS1302_VCC_PIN, HIGH); 43 | pinMode(DS1302_VCC_PIN, OUTPUT); 44 | 45 | Serial.println("RTC module activated"); 46 | Serial.println(); 47 | delay(500); 48 | 49 | if (RTC.haltRTC()) { 50 | Serial.println("The DS1302 is stopped. Please run the SetTime"); 51 | Serial.println("example to initialize the time and begin running."); 52 | Serial.println(); 53 | } 54 | if (!RTC.writeEN()) { 55 | Serial.println("The DS1302 is write protected. This normal."); 56 | Serial.println(); 57 | } 58 | 59 | delay(5000); 60 | } 61 | 62 | void loop() 63 | { 64 | tmElements_t tm; 65 | 66 | Serial.print("UNIX Time: "); 67 | Serial.print(RTC.get()); 68 | 69 | if (! RTC.read(tm)) { 70 | Serial.print(" Time = "); 71 | print2digits(tm.Hour); 72 | Serial.write(':'); 73 | print2digits(tm.Minute); 74 | Serial.write(':'); 75 | print2digits(tm.Second); 76 | Serial.print(", Date (D/M/Y) = "); 77 | Serial.print(tm.Day); 78 | Serial.write('/'); 79 | Serial.print(tm.Month); 80 | Serial.write('/'); 81 | Serial.print(tmYearToCalendar(tm.Year)); 82 | Serial.print(", DoW = "); 83 | Serial.print(tm.Wday); 84 | Serial.println(); 85 | } else { 86 | Serial.println("DS1302 read error! Please check the circuitry."); 87 | Serial.println(); 88 | delay(9000); 89 | } 90 | 91 | // Wait one second before repeating :) 92 | delay (1000); 93 | } 94 | 95 | void print2digits(int number) { 96 | if (number >= 0 && number < 10) 97 | Serial.write('0'); 98 | Serial.print(number); 99 | } 100 | 101 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /libraries/DallasTemperature/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | classes 3 | target 4 | out 5 | build 6 | *.iml 7 | *.ipr 8 | *.iws 9 | *.log 10 | *.war 11 | .idea 12 | .project 13 | .classpath 14 | .settings 15 | .gradle 16 | 17 | -------------------------------------------------------------------------------- /libraries/DallasTemperature/README.md: -------------------------------------------------------------------------------- 1 | Arduino Library for Dallas Temperature ICs 2 | ========================================== 3 | 4 | Usage 5 | ----- 6 | 7 | This library supports the following devices : 8 | 9 | 10 | * DS18B20 11 | * DS18S20 - Please note there appears to be an issue with this series. 12 | * DS1822 13 | * DS1820 14 | 15 | 16 | You will need a pull-up resistor of about 5 KOhm between the 1-Wire data line 17 | and your 5V power. If you are using the DS18B20, ground pins 1 and 3. The 18 | centre pin is the data line '1-wire'. 19 | 20 | We have included a "REQUIRESNEW" and "REQUIRESALARMS" definition. If you 21 | want to slim down the code feel free to use either of these by including 22 | 23 | 24 | 25 | #define REQUIRESNEW 26 | 27 | or 28 | 29 | #define REQUIRESALARMS 30 | 31 | 32 | at the top of DallasTemperature.h 33 | 34 | 35 | Credits 36 | ------- 37 | 38 | The OneWire code has been derived from 39 | http://www.arduino.cc/playground/Learning/OneWire. 40 | Miles Burton originally developed this library. 41 | Tim Newsome added support for multiple sensors on 42 | the same bus. 43 | Guil Barros [gfbarros@bappos.com] added getTempByAddress (v3.5) 44 | Rob Tillaart [rob.tillaart@gmail.com] added async modus (v3.7.0) 45 | 46 | 47 | Website 48 | ------- 49 | 50 | You can find the latest version of the library at 51 | http://milesburton.com/index.php?title=Dallas_Temperature_Control_Library 52 | 53 | License 54 | ------- 55 | 56 | This library is free software; you can redistribute it and/or 57 | modify it under the terms of the GNU Lesser General Public 58 | License as published by the Free Software Foundation; either 59 | version 2.1 of the License, or (at your option) any later version. 60 | 61 | This library is distributed in the hope that it will be useful, 62 | but WITHOUT ANY WARRANTY; without even the implied warranty of 63 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 64 | Lesser General Public License for more details. 65 | 66 | You should have received a copy of the GNU Lesser General Public 67 | License along with this library; if not, write to the Free Software 68 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 69 | -------------------------------------------------------------------------------- /libraries/DallasTemperature/examples/Simple/Simple.pde: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | // Data wire is plugged into port 2 on the Arduino 5 | #define ONE_WIRE_BUS 2 6 | 7 | // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs) 8 | OneWire oneWire(ONE_WIRE_BUS); 9 | 10 | // Pass our oneWire reference to Dallas Temperature. 11 | DallasTemperature sensors(&oneWire); 12 | 13 | void setup(void) 14 | { 15 | // start serial port 16 | Serial.begin(9600); 17 | Serial.println("Dallas Temperature IC Control Library Demo"); 18 | 19 | // Start up the library 20 | sensors.begin(); 21 | } 22 | 23 | void loop(void) 24 | { 25 | // call sensors.requestTemperatures() to issue a global temperature 26 | // request to all devices on the bus 27 | Serial.print("Requesting temperatures..."); 28 | sensors.requestTemperatures(); // Send the command to get temperatures 29 | Serial.println("DONE"); 30 | 31 | Serial.print("Temperature for the device 1 (index 0) is: "); 32 | Serial.println(sensors.getTempCByIndex(0)); 33 | } 34 | -------------------------------------------------------------------------------- /libraries/DallasTemperature/examples/WaitForConversion/WaitForConversion.pde: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | // Data wire is plugged into port 2 on the Arduino 5 | #define ONE_WIRE_BUS 2 6 | 7 | // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs) 8 | OneWire oneWire(ONE_WIRE_BUS); 9 | 10 | // Pass our oneWire reference to Dallas Temperature. 11 | DallasTemperature sensors(&oneWire); 12 | 13 | void setup(void) 14 | { 15 | // start serial port 16 | Serial.begin(115200); 17 | Serial.println("Dallas Temperature Control Library - Async Demo"); 18 | Serial.println("\nDemo shows the difference in length of the call\n\n"); 19 | 20 | // Start up the library 21 | sensors.begin(); 22 | } 23 | 24 | void loop(void) 25 | { 26 | // Request temperature conversion (traditional) 27 | Serial.println("Before blocking requestForConversion"); 28 | unsigned long start = millis(); 29 | 30 | sensors.requestTemperatures(); 31 | 32 | unsigned long stop = millis(); 33 | Serial.println("After blocking requestForConversion"); 34 | Serial.print("Time used: "); 35 | Serial.println(stop - start); 36 | 37 | // get temperature 38 | Serial.print("Temperature: "); 39 | Serial.println(sensors.getTempCByIndex(0)); 40 | Serial.println("\n"); 41 | 42 | // Request temperature conversion - non-blocking / async 43 | Serial.println("Before NON-blocking/async requestForConversion"); 44 | start = millis(); 45 | sensors.setWaitForConversion(false); // makes it async 46 | sensors.requestTemperatures(); 47 | sensors.setWaitForConversion(true); 48 | stop = millis(); 49 | Serial.println("After NON-blocking/async requestForConversion"); 50 | Serial.print("Time used: "); 51 | Serial.println(stop - start); 52 | 53 | 54 | // 9 bit resolution by default 55 | // Note the programmer is responsible for the right delay 56 | // we could do something usefull here instead of the delay 57 | int resolution = 9; 58 | delay(750/ (1 << (12-resolution))); 59 | 60 | // get temperature 61 | Serial.print("Temperature: "); 62 | Serial.println(sensors.getTempCByIndex(0)); 63 | Serial.println("\n\n\n\n"); 64 | 65 | delay(5000); 66 | } 67 | -------------------------------------------------------------------------------- /libraries/DallasTemperature/examples/WaitForConversion2/WaitForConversion2.pde: -------------------------------------------------------------------------------- 1 | // 2 | // Sample of using Async reading of Dallas Temperature Sensors 3 | // 4 | #include 5 | #include 6 | 7 | // Data wire is plugged into port 2 on the Arduino 8 | #define ONE_WIRE_BUS 2 9 | 10 | // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs) 11 | OneWire oneWire(ONE_WIRE_BUS); 12 | 13 | // Pass our oneWire reference to Dallas Temperature. 14 | DallasTemperature sensors(&oneWire); 15 | 16 | DeviceAddress tempDeviceAddress; 17 | 18 | int resolution = 12; 19 | unsigned long lastTempRequest = 0; 20 | int delayInMillis = 0; 21 | float temperature = 0.0; 22 | int idle = 0; 23 | // 24 | // SETUP 25 | // 26 | void setup(void) 27 | { 28 | Serial.begin(115200); 29 | Serial.println("Dallas Temperature Control Library - Async Demo"); 30 | Serial.print("Library Version: "); 31 | Serial.println(DALLASTEMPLIBVERSION); 32 | Serial.println("\n"); 33 | 34 | sensors.begin(); 35 | sensors.getAddress(tempDeviceAddress, 0); 36 | sensors.setResolution(tempDeviceAddress, resolution); 37 | 38 | sensors.setWaitForConversion(false); 39 | sensors.requestTemperatures(); 40 | delayInMillis = 750 / (1 << (12 - resolution)); 41 | lastTempRequest = millis(); 42 | 43 | pinMode(13, OUTPUT); 44 | } 45 | 46 | void loop(void) 47 | { 48 | 49 | if (millis() - lastTempRequest >= delayInMillis) // waited long enough?? 50 | { 51 | digitalWrite(13, LOW); 52 | Serial.print(" Temperature: "); 53 | temperature = sensors.getTempCByIndex(0); 54 | Serial.println(temperature, resolution - 8); 55 | Serial.print(" Resolution: "); 56 | Serial.println(resolution); 57 | Serial.print("Idle counter: "); 58 | Serial.println(idle); 59 | Serial.println(); 60 | 61 | idle = 0; 62 | 63 | // immediately after fetching the temperature we request a new sample 64 | // in the async modus 65 | // for the demo we let the resolution change to show differences 66 | resolution++; 67 | if (resolution > 12) resolution = 9; 68 | 69 | sensors.setResolution(tempDeviceAddress, resolution); 70 | sensors.requestTemperatures(); 71 | delayInMillis = 750 / (1 << (12 - resolution)); 72 | lastTempRequest = millis(); 73 | } 74 | 75 | digitalWrite(13, HIGH); 76 | // we can do usefull things here 77 | // for the demo we just count the idle time in millis 78 | delay(1); 79 | idle++; 80 | } 81 | -------------------------------------------------------------------------------- /libraries/DallasTemperature/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For Ultrasound 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | DallasTemperature KEYWORD1 9 | OneWire KEYWORD1 10 | AlarmHandler KEYWORD1 11 | DeviceAddress KEYWORD1 12 | 13 | ####################################### 14 | # Methods and Functions (KEYWORD2) 15 | ####################################### 16 | 17 | setResolution KEYWORD2 18 | getResolution KEYWORD2 19 | getTempC KEYWORD2 20 | toFahrenheit KEYWORD2 21 | getTempF KEYWORD2 22 | getTempCByIndex KEYWORD2 23 | getTempFByIndex KEYWORD2 24 | setWaitForConversion KEYWORD2 25 | getWaitForConversion KEYWORD2 26 | requestTemperatures KEYWORD2 27 | requestTemperaturesByAddress KEYWORD2 28 | requestTemperaturesByIndex KEYWORD2 29 | isParasitePowerMode KEYWORD2 30 | begin KEYWORD2 31 | getDeviceCount KEYWORD2 32 | getAddress KEYWORD2 33 | validAddress KEYWORD2 34 | isConnected KEYWORD2 35 | readScratchPad KEYWORD2 36 | writeScratchPad KEYWORD2 37 | readPowerSupply KEYWORD2 38 | setHighAlarmTemp KEYWORD2 39 | setLowAlarmTemp KEYWORD2 40 | getHighAlarmTemp KEYWORD2 41 | getLowAlarmTemp KEYWORD2 42 | resetAlarmSearch KEYWORD2 43 | alarmSearch KEYWORD2 44 | hasAlarm KEYWORD2 45 | toCelsius KEYWORD2 46 | processAlarmss KEYWORD2 47 | setAlarmHandlers KEYWORD2 48 | defaultAlarmHandler KEYWORD2 49 | calculateTemperature KEYWORD2 50 | 51 | ####################################### 52 | # Constants (LITERAL1) 53 | ####################################### 54 | 55 | -------------------------------------------------------------------------------- /libraries/DallasTemperature/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "DallasTemperature", 3 | "keywords": "onewire, 1-wire, bus, sensor, temperature", 4 | "description": "Arduino Library for Dallas Temperature ICs (DS18B20, DS18S20, DS1822, DS1820)", 5 | "repository": 6 | { 7 | "type": "git", 8 | "url": "https://github.com/milesburton/Arduino-Temperature-Control-Library.git" 9 | }, 10 | "authors": 11 | [ 12 | { 13 | "name": "Miles Burton", 14 | "email": "miles@mnetcs.com", 15 | "url": "http://www.milesburton.com", 16 | "maintainer": true 17 | }, 18 | { 19 | "name": "Tim Newsome", 20 | "email": "nuisance@casualhacker.net" 21 | }, 22 | { 23 | "name": "Guil Barros", 24 | "email": "gfbarros@bappos.com" 25 | }, 26 | { 27 | "name": "Rob Tillaart", 28 | "email": "rob.tillaart@gmail.com" 29 | } 30 | ], 31 | "dependencies": 32 | { 33 | "name": "OneWire", 34 | "authors": "Paul Stoffregen", 35 | "frameworks": "arduino" 36 | }, 37 | "frameworks": "arduino", 38 | "platforms": "atmelavr" 39 | } 40 | -------------------------------------------------------------------------------- /libraries/EasyTransfer/EasyTransfer.cpp: -------------------------------------------------------------------------------- 1 | #include "EasyTransfer.h" 2 | 3 | 4 | 5 | 6 | //Captures address and size of struct 7 | void EasyTransfer::begin(uint8_t * ptr, uint8_t length, Stream *theStream){ 8 | address = ptr; 9 | size = length; 10 | _stream = theStream; 11 | 12 | //dynamic creation of rx parsing buffer in RAM 13 | rx_buffer = (uint8_t*) malloc(size+1); 14 | } 15 | 16 | //Sends out struct in binary, with header, length info and checksum 17 | void EasyTransfer::sendData(){ 18 | uint8_t CS = size; 19 | _stream->write(0x06); 20 | _stream->write(0x85); 21 | _stream->write(size); 22 | for(int i = 0; iwrite(*(address+i)); 25 | } 26 | _stream->write(CS); 27 | 28 | } 29 | 30 | boolean EasyTransfer::receiveData(){ 31 | 32 | //start off by looking for the header bytes. If they were already found in a previous call, skip it. 33 | if(rx_len == 0){ 34 | //this size check may be redundant due to the size check below, but for now I'll leave it the way it is. 35 | if(_stream->available() >= 3){ 36 | //this will block until a 0x06 is found or buffer size becomes less then 3. 37 | while(_stream->read() != 0x06) { 38 | //This will trash any preamble junk in the serial buffer 39 | //but we need to make sure there is enough in the buffer to process while we trash the rest 40 | //if the buffer becomes too empty, we will escape and try again on the next call 41 | if(_stream->available() < 3) 42 | return false; 43 | } 44 | if (_stream->read() == 0x85){ 45 | rx_len = _stream->read(); 46 | //make sure the binary structs on both Arduinos are the same size. 47 | if(rx_len != size){ 48 | rx_len = 0; 49 | return false; 50 | } 51 | } 52 | } 53 | } 54 | 55 | //we get here if we already found the header bytes, the struct size matched what we know, and now we are byte aligned. 56 | if(rx_len != 0){ 57 | while(_stream->available() && rx_array_inx <= rx_len){ 58 | rx_buffer[rx_array_inx++] = _stream->read(); 59 | } 60 | 61 | if(rx_len == (rx_array_inx-1)){ 62 | //seem to have got whole message 63 | //last uint8_t is CS 64 | calc_CS = rx_len; 65 | for (int i = 0; i 19 | * 20 | *This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. 21 | *To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or 22 | *send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 23 | ******************************************************************/ 24 | #ifndef EasyTransfer_h 25 | #define EasyTransfer_h 26 | 27 | 28 | //make it a little prettier on the front end. 29 | #define details(name) (byte*)&name,sizeof(name) 30 | 31 | //Not neccessary, but just in case. 32 | #if ARDUINO > 22 33 | #include "Arduino.h" 34 | #else 35 | #include "WProgram.h" 36 | #endif 37 | #include "Stream.h" 38 | //#include 39 | //#include 40 | //#include 41 | //#include 42 | //#include 43 | 44 | class EasyTransfer { 45 | public: 46 | void begin(uint8_t *, uint8_t, Stream *theStream); 47 | //void begin(uint8_t *, uint8_t, NewSoftSerial *theSerial); 48 | void sendData(); 49 | boolean receiveData(); 50 | private: 51 | Stream *_stream; 52 | //NewSoftSerial *_serial; 53 | uint8_t * address; //address of struct 54 | uint8_t size; //size of struct 55 | uint8_t * rx_buffer; //address for temporary storage and parsing buffer 56 | uint8_t rx_array_inx; //index for RX parsing buffer 57 | uint8_t rx_len; //RX packet length according to the packet 58 | uint8_t calc_CS; //calculated Chacksum 59 | }; 60 | 61 | 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /libraries/EasyTransfer/I2C_Wiring.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iot-playground/EasyIoT-Cloud/982c29112186ee6e5fe6864fefa8acbc7e88a906/libraries/EasyTransfer/I2C_Wiring.png -------------------------------------------------------------------------------- /libraries/EasyTransfer/README.txt: -------------------------------------------------------------------------------- 1 | /****************************************************************** 2 | * EasyTransfer Arduino Library v1.7 3 | * details and example sketch: 4 | * http://www.billporter.info/easytransfer-arduino-library/ 5 | * 6 | * Brought to you by: 7 | * Bill Porter 8 | * www.billporter.info 9 | * 10 | * Lib version history 11 | * 1.0 Created 12 | * 1.1 Fixed dumb Copy-paste error in header file 13 | * Added a keyword file 14 | * 1.5 Forked lib into Software and Hardware Serial branches, I don't know a better way 15 | * added passing in of Serial port of different types 16 | * 1.6 Fixed bug where it wasn't clearing out the buffers if the CheckSum failed, 17 | * I'm good at dumb mistakes 18 | * 1.7 Fixed a bug where the receive function could block for too long and never process data correctly 19 | * Organized the examples to be Arduino IDE compatible 20 | * 1.8 21 | * Now Arduino 1.0 compatible! 22 | * 23 | * 24 | * Limits of the Library 25 | * You can change the Serial port, 26 | * but the Struct size must not pass 255 bytes 27 | * 28 | * The protcol is as follows: 29 | * Header(0x06,0x85),SizeofPayload,Payload,Checksum 30 | * 31 | * 32 | *This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or(at your option) any later version. 33 | This program is distributed in the hope that it will be useful, 34 | but WITHOUT ANY WARRANTY; without even the implied warranty of 35 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 36 | GNU General Public License for more details. 37 | 38 | * 39 | *This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. 40 | *To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or 41 | *send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 42 | ******************************************************************/ 43 | 44 | 45 | ********************To Install************************************* 46 | 47 | To install, unzip and place 'EasyTransfer' folder into your 'C:\Users\{user name}\Documents\Arduino\libraries' folder or '{Arduino IDE path}\hardware\libraries" or {Arduino IDE path}\libraries" directory. 48 | 49 | Restart the Arduino IDE, look for the Library under "Sketch" -> "Import Library". You can also try the examples by finding them 50 | under "File" -> "Examples" -> "EasyTransfer". 51 | 52 | All uses of the library are in the example sketchs. 53 | 54 | 55 | ******************************************************************* 56 | 57 | 58 | Library now has two versions, one for regular hardware Serial, one for use with the NewSoftSerial library 59 | making any Arduino pin capable of transfering data back and forth easily. 60 | 61 | See the examples to find out how to use the library. -------------------------------------------------------------------------------- /libraries/EasyTransfer/UARTS_Wiring.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iot-playground/EasyIoT-Cloud/982c29112186ee6e5fe6864fefa8acbc7e88a906/libraries/EasyTransfer/UARTS_Wiring.png -------------------------------------------------------------------------------- /libraries/EasyTransfer/examples/EasyTransfer_2Way_wPot_Example/EasyTransfer_2Way_wPot_Example.pde: -------------------------------------------------------------------------------- 1 | /*This is an example of the EasyTransfer Library 2way communications. 2 | 3 | The sketch is for the Arduino with a potentiometer attached to analog pin 0. 4 | 5 | This other Arduino has the servo attached to pin 9. 6 | Both have a putton attached to pin 12 and output a status using the LED on pin 13. 7 | 8 | The idea is each arduino will read the status of the button attached to it, and send it 9 | to the other Arduino, which will toggle it's LED based on the others button. The button 10 | should connect pin 12 to ground when pushed. 11 | 12 | And the Arduino with the potentiometer will send it's value to the one with the servo. 13 | The servo will move to the position based on the potentiometer. 14 | */ 15 | 16 | 17 | 18 | #include 19 | 20 | //create two objects 21 | EasyTransfer ETin, ETout; 22 | 23 | 24 | struct RECEIVE_DATA_STRUCTURE{ 25 | //put your variable definitions here for the data you want to receive 26 | //THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO 27 | int16_t buttonstate; 28 | }; 29 | 30 | struct SEND_DATA_STRUCTURE{ 31 | //put your variable definitions here for the data you want to receive 32 | //THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO 33 | int16_t buttonstate; 34 | int16_t servoval; 35 | }; 36 | 37 | //give a name to the group of data 38 | RECEIVE_DATA_STRUCTURE rxdata; 39 | SEND_DATA_STRUCTURE txdata; 40 | 41 | 42 | void setup(){ 43 | Serial.begin(9600); 44 | //start the library, pass in the data details and the name of the serial port. Can be Serial, Serial1, Serial2, etc. 45 | ETin.begin(details(rxdata), &Serial); 46 | ETout.begin(details(txdata), &Serial); 47 | 48 | pinMode(13, OUTPUT); 49 | //enable pull-up 50 | pinMode(12, INPUT_PULLUP); 51 | 52 | } 53 | 54 | void loop(){ 55 | 56 | //first, lets read our potentiometer and button and store it in our data structure 57 | txdata.servoval = analogRead(0); 58 | 59 | if(!digitalRead(12)) 60 | txdata.buttonstate = HIGH; 61 | else 62 | txdata.buttonstate = LOW; 63 | 64 | //then we will go ahead and send that data out 65 | ETout.sendData(); 66 | 67 | //there's a loop here so that we run the recieve function more often then the 68 | //transmit function. This is important due to the slight differences in 69 | //the clock speed of different Arduinos. If we didn't do this, messages 70 | //would build up in the buffer and appear to cause a delay. 71 | for(int i=0; i<5; i++){ 72 | //remember, you could use an if() here to check for new data, this time it's not needed. 73 | ETin.receiveData(); 74 | 75 | //set our LED on or off based on what we received from the other Arduino 76 | digitalWrite(13, rxdata.buttonstate); 77 | 78 | //delay 79 | delay(10); 80 | } 81 | 82 | //delay for good measure 83 | delay(10); 84 | } 85 | -------------------------------------------------------------------------------- /libraries/EasyTransfer/examples/EasyTransfer_2Way_wServo_Example/EasyTransfer_2Way_wServo_Example.pde: -------------------------------------------------------------------------------- 1 | /*This is an example of the EasyTransfer Library 2way communications. 2 | 3 | This sketch is for the Arduino with the servo attached to pin 9. 4 | 5 | The other Arduino has a potentiometer attached to analog pin 0. 6 | Both have a putton attached to pin 12 and output a status using the LED on pin 13. 7 | 8 | The idea is each arduino will read the status of the button attached to it, and send it 9 | to the other Arduino, which will toggle it's LED based on the others button. The button 10 | should connect pin 12 to ground when pushed. 11 | 12 | And the Arduino with the potentiometer will send it's value to the one with the servo. 13 | The servo will move to the position based on the potentiometer. 14 | */ 15 | 16 | #include 17 | #include 18 | 19 | //create two objects 20 | EasyTransfer ETin, ETout; 21 | //create servo 22 | Servo myservo; 23 | 24 | struct RECEIVE_DATA_STRUCTURE{ 25 | //put your variable definitions here for the data you want to receive 26 | //THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO 27 | int16_t buttonstate; 28 | int16_t servoval; 29 | }; 30 | 31 | struct SEND_DATA_STRUCTURE{ 32 | //put your variable definitions here for the data you want to receive 33 | //THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO 34 | int16_t buttonstate; 35 | }; 36 | 37 | 38 | //give a name to the group of data 39 | RECEIVE_DATA_STRUCTURE rxdata; 40 | SEND_DATA_STRUCTURE txdata; 41 | 42 | 43 | void setup(){ 44 | Serial.begin(9600); 45 | //start the library, pass in the data details and the name of the serial port. Can be Serial, Serial1, Serial2, etc. 46 | ETin.begin(details(rxdata), &Serial); 47 | ETout.begin(details(txdata), &Serial); 48 | 49 | pinMode(13, OUTPUT); 50 | //enable pull-up 51 | pinMode(12, INPUT_PULLUP); 52 | 53 | myservo.attach(9); 54 | } 55 | 56 | void loop(){ 57 | 58 | //first, lets read our button and store it in our data structure 59 | if(!digitalRead(12)) 60 | txdata.buttonstate = HIGH; 61 | else 62 | txdata.buttonstate = LOW; 63 | 64 | //then we will go ahead and send that data out 65 | ETout.sendData(); 66 | 67 | //there's a loop here so that we run the recieve function more often then the 68 | //transmit function. This is important due to the slight differences in 69 | //the clock speed of different Arduinos. If we didn't do this, messages 70 | //would build up in the buffer and appear to cause a delay. 71 | 72 | for(int i=0; i<5; i++){ 73 | //remember, you could use an if() here to check for new data, this time it's not needed. 74 | ETin.receiveData(); 75 | 76 | //set our LED on or off based on what we received from the other Arduino 77 | digitalWrite(13, rxdata.buttonstate); 78 | 79 | //set our servo position based on what we received from the other Arduino 80 | //we will also map the ADC value to a servo value 81 | myservo.write(map(rxdata.servoval, 0, 1023, 0, 179)); 82 | 83 | //delay 84 | delay(10); 85 | } 86 | 87 | //delay for good measure 88 | delay(10); 89 | } 90 | -------------------------------------------------------------------------------- /libraries/EasyTransfer/examples/EasyTransfer_RX_Example/EasyTransfer_RX_Example.pde: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | //create object 4 | EasyTransfer ET; 5 | 6 | struct RECEIVE_DATA_STRUCTURE{ 7 | //put your variable definitions here for the data you want to receive 8 | //THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO 9 | int16_t blinks; 10 | int16_t pause; 11 | }; 12 | 13 | //give a name to the group of data 14 | RECEIVE_DATA_STRUCTURE mydata; 15 | 16 | void setup(){ 17 | Serial.begin(9600); 18 | //start the library, pass in the data details and the name of the serial port. Can be Serial, Serial1, Serial2, etc. 19 | ET.begin(details(mydata), &Serial); 20 | 21 | pinMode(13, OUTPUT); 22 | 23 | } 24 | 25 | void loop(){ 26 | //check and see if a data packet has come in. 27 | if(ET.receiveData()){ 28 | //this is how you access the variables. [name of the group].[variable name] 29 | //since we have data, we will blink it out. 30 | for(int i = mydata.blinks; i>0; i--){ 31 | digitalWrite(13, HIGH); 32 | delay(mydata.pause * 100); 33 | digitalWrite(13, LOW); 34 | delay(mydata.pause * 100); 35 | } 36 | } 37 | 38 | //you should make this delay shorter then your transmit delay or else messages could be lost 39 | delay(250); 40 | } 41 | -------------------------------------------------------------------------------- /libraries/EasyTransfer/examples/EasyTransfer_TX_Example/EasyTransfer_TX_Example.pde: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | //create object 4 | EasyTransfer ET; 5 | 6 | struct SEND_DATA_STRUCTURE{ 7 | //put your variable definitions here for the data you want to send 8 | //THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO 9 | int16_t blinks; 10 | int16_t pause; 11 | }; 12 | 13 | //give a name to the group of data 14 | SEND_DATA_STRUCTURE mydata; 15 | 16 | void setup(){ 17 | Serial.begin(9600); 18 | //start the library, pass in the data details and the name of the serial port. Can be Serial, Serial1, Serial2, etc. 19 | ET.begin(details(mydata), &Serial); 20 | 21 | pinMode(13, OUTPUT); 22 | 23 | randomSeed(analogRead(0)); 24 | 25 | } 26 | 27 | void loop(){ 28 | //this is how you access the variables. [name of the group].[variable name] 29 | mydata.blinks = random(5); 30 | mydata.pause = random(5); 31 | //send the data 32 | ET.sendData(); 33 | 34 | //Just for fun, we will blink it out too 35 | for(int i = mydata.blinks; i>0; i--){ 36 | digitalWrite(13, HIGH); 37 | delay(mydata.pause * 100); 38 | digitalWrite(13, LOW); 39 | delay(mydata.pause * 100); 40 | } 41 | 42 | delay(5000); 43 | } 44 | -------------------------------------------------------------------------------- /libraries/EasyTransfer/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map EasyTransfer 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | EasyTransfer KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | sendData KEYWORD2 15 | receiveData KEYWORD2 16 | begin KEYWORD2 17 | 18 | 19 | ####################################### 20 | # Constants (LITERAL1) 21 | ####################################### 22 | details LITERAL1 23 | -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /libraries/SoftEasyTransfer/SoftEasyTransfer.h: -------------------------------------------------------------------------------- 1 | /****************************************************************** 2 | * EasyTransfer Arduino Library 3 | * details and example sketch: 4 | * http://www.billporter.info/easytransfer-arduino-library/ 5 | * 6 | * Brought to you by: 7 | * Bill Porter 8 | * www.billporter.info 9 | * 10 | * See Readme for other info and version history 11 | * 12 | * 13 | *This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or(at your option) any later version. 14 | This program is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | * 20 | *This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. 21 | *To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or 22 | *send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 23 | ******************************************************************/ 24 | #ifndef SoftEasyTransfer_h 25 | #define SoftEasyTransfer_h 26 | 27 | 28 | //make it a little prettier on the front end. 29 | #define details(name) (byte*)&name,sizeof(name) 30 | 31 | //Not neccessary, but just in case. 32 | #if ARDUINO > 22 33 | #include "Arduino.h" 34 | #include 35 | #else 36 | #include "WProgram.h" 37 | #include 38 | #endif 39 | //#include "HardwareSerial.h" 40 | 41 | 42 | #include 43 | #include 44 | #include 45 | //#include 46 | 47 | class SoftEasyTransfer { 48 | public: 49 | //void begin(uint8_t *, uint8_t, HardwareSerial *theSerial); 50 | #if ARDUINO > 22 51 | void begin(uint8_t *, uint8_t, SoftwareSerial *theSerial); 52 | #else 53 | void begin(uint8_t *, uint8_t, NewSoftSerial *theSerial); 54 | #endif 55 | void sendData(); 56 | boolean receiveData(); 57 | private: 58 | //HardwareSerial *_serial; 59 | 60 | #if ARDUINO > 22 61 | SoftwareSerial *_serial; 62 | #else 63 | NewSoftSerial *_serial; 64 | #endif 65 | 66 | 67 | uint8_t * address; //address of struct 68 | uint8_t size; //size of struct 69 | uint8_t * rx_buffer; //address for temporary storage and parsing buffer 70 | uint8_t rx_array_inx; //index for RX parsing buffer 71 | uint8_t rx_len; //RX packet length according to the packet 72 | uint8_t calc_CS; //calculated Chacksum 73 | }; 74 | 75 | 76 | 77 | #endif -------------------------------------------------------------------------------- /libraries/SoftEasyTransfer/examples/SoftEasyTransfer_RX_Example/SoftEasyTransfer_RX_Example.pde: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* For Arduino 1.0 and newer, do this: */ 4 | #include 5 | SoftwareSerial mySerial(2, 3); 6 | 7 | /* For Arduino 22 and older, do this: */ 8 | //#include 9 | //NewSoftSerial mySerial(2, 3); 10 | 11 | 12 | //create object 13 | SoftEasyTransfer ET; 14 | 15 | struct RECEIVE_DATA_STRUCTURE{ 16 | //put your variable definitions here for the data you want to receive 17 | //THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO 18 | int16_t blinks; 19 | int16_t pause; 20 | }; 21 | 22 | //give a name to the group of data 23 | RECEIVE_DATA_STRUCTURE mydata; 24 | 25 | void setup(){ 26 | mySerial.begin(9600); 27 | //start the library, pass in the data details and the name of the serial port. 28 | ET.begin(details(mydata), &mySerial); 29 | 30 | pinMode(13, OUTPUT); 31 | 32 | } 33 | 34 | void loop(){ 35 | //check and see if a data packet has come in. 36 | if(ET.receiveData()){ 37 | //this is how you access the variables. [name of the group].[variable name] 38 | //since we have data, we will blink it out. 39 | for(int i = mydata.blinks; i>0; i--){ 40 | digitalWrite(13, HIGH); 41 | delay(mydata.pause * 100); 42 | digitalWrite(13, LOW); 43 | delay(mydata.pause * 100); 44 | } 45 | } 46 | //you should make this delay shorter then your transmit delay or else messages could be lost 47 | delay(250); 48 | } 49 | -------------------------------------------------------------------------------- /libraries/SoftEasyTransfer/examples/SoftEasyTransfer_TX_Example/SoftEasyTransfer_TX_Example.pde: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* For Arduino 1.0 and newer, do this: */ 4 | #include 5 | SoftwareSerial mySerial(2, 3); 6 | 7 | /* For Arduino 22 and older, do this: */ 8 | //#include 9 | //NewSoftSerial mySerial(2, 3); 10 | 11 | 12 | 13 | //create object 14 | SoftEasyTransfer ET; 15 | 16 | struct SEND_DATA_STRUCTURE{ 17 | //put your variable definitions here for the data you want to send 18 | //THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO 19 | int16_t blinks; 20 | int16_t pause; 21 | }; 22 | 23 | //give a name to the group of data 24 | SEND_DATA_STRUCTURE mydata; 25 | 26 | void setup(){ 27 | mySerial.begin(9600); 28 | //start the library, pass in the data details and the name of the serial port. 29 | ET.begin(details(mydata), &mySerial); 30 | 31 | pinMode(13, OUTPUT); 32 | 33 | randomSeed(analogRead(0)); 34 | 35 | } 36 | 37 | void loop(){ 38 | //this is how you access the variables. [name of the group].[variable name] 39 | mydata.blinks = random(5); 40 | mydata.pause = random(5); 41 | //send the data 42 | ET.sendData(); 43 | 44 | //Just for fun, we will blink it out too 45 | for(int i = mydata.blinks; i>0; i--){ 46 | digitalWrite(13, HIGH); 47 | delay(mydata.pause * 100); 48 | digitalWrite(13, LOW); 49 | delay(mydata.pause * 100); 50 | } 51 | 52 | delay(5000); 53 | } 54 | -------------------------------------------------------------------------------- /libraries/SoftEasyTransfer/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map EasyTransfer 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | SoftEasyTransfer KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | sendData KEYWORD2 15 | receiveData KEYWORD2 16 | begin KEYWORD2 17 | 18 | 19 | ####################################### 20 | # Constants (LITERAL1) 21 | ####################################### 22 | details LITERAL1 23 | -------------------------------------------------------------------------------- /libraries/Time/Time.h: -------------------------------------------------------------------------------- 1 | #include "TimeLib.h" 2 | -------------------------------------------------------------------------------- /libraries/Time/examples/Processing/SyncArduinoClock/SyncArduinoClock.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * SyncArduinoClock. 3 | * 4 | * portIndex must be set to the port connected to the Arduino 5 | * 6 | * The current time is sent in response to request message from Arduino 7 | * or by clicking the display window 8 | * 9 | * The time message is 11 ASCII text characters; a header (the letter 'T') 10 | * followed by the ten digit system time (unix time) 11 | */ 12 | 13 | 14 | import processing.serial.*; 15 | import java.util.Date; 16 | import java.util.Calendar; 17 | import java.util.GregorianCalendar; 18 | 19 | public static final short portIndex = 0; // select the com port, 0 is the first port 20 | public static final String TIME_HEADER = "T"; //header for arduino serial time message 21 | public static final char TIME_REQUEST = 7; // ASCII bell character 22 | public static final char LF = 10; // ASCII linefeed 23 | public static final char CR = 13; // ASCII linefeed 24 | Serial myPort; // Create object from Serial class 25 | 26 | void setup() { 27 | size(200, 200); 28 | println(Serial.list()); 29 | println(" Connecting to -> " + Serial.list()[portIndex]); 30 | myPort = new Serial(this,Serial.list()[portIndex], 9600); 31 | println(getTimeNow()); 32 | } 33 | 34 | void draw() 35 | { 36 | textSize(20); 37 | textAlign(CENTER); 38 | fill(0); 39 | text("Click to send\nTime Sync", 0, 75, 200, 175); 40 | if ( myPort.available() > 0) { // If data is available, 41 | char val = char(myPort.read()); // read it and store it in val 42 | if(val == TIME_REQUEST){ 43 | long t = getTimeNow(); 44 | sendTimeMessage(TIME_HEADER, t); 45 | } 46 | else 47 | { 48 | if(val == LF) 49 | ; //igonore 50 | else if(val == CR) 51 | println(); 52 | else 53 | print(val); // echo everying but time request 54 | } 55 | } 56 | } 57 | 58 | void mousePressed() { 59 | sendTimeMessage( TIME_HEADER, getTimeNow()); 60 | } 61 | 62 | 63 | void sendTimeMessage(String header, long time) { 64 | String timeStr = String.valueOf(time); 65 | myPort.write(header); // send header and time to arduino 66 | myPort.write(timeStr); 67 | myPort.write('\n'); 68 | } 69 | 70 | long getTimeNow(){ 71 | // java time is in ms, we want secs 72 | Date d = new Date(); 73 | Calendar cal = new GregorianCalendar(); 74 | long current = d.getTime()/1000; 75 | long timezone = cal.get(cal.ZONE_OFFSET)/1000; 76 | long daylight = cal.get(cal.DST_OFFSET)/1000; 77 | return current + timezone + daylight; 78 | } 79 | -------------------------------------------------------------------------------- /libraries/Time/examples/Processing/SyncArduinoClock/readme.txt: -------------------------------------------------------------------------------- 1 | SyncArduinoClock is a Processing sketch that responds to Arduino requests for 2 | time synchronization messages. 3 | 4 | The portIndex must be set the Serial port connected to Arduino. 5 | 6 | Download TimeSerial.pde onto Arduino and you should see the time 7 | message displayed when you run SyncArduinoClock in Processing. 8 | The Arduino time is set from the time on your computer through the 9 | Processing sketch. 10 | -------------------------------------------------------------------------------- /libraries/Time/examples/TimeArduinoDue/TimeArduinoDue.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * TimeRTC.pde 3 | * example code illustrating Time library with Real Time Clock. 4 | * 5 | * This example requires Markus Lange's Arduino Due RTC Library 6 | * https://github.com/MarkusLange/Arduino-Due-RTC-Library 7 | */ 8 | 9 | #include 10 | #include 11 | 12 | // Select the Slowclock source 13 | //RTC_clock rtc_clock(RC); 14 | RTC_clock rtc_clock(XTAL); 15 | 16 | void setup() { 17 | Serial.begin(9600); 18 | rtc_clock.init(); 19 | if (rtc_clock.date_already_set() == 0) { 20 | // Unfortunately, the Arduino Due hardware does not seem to 21 | // be designed to maintain the RTC clock state when the 22 | // board resets. Markus described it thusly: "Uhh the Due 23 | // does reset with the NRSTB pin. This resets the full chip 24 | // with all backup regions including RTC, RTT and SC. Only 25 | // if the reset is done with the NRST pin will these regions 26 | // stay with their old values." 27 | rtc_clock.set_time(__TIME__); 28 | rtc_clock.set_date(__DATE__); 29 | // However, this might work on other unofficial SAM3X boards 30 | // with different reset circuitry than Arduino Due? 31 | } 32 | setSyncProvider(getArduinoDueTime); 33 | if(timeStatus()!= timeSet) 34 | Serial.println("Unable to sync with the RTC"); 35 | else 36 | Serial.println("RTC has set the system time"); 37 | } 38 | 39 | time_t getArduinoDueTime() 40 | { 41 | return rtc_clock.unixtime(); 42 | } 43 | 44 | void loop() 45 | { 46 | digitalClockDisplay(); 47 | delay(1000); 48 | } 49 | 50 | void digitalClockDisplay(){ 51 | // digital clock display of the time 52 | Serial.print(hour()); 53 | printDigits(minute()); 54 | printDigits(second()); 55 | Serial.print(" "); 56 | Serial.print(day()); 57 | Serial.print(" "); 58 | Serial.print(month()); 59 | Serial.print(" "); 60 | Serial.print(year()); 61 | Serial.println(); 62 | } 63 | 64 | void printDigits(int digits){ 65 | // utility function for digital clock display: prints preceding colon and leading 0 66 | Serial.print(":"); 67 | if(digits < 10) 68 | Serial.print('0'); 69 | Serial.print(digits); 70 | } 71 | 72 | -------------------------------------------------------------------------------- /libraries/Time/examples/TimeGPS/TimeGPS.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * TimeGPS.pde 3 | * example code illustrating time synced from a GPS 4 | * 5 | */ 6 | 7 | #include 8 | #include // http://arduiniana.org/libraries/TinyGPS/ 9 | #include 10 | // TinyGPS and SoftwareSerial libraries are the work of Mikal Hart 11 | 12 | SoftwareSerial SerialGPS = SoftwareSerial(10, 11); // receive on pin 10 13 | TinyGPS gps; 14 | 15 | // To use a hardware serial port, which is far more efficient than 16 | // SoftwareSerial, uncomment this line and remove SoftwareSerial 17 | //#define SerialGPS Serial1 18 | 19 | // Offset hours from gps time (UTC) 20 | const int offset = 1; // Central European Time 21 | //const int offset = -5; // Eastern Standard Time (USA) 22 | //const int offset = -4; // Eastern Daylight Time (USA) 23 | //const int offset = -8; // Pacific Standard Time (USA) 24 | //const int offset = -7; // Pacific Daylight Time (USA) 25 | 26 | // Ideally, it should be possible to learn the time zone 27 | // based on the GPS position data. However, that would 28 | // require a complex library, probably incorporating some 29 | // sort of database using Eric Muller's time zone shape 30 | // maps, at http://efele.net/maps/tz/ 31 | 32 | time_t prevDisplay = 0; // when the digital clock was displayed 33 | 34 | void setup() 35 | { 36 | Serial.begin(9600); 37 | while (!Serial) ; // Needed for Leonardo only 38 | SerialGPS.begin(4800); 39 | Serial.println("Waiting for GPS time ... "); 40 | } 41 | 42 | void loop() 43 | { 44 | while (SerialGPS.available()) { 45 | if (gps.encode(SerialGPS.read())) { // process gps messages 46 | // when TinyGPS reports new data... 47 | unsigned long age; 48 | int Year; 49 | byte Month, Day, Hour, Minute, Second; 50 | gps.crack_datetime(&Year, &Month, &Day, &Hour, &Minute, &Second, NULL, &age); 51 | if (age < 500) { 52 | // set the Time to the latest GPS reading 53 | setTime(Hour, Minute, Second, Day, Month, Year); 54 | adjustTime(offset * SECS_PER_HOUR); 55 | } 56 | } 57 | } 58 | if (timeStatus()!= timeNotSet) { 59 | if (now() != prevDisplay) { //update the display only if the time has changed 60 | prevDisplay = now(); 61 | digitalClockDisplay(); 62 | } 63 | } 64 | } 65 | 66 | void digitalClockDisplay(){ 67 | // digital clock display of the time 68 | Serial.print(hour()); 69 | printDigits(minute()); 70 | printDigits(second()); 71 | Serial.print(" "); 72 | Serial.print(day()); 73 | Serial.print(" "); 74 | Serial.print(month()); 75 | Serial.print(" "); 76 | Serial.print(year()); 77 | Serial.println(); 78 | } 79 | 80 | void printDigits(int digits) { 81 | // utility function for digital clock display: prints preceding colon and leading 0 82 | Serial.print(":"); 83 | if(digits < 10) 84 | Serial.print('0'); 85 | Serial.print(digits); 86 | } 87 | 88 | -------------------------------------------------------------------------------- /libraries/Time/examples/TimeRTC/TimeRTC.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * TimeRTC.pde 3 | * example code illustrating Time library with Real Time Clock. 4 | * 5 | */ 6 | 7 | #include 8 | #include 9 | #include // a basic DS1307 library that returns time as a time_t 10 | 11 | void setup() { 12 | Serial.begin(9600); 13 | while (!Serial) ; // wait until Arduino Serial Monitor opens 14 | setSyncProvider(RTC.get); // the function to get the time from the RTC 15 | if(timeStatus()!= timeSet) 16 | Serial.println("Unable to sync with the RTC"); 17 | else 18 | Serial.println("RTC has set the system time"); 19 | } 20 | 21 | void loop() 22 | { 23 | if (timeStatus() == timeSet) { 24 | digitalClockDisplay(); 25 | } else { 26 | Serial.println("The time has not been set. Please run the Time"); 27 | Serial.println("TimeRTCSet example, or DS1307RTC SetTime example."); 28 | Serial.println(); 29 | delay(4000); 30 | } 31 | delay(1000); 32 | } 33 | 34 | void digitalClockDisplay(){ 35 | // digital clock display of the time 36 | Serial.print(hour()); 37 | printDigits(minute()); 38 | printDigits(second()); 39 | Serial.print(" "); 40 | Serial.print(day()); 41 | Serial.print(" "); 42 | Serial.print(month()); 43 | Serial.print(" "); 44 | Serial.print(year()); 45 | Serial.println(); 46 | } 47 | 48 | void printDigits(int digits){ 49 | // utility function for digital clock display: prints preceding colon and leading 0 50 | Serial.print(":"); 51 | if(digits < 10) 52 | Serial.print('0'); 53 | Serial.print(digits); 54 | } 55 | 56 | -------------------------------------------------------------------------------- /libraries/Time/examples/TimeRTCSet/TimeRTCSet.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * TimeRTCSet.pde 3 | * example code illustrating Time library with Real Time Clock. 4 | * 5 | * RTC clock is set in response to serial port time message 6 | * A Processing example sketch to set the time is included in the download 7 | * On Linux, you can use "date +T%s > /dev/ttyACM0" (UTC time zone) 8 | */ 9 | 10 | #include 11 | #include 12 | #include // a basic DS1307 library that returns time as a time_t 13 | 14 | 15 | void setup() { 16 | Serial.begin(9600); 17 | while (!Serial) ; // Needed for Leonardo only 18 | setSyncProvider(RTC.get); // the function to get the time from the RTC 19 | if (timeStatus() != timeSet) 20 | Serial.println("Unable to sync with the RTC"); 21 | else 22 | Serial.println("RTC has set the system time"); 23 | } 24 | 25 | void loop() 26 | { 27 | if (Serial.available()) { 28 | time_t t = processSyncMessage(); 29 | if (t != 0) { 30 | RTC.set(t); // set the RTC and the system time to the received value 31 | setTime(t); 32 | } 33 | } 34 | digitalClockDisplay(); 35 | delay(1000); 36 | } 37 | 38 | void digitalClockDisplay(){ 39 | // digital clock display of the time 40 | Serial.print(hour()); 41 | printDigits(minute()); 42 | printDigits(second()); 43 | Serial.print(" "); 44 | Serial.print(day()); 45 | Serial.print(" "); 46 | Serial.print(month()); 47 | Serial.print(" "); 48 | Serial.print(year()); 49 | Serial.println(); 50 | } 51 | 52 | void printDigits(int digits){ 53 | // utility function for digital clock display: prints preceding colon and leading 0 54 | Serial.print(":"); 55 | if(digits < 10) 56 | Serial.print('0'); 57 | Serial.print(digits); 58 | } 59 | 60 | /* code to process time sync messages from the serial port */ 61 | #define TIME_HEADER "T" // Header tag for serial time sync message 62 | 63 | unsigned long processSyncMessage() { 64 | unsigned long pctime = 0L; 65 | const unsigned long DEFAULT_TIME = 1357041600; // Jan 1 2013 66 | 67 | if(Serial.find(TIME_HEADER)) { 68 | pctime = Serial.parseInt(); 69 | return pctime; 70 | if( pctime < DEFAULT_TIME) { // check the value is a valid time (greater than Jan 1 2013) 71 | pctime = 0L; // return 0 to indicate that the time is not valid 72 | } 73 | } 74 | return pctime; 75 | } 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /libraries/Time/examples/TimeSerial/TimeSerial.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * TimeSerial.pde 3 | * example code illustrating Time library set through serial port messages. 4 | * 5 | * Messages consist of the letter T followed by ten digit time (as seconds since Jan 1 1970) 6 | * you can send the text on the next line using Serial Monitor to set the clock to noon Jan 1 2013 7 | T1357041600 8 | * 9 | * A Processing example sketch to automatically send the messages is included in the download 10 | * On Linux, you can use "date +T%s\n > /dev/ttyACM0" (UTC time zone) 11 | */ 12 | 13 | #include 14 | 15 | #define TIME_HEADER "T" // Header tag for serial time sync message 16 | #define TIME_REQUEST 7 // ASCII bell character requests a time sync message 17 | 18 | void setup() { 19 | Serial.begin(9600); 20 | while (!Serial) ; // Needed for Leonardo only 21 | pinMode(13, OUTPUT); 22 | setSyncProvider( requestSync); //set function to call when sync required 23 | Serial.println("Waiting for sync message"); 24 | } 25 | 26 | void loop(){ 27 | if (Serial.available()) { 28 | processSyncMessage(); 29 | } 30 | if (timeStatus()!= timeNotSet) { 31 | digitalClockDisplay(); 32 | } 33 | if (timeStatus() == timeSet) { 34 | digitalWrite(13, HIGH); // LED on if synced 35 | } else { 36 | digitalWrite(13, LOW); // LED off if needs refresh 37 | } 38 | delay(1000); 39 | } 40 | 41 | void digitalClockDisplay(){ 42 | // digital clock display of the time 43 | Serial.print(hour()); 44 | printDigits(minute()); 45 | printDigits(second()); 46 | Serial.print(" "); 47 | Serial.print(day()); 48 | Serial.print(" "); 49 | Serial.print(month()); 50 | Serial.print(" "); 51 | Serial.print(year()); 52 | Serial.println(); 53 | } 54 | 55 | void printDigits(int digits){ 56 | // utility function for digital clock display: prints preceding colon and leading 0 57 | Serial.print(":"); 58 | if(digits < 10) 59 | Serial.print('0'); 60 | Serial.print(digits); 61 | } 62 | 63 | 64 | void processSyncMessage() { 65 | unsigned long pctime; 66 | const unsigned long DEFAULT_TIME = 1357041600; // Jan 1 2013 67 | 68 | if(Serial.find(TIME_HEADER)) { 69 | pctime = Serial.parseInt(); 70 | if( pctime >= DEFAULT_TIME) { // check the integer is a valid time (greater than Jan 1 2013) 71 | setTime(pctime); // Sync Arduino clock to the time received on the serial port 72 | } 73 | } 74 | } 75 | 76 | time_t requestSync() 77 | { 78 | Serial.write(TIME_REQUEST); 79 | return 0; // the time will be sent later in response to serial mesg 80 | } 81 | 82 | -------------------------------------------------------------------------------- /libraries/Time/examples/TimeTeensy3/TimeTeensy3.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * TimeRTC.pde 3 | * example code illustrating Time library with Real Time Clock. 4 | * 5 | */ 6 | 7 | #include 8 | 9 | void setup() { 10 | // set the Time library to use Teensy 3.0's RTC to keep time 11 | setSyncProvider(getTeensy3Time); 12 | 13 | Serial.begin(115200); 14 | while (!Serial); // Wait for Arduino Serial Monitor to open 15 | delay(100); 16 | if (timeStatus()!= timeSet) { 17 | Serial.println("Unable to sync with the RTC"); 18 | } else { 19 | Serial.println("RTC has set the system time"); 20 | } 21 | } 22 | 23 | void loop() { 24 | if (Serial.available()) { 25 | time_t t = processSyncMessage(); 26 | if (t != 0) { 27 | Teensy3Clock.set(t); // set the RTC 28 | setTime(t); 29 | } 30 | } 31 | digitalClockDisplay(); 32 | delay(1000); 33 | } 34 | 35 | void digitalClockDisplay() { 36 | // digital clock display of the time 37 | Serial.print(hour()); 38 | printDigits(minute()); 39 | printDigits(second()); 40 | Serial.print(" "); 41 | Serial.print(day()); 42 | Serial.print(" "); 43 | Serial.print(month()); 44 | Serial.print(" "); 45 | Serial.print(year()); 46 | Serial.println(); 47 | } 48 | 49 | time_t getTeensy3Time() 50 | { 51 | return Teensy3Clock.get(); 52 | } 53 | 54 | /* code to process time sync messages from the serial port */ 55 | #define TIME_HEADER "T" // Header tag for serial time sync message 56 | 57 | unsigned long processSyncMessage() { 58 | unsigned long pctime = 0L; 59 | const unsigned long DEFAULT_TIME = 1357041600; // Jan 1 2013 60 | 61 | if(Serial.find(TIME_HEADER)) { 62 | pctime = Serial.parseInt(); 63 | return pctime; 64 | if( pctime < DEFAULT_TIME) { // check the value is a valid time (greater than Jan 1 2013) 65 | pctime = 0L; // return 0 to indicate that the time is not valid 66 | } 67 | } 68 | return pctime; 69 | } 70 | 71 | void printDigits(int digits){ 72 | // utility function for digital clock display: prints preceding colon and leading 0 73 | Serial.print(":"); 74 | if(digits < 10) 75 | Serial.print('0'); 76 | Serial.print(digits); 77 | } 78 | 79 | -------------------------------------------------------------------------------- /libraries/Time/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For Time 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | time_t KEYWORD1 9 | ####################################### 10 | # Methods and Functions (KEYWORD2) 11 | ####################################### 12 | now KEYWORD2 13 | second KEYWORD2 14 | minute KEYWORD2 15 | hour KEYWORD2 16 | day KEYWORD2 17 | month KEYWORD2 18 | year KEYWORD2 19 | isAM KEYWORD2 20 | isPM KEYWORD2 21 | weekday KEYWORD2 22 | setTime KEYWORD2 23 | adjustTime KEYWORD2 24 | setSyncProvider KEYWORD2 25 | setSyncInterval KEYWORD2 26 | timeStatus KEYWORD2 27 | TimeLib KEYWORD2 28 | ####################################### 29 | # Instances (KEYWORD2) 30 | ####################################### 31 | 32 | ####################################### 33 | # Constants (LITERAL1) 34 | ####################################### 35 | -------------------------------------------------------------------------------- /libraries/Time/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Time", 3 | "description": "Time keeping library", 4 | "keywords": "Time, date, hour, minute, second, day, week, month, year, RTC", 5 | "authors": [ 6 | { 7 | "name": "Michael Margolis" 8 | }, 9 | { 10 | "name": "Paul Stoffregen", 11 | "email": "paul@pjrc.com", 12 | "url": "http://www.pjrc.com", 13 | "maintainer": true 14 | } 15 | ], 16 | "repository": { 17 | "type": "git", 18 | "url": "https://github.com/PaulStoffregen/Time" 19 | }, 20 | "version": "1.5", 21 | "homepage": "http://playground.arduino.cc/Code/Time", 22 | "frameworks": "Arduino", 23 | "examples": [ 24 | "examples/*/*.ino" 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /libraries/Time/library.properties: -------------------------------------------------------------------------------- 1 | name=Time 2 | version=1.5 3 | author=Michael Margolis 4 | maintainer=Paul Stoffregen 5 | sentence=Timekeeping functionality for Arduino 6 | paragraph=Date and Time functions, with provisions to synchronize to external time sources like GPS and NTP (Internet). This library is often used together with TimeAlarms and DS1307RTC. 7 | category=Timing 8 | url=http://playground.arduino.cc/code/time 9 | architectures=* 10 | 11 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /libraries/UTFT/Documentation/UTFT.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iot-playground/EasyIoT-Cloud/982c29112186ee6e5fe6864fefa8acbc7e88a906/libraries/UTFT/Documentation/UTFT.pdf -------------------------------------------------------------------------------- /libraries/UTFT/Documentation/UTFT_Requirements.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iot-playground/EasyIoT-Cloud/982c29112186ee6e5fe6864fefa8acbc7e88a906/libraries/UTFT/Documentation/UTFT_Requirements.pdf -------------------------------------------------------------------------------- /libraries/UTFT/Documentation/UTFT_Supported_display_modules_&_controllers.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iot-playground/EasyIoT-Cloud/982c29112186ee6e5fe6864fefa8acbc7e88a906/libraries/UTFT/Documentation/UTFT_Supported_display_modules_&_controllers.pdf -------------------------------------------------------------------------------- /libraries/UTFT/License/License - CC BY-NC-SA 3.0 - Legal.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iot-playground/EasyIoT-Cloud/982c29112186ee6e5fe6864fefa8acbc7e88a906/libraries/UTFT/License/License - CC BY-NC-SA 3.0 - Legal.pdf -------------------------------------------------------------------------------- /libraries/UTFT/License/License - CC BY-NC-SA 3.0 - Summary.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iot-playground/EasyIoT-Cloud/982c29112186ee6e5fe6864fefa8acbc7e88a906/libraries/UTFT/License/License - CC BY-NC-SA 3.0 - Summary.pdf -------------------------------------------------------------------------------- /libraries/UTFT/Tools/ImageConverter565.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iot-playground/EasyIoT-Cloud/982c29112186ee6e5fe6864fefa8acbc7e88a906/libraries/UTFT/Tools/ImageConverter565.exe -------------------------------------------------------------------------------- /libraries/UTFT/Tools/ImgConv.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iot-playground/EasyIoT-Cloud/982c29112186ee6e5fe6864fefa8acbc7e88a906/libraries/UTFT/Tools/ImgConv.exe -------------------------------------------------------------------------------- /libraries/UTFT/Tools/UTFT Image Converters.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iot-playground/EasyIoT-Cloud/982c29112186ee6e5fe6864fefa8acbc7e88a906/libraries/UTFT/Tools/UTFT Image Converters.pdf -------------------------------------------------------------------------------- /libraries/UTFT/examples/Arduino (ARM) + Teensy/UTFT_Bitmap/UTFT_Bitmap.ino: -------------------------------------------------------------------------------- 1 | // UTFT_Bitmap 2 | // Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved 3 | // web: http://www.RinkyDinkElectronics.com/ 4 | // 5 | // This program is a demo of the drawBitmap()-function. 6 | // 7 | // This demo was made to work on the 320x240 modules. 8 | // Any other size displays may cause strange behaviour. 9 | // 10 | // This program requires the UTFT library. 11 | // 12 | 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 | // 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 | extern unsigned short info[0x400]; 29 | extern unsigned short icon[0x400]; 30 | extern unsigned short tux[0x400]; 31 | 32 | void setup() 33 | { 34 | myGLCD.InitLCD(); 35 | myGLCD.setFont(SmallFont); 36 | } 37 | 38 | void loop() 39 | { 40 | myGLCD.fillScr(255, 255, 255); 41 | myGLCD.setColor(255, 255, 255); 42 | myGLCD.print(" *** A 10 by 7 grid of a 32x32 icon *** ", CENTER, 228); 43 | for (int x=0; x<10; x++) 44 | for (int y=0; y<7; y++) 45 | myGLCD.drawBitmap (x*32, y*32, 32, 32, info); 46 | 47 | delay(5000); 48 | 49 | myGLCD.fillScr(255, 255, 255); 50 | myGLCD.setColor(255, 255, 255); 51 | myGLCD.print(" Two different icons in scale 1 to 4 ", CENTER, 228); 52 | int x=0; 53 | for (int s=0; s<4; s++) 54 | { 55 | x+=(s*32); 56 | myGLCD.drawBitmap (x, 0, 32, 32, tux, s+1); 57 | } 58 | x=0; 59 | for (int s=4; s>0; s--) 60 | { 61 | myGLCD.drawBitmap (x, 224-(s*32), 32, 32, icon, s); 62 | x+=(s*32); 63 | } 64 | 65 | delay(5000); 66 | } 67 | 68 | -------------------------------------------------------------------------------- /libraries/UTFT/examples/Arduino (ARM) + Teensy/UTFT_Bitmap_128x128/UTFT_Bitmap_128x128.ino: -------------------------------------------------------------------------------- 1 | // UTFT_Bitmap_128x128 2 | // Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved 3 | // web: http://www.RinkyDinkElectronics.com/ 4 | // 5 | // This program is a demo of the drawBitmap()-function. 6 | // 7 | // This demo was made to work on the 128x128 modules. 8 | // Any other size displays may cause strange behaviour. 9 | // 10 | // This program requires the UTFT library. 11 | // 12 | 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 short icon1[0x400]; 18 | extern unsigned short icon2[0x400]; 19 | extern unsigned short 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 | -------------------------------------------------------------------------------- /libraries/UTFT/examples/Arduino (ARM) + Teensy/UTFT_CPLD_PageSwitching/UTFT_CPLD_PageSwitching.ino: -------------------------------------------------------------------------------- 1 | // UTFT_CPLD_PageSwitching 2 | // Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved 3 | // web: http://www.RinkyDinkElectronics.com/ 4 | // 5 | // This program is a demo of page switching on CPLD-based display modules.. 6 | // 7 | // This demo was made for modules with a screen resolution 8 | // of 800x480 pixels. 9 | // 10 | // This program requires the UTFT library. 11 | // 12 | // NOTE: The display will be black for a short while during the start 13 | // 14 | 15 | #include 16 | 17 | // Declare which fonts we will be using 18 | extern uint8_t BigFont[]; 19 | extern uint8_t SevenSegNumFont[]; 20 | 21 | // Set the pins to the correct ones for your development shield 22 | // ------------------------------------------------------------ 23 | // Standard Arduino Mega/Due shield : ,38,39,40,41 24 | // CTE TFT LCD/SD Shield for Arduino Due : ,25,26,27,28 25 | // Teensy 3.x TFT Test Board : ,23,22, 3, 4 26 | // ElecHouse TFT LCD/SD Shield for Arduino Due : ,22,23,31,33 27 | // 28 | // Remember to change the model parameter to suit your display module! 29 | UTFT myGLCD(EHOUSE50CPLD,22,23,31,33); 30 | 31 | void setup() 32 | { 33 | myGLCD.InitLCD(); 34 | } 35 | 36 | void loop() 37 | { 38 | myGLCD.setBackColor(VGA_TRANSPARENT); 39 | 40 | myGLCD.setBrightness(0); 41 | for (byte pg=0; pg<8; pg++) 42 | { 43 | myGLCD.setWritePage(pg); 44 | myGLCD.clrScr(); 45 | for (int ln=0; ln<480; ln+=2) 46 | { 47 | switch (pg) 48 | { 49 | case 0: 50 | myGLCD.setColor(ln/2, 0, 0); 51 | break; 52 | case 1: 53 | myGLCD.setColor(0, ln/2, 0); 54 | break; 55 | case 2: 56 | myGLCD.setColor(0, 0, ln/2); 57 | break; 58 | case 3: 59 | myGLCD.setColor(ln/4, ln/2, 0); 60 | break; 61 | case 4: 62 | myGLCD.setColor(0, ln/2, ln/2); 63 | break; 64 | case 5: 65 | myGLCD.setColor(ln/2, 0, ln/2); 66 | break; 67 | case 6: 68 | myGLCD.setColor(ln/2, ln/2, 0); 69 | break; 70 | case 7: 71 | myGLCD.setColor(0, ln/2, ln/4); 72 | break; 73 | } 74 | myGLCD.drawLine(0, ln, 799, ln); 75 | myGLCD.drawLine(0, ln+1, 799, ln+1); 76 | } 77 | myGLCD.setColor(VGA_WHITE); 78 | myGLCD.setFont(BigFont); 79 | myGLCD.print("This is page:", CENTER, 200); 80 | myGLCD.setFont(SevenSegNumFont); 81 | myGLCD.printNumI(pg, CENTER, 240); 82 | } 83 | myGLCD.setBrightness(16); 84 | 85 | while(1) 86 | { 87 | for (byte pg=0; pg<8; pg++) 88 | { 89 | myGLCD.setDisplayPage(pg); 90 | delay(500); 91 | } 92 | } 93 | } 94 | 95 | -------------------------------------------------------------------------------- /libraries/UTFT/examples/Arduino (ARM) + Teensy/UTFT_Rotate_Bitmap/UTFT_Rotate_Bitmap.ino: -------------------------------------------------------------------------------- 1 | // UTFT_Rotate_Bitmap 2 | // Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved 3 | // web: http://www.RinkyDinkElectronics.com/ 4 | // 5 | // This program is a demo of the drawBitmap()-function. 6 | // 7 | // This program requires the UTFT library. 8 | // 9 | 10 | #include 11 | 12 | // Set the pins to the correct ones for your development shield 13 | // ------------------------------------------------------------ 14 | // Standard Arduino Mega/Due shield : ,38,39,40,41 15 | // CTE TFT LCD/SD Shield for Arduino Due : ,25,26,27,28 16 | // Teensy 3.x TFT Test Board : ,23,22, 3, 4 17 | // ElecHouse TFT LCD/SD Shield for Arduino Due : ,22,23,31,33 18 | // 19 | // Remember to change the model parameter to suit your display module! 20 | UTFT myGLCD(ITDB32S,38,39,40,41); 21 | 22 | extern unsigned short biohazard[0x1000]; 23 | 24 | void setup() 25 | { 26 | myGLCD.InitLCD(LANDSCAPE); 27 | myGLCD.fillScr(255, 255, 255); 28 | myGLCD.setColor(0, 0, 0); 29 | } 30 | 31 | void loop() 32 | { 33 | for (int i=0; i<360; i+=5) 34 | { 35 | myGLCD.drawBitmap (10, 10, 64, 64, biohazard, i, 32, 32); 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /libraries/UTFT/examples/Arduino (ARM) + Teensy/UTFT_Textrotation_Demo/UTFT_Textrotation_Demo.ino: -------------------------------------------------------------------------------- 1 | // UTFT_Textrotation_Demo 2 | // Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved 3 | // web: http://www.RinkyDinkElectronics.com/ 4 | // 5 | // This program is a demo of the textrotation-functions. 6 | // 7 | // This demo was made for modules with a screen resolution 8 | // of 320x240 pixels. 9 | // 10 | // This program requires the UTFT library. 11 | // 12 | 13 | #include 14 | 15 | // Declare which fonts we will be using 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 | myGLCD.clrScr(); 33 | myGLCD.setFont(BigFont); 34 | } 35 | 36 | void loop() 37 | { 38 | myGLCD.print("Text rotation", 0, 0); 39 | myGLCD.setColor(0, 0, 255); 40 | myGLCD.print("0 degrees", 0, 16, 0); 41 | myGLCD.print("90 degrees", 319, 0, 90); 42 | myGLCD.print("180 degrees", 319, 239, 180); 43 | myGLCD.print("270 degrees", 0, 239, 270); 44 | 45 | myGLCD.setFont(SevenSegNumFont); 46 | myGLCD.setColor(0, 255, 0); 47 | myGLCD.print("45", 90, 100, 45); 48 | myGLCD.print("90", 200, 50, 90); 49 | myGLCD.print("180", 300, 200, 180); 50 | 51 | while (true) {}; 52 | } 53 | 54 | -------------------------------------------------------------------------------- /libraries/UTFT/examples/Arduino (ARM) + Teensy/UTFT_ViewFont/UTFT_ViewFont.ino: -------------------------------------------------------------------------------- 1 | // UTFT_ViewFont 2 | // Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved 3 | // web: http://www.RinkyDinkElectronics.com/ 4 | // 5 | // This program is a demo of the included fonts. 6 | // 7 | // This demo was made for modules with a screen resolution 8 | // of 320x240 pixels. 9 | // 10 | // This program requires the UTFT library. 11 | // 12 | 13 | #include 14 | 15 | // Declare which fonts we will be using 16 | extern uint8_t SmallFont[]; 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(ITDB32S,38,39,40,41); 29 | 30 | void setup() 31 | { 32 | myGLCD.InitLCD(); 33 | 34 | myGLCD.clrScr(); 35 | } 36 | 37 | void loop() 38 | { 39 | myGLCD.setColor(0, 255, 0); 40 | myGLCD.setBackColor(0, 0, 0); 41 | 42 | myGLCD.setFont(BigFont); 43 | myGLCD.print(" !\"#$%&'()*+,-./", CENTER, 0); 44 | myGLCD.print("0123456789:;<=>?", CENTER, 16); 45 | myGLCD.print("@ABCDEFGHIJKLMNO", CENTER, 32); 46 | myGLCD.print("PQRSTUVWXYZ[\\]^_", CENTER, 48); 47 | myGLCD.print("`abcdefghijklmno", CENTER, 64); 48 | myGLCD.print("pqrstuvwxyz{|}~ ", CENTER, 80); 49 | 50 | myGLCD.setFont(SmallFont); 51 | myGLCD.print(" !\"#$%&'()*+,-./0123456789:;<=>?", CENTER, 120); 52 | myGLCD.print("@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_", CENTER, 132); 53 | myGLCD.print("`abcdefghijklmnopqrstuvwxyz{|}~ ", CENTER, 144); 54 | 55 | myGLCD.setFont(SevenSegNumFont); 56 | myGLCD.print("0123456789", CENTER, 190); 57 | 58 | while(1) {}; 59 | } 60 | 61 | -------------------------------------------------------------------------------- /libraries/UTFT/examples/Arduino (AVR)/UTFT_Bitmap/UTFT_Bitmap.ino: -------------------------------------------------------------------------------- 1 | // UTFT_Bitmap 2 | // Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved 3 | // web: http://www.RinkyDinkElectronics.com/ 4 | // 5 | // This program is a demo of the drawBitmap()-function. 6 | // 7 | // This demo was made to work on the 320x240 modules. 8 | // Any other size displays may cause strange behaviour. 9 | // 10 | // This program requires the UTFT library. 11 | // 12 | 13 | #include 14 | #include 15 | 16 | // Declare which fonts we will be using 17 | extern uint8_t SmallFont[]; 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,A5,A4,A3,A2); 33 | 34 | extern unsigned int info[0x400]; 35 | extern unsigned int icon[0x400]; 36 | extern unsigned int tux[0x400]; 37 | 38 | void setup() 39 | { 40 | myGLCD.InitLCD(); 41 | myGLCD.setFont(SmallFont); 42 | } 43 | 44 | void loop() 45 | { 46 | myGLCD.fillScr(255, 255, 255); 47 | myGLCD.setColor(255, 255, 255); 48 | myGLCD.print(" *** A 10 by 7 grid of a 32x32 icon *** ", CENTER, 228); 49 | for (int x=0; x<10; x++) 50 | for (int y=0; y<7; y++) 51 | myGLCD.drawBitmap (x*32, y*32, 32, 32, info); 52 | 53 | delay(5000); 54 | 55 | myGLCD.fillScr(255, 255, 255); 56 | myGLCD.setColor(255, 255, 255); 57 | myGLCD.print(" Two different icons in scale 1 to 4 ", CENTER, 228); 58 | int x=0; 59 | for (int s=0; s<4; s++) 60 | { 61 | x+=(s*32); 62 | myGLCD.drawBitmap (x, 0, 32, 32, tux, s+1); 63 | } 64 | x=0; 65 | for (int s=4; s>0; s--) 66 | { 67 | myGLCD.drawBitmap (x, 224-(s*32), 32, 32, icon, s); 68 | x+=(s*32); 69 | } 70 | 71 | delay(5000); 72 | } 73 | -------------------------------------------------------------------------------- /libraries/UTFT/examples/Arduino (AVR)/UTFT_Bitmap_128x128/UTFT_Bitmap_128x128.ino: -------------------------------------------------------------------------------- 1 | // UTFT_Bitmap_128x128 2 | // Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved 3 | // web: http://www.RinkyDinkElectronics.com/ 4 | // 5 | // This program is a demo of the drawBitmap()-function. 6 | // 7 | // This demo was made to work on the 128x128 modules. 8 | // Any other size displays may cause strange behaviour. 9 | // 10 | // This program requires the UTFT library. 11 | // 12 | 13 | #include 14 | #include 15 | 16 | UTFT myGLCD(LPH9135,6,5,2,3,4); // Remember to change the model parameter to suit your display module! 17 | 18 | extern unsigned int icon1[0x400]; 19 | extern unsigned int icon2[0x400]; 20 | extern unsigned int tux[0x1000]; 21 | 22 | void setup() 23 | { 24 | myGLCD.InitLCD(PORTRAIT); 25 | } 26 | 27 | void loop() 28 | { 29 | // Draw a 4 by 4 grid of a 32x32 icon. 30 | myGLCD.fillScr(255, 255, 255); 31 | for (int x=0; x<4; x++) 32 | for (int y=0; y<4; y++) 33 | myGLCD.drawBitmap (x*32, y*32, 32, 32, icon1); 34 | 35 | delay(5000); 36 | 37 | // Draw a 64x64 icon in double size. 38 | myGLCD.fillScr(255, 255, 255); 39 | myGLCD.drawBitmap (0, 0, 64, 64, tux, 2); 40 | 41 | delay(5000); 42 | 43 | // Draw a 2 by 2 grid of a 32x32 icon in double size. 44 | myGLCD.fillScr(255, 255, 255); 45 | for (int x=0; x<2; x++) 46 | for (int y=0; y<2; y++) 47 | myGLCD.drawBitmap (x*64, y*64, 32, 32, icon2, 2); 48 | 49 | delay(5000); 50 | } 51 | 52 | -------------------------------------------------------------------------------- /libraries/UTFT/examples/Arduino (AVR)/UTFT_CPLD_PageSwitching/UTFT_CPLD_PageSwitching.ino: -------------------------------------------------------------------------------- 1 | // UTFT_CPLD_PageSwitching 2 | // Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved 3 | // web: http://www.RinkyDinkElectronics.com/ 4 | // 5 | // This program is a demo of page switching on CPLD-based display modules.. 6 | // 7 | // This demo was made for modules with a screen resolution 8 | // of 800x480 pixels. 9 | // 10 | // This program requires the UTFT library. 11 | // 12 | // NOTE: The display will be black for 10-15 seconds during the start 13 | // 14 | 15 | #include 16 | 17 | // Declare which fonts we will be using 18 | extern uint8_t BigFont[]; 19 | extern uint8_t SevenSegNumFont[]; 20 | 21 | // Set the pins to the correct ones for your development shield 22 | // ------------------------------------------------------------ 23 | // Arduino Mega: 24 | // ------------------- 25 | // Standard Arduino Mega/Due shield : ,38,39,40,41 26 | // CTE TFT LCD/SD Shield for Arduino Mega : ,38,39,40,41 27 | // 28 | // Remember to change the model parameter to suit your display module! 29 | UTFT myGLCD(CPLD,38,39,40,41); 30 | 31 | void setup() 32 | { 33 | myGLCD.InitLCD(); 34 | } 35 | 36 | void loop() 37 | { 38 | myGLCD.setBackColor(VGA_TRANSPARENT); 39 | 40 | myGLCD.setBrightness(0); 41 | for (byte pg=0; pg<8; pg++) 42 | { 43 | myGLCD.setWritePage(pg); 44 | myGLCD.clrScr(); 45 | for (int ln=0; ln<480; ln+=2) 46 | { 47 | switch (pg) 48 | { 49 | case 0: 50 | myGLCD.setColor(ln/2, 0, 0); 51 | break; 52 | case 1: 53 | myGLCD.setColor(0, ln/2, 0); 54 | break; 55 | case 2: 56 | myGLCD.setColor(0, 0, ln/2); 57 | break; 58 | case 3: 59 | myGLCD.setColor(ln/4, ln/2, 0); 60 | break; 61 | case 4: 62 | myGLCD.setColor(0, ln/2, ln/2); 63 | break; 64 | case 5: 65 | myGLCD.setColor(ln/2, 0, ln/2); 66 | break; 67 | case 6: 68 | myGLCD.setColor(ln/2, ln/2, 0); 69 | break; 70 | case 7: 71 | myGLCD.setColor(0, ln/2, ln/4); 72 | break; 73 | } 74 | myGLCD.drawLine(0, ln, 799, ln); 75 | myGLCD.drawLine(0, ln+1, 799, ln+1); 76 | } 77 | myGLCD.setColor(VGA_WHITE); 78 | myGLCD.setFont(BigFont); 79 | myGLCD.print("This is page:", CENTER, 200); 80 | myGLCD.setFont(SevenSegNumFont); 81 | myGLCD.printNumI(pg, CENTER, 240); 82 | } 83 | myGLCD.setBrightness(16); 84 | 85 | while(1) 86 | { 87 | for (byte pg=0; pg<8; pg++) 88 | { 89 | myGLCD.setDisplayPage(pg); 90 | delay(500); 91 | } 92 | } 93 | } 94 | 95 | -------------------------------------------------------------------------------- /libraries/UTFT/examples/Arduino (AVR)/UTFT_Rotate_Bitmap/UTFT_Rotate_Bitmap.ino: -------------------------------------------------------------------------------- 1 | // UTFT_Rotate_Bitmap 2 | // Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved 3 | // web: http://www.RinkyDinkElectronics.com/ 4 | // 5 | // This program is a demo of the drawBitmap()-function. 6 | // 7 | // This program requires the UTFT library. 8 | // 9 | 10 | #include 11 | #include 12 | 13 | // Set the pins to the correct ones for your development shield 14 | // ------------------------------------------------------------ 15 | // Arduino Uno / 2009: 16 | // ------------------- 17 | // Standard Arduino Uno/2009 shield : ,A5,A4,A3,A2 18 | // DisplayModule Arduino Uno TFT shield : ,A5,A4,A3,A2 19 | // 20 | // Arduino Mega: 21 | // ------------------- 22 | // Standard Arduino Mega/Due shield : ,38,39,40,41 23 | // CTE TFT LCD/SD Shield for Arduino Mega : ,38,39,40,41 24 | // 25 | // Remember to change the model parameter to suit your display module! 26 | UTFT myGLCD(ITDB32S,38,39,40,41); 27 | 28 | extern unsigned int tux[0x400]; 29 | 30 | void setup() 31 | { 32 | myGLCD.InitLCD(LANDSCAPE); 33 | myGLCD.fillScr(255, 255, 255); 34 | myGLCD.setColor(0, 0, 0); 35 | } 36 | 37 | void loop() 38 | { 39 | for (int i=0; i<360; i+=5) 40 | { 41 | myGLCD.drawBitmap (10, 10, 32, 32, tux, i, 16, 16); 42 | } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /libraries/UTFT/examples/Arduino (AVR)/UTFT_Textrotation_Demo/UTFT_Textrotation_Demo.ino: -------------------------------------------------------------------------------- 1 | // UTFT_Textrotation_Demo 2 | // Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved 3 | // web: http://www.RinkyDinkElectronics.com/ 4 | // 5 | // This program is a demo of the textrotation-functions. 6 | // 7 | // This demo was made for modules with a screen resolution 8 | // of 320x240 pixels. 9 | // 10 | // This program requires the UTFT library. 11 | // 12 | 13 | #include 14 | 15 | // Declare which fonts we will be using 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 | myGLCD.clrScr(); 38 | myGLCD.setFont(BigFont); 39 | } 40 | 41 | void loop() 42 | { 43 | myGLCD.print("Text rotation", 0, 0); 44 | myGLCD.setColor(0, 0, 255); 45 | myGLCD.print("0 degrees", 0, 16, 0); 46 | myGLCD.print("90 degrees", 319, 0, 90); 47 | myGLCD.print("180 degrees", 319, 239, 180); 48 | myGLCD.print("270 degrees", 0, 239, 270); 49 | 50 | myGLCD.setFont(SevenSegNumFont); 51 | myGLCD.setColor(0, 255, 0); 52 | myGLCD.print("45", 90, 100, 45); 53 | myGLCD.print("90", 200, 50, 90); 54 | myGLCD.print("180", 300, 200, 180); 55 | 56 | while (true) {}; 57 | } 58 | 59 | -------------------------------------------------------------------------------- /libraries/UTFT/examples/Arduino (AVR)/UTFT_ViewFont/UTFT_ViewFont.ino: -------------------------------------------------------------------------------- 1 | // UTFT_ViewFont 2 | // Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved 3 | // web: http://www.RinkyDinkElectronics.com/ 4 | // 5 | // This program is a demo of the included fonts. 6 | // 7 | // This demo was made for modules with a screen resolution 8 | // of 320x240 pixels. 9 | // 10 | // This program requires the UTFT library. 11 | // 12 | 13 | #include 14 | 15 | // Declare which fonts we will be using 16 | extern uint8_t SmallFont[]; 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 Uno / 2009: 23 | // ------------------- 24 | // Standard Arduino Uno/2009 shield : ,A5,A4,A3,A2 25 | // DisplayModule Arduino Uno TFT shield : ,A5,A4,A3,A2 26 | // 27 | // Arduino Mega: 28 | // ------------------- 29 | // Standard Arduino Mega/Due shield : ,38,39,40,41 30 | // CTE TFT LCD/SD Shield for Arduino Mega : ,38,39,40,41 31 | // 32 | // Remember to change the model parameter to suit your display module! 33 | UTFT myGLCD(ITDB32S,38,39,40,41); 34 | 35 | void setup() 36 | { 37 | myGLCD.InitLCD(); 38 | 39 | myGLCD.clrScr(); 40 | } 41 | 42 | void loop() 43 | { 44 | myGLCD.setColor(0, 255, 0); 45 | myGLCD.setBackColor(0, 0, 0); 46 | 47 | myGLCD.setFont(BigFont); 48 | myGLCD.print(" !\"#$%&'()*+,-./", CENTER, 0); 49 | myGLCD.print("0123456789:;<=>?", CENTER, 16); 50 | myGLCD.print("@ABCDEFGHIJKLMNO", CENTER, 32); 51 | myGLCD.print("PQRSTUVWXYZ[\\]^_", CENTER, 48); 52 | myGLCD.print("`abcdefghijklmno", CENTER, 64); 53 | myGLCD.print("pqrstuvwxyz{|}~ ", CENTER, 80); 54 | 55 | myGLCD.setFont(SmallFont); 56 | myGLCD.print(" !\"#$%&'()*+,-./0123456789:;<=>?", CENTER, 120); 57 | myGLCD.print("@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_", CENTER, 132); 58 | myGLCD.print("`abcdefghijklmnopqrstuvwxyz{|}~ ", CENTER, 144); 59 | 60 | myGLCD.setFont(SevenSegNumFont); 61 | myGLCD.print("0123456789", CENTER, 190); 62 | 63 | while(1) {}; 64 | } 65 | 66 | -------------------------------------------------------------------------------- /libraries/UTFT/examples/TI LaunchPads (Energia)/UTFT_Bitmap/UTFT_Bitmap.ino: -------------------------------------------------------------------------------- 1 | // UTFT_Bitmap 2 | // Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved 3 | // web: http://www.RinkyDinkElectronics.com/ 4 | // 5 | // This program is a demo of the drawBitmap()-function. 6 | // 7 | // This demo was made to work on the 320x240 modules. 8 | // Any other size displays may cause strange behaviour. 9 | // 10 | // This program requires the UTFT library. 11 | // 12 | 13 | #include 14 | 15 | // Declare which fonts we will be using 16 | extern uint8_t SmallFont[]; 17 | 18 | // Remember to change the model parameter to suit your display module! 19 | UTFT myGLCD(ITDB32S,15,18,11,32); 20 | 21 | extern unsigned short info[0x400]; 22 | extern unsigned short icon[0x400]; 23 | extern unsigned short tux[0x400]; 24 | 25 | void setup() 26 | { 27 | myGLCD.InitLCD(); 28 | myGLCD.setFont(SmallFont); 29 | } 30 | 31 | void loop() 32 | { 33 | myGLCD.fillScr(255, 255, 255); 34 | myGLCD.setColor(255, 255, 255); 35 | myGLCD.print(" *** A 10 by 7 grid of a 32x32 icon *** ", CENTER, 228); 36 | for (int x=0; x<10; x++) 37 | for (int y=0; y<7; y++) 38 | myGLCD.drawBitmap (x*32, y*32, 32, 32, info); 39 | 40 | delay(5000); 41 | 42 | myGLCD.fillScr(255, 255, 255); 43 | myGLCD.setColor(255, 255, 255); 44 | myGLCD.print(" Two different icons in scale 1 to 4 ", CENTER, 228); 45 | int x=0; 46 | for (int s=0; s<4; s++) 47 | { 48 | x+=(s*32); 49 | myGLCD.drawBitmap (x, 0, 32, 32, tux, s+1); 50 | } 51 | x=0; 52 | for (int s=4; s>0; s--) 53 | { 54 | myGLCD.drawBitmap (x, 224-(s*32), 32, 32, icon, s); 55 | x+=(s*32); 56 | } 57 | 58 | delay(5000); 59 | } 60 | 61 | -------------------------------------------------------------------------------- /libraries/UTFT/examples/TI LaunchPads (Energia)/UTFT_Rotate_Bitmap/UTFT_Rotate_Bitmap.ino: -------------------------------------------------------------------------------- 1 | // UTFT_Rotate_Bitmap 2 | // Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved 3 | // web: http://www.RinkyDinkElectronics.com/ 4 | // 5 | // This program is a demo of the drawBitmap()-function. 6 | // 7 | // This program requires the UTFT library. 8 | // 9 | 10 | #include 11 | 12 | // Remember to change the model parameter to suit your display module! 13 | UTFT myGLCD(ITDB32S,15,18,11,32); 14 | 15 | extern unsigned short biohazard[0x1000]; 16 | 17 | void setup() 18 | { 19 | myGLCD.InitLCD(LANDSCAPE); 20 | myGLCD.fillScr(255, 255, 255); 21 | myGLCD.setColor(0, 0, 0); 22 | } 23 | 24 | void loop() 25 | { 26 | for (int i=0; i<360; i+=5) 27 | { 28 | myGLCD.drawBitmap (10, 10, 64, 64, biohazard, i, 32, 32); 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /libraries/UTFT/examples/TI LaunchPads (Energia)/UTFT_Textrotation_Demo/UTFT_Textrotation_Demo.ino: -------------------------------------------------------------------------------- 1 | // UTFT_Textrotation_Demo 2 | // Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved 3 | // web: http://www.RinkyDinkElectronics.com/ 4 | // 5 | // This program is a demo of the textrotation-functions. 6 | // 7 | // This demo was made for modules with a screen resolution 8 | // of 320x240 pixels. 9 | // 10 | // This program requires the UTFT library. 11 | // 12 | 13 | #include 14 | 15 | // Declare which fonts we will be using 16 | extern uint8_t BigFont[]; 17 | extern uint8_t SevenSegNumFont[]; 18 | 19 | // Remember to change the model parameter to suit your display module! 20 | UTFT myGLCD(ITDB32S,15,18,11,32); 21 | 22 | void setup() 23 | { 24 | myGLCD.InitLCD(); 25 | myGLCD.clrScr(); 26 | myGLCD.setFont(BigFont); 27 | } 28 | 29 | void loop() 30 | { 31 | myGLCD.print("Text rotation", 0, 0); 32 | myGLCD.setColor(0, 0, 255); 33 | myGLCD.print("0 degrees", 0, 16, 0); 34 | myGLCD.print("90 degrees", 319, 0, 90); 35 | myGLCD.print("180 degrees", 319, 239, 180); 36 | myGLCD.print("270 degrees", 0, 239, 270); 37 | 38 | myGLCD.setFont(SevenSegNumFont); 39 | myGLCD.setColor(0, 255, 0); 40 | myGLCD.print("45", 90, 100, 45); 41 | myGLCD.print("90", 200, 50, 90); 42 | myGLCD.print("180", 300, 200, 180); 43 | 44 | while (true) {}; 45 | } 46 | 47 | -------------------------------------------------------------------------------- /libraries/UTFT/examples/TI LaunchPads (Energia)/UTFT_ViewFont/UTFT_ViewFont.ino: -------------------------------------------------------------------------------- 1 | // UTFT_ViewFont 2 | // Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved 3 | // web: http://www.RinkyDinkElectronics.com/ 4 | // 5 | // This program is a demo of the included fonts. 6 | // 7 | // This demo was made for modules with a screen resolution 8 | // of 320x240 pixels. 9 | // 10 | // This program requires the UTFT library. 11 | // 12 | 13 | #include 14 | 15 | // Declare which fonts we will be using 16 | extern uint8_t SmallFont[]; 17 | extern uint8_t BigFont[]; 18 | extern uint8_t SevenSegNumFont[]; 19 | 20 | // Remember to change the model parameter to suit your display module! 21 | UTFT myGLCD(ITDB32S,15,18,11,32); 22 | 23 | void setup() 24 | { 25 | myGLCD.InitLCD(); 26 | 27 | myGLCD.clrScr(); 28 | } 29 | 30 | void loop() 31 | { 32 | myGLCD.setBackColor(0, 0, 0); 33 | 34 | myGLCD.setColor(0, 0, 255); 35 | myGLCD.setFont(BigFont); 36 | myGLCD.print(" !\"#$%&'()*+,-./", CENTER, 0); 37 | myGLCD.print("0123456789:;<=>?", CENTER, 16); 38 | myGLCD.print("@ABCDEFGHIJKLMNO", CENTER, 32); 39 | myGLCD.print("PQRSTUVWXYZ[\\]^_", CENTER, 48); 40 | myGLCD.print("`abcdefghijklmno", CENTER, 64); 41 | myGLCD.print("pqrstuvwxyz{|}~ ", CENTER, 80); 42 | 43 | myGLCD.setColor(255, 0, 0); 44 | myGLCD.setFont(SmallFont); 45 | myGLCD.print(" !\"#$%&'()*+,-./0123456789:;<=>?", CENTER, 120); 46 | myGLCD.print("@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_", CENTER, 132); 47 | myGLCD.print("`abcdefghijklmnopqrstuvwxyz{|}~ ", CENTER, 144); 48 | 49 | myGLCD.setColor(0, 255, 0); 50 | myGLCD.setFont(SevenSegNumFont); 51 | myGLCD.print("0123456789", CENTER, 190); 52 | 53 | while(1) {}; 54 | } 55 | 56 | -------------------------------------------------------------------------------- /libraries/UTFT/examples/chipKit/UTFT_Bitmap/UTFT_Bitmap.pde: -------------------------------------------------------------------------------- 1 | // UTFT_Bitmap 2 | // Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved 3 | // web: http://www.RinkyDinkElectronics.com/ 4 | // 5 | // This program is a demo of the drawBitmap()-function. 6 | // 7 | // This demo was made to work on the 320x240 modules. 8 | // Any other size displays may cause strange behaviour. 9 | // 10 | // This program requires the UTFT library. 11 | // 12 | 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 | // 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 | 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 | -------------------------------------------------------------------------------- /libraries/UTFT/examples/chipKit/UTFT_Bitmap_128x128/UTFT_Bitmap_128x128.pde: -------------------------------------------------------------------------------- 1 | // UTFT_Bitmap_128x128 2 | // Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved 3 | // web: http://www.RinkyDinkElectronics.com/ 4 | // 5 | // This program is a demo of the drawBitmap()-function. 6 | // 7 | // This demo was made to work on the 128x128 modules. 8 | // Any other size displays may cause strange behaviour. 9 | // 10 | // This program requires the UTFT library. 11 | // 12 | 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 short icon1[0x400]; 18 | extern unsigned short icon2[0x400]; 19 | extern unsigned short 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 | -------------------------------------------------------------------------------- /libraries/UTFT/examples/chipKit/UTFT_Rotate_Bitmap/UTFT_Rotate_Bitmap.pde: -------------------------------------------------------------------------------- 1 | // UTFT_Rotate_Bitmap 2 | // Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved 3 | // web: http://www.RinkyDinkElectronics.com/ 4 | // 5 | // This program is a demo of the drawBitmap()-function. 6 | // 7 | // This program requires the UTFT library. 8 | // 9 | 10 | #include 11 | 12 | // Set the pins to the correct ones for your development shield 13 | // ------------------------------------------------------------ 14 | // My chipKit Uno32/uC32 shield : ,38,39,40,41 15 | // My chipKit Max32 shield : ,82,83,84,85 16 | // AquaLEDSource All in One Super Screw Shield : ,82,83,84,85 17 | // 18 | // Remember to change the model parameter to suit your display module! 19 | UTFT myGLCD(ITDB32S,82,83,84,85); 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 | -------------------------------------------------------------------------------- /libraries/UTFT/examples/chipKit/UTFT_Textrotation_Demo/UTFT_Textrotation_Demo.pde: -------------------------------------------------------------------------------- 1 | // UTFT_Textrotation_Demo 2 | // Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved 3 | // web: http://www.RinkyDinkElectronics.com/ 4 | // 5 | // This program is a demo of the textrotation-functions. 6 | // 7 | // This demo was made for modules with a screen resolution 8 | // of 320x240 pixels. 9 | // 10 | // This program requires the UTFT library. 11 | // 12 | 13 | #include 14 | 15 | // Declare which fonts we will be using 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 | 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 | -------------------------------------------------------------------------------- /libraries/UTFT/examples/chipKit/UTFT_ViewFont/UTFT_ViewFont.pde: -------------------------------------------------------------------------------- 1 | // UTFT_ViewFont 2 | // Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved 3 | // web: http://www.RinkyDinkElectronics.com/ 4 | // 5 | // This program is a demo of the included fonts. 6 | // 7 | // This demo was made for modules with a screen resolution 8 | // of 320x240 pixels. 9 | // 10 | // This program requires the UTFT library. 11 | // 12 | 13 | #include 14 | 15 | // Declare which fonts we will be using 16 | extern uint8_t SmallFont[]; 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 | // My chipKit Uno32/uC32 shield : ,38,39,40,41 23 | // My chipKit Max32 shield : ,82,83,84,85 24 | // AquaLEDSource All in One Super Screw Shield : ,82,83,84,85 25 | // 26 | // Remember to change the model parameter to suit your display module! 27 | UTFT myGLCD(ITDB32S,82,83,84,85); 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | #if defined(ENERGIA) 19 | #define cbi(reg, bitmask) HWREG((uint32_t)reg + 0x3FC) &= ~bitmask 20 | #define sbi(reg, bitmask) HWREG((uint32_t)reg + 0x3FC) |= bitmask 21 | #else 22 | #define cbi(reg, bitmask) *reg &= ~bitmask 23 | #define sbi(reg, bitmask) *reg |= bitmask 24 | #endif 25 | #define pulse_high(reg, bitmask) sbi(reg, bitmask); cbi(reg, bitmask); 26 | #define pulse_low(reg, bitmask) cbi(reg, bitmask); sbi(reg, bitmask); 27 | 28 | #define cport(port, data) port &= data 29 | #define sport(port, data) port |= data 30 | 31 | #define swap(type, i, j) {type t = i; i = j; j = t;} 32 | 33 | #define fontbyte(x) cfont.font[x] 34 | 35 | #define pgm_read_word(data) *data 36 | #define pgm_read_byte(data) *data 37 | #define bitmapdatatype unsigned short* 38 | 39 | #if defined(TEENSYDUINO) && TEENSYDUINO >= 117 40 | #define regtype volatile uint8_t 41 | #define regsize uint8_t 42 | #else 43 | #define regtype volatile uint32_t 44 | #define regsize uint32_t 45 | #endif 46 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 // CTE50CPLD / CTE70CPLD / EHOUSE50CPLD 16 | 17 | //#define DISABLE_HX8340B_8 1 // ITDB22 8bit mode 18 | //#define DISABLE_HX8352A 1 // ITDB32WD / TFT01_32WD / CTE32W 19 | //#define DISABLE_HX8353C 1 // DMTFT18101 20 | 21 | //#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 22 | //#define DISABLE_ILI9325D_ALT 1 // CTE28 23 | //#define DISABLE_ILI9341_S4P 1 // MI0283QT9 24 | //#define DISABLE_ILI9341_S5P 1 // TFT01_22SP / TFT01_24SP / TFT22SHLD / DMTFT28105 25 | //#define DISABLE_ILI9341_16 1 // CTE32_R2 26 | //#define DISABLE_ILI9481 1 // CTE32HR 27 | //#define DISABLE_ILI9486 1 // CTE40 28 | 29 | //#define DISABLE_PCF8833 1 // LPH9135 30 | 31 | //#define DISABLE_R61581 1 // CTE35IPS 32 | 33 | //#define DISABLE_S6D0164 1 // CTE22 / DMTFT22102 34 | //#define DISABLE_S6D1121 1 // ITDB24E - This single define will disable both 8bit and 16bit mode for this controller 35 | //#define DISABLE_SSD1289 1 // ITDB32S / TFT01_32 / ELEE32_REVA / ELEE32_REVB / CTE32 - This single define will disable both 8bit, 16bit and latched mode for this controller 36 | //#define DISABLE_SSD1963_480 1 // ITDB43 / TFT01_43 37 | //#define DISABLE_SSD1963_800 1 // ITDB50 / TFT01_50 / CTE50 / EHOUSE50 38 | //#define DISABLE_SSD1963_800_ALT 1 // TFT01_70 / CTE70 / EHOUSE70 39 | //#define DISABLE_ST7735 1 // ITDB18SP 40 | //#define DISABLE_ST7735_ALT 1 // TFT01_18SHLD 41 | //#define DISABLE_ST7735S 1 // TFT01_18SP 42 | 43 | // ---------------------------------------------------------------------------- 44 | // The following TFT controllers are used by display modules and shields that 45 | // have been retired by their vendors. They are still supported but support may 46 | // be removed in future versions of the library. These controllers are disabled 47 | // by default to save flash memory. To use them you must enable support for 48 | // them by commenting them out here. 49 | 50 | #define DISABLE_HX8340B_S 1 // ITDB22 Serial mode 51 | #define DISABLE_HX8347A 1 // ITDB32 52 | #define DISABLE_ILI9325C 1 // ITDB24 53 | #define DISABLE_ILI9327 1 // ITDB32WC / TFT01_32W 54 | #define DISABLE_S1D19122 1 // ITDB25H 55 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /libraries/UTFT/tft_drivers/ili9341/16/initlcd.h: -------------------------------------------------------------------------------- 1 | case ILI9341_16: 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 | -------------------------------------------------------------------------------- /libraries/UTFT/tft_drivers/ili9341/16/setxy.h: -------------------------------------------------------------------------------- 1 | case ILI9341_16: 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /libraries/UTFT/tft_drivers/st7735/alt/initlcd.h: -------------------------------------------------------------------------------- 1 | case ST7735_ALT: 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(0xC0); 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 | -------------------------------------------------------------------------------- /libraries/UTFT/tft_drivers/st7735/alt/setxy.h: -------------------------------------------------------------------------------- 1 | case ST7735_ALT: 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 | -------------------------------------------------------------------------------- /libraries/UTFT/tft_drivers/st7735/std/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 | -------------------------------------------------------------------------------- /libraries/UTFT/tft_drivers/st7735/std/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /libraries/esp-mqtt/.gitignore: -------------------------------------------------------------------------------- 1 | # C++ objects and libs 2 | 3 | *.slo 4 | *.lo 5 | *.o 6 | #*.a 7 | *.la 8 | *.lai 9 | *.so 10 | *.dll 11 | *.dylib 12 | 13 | #Makefile 14 | *-build-* 15 | build-* 16 | *.autosave 17 | 18 | # .log files (usually created by QtTest - thanks to VestniK) 19 | *.log 20 | 21 | 22 | # Editors temporary files 23 | *~ 24 | 25 | 26 | #OSX 27 | .DS_Store 28 | ._* 29 | -------------------------------------------------------------------------------- /libraries/esp-mqtt/README.md: -------------------------------------------------------------------------------- 1 | MQTT 2 | ==== 3 | 4 | A Wrapper around mqtt for Arduino to be used with esp8266 modules. 5 | 6 | It wraps a slightly modified version of mqtt for esp8266 ported by Tuan PM. 7 | Original code for esp: https://github.com/tuanpmt/esp_mqtt 8 | Original code for contiki: https://github.com/esar/contiki-mqtt 9 | 10 | 11 | ==== 12 | 13 | **secure libssl:** 14 | 15 | If you want to use secure communication, please use the `secure`-branch! 16 | -------------------------------------------------------------------------------- /libraries/esp-mqtt/examples/mqtt_pub/mqtt_pub.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void myDataCb(String& topic, String& data); 5 | void myPublishedCb(); 6 | void myDisconnectedCb(); 7 | void myConnectedCb(); 8 | 9 | #define CLIENT_ID "client1" 10 | 11 | // create MQTT object 12 | MQTT myMqtt(CLIENT_ID, "192.168.0.1", 1883); 13 | 14 | // 15 | const char* ssid = "ssid"; 16 | const char* password = "ssid_password"; 17 | 18 | 19 | // 20 | void setup() { 21 | Serial.begin(115200); 22 | delay(1000); 23 | 24 | Serial.println(); 25 | Serial.println(); 26 | Serial.print("Connecting to "); 27 | Serial.println(ssid); 28 | 29 | WiFi.begin(ssid, password); 30 | 31 | while (WiFi.status() != WL_CONNECTED) { 32 | delay(500); 33 | Serial.print("."); 34 | } 35 | 36 | Serial.println(""); 37 | Serial.println("WiFi connected"); 38 | Serial.println("IP address: "); 39 | Serial.println(WiFi.localIP()); 40 | 41 | Serial.println("Connecting to MQTT server"); 42 | 43 | // setup callbacks 44 | myMqtt.onConnected(myConnectedCb); 45 | myMqtt.onDisconnected(myDisconnectedCb); 46 | myMqtt.onPublished(myPublishedCb); 47 | myMqtt.onData(myDataCb); 48 | 49 | Serial.println("connect mqtt..."); 50 | myMqtt.connect(); 51 | 52 | delay(10); 53 | } 54 | 55 | // 56 | void loop() { 57 | 58 | int value = analogRead(A0); 59 | 60 | String topic("/"); 61 | topic += CLIENT_ID; 62 | topic += "/value"; 63 | 64 | String valueStr(value); 65 | 66 | // publish value to topic 67 | boolean result = myMqtt.publish(topic, valueStr); 68 | 69 | delay(1000); 70 | } 71 | 72 | 73 | /* 74 | * 75 | */ 76 | void myConnectedCb() 77 | { 78 | Serial.println("connected to MQTT server"); 79 | } 80 | 81 | void myDisconnectedCb() 82 | { 83 | Serial.println("disconnected. try to reconnect..."); 84 | delay(500); 85 | myMqtt.connect(); 86 | } 87 | 88 | void myPublishedCb() 89 | { 90 | //Serial.println("published."); 91 | } 92 | 93 | void myDataCb(String& topic, String& data) 94 | { 95 | 96 | Serial.print(topic); 97 | Serial.print(": "); 98 | Serial.println(data); 99 | } 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /libraries/esp-mqtt/examples/mqtt_sub/mqtt_sub.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void myDataCb(String& topic, String& data); 5 | void myPublishedCb(); 6 | void myDisconnectedCb(); 7 | void myConnectedCb(); 8 | 9 | #define CLIENT_ID "client3" 10 | #define TOPIC "/client1/value" 11 | 12 | 13 | // create MQTT 14 | MQTT myMqtt(CLIENT_ID, "192.168.0.1", 1883); 15 | 16 | 17 | const char* ssid = "ssid"; 18 | const char* password = "ssid_password"; 19 | 20 | 21 | // 22 | void setup() { 23 | Serial.begin(115200); 24 | delay(1000); 25 | 26 | Serial.println(); 27 | Serial.println(); 28 | Serial.print("Connecting to "); 29 | Serial.println(ssid); 30 | 31 | WiFi.begin(ssid, password); 32 | 33 | while (WiFi.status() != WL_CONNECTED) { 34 | delay(500); 35 | Serial.print("."); 36 | } 37 | 38 | Serial.println(""); 39 | Serial.println("WiFi connected"); 40 | Serial.println("IP address: "); 41 | Serial.println(WiFi.localIP()); 42 | 43 | 44 | Serial.println("Connecting to MQTT server"); 45 | 46 | // setup callbacks 47 | myMqtt.onConnected(myConnectedCb); 48 | myMqtt.onDisconnected(myDisconnectedCb); 49 | myMqtt.onPublished(myPublishedCb); 50 | myMqtt.onData(myDataCb); 51 | 52 | Serial.println("connect mqtt..."); 53 | myMqtt.connect(); 54 | 55 | Serial.println("subscribe to topic..."); 56 | myMqtt.subscribe(TOPIC); 57 | 58 | delay(10); 59 | } 60 | 61 | // 62 | void loop() { 63 | } 64 | 65 | 66 | /* 67 | * 68 | */ 69 | void myConnectedCb() 70 | { 71 | Serial.println("connected to MQTT server"); 72 | } 73 | 74 | void myDisconnectedCb() 75 | { 76 | Serial.println("disconnected. try to reconnect..."); 77 | delay(500); 78 | myMqtt.connect(); 79 | } 80 | 81 | void myPublishedCb() 82 | { 83 | //Serial.println("published."); 84 | } 85 | 86 | void myDataCb(String& topic, String& data) 87 | { 88 | 89 | Serial.print(topic); 90 | Serial.print(": "); 91 | Serial.println(data); 92 | } 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /libraries/esp-mqtt/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For Test 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | MQTT.h KEYWORD1 10 | 11 | MQTT KEYWORD1 12 | 13 | 14 | ####################################### 15 | # Methods and Functions (KEYWORD2) 16 | ####################################### 17 | 18 | setClientId KEYWORD2 19 | setUserPwd KEYWORD2 20 | 21 | connect KEYWORD2 22 | disconnect KEYWORD2 23 | isConnected KEYWORD2 24 | 25 | publish KEYWORD2 26 | subscribe KEYWORD2 27 | 28 | getState KEYWORD2 29 | 30 | #general 31 | onConnected KEYWORD2 32 | onDisconnected KEYWORD2 33 | onPublished KEYWORD2 34 | onData KEYWORD2 35 | 36 | ####################################### 37 | # Instances (KEYWORD2) 38 | ####################################### 39 | 40 | ####################################### 41 | # Constants (LITERAL1) 42 | ####################################### 43 | 44 | -------------------------------------------------------------------------------- /libraries/esp-mqtt/library.properties: -------------------------------------------------------------------------------- 1 | name=ESP MQTT 2 | version=1.0.1 3 | author=Ingo Randolf 4 | maintainer=Ingo Randolf 5 | sentence=A Wrapper around mqtt for Arduino to be used with esp8266 modules. 6 | paragraph=It wraps a slightly modified version of mqtt for esp8266 ported by Tuan PM. Original code for esp: https://github.com/tuanpmt/esp_mqtt (7ec2ef8e1df0422b77348fe1da7885568e0c9d01) Original code for contiki: https://github.com/esar/contiki-mqtt 7 | category=Communication 8 | url=https://github.com/i-n-g-o/esp-mqtt-arduino 9 | architectures=esp8266 -------------------------------------------------------------------------------- /libraries/esp-mqtt/src/mqtt/debug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * debug.h 3 | * 4 | * Created on: Dec 4, 2014 5 | * Author: Minh 6 | */ 7 | 8 | #ifndef USER_DEBUG_H_ 9 | #define USER_DEBUG_H_ 10 | 11 | //#define MQTT_INFO( format, ... ) printf( format, ## __VA_ARGS__ ) 12 | #if defined(MQTT_DEBUG_ON) 13 | #define MQTT_INFO( format, ... ) os_printf( format, ## __VA_ARGS__ ) 14 | #else 15 | #define MQTT_INFO( format, ... ) 16 | #endif 17 | 18 | 19 | #endif /* USER_DEBUG_H_ */ 20 | -------------------------------------------------------------------------------- /libraries/esp-mqtt/src/mqtt/mqtt_config.h: -------------------------------------------------------------------------------- 1 | #ifndef __MQTT_CONFIG_H__ 2 | #define __MQTT_CONFIG_H__ 3 | 4 | //#define MQTT_SSL_ENABLE 5 | 6 | /*DEFAULT CONFIGURATIONS*/ 7 | 8 | #define MQTT_BUF_SIZE 1024 9 | #define MQTT_KEEPALIVE 120 /*second*/ 10 | 11 | #define MQTT_RECONNECT_TIMEOUT 5 /*second*/ 12 | 13 | #define QUEUE_BUFFER_SIZE 2048 14 | 15 | #define PROTOCOL_NAMEv31 /*MQTT version 3.1 compatible with Mosquitto v0.15*/ 16 | //PROTOCOL_NAMEv311 /*MQTT version 3.11 compatible with https://eclipse.org/paho/clients/testing/*/ 17 | 18 | #endif // __MQTT_CONFIG_H__ -------------------------------------------------------------------------------- /libraries/esp-mqtt/src/mqtt/proto.c: -------------------------------------------------------------------------------- 1 | #include "proto.h" 2 | #include "ringbuf.h" 3 | I8 ICACHE_FLASH_ATTR PROTO_Init(PROTO_PARSER *parser, PROTO_PARSE_CALLBACK *completeCallback, U8 *buf, U16 bufSize) 4 | { 5 | parser->buf = buf; 6 | parser->bufSize = bufSize; 7 | parser->dataLen = 0; 8 | parser->callback = completeCallback; 9 | parser->isEsc = 0; 10 | return 0; 11 | } 12 | 13 | I8 ICACHE_FLASH_ATTR PROTO_ParseByte(PROTO_PARSER *parser, U8 value) 14 | { 15 | switch (value) { 16 | case 0x7D: 17 | parser->isEsc = 1; 18 | break; 19 | 20 | case 0x7E: 21 | parser->dataLen = 0; 22 | parser->isEsc = 0; 23 | parser->isBegin = 1; 24 | break; 25 | 26 | case 0x7F: 27 | if (parser->callback != NULL) 28 | parser->callback(); 29 | parser->isBegin = 0; 30 | return 0; 31 | break; 32 | 33 | default: 34 | if (parser->isBegin == 0) break; 35 | 36 | if (parser->isEsc) { 37 | value ^= 0x20; 38 | parser->isEsc = 0; 39 | } 40 | 41 | if (parser->dataLen < parser->bufSize) 42 | parser->buf[parser->dataLen++] = value; 43 | 44 | break; 45 | } 46 | return -1; 47 | } 48 | 49 | I8 ICACHE_FLASH_ATTR PROTO_Parse(PROTO_PARSER *parser, U8 *buf, U16 len) 50 | { 51 | while (len--) 52 | PROTO_ParseByte(parser, *buf++); 53 | 54 | return 0; 55 | } 56 | I16 ICACHE_FLASH_ATTR PROTO_ParseRb(RINGBUF* rb, U8 *bufOut, U16* len, U16 maxBufLen) 57 | { 58 | U8 c; 59 | 60 | PROTO_PARSER proto; 61 | PROTO_Init(&proto, NULL, bufOut, maxBufLen); 62 | while (RINGBUF_Get(rb, &c) == 0) { 63 | if (PROTO_ParseByte(&proto, c) == 0) { 64 | *len = proto.dataLen; 65 | return 0; 66 | } 67 | } 68 | return -1; 69 | } 70 | I16 ICACHE_FLASH_ATTR PROTO_Add(U8 *buf, const U8 *packet, I16 bufSize) 71 | { 72 | U16 i = 2; 73 | U16 len = *(U16*) packet; 74 | 75 | if (bufSize < 1) return -1; 76 | 77 | *buf++ = 0x7E; 78 | bufSize--; 79 | 80 | while (len--) { 81 | switch (*packet) { 82 | case 0x7D: 83 | case 0x7E: 84 | case 0x7F: 85 | if (bufSize < 2) return -1; 86 | *buf++ = 0x7D; 87 | *buf++ = *packet++ ^ 0x20; 88 | i += 2; 89 | bufSize -= 2; 90 | break; 91 | default: 92 | if (bufSize < 1) return -1; 93 | *buf++ = *packet++; 94 | i++; 95 | bufSize--; 96 | break; 97 | } 98 | } 99 | 100 | if (bufSize < 1) return -1; 101 | *buf++ = 0x7F; 102 | 103 | return i; 104 | } 105 | 106 | I16 ICACHE_FLASH_ATTR PROTO_AddRb(RINGBUF *rb, const U8 *packet, I16 len) 107 | { 108 | U16 i = 2; 109 | if (RINGBUF_Put(rb, 0x7E) == -1) return -1; 110 | while (len--) { 111 | switch (*packet) { 112 | case 0x7D: 113 | case 0x7E: 114 | case 0x7F: 115 | if (RINGBUF_Put(rb, 0x7D) == -1) return -1; 116 | if (RINGBUF_Put(rb, *packet++ ^ 0x20) == -1) return -1; 117 | i += 2; 118 | break; 119 | default: 120 | if (RINGBUF_Put(rb, *packet++) == -1) return -1; 121 | i++; 122 | break; 123 | } 124 | } 125 | if (RINGBUF_Put(rb, 0x7F) == -1) return -1; 126 | 127 | return i; 128 | } 129 | 130 | -------------------------------------------------------------------------------- /libraries/esp-mqtt/src/mqtt/proto.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: proto.h 3 | * Author: ThuHien 4 | * 5 | * Created on November 23, 2012, 8:57 AM 6 | */ 7 | 8 | #ifndef _PROTO_H_ 9 | #define _PROTO_H_ 10 | #include 11 | #include "typedef.h" 12 | #include "ringbuf.h" 13 | 14 | typedef void(PROTO_PARSE_CALLBACK)(); 15 | 16 | typedef struct { 17 | U8 *buf; 18 | U16 bufSize; 19 | U16 dataLen; 20 | U8 isEsc; 21 | U8 isBegin; 22 | PROTO_PARSE_CALLBACK* callback; 23 | } PROTO_PARSER; 24 | 25 | I8 ICACHE_FLASH_ATTR PROTO_Init(PROTO_PARSER *parser, PROTO_PARSE_CALLBACK *completeCallback, U8 *buf, U16 bufSize); 26 | I8 ICACHE_FLASH_ATTR PROTO_Parse(PROTO_PARSER *parser, U8 *buf, U16 len); 27 | I16 ICACHE_FLASH_ATTR PROTO_Add(U8 *buf, const U8 *packet, I16 bufSize); 28 | I16 ICACHE_FLASH_ATTR PROTO_AddRb(RINGBUF *rb, const U8 *packet, I16 len); 29 | I8 ICACHE_FLASH_ATTR PROTO_ParseByte(PROTO_PARSER *parser, U8 value); 30 | I16 ICACHE_FLASH_ATTR PROTO_ParseRb(RINGBUF *rb, U8 *bufOut, U16* len, U16 maxBufLen); 31 | #endif 32 | 33 | -------------------------------------------------------------------------------- /libraries/esp-mqtt/src/mqtt/queue.c: -------------------------------------------------------------------------------- 1 | /* str_queue.c 2 | * 3 | * Copyright (c) 2014-2015, Tuan PM 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * * Neither the name of Redis nor the names of its contributors may be used 15 | * to endorse or promote products derived from this software without 16 | * specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | #include "queue.h" 31 | 32 | #include "user_interface.h" 33 | #include "osapi.h" 34 | #include "os_type.h" 35 | #include "mem.h" 36 | #include "proto.h" 37 | 38 | uint8_t *last_rb_p_r; 39 | uint8_t *last_rb_p_w; 40 | uint32_t last_fill_cnt; 41 | 42 | void ICACHE_FLASH_ATTR QUEUE_Init(QUEUE *queue, int bufferSize) 43 | { 44 | queue->buf = (uint8_t*)os_zalloc(bufferSize); 45 | RINGBUF_Init(&queue->rb, queue->buf, bufferSize); 46 | } 47 | int32_t ICACHE_FLASH_ATTR QUEUE_Puts(QUEUE *queue, uint8_t* buffer, uint16_t len) 48 | { 49 | uint32_t ret; 50 | 51 | last_rb_p_r = queue->rb.p_r; 52 | last_rb_p_w = queue->rb.p_w; 53 | last_fill_cnt = queue->rb.fill_cnt; 54 | 55 | ret = PROTO_AddRb(&queue->rb, buffer, len); 56 | if (ret == -1) { 57 | // rolling ring buffer back 58 | queue->rb.p_r = last_rb_p_r; 59 | queue->rb.p_w = last_rb_p_w; 60 | queue->rb.fill_cnt = last_fill_cnt; 61 | } 62 | return ret; 63 | } 64 | int32_t ICACHE_FLASH_ATTR QUEUE_Gets(QUEUE *queue, uint8_t* buffer, uint16_t* len, uint16_t maxLen) 65 | { 66 | 67 | return PROTO_ParseRb(&queue->rb, buffer, len, maxLen); 68 | } 69 | 70 | BOOL ICACHE_FLASH_ATTR QUEUE_IsEmpty(QUEUE *queue) 71 | { 72 | if (queue->rb.fill_cnt <= 0) 73 | return TRUE; 74 | return FALSE; 75 | } 76 | -------------------------------------------------------------------------------- /libraries/esp-mqtt/src/mqtt/queue.h: -------------------------------------------------------------------------------- 1 | /* str_queue.h -- 2 | * 3 | * Copyright (c) 2014-2015, Tuan PM 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * * Neither the name of Redis nor the names of its contributors may be used 15 | * to endorse or promote products derived from this software without 16 | * specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef USER_QUEUE_H_ 32 | #define USER_QUEUE_H_ 33 | #include "os_type.h" 34 | #include "ringbuf.h" 35 | typedef struct { 36 | uint8_t *buf; 37 | RINGBUF rb; 38 | } QUEUE; 39 | 40 | void ICACHE_FLASH_ATTR QUEUE_Init(QUEUE *queue, int bufferSize); 41 | int32_t ICACHE_FLASH_ATTR QUEUE_Puts(QUEUE *queue, uint8_t* buffer, uint16_t len); 42 | int32_t ICACHE_FLASH_ATTR QUEUE_Gets(QUEUE *queue, uint8_t* buffer, uint16_t* len, uint16_t maxLen); 43 | bool ICACHE_FLASH_ATTR QUEUE_IsEmpty(QUEUE *queue); 44 | #endif /* USER_QUEUE_H_ */ 45 | -------------------------------------------------------------------------------- /libraries/esp-mqtt/src/mqtt/ringbuf.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * Ring Buffer library 4 | */ 5 | 6 | #include "ringbuf.h" 7 | 8 | 9 | /** 10 | * \brief init a RINGBUF object 11 | * \param r pointer to a RINGBUF object 12 | * \param buf pointer to a byte array 13 | * \param size size of buf 14 | * \return 0 if successfull, otherwise failed 15 | */ 16 | I16 ICACHE_FLASH_ATTR RINGBUF_Init(RINGBUF *r, U8* buf, I32 size) 17 | { 18 | if (r == NULL || buf == NULL || size < 2) return -1; 19 | 20 | r->p_o = r->p_r = r->p_w = buf; 21 | r->fill_cnt = 0; 22 | r->size = size; 23 | 24 | return 0; 25 | } 26 | /** 27 | * \brief put a character into ring buffer 28 | * \param r pointer to a ringbuf object 29 | * \param c character to be put 30 | * \return 0 if successfull, otherwise failed 31 | */ 32 | I16 ICACHE_FLASH_ATTR RINGBUF_Put(RINGBUF *r, U8 c) 33 | { 34 | if (r->fill_cnt >= r->size)return -1; // ring buffer is full, this should be atomic operation 35 | 36 | 37 | r->fill_cnt++; // increase filled slots count, this should be atomic operation 38 | 39 | 40 | *r->p_w++ = c; // put character into buffer 41 | 42 | if (r->p_w >= r->p_o + r->size) // rollback if write pointer go pass 43 | r->p_w = r->p_o; // the physical boundary 44 | 45 | return 0; 46 | } 47 | /** 48 | * \brief get a character from ring buffer 49 | * \param r pointer to a ringbuf object 50 | * \param c read character 51 | * \return 0 if successfull, otherwise failed 52 | */ 53 | I16 ICACHE_FLASH_ATTR RINGBUF_Get(RINGBUF *r, U8* c) 54 | { 55 | if (r->fill_cnt <= 0)return -1; // ring buffer is empty, this should be atomic operation 56 | 57 | 58 | r->fill_cnt--; // decrease filled slots count 59 | 60 | 61 | *c = *r->p_r++; // get the character out 62 | 63 | if (r->p_r >= r->p_o + r->size) // rollback if write pointer go pass 64 | r->p_r = r->p_o; // the physical boundary 65 | 66 | return 0; 67 | } 68 | -------------------------------------------------------------------------------- /libraries/esp-mqtt/src/mqtt/ringbuf.h: -------------------------------------------------------------------------------- 1 | #ifndef _RING_BUF_H_ 2 | #define _RING_BUF_H_ 3 | 4 | #include 5 | #include 6 | #include "typedef.h" 7 | 8 | typedef struct { 9 | U8* p_o; /**< Original pointer */ 10 | U8* volatile p_r; /**< Read pointer */ 11 | U8* volatile p_w; /**< Write pointer */ 12 | volatile I32 fill_cnt; /**< Number of filled slots */ 13 | I32 size; /**< Buffer size */ 14 | } RINGBUF; 15 | 16 | I16 ICACHE_FLASH_ATTR RINGBUF_Init(RINGBUF *r, U8* buf, I32 size); 17 | I16 ICACHE_FLASH_ATTR RINGBUF_Put(RINGBUF *r, U8 c); 18 | I16 ICACHE_FLASH_ATTR RINGBUF_Get(RINGBUF *r, U8* c); 19 | #endif 20 | -------------------------------------------------------------------------------- /libraries/esp-mqtt/src/mqtt/typedef.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * Standard Types definition 4 | */ 5 | 6 | #ifndef _TYPE_DEF_H_ 7 | #define _TYPE_DEF_H_ 8 | 9 | typedef char I8; 10 | typedef unsigned char U8; 11 | typedef short I16; 12 | typedef unsigned short U16; 13 | typedef long I32; 14 | typedef unsigned long U32; 15 | typedef unsigned long long U64; 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /libraries/esp-mqtt/src/mqtt/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef _UTILS_H_ 2 | #define _UTILS_H_ 3 | 4 | #include "c_types.h" 5 | 6 | uint32_t ICACHE_FLASH_ATTR UTILS_Atoh(const int8_t *s); 7 | uint8_t ICACHE_FLASH_ATTR UTILS_StrToIP(const int8_t* str, void *ip); 8 | uint8_t ICACHE_FLASH_ATTR UTILS_IsIPV4 (int8_t *str); 9 | #endif 10 | --------------------------------------------------------------------------------