getting confused with switch case activation side

//AD5665.cpp

void AD5665::dacAddress(int adr)                     //???????????????????????????
{ 
  switch (adr)                                                     //????????????????????????
  {
    case 0:
      {
        int  dacA   = 0x00; //  0 . 0  . 0                   //end part of Command byte
      }
      break;
    case 1:
      {
        int  dacB   = 0x01; //  0 . 0  . 1
      }
      break;
    case 2:
      {
        int  dacC   = 0x02; //  0 . 1  . 0
      }
      break;
    case 3:
      {
        int  dacD   = 0x03; //  0 . 1  . 1
      }
      break;
    default:
      {
        int  dacAll = 0x07; //  1 . 1  . 1
      }
      break;
  }
}

so this is suposed to be part of my perminent library

   AD5665.h

 void dacAddress(int adr);                        //pick_channel A,B,C,D,ALL

the Galvo.h file is used to link my library to the main program

//Galvo.h

    void channel()//to interact with AD5665::dacAddress(int adr) //switch (adr) in AD5665.cpp
    {

     // AD5665.dacAddress(int adr);       //??????????????????????????????????
      int adr;                                         //???????????????????????????????????????????

      int X_AXIS(adr == 1);                   //AD5665::dacAddress(int adr) adr case 1 (dac output B)
      int Y_AXIS(adr == 3);                   //AD5665::dacAddress(int adr) adr case 3 (dac output D)
      int LasPwr1(adr == 0);                  //AD5665::dacAddress(int adr) adr case 0 (dac output A)
      int LasPwr2(adr == 2);                  //AD5665::dacAddress(int adr) adr case 2 (dac output C)
      int DisconectAll(adr == default);    //default
    }

Ok so in the Galvo.h file im trying to assosiate each axis to the switch case in the AD5665 library not sure where im going wrong if i uncoment the AD5665.dacAddress(int adr); dose not compile but i dont think how it is will link properly. I want to get my story straigt before making a bigger mess as the library gets bigger

        int  dacA  = 0x00; //  0 . 0  . 0                  //end part of Command byteWhat scope do you expect this and similarly declared variables to have ?

how do you define X_AXIS etc
if it is an int you could do something like

if(channel == X_AXIS)
    AD5665.dacAddress(1);

ok so in the main library i wanted to set a perminant Hex value to a pin on the chip as this call will never change. but say i was to call a channel over a serial monitor or just loop it in some coad. in this case im calling the channels axis X axis Y etc ... but in future they could be called motor_1, fan etc that depends what the library gets used for that the reson for the extra .h file

UKHeliBob:
        int  dacA  = 0x00; //  0 . 0  . 0                  //end part of Command byteWhat scope do you expect this and similarly declared variables to have ?

the hex number never changes if that channel is to be used

horace:
how do you define X_AXIS etc
if it is an int you could do something like

if(channel == X_AXIS)

AD5665.dacAddress(1);

i knew i needed a class"."function look like i was doing it wrong. so do i need to get rid of the
int adr: ill have a pop at it

 //Galvo.h

   void channel()      //to interact with AD5665::dacAddress(int adr) //switch (adr) in AD5665.cpp
    {
      if (channel == X_AXIS)
        AD5665.dacAddress(1);         //AD5665::dacAddress(int adr) adr case 1 (dac output B)

      elif(channel == Y_AXIS)
      AD5665.dacAddress(3);           //AD5665::dacAddress(int adr) adr case 3 (dac output D)

      elif(channel == LasPwr1)
      AD5665.dacAddress(0);           //AD5665::dacAddress(int adr) adr case 0 (dac output A)

      elif(channel == LasPwr2)
      AD5665.dacAddress(2);           //AD5665::dacAddress(int adr) adr case 2 (dac output C)

      else
        AD5665.dacAddress(default); //default All dac outputs
      endif;
    }

looks like this would be somthing like whats expected to interact with AD5665.cpp but im still getting errors this is why i end up lost?

Arduino: 1.6.11 (Windows 7), Board: "Arduino Due (Programming Port)"

In file included from C:\Users\robbie\AppData\Local\Temp\arduino_modified_sketch_539620\ad5665r.ino:7:0:

sketch\Galvo.h: In member function 'void Galvo::channel()':

Galvo.h:60: error: expected primary-expression before ')' token

       if (channel == X_AXIS)

                            ^

Galvo.h:61: error: expected unqualified-id before '.' token

         AD5665.dacAddress(1);         //AD5665::dacAddress(int adr) adr case 1 (dac output B)

               ^

Galvo.h:63: error: expected primary-expression before ')' token

       elif(channel == Y_AXIS)

                             ^

Galvo.h:63: error: 'elif' was not declared in this scope

Galvo.h:64: error: expected ';' before 'AD5665'

       AD5665.dacAddress(3);           //AD5665::dacAddress(int adr) adr case 3 (dac output D)

       ^

Galvo.h:66: error: expected primary-expression before ')' token

       elif(channel == LasPwr1)

                              ^

Galvo.h:67: error: expected ';' before 'AD5665'

       AD5665.dacAddress(0);           //AD5665::dacAddress(int adr) adr case 0 (dac output A)

       ^

Galvo.h:69: error: expected primary-expression before ')' token

       elif(channel == LasPwr2)

                              ^

Galvo.h:70: error: expected ';' before 'AD5665'

       AD5665.dacAddress(2);           //AD5665::dacAddress(int adr) adr case 2 (dac output C)

       ^

Galvo.h:72: error: 'else' without a previous 'if'

       else

       ^

Galvo.h:73: error: expected unqualified-id before '.' token

         AD5665.dacAddress(default); //default All dac outputs

               ^

Galvo.h:74: error: 'endif' was not declared in this scope

       endif;

       ^

exit status 1
expected primary-expression before ')' token

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

do i need # ? i have seen it done without

I assumed you would pass the channel as a parameter, e.g.

void setChannel(int channel)      //to interact with AD5665::dacAddress(int adr) //switch (adr) in AD5665.cpp
    {
      if (channel == X_AXIS)
        AD5665.dacAddress(1);

I assume AD5665 is a class - check that the class declaration in the header file is correct

horace:
I assumed you would pass the channel as a parameter, e.g.

void setChannel(int channel)      //to interact with AD5665::dacAddress(int adr) //switch (adr) in AD5665.cpp

{
     if (channel == X_AXIS)
       AD5665.dacAddress(1);

ok missed that but just changed the name but still errors

//Galvo.h


   void setChannel(int channel)      //to interact with AD5665::dacAddress(int adr) AD5665.cpp

   {
     if (channel == X_AXIS)
       AD5665.dacAddress(1);         //AD5665::dacAddress(int adr) adr case 1 (dac output B)

     elif(channel == Y_AXIS)
     AD5665.dacAddress(3);           //AD5665::dacAddress(int adr) adr case 3 (dac output D)

     elif(channel == LasPwr1)
     AD5665.dacAddress(0);           //AD5665::dacAddress(int adr) adr case 0 (dac output A)

     elif(channel == LasPwr2)
     AD5665.dacAddress(2);           //AD5665::dacAddress(int adr) adr case 2 (dac output C)

     else
       AD5665.dacAddress(default); //default All dac outputs
     endif;
   }

now getting these errors

Arduino: 1.6.11 (Windows 7), Board: "Arduino Due (Programming Port)"

In file included from C:\Users\robbie\AppData\Local\Temp\arduino_modified_sketch_728116\ad5665r.ino:7:0:

sketch\Galvo.h: In member function 'void Galvo::setChannel(int)':

Galvo.h:60: error: expected primary-expression before ')' token

       if (channel == X_AXIS)

                            ^

Galvo.h:61: error: expected unqualified-id before '.' token

         AD5665.dacAddress(1);         //AD5665::dacAddress(int adr) adr case 1 (dac output B)

               ^

Galvo.h:63: error: expected primary-expression before ')' token

       elif(channel == Y_AXIS)

                             ^

Galvo.h:63: error: 'elif' was not declared in this scope

Galvo.h:64: error: expected ';' before 'AD5665'

       AD5665.dacAddress(3);           //AD5665::dacAddress(int adr) adr case 3 (dac output D)

       ^

Galvo.h:66: error: expected primary-expression before ')' token

       elif(channel == LasPwr1)

                              ^

Galvo.h:67: error: expected ';' before 'AD5665'

       AD5665.dacAddress(0);           //AD5665::dacAddress(int adr) adr case 0 (dac output A)

       ^

Galvo.h:69: error: expected primary-expression before ')' token

       elif(channel == LasPwr2)

                              ^

Galvo.h:70: error: expected ';' before 'AD5665'

       AD5665.dacAddress(2);           //AD5665::dacAddress(int adr) adr case 2 (dac output C)

       ^

Galvo.h:72: error: 'else' without a previous 'if'

       else

       ^

Galvo.h:73: error: expected unqualified-id before '.' token

         AD5665.dacAddress(default); //default All dac outputs

               ^

Galvo.h:74: error: 'endif' was not declared in this scope

       endif;

       ^

exit status 1
expected primary-expression before ')' token

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

how is X_AXIS defined?

#define X_AXIS
#define Y_AXIS
#define LasPwr1
#define LasPwr2

at the top of the .h

above the

class Galvo

ive only posted the part of the code i was working on sorry

i can show the rest of the coad but its a bit messy at the minuite as im still "Noob Status"

/*calculations test page
 maps program to dac and scales it depending on what you want to do?
*/
#include "Arduino.h"
#ifndef Galvo_H
#define Galvo_H
#include "AD5665.h"
//#define AD5665 (0x20 >> 1)//to start the dac ??? dose it go here ?????????????????????????????????????????

#ifndef Ldac_pin    // would normaly be set in (pins.h) this gets canceled out if it is
#define Ldac_pin 25 //digital pin 25
#endif//Ldac
//pinMode (Ldac_pin, OUTPUT); //somthing not right here ?????????????????????????????????????????????????????

#define X_AXIS
#define Y_AXIS
#define LasPwr1
#define LasPwr2

#define galvoScannerAngle 20 //deg max swing end to end 
// below would be in (configeration.h) temp for testing
#define X_MAX_POS 400 // mm
#define X_MIN_POS 0
#define Y_MAX_POS 400
#define Y_MIN_POS 0
// below would be in (configeration.h) temp for testing
#define X_mm_sec 100 // if 400 mm max position 100 mm per sec should take dac 4 seconds to go (0 to 65536) 16bits
#define Y_mm_sec 100
/*********************************************************************************/
class Galvo
{
   /*****************************************************************************/
 public://meaning that they can be accessed by people using your library.
   Galvo();//constructor
   /*****************************************************************************/

   float DacScale(float swing)//to scale mm to dac volts//????????????????????????????????????????????????????????????
   {
     //      int X_AXIS = swing;
     float totalSwing_X_AXIS();//to scale x to dac
     //      swing (X_MAX_POS; - X_MIN_POS;);
     //      int Y_AXIS = swing;
     float totalSwing_Y_AXIS();//to scale y to dac
     //      swing = Y_MAX_POS() - Y_MIN_POS();
     //LasPwr1 dont need scale as uses 5volts
     //LasPwr2 dont need scale as uses 5volts
   }
   void dacMode ()//to interact with AD5665::dacCommand(int comm) //switch (comm) in AD5665.cpp
   {
     int comm;//???????????????????????????????????????????keyword????????????????????????????????????????
   }
   /**********************below things needed for galvo control************************/
   /*
     void invertChannel()
     {
     //invert LasPwr2 for test
     }*/
   void setChannel(int channel)      //to interact with AD5665::dacAddress(int adr) //switch (adr) in AD5665.cpp
   {
     if (channel == X_AXIS)
       AD5665.dacAddress(1);         //AD5665::dacAddress(int adr) adr case 1 (dac output B)

     elif(channel == Y_AXIS)
     AD5665.dacAddress(3);           //AD5665::dacAddress(int adr) adr case 3 (dac output D)

     elif(channel == LasPwr1)
     AD5665.dacAddress(0);           //AD5665::dacAddress(int adr) adr case 0 (dac output A)

     elif(channel == LasPwr2)
     AD5665.dacAddress(2);           //AD5665::dacAddress(int adr) adr case 2 (dac output C)

     else
       AD5665.dacAddress(default); //default All dac outputs
     endif;
   }
   /* void positionCorrection()// this may posibley be done with the scanner card so may not be needed yet
     {
     // float galvoScannerAngle
     // galvoScannerAngle/2 = 20/2 = 10 = 2.5v = 10/32768  = adjacent (half way point)
     // float swing
     // swing/2 = 400/2 = 200mm
     // opposite & adjacent = 90deg
     // adjacent & hypotenuse = galvoScannerAngle/2 (in degrees)
     // opposite & hypotenuse = 180 - 90 - galvoScannerAngle/2
      // user input == total swing & scanner angle
      // position correction adjacent = middle... hypotenuse = long side of the triangle +-10 degree swing as 20degree total
      // opposite = mm total swing/2 (user input)
      // mm total swing/2 angle = (20deg)/2 == shows length of adjacent & hypotenuse length
      // hypotenuse length = radius of projected circle
      // so given the total swing and the max posible angle of galvos the hypotenuse gives the radius of the circle
      // but we need to cut the top off the circle(400mm)to get the opposite scale
      // as each angle change will give different values to mm
      // so we actualy want the angle degree to volts to give the correct mm projected
     }*/
   void position()
   {

     int volts;//?????????????????????????????????????????keyword?????????????????????????????????????????
     //extern float mm();//position in mm
     //extern float X_AXIS
     //extern float Y_AXIS

     //extern unsigned char LASER_PWR();//1st laser intensity 100.000%
     //extern unsigned char LASER_PWR2();//2nd laser intensity 100.000%
     //int percent();
   }
   /*
       void vertualEndStop() // triggers vertual end stop when limmit reached to stop rollover
       {

       }*/
   /*
       void MmPerSec(float delay)
       {
         //once X & Y coodinates are set the delay till next move gives the mm per second effect using a scale map calculation
         //delay = (65536/(totalSwing / MmPerSec));//once X & Y coodinates are set the delay till next move gives the mm per second effect using a scale map calculation
         //no delay needed for laser as instant is best and will happen when x y position is set
       }*/
   /*
       void Ldac()//verifies completed data
       {

       }*/
 private:// meaning they can only be accessed from within the class itself.
   ~Galvo();//destructor
};//end class
#endif//Galvo_H

when you define a constant such as X_AXIS you need to specify a value, e.g. could you

#define X_AXIS  1

then use the value directly?

 AD5665.dacAddress(X_AXIS);

see

ok X_axis will be used with other functions when its running with my master plan so i dont want to just restrict it to the dac library not shure if doing this dose.. but i tryed it.. using the numbers that the switch use as i dont know what else to use.. errors still grrr
also tryed

#define X_axis[]

also the "X_axis" is going to be assosiated with Gcode that will come out like

X 255, Y 50, La1 100, La2 0;

with the numbers changing constantly

the page you attached just confused me as im not sure exactly what MY TYPE of #define is or should be?

also i have other switch cases in the AD5665 library and dont want it to get confused with them..

so the X_axis dose somthing with the main program as well as in the Galvo.h