babblebots
Advanced tools
Comparing version 0.2.61 to 0.2.63
@@ -12,3 +12,3 @@ module.exports = { | ||
{ | ||
name: "neopixels", | ||
name: "neopixels1", | ||
type: "neopixels", | ||
@@ -15,0 +15,0 @@ pins: { |
{ | ||
"name": "babblebots", | ||
"version": "0.2.61", | ||
"version": "0.2.63", | ||
"description": "BabbleBots allows you to declaratively generate thin NodeBots clients in appropriate languages for IoT microcontrollers\"", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
var fs = require('fs'); | ||
var path = require('path'); | ||
var ejs = require('ejs'); | ||
var _ = require('lodash'); | ||
var Platform = require('../../../../lib/Platform.js'); | ||
var Component = require('../../../../lib/component.js'); | ||
var Neopixels = { | ||
@@ -15,3 +16,3 @@ name: 'neopixels', | ||
'neopixel.h': 'https://raw.githubusercontent.com/technobly/SparkCore-NeoPixel/master/firmware/neopixel.h', | ||
'neopixel.cpp': 'https://raw.githubusercontent.com/technobly/SparkCore-NeoPixel/master/firmware/neopixel.cpp': | ||
'neopixel.cpp': 'https://raw.githubusercontent.com/technobly/SparkCore-NeoPixel/master/firmware/neopixel.cpp' | ||
}, | ||
@@ -23,11 +24,11 @@ includes:[ | ||
pixels: 'templates/pixels.tmpl' | ||
} | ||
}, | ||
preInit: function(build, component){ | ||
build.map.preInit.push('#define PIXEL_PIN ' + component.pins.data + | ||
'\n#define PIXEL_COUNT ' + component.options.length + | ||
'\n#define PIXEL_TYPE ' + component.options.type + '\n\n' + | ||
'Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);'); | ||
build.map.preInit.push('#define PIXEL_PIN_' + component.name.toUpperCase() + ' ' + component.pins.data + | ||
'\n#define PIXEL_COUNT_' + component.name.toUpperCase() + ' ' + component.options.length + | ||
'\n#define PIXEL_TYPE_' + component.name.toUpperCase() + ' ' + component.options.type + '\n\n' + | ||
'Adafruit_NeoPixel strip_' + component.name + ' = Adafruit_NeoPixel(PIXEL_COUNT_' + component.name.toUpperCase() + ', PIXEL_PIN_' + component.name.toUpperCase() + ', PIXEL_TYPE_' + component.name.toUpperCase() + ');'); | ||
}, | ||
init: function(build){ | ||
build.map.init.push('\tstrip.begin();\n\tstrip.show();'); | ||
init: function(build, component){ | ||
build.map.init.push('\tstrip_' + component.name + '.begin();\n\tstrip_' + component.name + '.show();'); | ||
}, | ||
@@ -46,3 +47,3 @@ loop: function(build){ | ||
build.map.init.push('\n\tParticle.function("' + func + '", ' + func + ');'); | ||
build.map.init.push('\n\tParticle.function("' + func + '_' + component.name + '", ' + func + '_' + component.name + ');'); | ||
@@ -57,2 +58,4 @@ var result = fs.readFileSync(path.join(__dirname, Neopixels.compFunctions[func])); | ||
_.extend(Neopixels, Component); | ||
module.exports = Neopixels; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
153559
427