• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

4dsystems/ViSi-Genie-Arduino-Library: ViSi-Genie - Arduino Library

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

4dsystems/ViSi-Genie-Arduino-Library

开源软件地址(OpenSource Url):

https://github.com/4dsystems/ViSi-Genie-Arduino-Library

开源编程语言(OpenSource Language):

C++ 85.6%

开源软件介绍(OpenSource Introduction):

image

ViSi-Genie-Arduino-Library (A.K.A genieArduino)

Arduino Library for 4D Systems ViSi-Genie Environment

This library supports the following: Support for neagative numbers, unsigned longs, unsigned integers with the WriteStr function. Features enhanced String Writing capability, no longer is a character Array the only viable option. Support for Workshop4 PRO features. 2+ displays connected to a single Arduino, and adds a Demo to illustrate how that is achieved. New Internal and Inherent Widgets. Much more...

Information

This library provides high level functions for the Arduino, to ease communication with 4D Systems modules when using the module configured with ViSi-Genie. Workshop4 PRO adds additional features to ViSi-Genie, allowing the User to write 4DGL code which can be executed at will from ViSi-Genie, enabling many advanced features not previously possible. Please refer to the 4D Systems website, namingly the Workshop4 Product Page, for documentation regarding Workshop4, and its environments.

Installation

Library folder should be placed in the C:\Users(User name)\My Documents\Arduino\Libraries\ folder, or equivalent. (restart the IDE if already open).

PLEASE ensure that the old library (if installed) has been removed completely so it does not conflict.

For more information on the installation, please refer to [Installing Additional Arduino Libraries] (http://arduino.cc/en/Guide/Libraries)

Open the ViSi-Genie project using Workshop4 and download to your display, connect the display to Arduino, reset the Arduino and it should work.

This library should be discoverable from the Arduino IDE Library Manager too.

Example Sketch

Inside the library are 4 example sketches, to assist with getting started using this library. Inside is also a ViSi-Genie Workshop4 project, which can be used on a range of 4D Systems displays (designed on a uLCD-32PTU however can be changed via Workshop4 menu). It illustrates how to use some of the commands in the library include Read Object, Write Object, Reported Messages, Write Contrast and Write String.

Tested with

This library has been tested on the Duemilanove, Uno, Mega 1280, Mega 2560, Leonardo, Chipkit Max32, Due, Intel Galileo, Teensy and Yun (Software Serial only on Yun). Any problems discovered with this library, please contact technical support so fixes can be put in place, or seek support from our forum.

Compatible 4D Systems Display Modules

This library will work with all 4D Systems Modules which are capable of using the ViSi-Genie environment. This is therefore all Picaso, Pixxi-28, Pixxi-44 and Diablo16 Display Modules. The demo included with this library was made for the gen4-uLCD-32DCT-CLB (3.2" Capacitive Touch gen4 module) however can easily be adapted to other size displays.

General Library Discussion


This section serves to give brief discussion about the constructor and functions included in the library. For functional examples on how to use these functions in a project, refer to the examples folder.

Genie()

This is the constructor for the library. It creates a unique instance that can be set to use the desired serial port.

Genie genie; // Creates a new instance named 'genie'

Begin(Stream &serial)

Creates an instance of ViSi Genie by assigning a serial stream

Parameters Description
serial Stream object that represents the UART hardware
Serial.begin(115200); // Open Serial @115200. Can use other Serial UART's (Serial1, Serial2...) depending on your Arduino.
genie.Begin(Serial);  // Sets Serial/Serial0 to be used by the Genie instance 'genie'

WriteContrast(uint16_t value)

Sets the display contrast/brightness to a new value

Parameters Description
value New brightness/contrast value. The range of this value depends on the 4D display, Typically 0-15 Range
genie.WriteContrast(0); // Sets the contrast/brightness value to 0, effectively turning off the backlight
genie.WriteContrast(10); // Sets the contrast/brightness value to 10, about 2/3 max brightness

ReadObject(uint16_t object, uint16_t index)

Sends a request to read the value of the widget specified by object (ex: GENIE_OBJ_GAUGE) and index. The value will be sent as a GENIE_REPORT_OBJECT command. A full list of available objects (ex: GENIE_OBJ_GAUGE, GENIE_OBJ_SLIDER etc) can be found at the bottom of this Readme.

Parameters Description
object Type of target widget
index Index number of target widget
genie.ReadObject(GENIE_OBJ_GAUGE, 0); // Request a report of the widget Gauge0

WriteObject(uint16_t object, uint16_t index, uint16_t data)

Updates the widget, specified by object (ex: GENIE_OBJ_GAUGE) and index, to a new value specified by data A full list of available objects (ex: GENIE_OBJ_GAUGE, GENIE_OBJ_SLIDER etc) can be found at the bottom of this Readme.

Parameters Description
object Type of target widget
index Index number of target widget
data New value for the target widget
genie.WriteObject(GENIE_OBJ_GAUGE, 0, 50); // Sets Gauge0 to 50

WriteIntLedDigits(uint16_t index, int16_t data)

Updates the Internal LedDigits specified by index to a new 16-bit value, specified by data. The widget parameter Format in ViSi Genie project should be set to Int16. Internal LedDigits are availble for Diablo and Pixxi displays.

Parameters Description
index Index number of target Internal LedDigits
data New 16-bit integer value for the target Internal LedDigits
genie.WriteIntLedDigits(0, 50); // Sets ILedDigits0 to 50

WriteIntLedDigits(uint16_t index, float data)

Updates the Internal LedDigits specified by index to a new 32-bit float value, specified by data. The widget parameter Format in ViSi Genie project should be set to any Float option. Internal LedDigits are availble for Diablo and Pixxi displays.

Parameters Description
index Index number of target Internal LedDigits
data New 32-bit float value for the target Internal LedDigits
genie.WriteIntLedDigits(0, 3.1416f); // Sets ILedDigits0 to 3.1416

WriteIntLedDigits(uint16_t index, int32_t data)

Updates the Internal LedDigits specified by index to a new 32-bit integer value, specified by data. The widget parameter Format in ViSi Genie project should be set to Int16. Internal LedDigits are availble for Diablo and Pixxi displays.

Parameters Description
index Index number of target Internal LedDigits
data New 32-bit integer value for the target Internal LedDigits
genie.WriteIntLedDigits(0, 1000000L); // Sets ILedDigits0 to 1000000

WriteStr(uint16_t index, char * string)

Updates the String widget specified by index with a new character string specified by string

Parameters Description
index Index number of target String
string Character pointer containing the text to print in the String widget
genie.WriteStr(0, "Sample String"); // Set text in String0 to "Sample String"

WriteStr(uint16_t index, const __FlashStringHelper *ifsh)

Updates the String widget specified by index with a string stored in program space (flash memory) specified by ifsh. This is only available for AVR boards.

Parameters Description
index Index number of target String
ifsh Flash string containing the text to print in the String widget
// Writes the string stored in flash memory to String1
genie.WriteStr(1, F("Hello from Flash Memory")); // For AVR Arduinos only

WriteStr(uint16_t index, const String &s)

Updates the String widget specified by index with a String widget specified by s

Parameters Description
index Index number of target String
s String object containing the text to print in the String widget
String str = "This is string class";
genie.WriteStr(0, Str); // Writes the String class 'str' to String0

WriteStrU(uint16_t index, uint16_t * string)

Updates the String widget specified by index with a new Unicode (16-bit) character string specified by string

Parameters Description
index Index number of target String
string Character pointer containing the text to print in the String widget
uint16_t * unistr = {0x0034, 0x0044, 0x0020, 0x30B7, 0x30B9, 0x30C6, 0x30E0, 0x30BA, 0};
genie.WriteStr(2, unistr); // Writes the Unicode string "4D システムズ" to String2

WriteStr(uint16_t index, int n)

Updates the String widget specified by index with a new integer value n with base 10

Parameters Description
index Index number of target String
n Signed short integer value that will be formatted with base 10 to a string and will be printed in the String widget
genie.WriteStr(0, 10000); // Writes the value 10000 to String0

WriteStr(uint16_t index, int n, int base)

Updates the String widget specified by index with a new integer value n with base specified by base

Parameters Description
index Index number of target String
n Signed short integer value that will be formatted to a string and will be printed in the String widget
base Custom base to used when formatting the value to a string
genie.WriteStr(4, 10000, 16); // Writes the value 10000 to String4 in hexadecimal

WriteStr(uint16_t index, unsigned int n)

Updates the String widget specified by index with a new unsigned integer value n with base 10

Parameters Description
index Index number of target String
n Unsigned short integer value that will be formatted with base 10 to a string and will be printed in the String widget
unsigned int value = 40000;
genie.WriteStr(2, value); // Writes the value 40000 to String2

WriteStr(uint16_t index, unsigned int n, int base)

Updates the String widget specified by index with a new unsigned integer value n with base specified by base

Parameters Description
index Index number of target String
n Unsigned short integer value that will be formatted to a string and will be printed in the String widget
base Custom base to used when formatting the value to a string
unsigned int value = 40000;
genie.WriteStr(1, value, 16); // Writes the value 40000 to String1 in hexadecimal

WriteStr(uint16_t index, long n)

Updates the String widget specified by index with a new long value n with base 10

Parameters Description
index Index number of target String
n Signed long integer value that will be formatted with base 10 to a string and will be printed in the String widget
genie.WriteStr(2, 100000L); // Writes the value 100000 to String2

WriteStr(uint16_t index, long n, int base)

Updates the String widget specified by index with a new long value n with base specified by base

Parameters Description
index Index number of target String
n Signed long integer value that will be formatted to a string and will be printed in the String widget
base Custom base to used when formatting the value to a string
genie.WriteStr(3, 100000L, 8); // Writes the value 100000 to String3 in octal

WriteStr(uint16_t index, unsigned long n)

Updates the String widget specified by index with a new unsigned long value n with base 10

Parameters Description
index Index number of target String
n Unsigned long integer value that will be formatted with base 10 to a string and will be printed in the String widget
genie.WriteStr(0, 3000000000UL); // Writes the value 3000000000 to String0

WriteStr(uint16_t index, unsigned long n, int base)

Updates the String widget specified by index with a new unsigned long value n with base specified by base

Parameters Description
index Index number of target String
n Unsigned long integer value that will be formatted to a string and will be printed in the String widget
base Custom base to used when formatting the value to a string
genie.WriteStr(1, 3000000000UL, 16); // Writes the value 3000000000 to String1 in hexadecimal

WriteStr(uint16_t index, double n)

Updates the String widget specified by index with a new 64-bit float value n with 2 decimal digits

Parameters Description
index Index number of target String
n Signed 64-bit float value that will be formatted to a string with 2 decimal places (default) and will be printed in the String widget
double value = 175.3456;
genie.WriteStr(0, value); // Writes the 64-bit float value 175.3456 to String0
                          // with 2 decimal places (175.34)

WriteStr(uint16_t index, double n, digits)

Updates the String widget specified by index with a new 64-bit float value n with the number of decimal digits as specified by digits

Parameters Description
index Index number of target String
n Signed 64-bit float value that will be formatted to a string and will be printed in the String widget
digits Number of decimal places to format the value with
double value = 175.3456;
genie.WriteStr(0, value, 4); // Writes the 64-bit float value 175.3456 to String0
							 // with 4 decimal places (175.3456)

WriteInhLabel(uint16_t index)

Updates the Inherent Label widget specified by index with the default contents defined in Workshop4

Parameters Description
index Index number of target Inherent Label
genie.WriteInhLabel(1); // Set text in ILabelB1 to default String

WriteInhLabel(uint16_t index, char * string)

Updates the Inherent Label widget specified by index with a new character string specified by string

Parameters Description
index Index number of target Inherent Label
string Character pointer containing the text to print in the Inherent Label widget
genie.WriteInhLabel(0, "Sample String"); // Set text in ILabelB0 to "Sample String"

WriteInhLabel(uint16_t index, const __FlashStringHelper *ifsh)

Updates the Inherent Label widget specified by index with a string stored in program space (flash memory) specified by ifsh. This is only available for AVR boards.

Parameters Description
index Index number of target Inherent Label
ifsh Flash string containing the text to print in the Inherent Label widget
// Writes the string stored in flash memory to ILabelB1
genie.WriteInhLabel(1, F("Hello from Flash Memory")); // For AVR Arduinos only

WriteInhLabel(uint16_t index, const String &s)

Updates the Inherent Label widget specified by index with a Inherent Label widget specified by s

Parameters Description
index Index number of target Inherent Label
s String object containing the text to print in the Inherent Label widget
String str = "This is string class";
genie.WriteInhLabel(0, Str); // Writes the String class 'str' to ILabelB0

WriteInhLabel(uint16_t index, int n)

Updates the Inherent Label widget specified by index with a new integer value n with base 10

Parameters Description
index Index number of target Inherent Label
n Signed short integer value that will be formatted with base 10 to a string and will be printed in the Inherent Label widget
genie.WriteInhLabel(0, 10000); // Writes the value 10000 to ILabelB0

WriteInhLabel(uint16_t index, int n, int base)

Updates the Inherent Label widget specified by index with a new integer value n with base specified by base

Parameters Description
index Index number of target Inherent Label
n Signed short integer value that will be formatted to a string and will be printed in the Inherent Label widget
base Custom base to used when formatting the value to a string
// Writes the value 10000 to ILabelB4 in hexadecimal
genie.WriteInhLabel(4, 10000, 16); 

WriteInhLabel(uint16_t index, unsigned int n)

Updates the Inherent Label widget specified by index with a new unsigned integer value n with base 10

Parameters Description
index Index number of target Inherent Label
n Unsigned short integer value that will be formatted with base 10 to a string and will be printed in the Inherent Label widget
unsigned int value = 40000;
genie.WriteInhLabel(2, value); // Writes the value 40000 to ILabelB2

WriteInhLabel(uint16_t index, unsigned int n, int base)

Updates the Inherent Label widget specified by index with a new unsigned integer value n with base specified by base

Parameters Description
index Index number of target Inherent Label
n Unsigned short integer value that will be formatted to a string and will be printed in the Inherent Label widget
base Custom base to used when formatting the value to a string
unsigned int value = 40000;
// Writes the value 40000 to ILabelB1 in hexadecimal
genie.WriteInhLabel(1, value, 16); 

WriteInhLabel(uint16_t index, long n)

Updates the Inherent Label widget specified by index with a new long value n with base 10

Parameters Description
index Index number of target Inherent Label
n Signed long integer value that will be formatted with base 10 to a string and will be printed in the Inherent Label widget
genie.WriteInhLabel(2, 100000L); // Writes the value 100000 to ILabelB2

WriteInhLabel(uint16_t index, long n, int base)

Updates the Inherent Label widget specified by index with a new long value n with base specified by base

Parameters Description
index Index number of target Inherent Label
n Signed long integer value that will be formatted to a string and will be printed in the Inherent Label widget
base Custom base to used when formatting the value to a string
// Writes the value 100000 to ILabelB3 in octal
genie.WriteInhLabel(3, 100000L, 8); 

WriteInhLabel(uint16_t index, unsigned long n)

Updates the Inherent Label widget specified by index with a new unsigned long value n with base 10

Parameters Description
index Index number of target Inherent Label
n Unsigned long integer value that will be formatted with base 10 to a string and will be printed in the Inherent Label widget
genie.WriteInhLabel(0, 3000000000UL); // Writes the value 3000000000 to ILabelB0

WriteInhLabel(uint16_t index, unsigned long n, int base)

Updates the Inherent Label widget specified by index with a new unsigned long value n with base specified by base

Parameters Description
index Index number of target Inherent Label
n Unsigned long integer value that will be formatted to a string and will be printed in the Inherent Label widget
base Custom base to used when formatting the value to a string
// Writes the value 3000000000 to ILabelB1 in hexadecimal
genie.WriteInhLabel(1, 3000000000UL, 16); 

WriteInhLabel(uint16_t index, double n)

Updates the Inherent Label widget specified by index with a new 64-bit float value n with 2 decimal digits

Parameters Description
index Index number of target Inherent Label
n Signed 64-bit float value that will be formatted to a string with 2 decimal places and will be printed in the Inherent Label widget
double value = 175.3456;
// Writes the 64-bit float value 175.3456 to ILabelB0
genie.WriteInhLabel(0, value); // with 2 decimal places (175.34)

热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap