title: Pebble: How to pass an integer as callback_data with app_timer_register?
body: <p>Summary of answer:
  app_timer_register passes a pointer without type.
  To pass an integer, create an integer and pass it's pointer.
  Then type the pointer to integer.</p>
  
  <p>example of using the untyped pointer:</p>
  
  <pre><code>static void timeHandler(void * untyped_pointer_to_an_integer){
    function_requiring_integer((int)untyped_pointer_to_an_intergger); 
  </code></pre>
  
  <p>I'm trying to pass an integer along with the code called by app_time_register.
  When I try the following:</p>
  
  <pre><code>static void time_handler(int val){ 
    app_timer_register(wait_time_ms, time_handler, 1);
    do_stuff(); 
  }
  </code></pre>
  
  <p>I get the error:</p>
  
  <pre><code>../src/main.c:88:3: error: passing argument 2 of 'app_timer_register' from incompatible pointer type [-Werror]
  In file included from ../src/main.c:1:0:
  /app/sdk3/pebble/chalk/include/pebble.h:2656:11: note: expected 'AppTimerCallback' but argument is of type 'void (*)(int)'
  ../src/main.c:88:3: error: passing argument 3 of 'app_timer_register' makes pointer from integer without a cast [-Werror]
  In file included from ../src/main.c:1:0:
  /app/sdk3/pebble/chalk/include/pebble.h:2656:11: note: expected 'void *' but argument is of type 'int'
  </code></pre>
  
  <p>Pebble provides the following information about app_time_register (source <a href="https://developer.pebble.com/docs/c/Foundation/Timer/" rel="nofollow">https://developer.pebble.com/docs/c/Foundation/Timer/</a>).</p>
  
  <pre><code>AppTimer * app_timer_register(uint32_t timeout_ms, AppTimerCallback callback, void * callback_data)
    Registers a timer that ends up in callback being called some specified time in the future.
    Parameters
      timeout_ms
        The expiry time in milliseconds from the current time
      callback
        The callback that gets called at expiry time
      callback_data
        The data that will be passed to callback
  
  typedef void(* AppTimerCallback)(void *data)
  The type of function which can be called when a timer fires. The argument will be the callback_data passed to app_timer_register().
  </code></pre>
  
  <p>I need helping figuring out how to use the callback_data to pass an integer.</p>