Example #1
0
static void Print(iotjs_jhandler_t* jhandler, FILE* out_fd) {
  JHANDLER_CHECK_ARGS(1, string);

  iotjs_string_t msg = JHANDLER_GET_ARG(0, string);
  fprintf(out_fd, "%s", iotjs_string_data(&msg));
  iotjs_string_destroy(&msg);
}
void i2c_create_platform_data(iotjs_jhandler_t* jhandler, iotjs_i2c_t* i2c,
                              iotjs_i2c_platform_data_t** ppdata) {
  iotjs_i2c_platform_data_t* pdata = IOTJS_ALLOC(iotjs_i2c_platform_data_t);

  DJHANDLER_CHECK_ARGS(2, number, function);
  pdata->device = JHANDLER_GET_ARG(0, number);
  pdata->i2c_master = NULL;
  *ppdata = pdata;
}