
//[!]{************
//[사용자용:맷돌구동]
//}***************

//[주의]{-------------------------------------------------------------------
//
//<맷돌-C> 는 [구조체] 를 정확한 [구성원 크기] 로 배치하지만 다른 compiler 는 각각 배치를
//달리하며 순서가 바뀔수도 있음에 주의.
//
//즉, 다른 compiler 에서는 [구조체] 를 사용하지 않고 직접 메모리 접근 방법을 사용해야 함.
//이 경우는 [부가함수] 로 별도 제공된 API 사용.
//}------------------------------------------------------------------------


//[공통 사용]
//{
    //[흐름제어]
    //{
        //[2012.03.24.토][완료!!!]
        unsigned char _GMTDLARC_Ack(unsigned char  p맷돌통신포트번호);

        //[2012.03.24.토][완료!!!]
        unsigned char _GMTDLARC_WaitReport(unsigned char  p맷돌통신포트번호);

    //}

    //[2012.03.24.토][완료!!!]
    void _GMTDLARC_MemSet(unsigned char  p맷돌통신포트번호,
                          unsigned char  p제어기번호);

    //[2012.03.24.토][완료!!!]
    void _GMTDLARC_RptRqst(unsigned char  p맷돌통신포트번호,
                           unsigned char  p제어기번호,
                           unsigned char  p서보번호);

    //[2012.03.24.토][완료!!!]
    void _GMTDLARC_RptTimeWr(unsigned char  p맷돌통신포트번호,
                             unsigned char  p제어기번호,
                             unsigned char  p서보번호,
                             unsigned char  p완료보고비율);


    //[2012.03.24.토][완료!!!]
    void _GMTDLARC_RptTimeRd(unsigned char   p맷돌통신포트번호,
                             unsigned char   p제어기번호,
                             unsigned char   p서보번호,
                             unsigned char  *r완료보고비율);

    //[2012.03.24.토][완료!!!]
    void _GMTDLARC_AccelDivWr(unsigned char  p맷돌통신포트번호,
                              unsigned char  p제어기번호,
                              unsigned char  p서보번호,
                              unsigned char  p가감속상수);

    //[2012.03.24.토][완료!!!]
    void _GMTDLARC_AccelDivRd(unsigned char   p맷돌통신포트번호,
                              unsigned char   p제어기번호,
                              unsigned char   p서보번호,
                              unsigned char  *r가감속상수);

    //[2012.03.24.토][완료!!!]
    void _GMTDLARC_SpdWr(unsigned char   p맷돌통신포트번호,
                         unsigned char   p제어기번호,
                         unsigned char   p서보번호,
                         unsigned short  p속도,
                         unsigned char   p즉시_임시);

    struct SPDXWR_3
    {
      //[!]{---------------------------------
      //반드시 순서대로 기술하고 크기를 변경하면 안됨.
      //<맷돌-C> 에서만 유효함.
      //}------------------------------------

      unsigned char   서보번호;  //1바이트.
      unsigned short  속도;     //2바이트.

    };
    //[2012.03.24.토][완료!!!]
    void _GMTDLARC_SpdXWr(unsigned char     p맷돌통신포트번호,
                          unsigned char     p제어기번호,
                          unsigned char     p설정개수,
                          struct SPDXWR_3  *p설정목록,
                          unsigned char     p즉시_임시);

    //[부가함수]
    //{
        //[2012.03.24.토][완료!!!]
        void _GMTDLARC_SpdXWr2(unsigned char   p맷돌통신포트번호,
                               unsigned char   p제어기번호,
                               unsigned char   p설정개수,
                               unsigned char  *p설정목록,
                               unsigned char   p즉시_임시);

        //[2012.03.24.토][완료!!!]
        void _SpdXWr2_설정목록(unsigned char   *p설정목록,
                             int             *pr저장위치,
                             //[설정정보]{---------------
                             unsigned char    p서보번호,
                             unsigned short   p속도
                             //}-----------------------
                            );

    //}

    //[2012.03.24.토][완료!!!]
    void _GMTDLARC_SpdRd(unsigned char    p맷돌통신포트번호,
                         unsigned char    p제어기번호,
                         unsigned char    p서보번호,
                         unsigned short  *r속도);

//}

//[각도 구동기]
//{
    //[2012.03.24.토][완료!!!]
    void _GMTDLARC_DegWr(unsigned char   p맷돌통신포트번호,
                         unsigned char   p제어기번호,
                         unsigned char   p서보번호,
                         unsigned char   p속도종류,
                         unsigned short  p각도,
                         unsigned char   p즉시_임시);

    struct DEGXWR_4
    {
      //[!]{---------------------------------
      //반드시 순서대로 기술하고 크기를 변경하면 안됨.
      //<맷돌-C> 에서만 유효함.
      //}------------------------------------

      unsigned char   서보번호;  //1버이트.
      unsigned char   속도종류;  //1바이트.
      unsigned short  각도;     //2바이트.

    };
    //[2012.03.24.토][완료!!!]
    void _GMTDLARC_DegXWr(unsigned char     p맷돌통신포트번호,
                          unsigned char     p제어기번호,
                          unsigned char     p설정개수,
                          struct DEGXWR_4  *p설정목록,
                          unsigned char     p즉시_임시);

    //[부가함수]
    //{
        //[2012.03.24.토][완료!!!]
        void _GMTDLARC_DegXWr2(unsigned char   p맷돌통신포트번호,
                               unsigned char   p제어기번호,
                               unsigned char   p설정개수,
                               unsigned char  *p설정목록,
                               unsigned char   p즉시_임시);

        //[2012.03.24.토][완료!!!]
        void _DegXWr2_설정목록(unsigned char   *p설정목록,
                             int             *pr저장위치,
                             //[설정정보]{---------------
                             unsigned char    p서보번호,
                             unsigned char    p속도종류,
                             unsigned short   p각도
                             //}-----------------------
                            );

    //}

    //[2012.03.24.토][완료!!!]
    void _GMTDLARC_DegRd(unsigned char    p맷돌통신포트번호,
                         unsigned char    p제어기번호,
                         unsigned char    p서보번호,
                         unsigned short  *r각도);

    struct DEGSYNCMOVE_3
    {
      //[!]{---------------------------------
      //반드시 순서대로 기술하고 크기를 변경하면 안됨.
      //<맷돌-C> 에서만 유효함.
      //}------------------------------------

      unsigned char   서보번호;  //1버이트.
      unsigned short  각도;     //2바이트.

    };
    //[2012.03.24.토][완료!!!]
    void _GMTDLARC_DegSyncMove(unsigned char          p맷돌통신포트번호,
                               unsigned char          p제어기번호,
                               unsigned char          p설정개수,
                               struct DEGSYNCMOVE_3  *p설정목록,
                               unsigned short         p속도,
                               unsigned char          p속도종류,
                               unsigned char          p가감속상수,
                               unsigned char          p완료보고비율,
                               unsigned char          p즉시_임시);

    //[부가함수]
    //{
        //[2012.03.24.토][완료!!!]
        void _GMTDLARC_DegSyncMove2(unsigned char    p맷돌통신포트번호,
                                    unsigned char    p제어기번호,
                                    unsigned char    p설정개수,
                                    unsigned char   *p설정목록,
                                    unsigned short   p속도,
                                    unsigned char    p속도종류,
                                    unsigned char    p가감속상수,
                                    unsigned char    p완료보고비율,
                                    unsigned char    p즉시_임시);

        //[2012.03.24.토][완료!!!]
        void _DegSyncMove2_설정목록(unsigned char   *p설정목록,
                                  int             *pr저장위치,
                                  //[설정정보]{---------------
                                  unsigned char    p서보번호,
                                  unsigned short   p각도
                                  //}-----------------------
                                 );

    //}

    //[2012.03.24.토][완료!!!]
    void _GMTDLARC_DegSpd(unsigned char   p맷돌통신포트번호,
                          unsigned char   p제어기번호,
                          unsigned char   p서보번호,
                          unsigned char   p속도종류,
                          unsigned short  p각도,
                          unsigned short  p속도,
                          unsigned char   p즉시_임시);

//}

//[듀티 구동기]
//{
    //[2012.03.24.토][완료!!!]
    void _GMTDLARC_DutyWr(unsigned char   p맷돌통신포트번호,
                          unsigned char   p제어기번호,
                          unsigned char   p서보번호,
                          unsigned char   p속도종류,
                          unsigned short  p듀티,
                          unsigned char   p즉시_임시);

    struct DUTYXWR_4
    {
      //[!]{---------------------------------
      //반드시 순서대로 기술하고 크기를 변경하면 안됨.
      //<맷돌-C> 에서만 유효함.
      //}------------------------------------

      unsigned char   서보번호;  //1바이트.
      unsigned char   속도종류;  //1바이트.
      unsigned short  듀티;     //2바이트.

    };
    //[2012.03.24.토][완료!!!]
    void _GMTDLARC_DutyXWr(unsigned char      p맷돌통신포트번호,
                           unsigned char      p제어기번호,
                           unsigned char      p설정개수,
                           struct DUTYXWR_4  *p설정목록,
                           unsigned char      p즉시_임시);

    //[부가함수]
    //{
        //[2012.03.24.토][완료!!!]
        void _GMTDLARC_DutyXWr2(unsigned char   p맷돌통신포트번호,
                                unsigned char   p제어기번호,
                                unsigned char   p설정개수,
                                unsigned char  *p설정목록,
                                unsigned char   p즉시_임시);

        //[2012.03.24.토][완료!!!]
        void _DutyXWr2_설정목록(unsigned char   *p설정목록,
                              int             *pr저장위치,
                              //[설정정보]{---------------
                              unsigned char    p서보번호,
                              unsigned char    p속도종류,
                              unsigned short   p듀티
                              //}-----------------------
                             );

    //}

    //[2012.03.24.토][완료!!!]
    void _GMTDLARC_DutyRd(unsigned char    p맷돌통신포트번호,
                          unsigned char    p제어기번호,
                          unsigned char    p서보번호,
                          unsigned short  *r듀티);

    struct DUTYSYNCMOVE_3
    {
      //[!]{---------------------------------
      //반드시 순서대로 기술하고 크기를 변경하면 안됨.
      //<맷돌-C> 에서만 유효함.
      //}------------------------------------

      unsigned char   서보번호;  //1바이트.
      unsigned short  듀티;     //2바이트.

    };
    //[2012.03.24.토][완료!!!]
    void _GMTDLARC_DutySyncMove(unsigned char           p맷돌통신포트번호,
                                unsigned char           p제어기번호,
                                unsigned char           p설정개수,
                                struct DUTYSYNCMOVE_3  *p설정목록,
                                unsigned short          p속도,
                                unsigned char           p속도종류,
                                unsigned char           p가감속상수,
                                unsigned char           p완료보고비율,
                                unsigned char           p즉시_임시);

    //[부가함수]
    //{
        //[2012.03.24.토][완료!!!]
        void _GMTDLARC_DutySyncMove2(unsigned char    p맷돌통신포트번호,
                                     unsigned char    p제어기번호,
                                     unsigned char    p설정개수,
                                     unsigned char   *p설정목록,
                                     unsigned short   p속도,
                                     unsigned char    p속도종류,
                                     unsigned char    p가감속상수,
                                     unsigned char    p완료보고비율,
                                     unsigned char    p즉시_임시);

        //[2012.03.24.토][완료!!!]
        void _DutySyncMove2_설정목록(unsigned char   *p설정목록,
                                   int             *pr저장위치,
                                   //[설정정보]{---------------
                                   unsigned char    p서보번호,
                                   unsigned short   p듀티
                                   //}-----------------------
                                  );

    //}

    //[2012.03.24.토][완료!!!]
    void _GMTDLARC_DutySpd(unsigned char   p맷돌통신포트번호,
                           unsigned char   p제어기번호,
                           unsigned char   p서보번호,
                           unsigned char   p속도종류,
                           unsigned short  p듀티,
                           unsigned short  p속도,
                           unsigned char   p즉시_임시);

    //[2012.03.24.토][완료!!!]
    void _GMTDLARC_DutyPeriodWr(unsigned char   p맷돌통신포트번호,
                                unsigned char   p제어기번호,
                                unsigned short  p주기,
                                unsigned char   p조정_설정);

    //[2012.03.24.토][완료!!!]
    void _GMTDLARC_DutyPeriodRd(unsigned char    p맷돌통신포트번호,
                                unsigned char    p제어기번호,
                                unsigned short  *r주기);

//}

//[제어기 특수 기능]
//{
    //[2012.03.24.토][완료!!!]
    void _GMTDLARC_PwmRun(unsigned char  p맷돌통신포트번호,
                          unsigned char  p제어기번호);

    //[2012.03.24.토][완료!!!]
    void _GMTDLARC_PwmStop(unsigned char  p맷돌통신포트번호,
                           unsigned char  p제어기번호);

    //[2012.03.24.토][완료!!!]
    void _GMTDLARC_Reset(unsigned char  p맷돌통신포트번호,
                         unsigned char  p제어기번호);

//}

