/*
 ******************************************************************************
 * @file lib/tinker.js
 * @company Spark ( https://www.spark.io/ )
 * @source https://github.com/spark/sparkjs
 *
 * @Contributors
 *    David Middlecamp (david@spark.io)
 *    Edgar Silva (https://github.com/edgarsilva)
 *    Javier Cervantes (https://github.com/solojavier)
 *
 * @brief Basic API wrapper module
 ******************************************************************************
  Copyright (c) 2014 Spark Labs, Inc.  All rights reserved.

  This program is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation, either
  version 3 of the License, or (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this program; if not, see <http://www.gnu.org/licenses/>.
  ******************************************************************************
 */

/*jslint node: true */
'use strict';

/**
 * Creates a new Tinker obj
 * @constructor {Tinker}
 */
var Tinker = function(coreId, spark) {
  this.coreId = coreId;
  this.spark = spark;
};

Tinker.prototype.digitalWrite = function(pin, param, callback) {
  this.spark.callFunction(this.coreId, 'digitalWrite', pin + ':' + param, callback);
};

Tinker.prototype.digitalRead = function(pin, param, callback) {
  this.spark.callFunction(this.coreId, 'analogRead', pin + ':' + param, callback);
};

Tinker.prototype.analogRead = function(pin, param, callback) {
  this.spark.callFunction(this.coreId, 'analogRead', pin + ':' + param, callback);
};

Tinker.prototype.analogWrite = function(pin, param, callback) {
  this.spark.callFunction(this.coreId, 'analogWrite', pin + ':' + param, callback);
};

Tinker.prototype.flash = function(callback) {
  this.spark.flashTinker(this.coreId, callback);
};


/*
// Flash a custom binary to the spark core
Tinker.prototype.flash = function(callback) {
  this.spark.flashCore(this.coreId, './firmware/Tinker', callback);
};
*/

module.exports = Tinker;

@@ -1495,37 +1495,37 @@
 = function(pin, 
-param
+value
 , callback) %7B%0A  
@@ -1514,32 +1514,136 @@
 ue, callback) %7B%0A
+  console.log('pin:', pin);%0A  console.log('value:', value);%0A  console.log('param:', pin + ',' + value);%0A
   this.spark.cal
@@ -1669,25 +1669,25 @@
 Id, 'digital
-W
+w
 rite', pin +
@@ -1684,34 +1684,34 @@
 te', pin + '
-:
+,
 ' + 
-param
+value
 , callback);
@@ -1752,37 +1752,37 @@
 = function(pin, 
-param
+value
 , callback) %7B%0A  
@@ -1811,39 +1811,40 @@
 n(this.coreId, '
-analogR
+digitalr
 ead', pin + ':' 
@@ -1836,34 +1836,34 @@
 ad', pin + '
-:
+,
 ' + 
-param
+value
 , callback);
@@ -1903,37 +1903,37 @@
 = function(pin, 
-param
+value
 , callback) %7B%0A  
@@ -1976,17 +1976,17 @@
  'analog
-R
+r
 ead', pi
@@ -1986,34 +1986,34 @@
 ad', pin + '
-:
+,
 ' + 
-param
+value
 , callback);
@@ -2062,21 +2062,21 @@
 on(pin, 
-param
+value
 , callba
@@ -2123,25 +2123,25 @@
 eId, 'analog
-W
+w
 rite', pin +
@@ -2146,18 +2146,18 @@
  + '
-:
+,
 ' + 
-param
+value
 , ca

Fix plugin function calls and added flash function.