1 Reply Latest reply on Apr 26, 2016 10:46 PM by user_1377889

    BLE Keyboard Example question.  set up keyboard data?

    jacobramlow_1636026

      I am trying to figure out what this does.

         

      located in the hids.c file;

         

      line     220            keyboard_data[2u] = 0u;                       /* Set up keyboard data*/
      line     221            keyboard_data[3u] = 0u;                       /* Set up keyboard data*/

         

       

         

      What is the purpose of these two lines?

        • 1. Re: BLE Keyboard Example question.  set up keyboard data?
          user_1377889

          Welcome in the forum!

             

          The trailing 'u' after an integer constant advises the compiler to treat the number as an "unsigned" item. To use this qualifier after every constant (if needed or not) conforms to the "MISRA" coding rules which imho do not make readability easier. Companies as Cypress are bound to follow these rules. So the above lies could have been written as

             

          line     220            keyboard_data[2] = 0;                       /* Set up keyboard data*/
          line     221            keyboard_data[3] = 0;                       /* Set up keyboard data*/

             

          which is more the usual C-language style.

             

           

             

          Bob