Skip to content

Commit

Permalink
v1.3 Updates
Browse files Browse the repository at this point in the history
Added new functions and object ID's to support the new Internal/Inherent widgets which are part of Workshop4.
  • Loading branch information
4D Systems committed Jul 21, 2020
1 parent 74e1399 commit a4d0db9
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 8 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ Library for the Raspberry Pi to allow easy communication between 4D Intelligent

This library is also required for the Raspberry Pi demo programs.

## Genie Pi version 1.3
=======================================================
* Added the following function:

genieWriteShortToIntLedDigits (int index, int16_t data)
genieWriteLongToIntLedDigits (int index, int32_t data)
genieWriteFloatToIntLedDigits (int index, float data)

* Added numerous new objects to support Internal/Inherent Widgets in Workshop4

## Genie Pi version 1.2
=======================================================
* Added the following function:
Expand Down
27 changes: 25 additions & 2 deletions geniePi.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
* on most Linux platforms with a serial connection (USB on
* on-board) to the 4D Systems Intelligent displays.
*
* Gordon Henderson, December 2012, <[email protected]>
* Copyright (c) 2012 4D Systems PTY Ltd, Sydney, Australia
* Written by Gordon Henderson, December 2012, <[email protected]>
* Updated/Maintained by 4D Systems Pty Ltd, www.4dsystems.com.au
* Copyright (c) 2020 4D Systems PTY Ltd, Sydney, Australia
***********************************************************************
* This file is part of geniePi:
* geniePi is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -504,6 +505,7 @@ static int _genieWriteObj (int object, int index, unsigned int data)

return 0 ;
}

int genieWriteObj (int object, int index, unsigned int data)
{
int result ;
Expand All @@ -515,6 +517,27 @@ int genieWriteObj (int object, int index, unsigned int data)
return result ;
}

int genieWriteShortToIntLedDigits (int index, int16_t data) {
return genieWriteObj(GENIE_OBJ_ILED_DIGITS_L, index, data);
}

int genieWriteFloatToIntLedDigits (int index, float data) {
FloatLongFrame frame;
frame.floatValue = data;
int retval;
retval = genieWriteObj(GENIE_OBJ_ILED_DIGITS_H, index, frame.wordValue[1]);
if (retval != 1) return retval;
return genieWriteObj(GENIE_OBJ_ILED_DIGITS_L, index, frame.wordValue[0]);
}

int genieWriteLongToIntLedDigits (uint16_t index, int32_t data) {
FloatLongFrame frame;
frame.longValue = data;
int retval;
retval = genieWriteObj(GENIE_OBJ_ILED_DIGITS_H, index, frame.wordValue[1]);
if (retval != 1) return retval;
return genieWriteObj(GENIE_OBJ_ILED_DIGITS_L, index, frame.wordValue[0]);
}

/*
* genieWriteContrast:
Expand Down
57 changes: 51 additions & 6 deletions geniePi.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
* on most Linux platforms with a serial connection (USB on
* on-board) to the 4D Systems Intelligent displays.
*
* Gordon Henderson, December 2012, <[email protected]>
* Copyright (c) 2012 4D Systems PTY Ltd, Sydney, Australia
* Written by Gordon Henderson, December 2012, <[email protected]>
* Updated/Maintained by 4D Systems Pty Ltd, www.4dsystems.com.au
* Copyright (c) 2020 4D Systems PTY Ltd, Sydney, Australia
***********************************************************************
* This file is part of geniePi:
* geniePi is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -86,10 +87,45 @@
#define GENIE_OBJ_COLORPICKER 32
#define GENIE_OBJ_USERBUTTON 33
// reserved for magic functions 34
#define GENIE_OBJ_ISMARTGAUGE 35
#define GENIE_OBJ_ISMARTSLIDER 36
#define GENIE_OBJ_ISMARTKNOB 37

#define GENIE_OBJ_SMARTGAUGE 35
#define GENIE_OBJ_SMARTSLIDER 36
#define GENIE_OBJ_SMARTKNOB 37
// Not advisable to use the below 3, use the above 3 instead.
#define GENIE_OBJ_ISMARTGAUGE 35 // Retained for backwards compatibility, however Users should use SMARTGAUGE instead of ISMARTGAUGE
#define GENIE_OBJ_ISMARTSLIDER 36 // Retained for backwards compatibility, however Users should use SMARTSLIDER instead of ISMARTSLIDER
#define GENIE_OBJ_ISMARTKNOB 37 // Retained for backwards compatibility, however Users should use SMARTKNOB instead of ISMARTKNOB
// Comment end
#define GENIE_OBJ_ILED_DIGITS_H 38
#define GENIE_OBJ_IANGULAR_METER 39
#define GENIE_OBJ_IGAUGE 40
#define GENIE_OBJ_ILABEL 41
#define GENIE_OBJ_IUSER_GAUGE 42
#define GENIE_OBJ_IMEDIA_GAUGE 43
#define GENIE_OBJ_IMEDIA_THERMOMETER 44
#define GENIE_OBJ_ILED 45
#define GENIE_OBJ_IMEDIA_LED 46
#define GENIE_OBJ_ILED_DIGITS_L 47
#define GENIE_OBJ_ILED_DIGITS 47
#define GENIE_OBJ_INEEDLE 48
#define GENIE_OBJ_IRULER 49
#define GENIE_OBJ_ILED_DIGIT 50
#define GENIE_OBJ_IBUTTOND 51
#define GENIE_OBJ_IBUTTONE 52
#define GENIE_OBJ_IMEDIA_BUTTON 53
#define GENIE_OBJ_ITOGGLE_INPUT 54
#define GENIE_OBJ_IDIAL 55
#define GENIE_OBJ_IMEDIA_ROTARY 56
#define GENIE_OBJ_IROTARY_INPUT 57
#define GENIE_OBJ_ISWITCH 58
#define GENIE_OBJ_ISWITCHB 59
#define GENIE_OBJ_ISLIDERE 60
#define GENIE_OBJ_IMEDIA_SLIDER 61
#define GENIE_OBJ_ISLIDERH 62
#define GENIE_OBJ_ISLIDERG 63
#define GENIE_OBJ_ISLIDERF 64
#define GENIE_OBJ_ISLIDERD 65
#define GENIE_OBJ_ISLIDERC 66
#define GENIE_OBJ_ILINEAR_INPUT 67

// Structure to store replys returned from a display

Expand All @@ -111,6 +147,12 @@ struct genieMagicReplyStruct
unsigned int data[100] ;
} ;

union FloatLongFrame {
float floatValue;
int32_t longValue;
uint32_t ulongValue;
int16_t wordValue[2];
};

// Globals (for debugging, mostly)

Expand All @@ -135,6 +177,9 @@ extern void genieGetReply (struct genieReplyStruct *reply) ;

extern int genieReadObj (int object, int index) ;
extern int genieWriteObj (int object, int index, unsigned int data) ;
extern int genieWriteShortToIntLedDigits (int index, int16_t data);
extern int genieWriteLongToIntLedDigits (int index, int32_t data);
extern int genieWriteFloatToIntLedDigits (int index, float data);
extern int genieWriteContrast (int value) ;
extern int genieWriteStr (int index, char *string) ;

Expand Down

0 comments on commit a4d0db9

Please sign in to comment.