Defines | Functions | Variables
cphidgetir.c File Reference
#include "stdafx.h"
#include "cphidgetir.h"
#include "cusb.h"
#include "csocket.h"
#include "cthread.h"
#include "utils/utils.h"
Include dependency graph for cphidgetir.c:

Go to the source code of this file.

Defines

#define ABS(x)   ((x) < 0 ? -(x) : (x))
#define COUNT_TIMES(highlow, index)
#define ORDER_TIMES(highlow, index)
#define pdiff(a, b)   ( ABS((a) - (b)) / (double)( ((a) + (b)) / 2.0 ) )
#define TIME_TO_PACKET(data, length, index, us)

Functions

static int analyze_data (CPhidgetIRHandle phid, int trailgap_needed)
static int codeInfoToRawData (unsigned char *code, CPhidgetIR_CodeInfo codeInfo, int *rawData, int *rawDataLength, int *time, unsigned char repeat)
PHIDGET21_API int CCONV codeInfoToString (CPhidgetIR_CodeInfoHandle codeInfo, char *string)
static int CCONV_CDECL compare_int (const void *arg1, const void *arg2)
static int compareDataArrays (int *data, int ptr1, int ptr2, int endptr1, int endptr2, double maxpdiff)
PHIDGET21_API int CCONV CPhidgetIR_getLastCode (CPhidgetIRHandle phid, unsigned char *data, int *dataLength, int *bitCount)
PHIDGET21_API int CCONV CPhidgetIR_getLastLearnedCode (CPhidgetIRHandle phid, unsigned char *data, int *dataLength, CPhidgetIR_CodeInfo *codeInfo)
PHIDGET21_API int CCONV CPhidgetIR_getRawData (CPhidgetIRHandle phid, int *data, int *dataLength)
PHIDGET21_API int CCONV CPhidgetIR_Transmit (CPhidgetIRHandle phid, unsigned char *data, CPhidgetIR_CodeInfoHandle codeInfo)
PHIDGET21_API int CCONV CPhidgetIR_TransmitRaw (CPhidgetIRHandle phid, int *data, int dataLength, int carrierFrequency, int dutyCycle, int gap)
PHIDGET21_API int CCONV CPhidgetIR_TransmitRepeat (CPhidgetIRHandle phid)
static int dataTime (int *data, int *time, int ptr, int endptr)
static int decode_data (int *data, int inlength, unsigned char *decoded_data, int *outlength, CPhidgetIR_CodeInfoHandle codeInfo)
static int get_times (int *timesin, int incount, int *timesout, int *timesoutcount, int *outcount)
 if ()
 if (dataLength > 0)
static int learn_data (CPhidgetIRHandle phid)
ZEROMEMphid (phid->lastCodeInfo)
ZEROMEMphid (int)*100
static int RawTimeDataToRawData (int *rawTimeData, int rawTimeDataLength, int *rawData, int *rawDataLength, int *time)
static int sendRAWData (CPhidgetIRHandle phid, int *data, int length, int carrier, int dutyCycle, int gap)
PHIDGET21_API int CCONV stringToCodeInfo (char *string, CPhidgetIR_CodeInfoHandle codeInfo)
 TESTPTR (phid)

Variables

int data [IR_MAX_DATA_PER_PACKET]
int dataLength
phid dataReadPtr = 0
phid dataWritePtr = 0
phid delayCode = PTRUE
return EPHIDGET_OK
int i
phid lastCodeKnown = PFALSE
phid lastGap = PUNK_BOOL
phid lastLearnedCodeKnown = PFALSE
phid lastRepeat = PUNK_BOOL
phid learnReadPtr = 0
phid outputPacketLen = 0
gettimeofday & phid
phid polarity = PUNK_BOOL
phid rawDataSendWSCounter = PUNK_INT
int us
phid userReadPtr = 0

Define Documentation

#define ABS (   x)    ((x) < 0 ? -(x) : (x))

Definition at line 11 of file cphidgetir.c.

#define COUNT_TIMES (   highlow,
  index 
)
Value:
if(highlow##s[index] == data[i] || !highlow##s[index]) \
        { \
                highlow##s[index] = data[i]; \
                highlow##Counts[index]++; \
                if(highlow##count < index+1) \
                        highlow##count=index+1; \
                continue; \
        }

Definition at line 529 of file cphidgetir.c.

#define ORDER_TIMES (   highlow,
  index 
)
Value:
if(highlow##s[index+1] && (highlow##s[index+1] < highlow##s[index])) \
        { \
                int temp = highlow##Counts[index]; \
                highlow##Counts[index] = highlow##Counts[index+1]; \
                highlow##Counts[index+1] = temp; \
                temp = highlow##s[index]; \
                highlow##s[index] = highlow##s[index+1]; \
                highlow##s[index+1] = temp; \
        }

Definition at line 539 of file cphidgetir.c.

#define pdiff (   a,
 
)    ( ABS((a) - (b)) / (double)( ((a) + (b)) / 2.0 ) )

Definition at line 12 of file cphidgetir.c.

#define TIME_TO_PACKET (   data,
  length,
  index,
  us 
)
Value:
do{ \
                if ((index + 2) >= length) \
                        return EPHIDGET_NOMEMORY; \
        if ((us) > 327670) \
            return EPHIDGET_INVALIDARG; \
                if((us) > 1270) /*1270 == 0x7f << 1*/ \
                        data[index++] = ((round((us)/10) >> 8) | 0x80); \
                data[index++] = round((us)/10) & 0xff; \
                *time += (us); \
        } while(0)

Definition at line 273 of file cphidgetir.c.


Function Documentation

static int analyze_data ( CPhidgetIRHandle  phid,
int  trailgap_needed 
) [static]

Definition at line 1289 of file cphidgetir.c.

static int codeInfoToRawData ( unsigned char *  code,
CPhidgetIR_CodeInfo  codeInfo,
int *  rawData,
int *  rawDataLength,
int *  time,
unsigned char  repeat 
) [static]

Definition at line 301 of file cphidgetir.c.

static int CCONV_CDECL compare_int ( const void arg1,
const void arg2 
) [static]

Definition at line 473 of file cphidgetir.c.

static int compareDataArrays ( int *  data,
int  ptr1,
int  ptr2,
int  endptr1,
int  endptr2,
double  maxpdiff 
) [static]

Definition at line 912 of file cphidgetir.c.

static int dataTime ( int *  data,
int *  time,
int  ptr,
int  endptr 
) [static]

Definition at line 896 of file cphidgetir.c.

static int decode_data ( int *  data,
int  inlength,
unsigned char *  decoded_data,
int *  outlength,
CPhidgetIR_CodeInfoHandle  codeInfo 
) [static]

Definition at line 553 of file cphidgetir.c.

static int get_times ( int *  timesin,
int  incount,
int *  timesout,
int *  timesoutcount,
int *  outcount 
) [static]

Definition at line 485 of file cphidgetir.c.

if ( )

Definition at line 82 of file cphidgetir.c.

if ( dataLength  ,
 
)

Definition at line 154 of file cphidgetir.c.

static int learn_data ( CPhidgetIRHandle  phid) [static]

Definition at line 941 of file cphidgetir.c.

ZEROMEM& phid ( phid->  lastCodeInfo)
ZEROMEM& phid ( int  )
static int RawTimeDataToRawData ( int *  rawTimeData,
int  rawTimeDataLength,
int *  rawData,
int *  rawDataLength,
int *  time 
) [static]

Definition at line 286 of file cphidgetir.c.

static int sendRAWData ( CPhidgetIRHandle  phid,
int *  data,
int  length,
int  carrier,
int  dutyCycle,
int  gap 
) [static]

Definition at line 227 of file cphidgetir.c.

TESTPTR ( phid  )

Variable Documentation

Definition at line 80 of file cphidgetir.c.

Definition at line 79 of file cphidgetir.c.

Definition at line 29 of file cphidgetir.c.

Definition at line 30 of file cphidgetir.c.

Definition at line 63 of file cphidgetir.c.

return EPHIDGET_OK

Definition at line 36 of file cphidgetir.c.

int i

Definition at line 79 of file cphidgetir.c.

Definition at line 20 of file cphidgetir.c.

Definition at line 23 of file cphidgetir.c.

Definition at line 22 of file cphidgetir.c.

Definition at line 21 of file cphidgetir.c.

Definition at line 32 of file cphidgetir.c.

Definition at line 45 of file cphidgetir.c.

gettimeofday& phid

Definition at line 68 of file cphidgetir.c.

Definition at line 19 of file cphidgetir.c.

Definition at line 34 of file cphidgetir.c.

int us

Definition at line 79 of file cphidgetir.c.

Definition at line 31 of file cphidgetir.c.



pedal_monitor
Author(s): Pedro Mendes
autogenerated on Fri Jun 6 2014 18:37:21