![]() |
These calls are specific to the Phidget IR object. See your device's User Guide for more specific API details, technical information, and revision details. The User Guide, along with other resources, can be found on the product page for your device.
#define IR_DATA_ARRAY_MASK 0x7ff |
Definition at line 140 of file cphidgetir.h.
#define IR_DATA_ARRAY_SIZE 2048 |
Definition at line 139 of file cphidgetir.h.
#define IR_DEFINEDATA_PACKET 0 |
Definition at line 149 of file cphidgetir.h.
#define IR_MAX_CODE_BIT_COUNT 128 |
Maximum bit count for sent / received data
Definition at line 15 of file cphidgetir.h.
#define IR_MAX_CODE_DATA_LENGTH (IR_MAX_CODE_BIT_COUNT / 8) |
Maximum array size needed to hold the longest code
Definition at line 16 of file cphidgetir.h.
#define IR_MAX_DATA_PER_PACKET 31 |
Definition at line 137 of file cphidgetir.h.
#define IR_MAX_DATA_us 327670 |
Definition at line 143 of file cphidgetir.h.
#define IR_MAX_GAP_LENGTH 100000 |
Definition at line 146 of file cphidgetir.h.
#define IR_MAX_REPEAT_LENGTH 26 |
Maximum array size for a repeat code
Definition at line 17 of file cphidgetir.h.
#define IR_MIN_GAP_LENGTH 20000 |
Definition at line 147 of file cphidgetir.h.
#define IR_RAW_DATA_WS_KEYS_MAX 100 |
Definition at line 153 of file cphidgetir.h.
#define IR_STOP_RX_WHILE_TX_FLAG 0x01 |
Definition at line 151 of file cphidgetir.h.
typedef struct _CPhidgetIR_CodeInfo CPhidgetIR_CodeInfo |
The PhidgetIR CodeInfo structure contains all information needed to transmit a code, apart from the actual code data. Some values can be set to null to select defaults. See the product manual for more information.
typedef struct _CPhidgetIR_CodeInfo * CPhidgetIR_CodeInfoHandle |
enum CPhidgetIR_Encoding |
The PhidgetIR supports these data encodings.
Definition at line 22 of file cphidgetir.h.
enum CPhidgetIR_Length |
The PhidgetIR supports these encoding lengths
Definition at line 34 of file cphidgetir.h.
PHIDGET21_API int CCONV codeInfoToString | ( | CPhidgetIR_CodeInfoHandle | codeInfo, |
char * | string | ||
) |
Set a Code handler. This is called when a code has been received that could be automatically decoded. Data is return as an array with MSB in index 0. Bit count and a repeat flag are also returned. Repeats are detected as either the same code repeated in < 100ms or as a special repeat code.
phid | An attached phidget ir handle. |
fptr | Callback function pointer. |
userPtr | A pointer for use by the user - this value is passed back into the callback function. Set a Learn handler. This is called when a code has been received for long enough to be learned. The returned CodeInfo structure can be used to retransmit the same code. |
phid | An attached phidget ir handle. |
fptr | Callback function pointer. |
userPtr | A pointer for use by the user - this value is passed back into the callback function. Set a Raw Data handler. This is called when raw data has been read from the device. Raw data always starts with a space and ends with a pulse. |
phid | An attached phidget ir handle. |
fptr | Callback function pointer. |
userPtr | A pointer for use by the user - this value is passed back into the callback function. |
Definition at line 1470 of file cphidgetir.c.
PHIDGET21_API int CCONV CPhidgetIR_getLastCode | ( | CPhidgetIRHandle | phid, |
unsigned char * | data, | ||
int * | dataLength, | ||
int * | bitCount | ||
) |
Gets the last code that was received.
phid | An attached phidget ir handle. |
data | A user array to store the code data in. |
dataLength | Length of the user array - should be at least IR_MAX_CODE_DATA_LENGTH. This is set to the ammount of data actually written to the array. |
bitCount | set to the bit count of the code. |
Definition at line 1836 of file cphidgetir.c.
PHIDGET21_API int CCONV CPhidgetIR_getLastLearnedCode | ( | CPhidgetIRHandle | phid, |
unsigned char * | data, | ||
int * | dataLength, | ||
CPhidgetIR_CodeInfo * | codeInfo | ||
) |
Gets the last code that was learned.
phid | An attached phidget ir handle. |
data | A user array to store the code data in. |
dataLength | Length of the user array - should be at least IR_MAX_CODE_DATA_LENGTH. This is set to the ammount of data actually written to the array. |
codeInfo | The CodeInfo structure for the learned code. |
Definition at line 1864 of file cphidgetir.c.
PHIDGET21_API int CCONV CPhidgetIR_getRawData | ( | CPhidgetIRHandle | phid, |
int * | data, | ||
int * | dataLength | ||
) |
Read any available raw data. This should be polled continuously (every 20ms) to avoid missing data. Read data always starts with a space and ends with a pulse.
phid | An attached phidget ir handle. |
data | A user array for raw data to be written into. |
dataLength | The maximum ammount of data to read. This is set to the actual ammount of data read. |
Definition at line 1803 of file cphidgetir.c.
PHIDGET21_API int CCONV CPhidgetIR_Transmit | ( | CPhidgetIRHandle | phid, |
unsigned char * | data, | ||
CPhidgetIR_CodeInfoHandle | codeInfo | ||
) |
Transmits a code according to the settings in a CodeInto structure
phid | An attached phidget ir handle. |
data | The code to send. Data is transmitted MSBit first. MSByte is in array index 0. LSBit is right justified, so MSBit may be in bit positions 0-7 in array index 0 depending on the bit count. |
codeInfo | The CodeInfo structure specifying to to send the code. Anything left as null to select default is filled in for the user. |
Definition at line 1508 of file cphidgetir.c.
PHIDGET21_API int CCONV CPhidgetIR_TransmitRaw | ( | CPhidgetIRHandle | phid, |
int * | data, | ||
int | length, | ||
int | carrierFrequency, | ||
int | dutyCycle, | ||
int | gap | ||
) |
Transmits RAW data as a series of pulses and spaces.
phid | An attached phidget ir handle. |
data | The data to send. The array must start and end with a pulse and each element is a positive time in us. |
length | The length of the data array. Maximum length is 200, but streams should be kept much shorter, ie. < 100ms between gaps. |
carrierFrequency | The Carrier Frequency in Hz. leave as 0 for default. |
dutyCycle | The Duty Cycle (10-50). Leave as 0 for default. |
gap | The gap time in us. This guarantees a gap time (no transmitting) after the data is sent, but can be set to 0. |
Definition at line 1693 of file cphidgetir.c.
PHIDGET21_API int CCONV CPhidgetIR_TransmitRepeat | ( | CPhidgetIRHandle | phid | ) |
Transmits a repeat of the last transmited code. Depending of the CodeInfo structure, this may be a retransmission of the code itself, or there may be a special repeat code.
phid | An attached phidget ir handle. |
Definition at line 1743 of file cphidgetir.c.
PHIDGET21_API int CCONV stringToCodeInfo | ( | char * | string, |
CPhidgetIR_CodeInfoHandle | codeInfo | ||
) |
Definition at line 1481 of file cphidgetir.c.