Announcement

Collapse
No announcement yet.

calling subroutines from genieEventHandler

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • calling subroutines from genieEventHandler

    Apologies if this is in the wrong place, but I wasn't sure where this post belongs.

    Very simple (I hope) question.

    My routine for void genieEventHandler(void) was getting unwieldy and extremely long so I split it up into multiple .ino files and subroutines.

    The code complied and ran with no issues with an Arduino Mega 2560 as my MCU (code below). I recently upgraded to an Arduino SAM3 Due and started to get the following errors (errors below)

    Any help would be extremely welcome.

    best,

    Craig



    ERROR BELOW:

    error: invalid conversion from 'genieFrame*' to 'long unsigned int' [-fpermissive]
    TFT_procedure_1(&Event);
    ^
    TFT_procedure_1:113: error: initializing argument 1 of 'void TFT_procedure_1(long unsigned int)' [-fpermissive]
    void TFT_procedure_1(unsigned long EVENT)







    CODE BELOW:


    void genieEventHandler(void)
    {
    genieFrame Event; // read the event
    TFT.DequeueEvent(&Event); // remove queued event (hex) from buffer and process below

    // pass (&Event) reported from the 4D Genie TFT to procedures to do stuff

    TFT_procedure_1(&Event);
    TFT_procedure_2(&Event);
    TFT_procedure_3(&Event);


    }

    void TFT_procedure_1(unsigned long Event)
    {
    if (TFT.EventIs(Event, GENIE_REPORT_EVENT, GENIE_OBJ_FORM, 1))
    {
    // do something
    }
    }

    void TFT_procedure_2(unsigned long Event)
    {
    if (TFT.EventIs(Event, GENIE_REPORT_EVENT, GENIE_OBJ_FORM, 2))
    {
    // do something
    }
    }

    void TFT_procedure_3(unsigned long Event)
    {
    if (TFT.EventIs(Event, GENIE_REPORT_EVENT, GENIE_OBJ_FORM, 2))
    {
    // do something
    }
    }
    Last edited by lowsecmail; 29th June 2018, 11:24 AM.

  • #2
    Hi Craig,

    I tried replicating the problem you have mentioned and I have encountered the same error message/warning on both devices (Arduino Mega 2560 and Arduino Due SAM3).
    The problem is the conversion from 'long unsigned int' to 'genieFrame* is invalid. It would be better to replace “unsigned long” with “genieFrame*”.

    Hope it helps.

    Best Regards,
    Pearl
    Pearl

    Comment


    • #3
      Hi Pearl,

      Thanks for your help. That's awesome.

      void TFT_procedure_1(genieFrame* Event)
      {
      // blah;
      }

      Did the trick.

      Craig

      Comment


      • #4
        Hi Craig,

        Glad to help. If you have further questions, don't hesitate to ask.

        Best Regards,
        Pearl
        Pearl

        Comment

        Working...
        X