4 Replies Latest reply on Feb 19, 2019 8:29 PM by HIUR_3769846

    (CYW43907) How to call own function when WICED printing is called

    HIUR_3769846

      Hi,

       

      I would like to call our method to send printf data via wifi when the printf such as WPRINT_APP_INFO/ERROR/DEBUG is executed. Firstly, I tried to used wiced_log_init in reference to Logs ,a simple introduce in Wiced release . However, I cannot get have good result. This method is seemed not to support to switch WPRINT_APP_INFO to log output. Is there other solution?

       

      BR, Hiroyuki

        • 1. Re: (CYW43907) How to call own function when WICED printing is called
          SiSa_3185206

          You have to enable WPRINT_ENABLE_APP_INFO in your WICED build to be able to see WICED APP INFO prints.

          WPRINT_APP_INFO translates to printf() only.

           

          to enable that macro you can use the following line in your WICED app's makefile:

          GLOBAL_DEFINES += WPRINT_ENABLE_APP_INFO

           

          Then you can use the WPRINT_APP_INFO ( args ); on your code.

          • 2. Re: (CYW43907) How to call own function when WICED printing is called
            PriyaM_16

            I believe you want to change the default printf statement from WICED and use your own function for printing instead of  WPRINT_APP_INFO()

            WPRINT_APP_INFO is defined in wwd_debug.h file:

            #define WPRINT_APP_INFO(args)      WPRINT_MACRO(args)

             

            WPRINT_MACRO is in the same file 43xxx_Wi-Fi\WICED\WWD\include\wwd_debug.h -->

            #define WPRINT_MACRO(args) do {if (WPRINT_PLATFORM_PERMISSION_FUNC()) printf args;} while(0==1)

            and WPRINT_PLATFORM_PERMISSION_FUNC() is equal to 1.

             

            It is using 'printf' to print the logs on UART.

            Can you please explain the result you are looking for?

            2 of 2 people found this helpful
            • 3. Re: (CYW43907) How to call own function when WICED printing is called
              HIUR_3769846

              Thanks for your responses.

              Yes, I can found the above define position. And I changed following,

              From #define WPRINT_APP_INFO(args)   WPRINT_MACRO(args)

              TO    #define WPRINT_APP_INFO(args)   application_printf(args)

               

              application_printf(char args){

                   //non

              }

               

              However, I have many errors such as
              "error: passing argument 1 of 'application_printf' makes integer from pointer without a cast [-Werror]

                   #define WPRINT_APP_INFO(args)  application_printf(args)" and

              "error: left-hand operand of comma expression has no effect [-Werror=unused-value]

                           WPRINT_APP_INFO( ("CONSOLE: %s\n", buffer) );".

               

              Now I'm trying fix.

               

              By the way, my first hope is to transmit log of all "printf" to connected devices via wifi.

              • 4. Re: (CYW43907) How to call own function when WICED printing is called
                HIUR_3769846

                Hi, I resolve this issue. Thanks everyone for giving advice.

                I show the fixed points.

                 

                ・wwd_debug.h

                From #define WPRINT_APP_INFO(args)   WPRINT_MACRO(args)

                TO      #define WPRINT_APP_INFO(args) do {application_printf args;} while(0==1)

                 

                ・my_app.c

                int application_printf(const char *pcFormat, ...){

                     //Some Task

                }

                 

                BR,
                Hiroyuki