0

my question is: Is there an equivalent approach to wiringPiNodeStruct in pigpio? More specifically, I want to translate some codes that you can find for WiringPi to codes that use pigpio.

It looks like this:

// wiringPiNodeStruct:
//  This describes additional device nodes in the extended wiringPi
//  2.0 scheme of things.
//  It's a simple linked list for now, but will hopefully migrate to 
//  a binary tree for efficiency reasons - but then again, the chances
//  of more than 1 or 2 devices being added are fairly slim, so who
//  knows....

struct wiringPiNodeStruct
{
  int     pinBase ;
  int     pinMax ;

  int          fd ; // Node specific
  unsigned int data0 ;  //  ditto
  unsigned int data1 ;  //  ditto
  unsigned int data2 ;  //  ditto
  unsigned int data3 ;  //  ditto

  void   (*pinMode)         (struct wiringPiNodeStruct *node, int pin, int mode) ;
  void   (*pullUpDnControl) (struct wiringPiNodeStruct *node, int pin, int mode) ;
  int    (*digitalRead)     (struct wiringPiNodeStruct *node, int pin) ;
  void   (*digitalWrite)    (struct wiringPiNodeStruct *node, int pin, int value) ;
  void   (*pwmWrite)        (struct wiringPiNodeStruct *node, int pin, int value) ;
  int    (*analogRead)      (struct wiringPiNodeStruct *node, int pin) ;
  void   (*analogWrite)     (struct wiringPiNodeStruct *node, int pin, int value) ;

  struct wiringPiNodeStruct *next ;
} ;

extern struct wiringPiNodeStruct *wiringPiNodes ;

For many other functions there are actually already functions in pigpio where you don't have to change that much code at all.

Thanks in advance

Micha93
  • 628
  • 1
  • 9
  • 22

0 Answers0