2 Replies Latest reply on Feb 11, 2016 4:22 PM by user_13524663

    Reference for register usage in order to write functional code

    user_13524663

      Looking at the C example code made me realized that I don't know how to write my own code. For example, the example generates the following C code:

         
          

       CapSense_CSD_Start();

          

          /* Initialize baselines */
          CapSense_CSD_InitializeAllBaselines();

          

          /*when return value is 1, perform while loop*/
          while(1u)
          {
              /* Check whether the scanning of all enabled widgets is completed. */
              if(0u == CapSense_CSD_IsBusy())
              {
                  /* Update all baselines */
                  CapSense_CSD_UpdateEnabledBaselines();

          

                  /* Start scanning all enabled sensors */
                  CapSense_CSD_ScanEnabledWidgets();
              }

          

              /* Display CapSense state using LEDs */
              CapSense_DisplayState();
              
          }

         
         

      I can't figure out where the "1u" comes from that the while() function is using (thus where the "0u" that the if statement is using).

         

      I assume that some register is loaded with a value that is checked by the while() loop as a result of the call to "CapSense_CSD_InitializeAllBaselines();" However, the capsense data sheet states that no value is returned as a result of the call to "CapSense_CSD_InitializeAllBaselines();" 

         

      So, is there a reference that I can read that would provide this information?

         

      What would lead me to write "while(1u);" if I didn't see this in the example?

         

      What if I had other modules that required use of the what() function, how would I differentiate what source the "1u" would be used for the while loops?

         

      Sincerely, Jeff