void Motor::setSpeed( int speed) { this->speed = speed; updatePins(); }
// via Michael Vogt/neophob: empty constructor is used when strand length // isn't known at compile-time; situations where program config might be // read from internal flash memory or an SD card, or arrive via serial // command. If using this constructor, MUST follow up with updateLength() // and updatePins() to establish the strand length and output pins! // Also, updateOrder() to change RGB vs GRB order (RGB is default). Adafruit_WS2801::Adafruit_WS2801(void) { begun = false; numLEDs = 0; pixels = NULL; rgb_order = WS2801_RGB; updatePins(); // Must assume hardware SPI until pins are set }
bool Motor::handleMessage( const Message& message) { bool handled = false; // MOTOR_CONFIG if (message.getMessageId() == MotorConfigMsg::MESSAGE_ID) { Logger::logDebug("Motor Config\n"); handled = true; const MotorConfigMsg* castMessage = static_cast<const MotorConfigMsg*>(&message); // speed speed = castMessage->getSpeed(); Logger::logDebug("Speed = " + String(speed) + "\n"); updatePins(); Message* replyMessage = new MotorConfigReplyMsg(speed); replyMessage->address(getId(), message.getSource()); MessageRouter::getInstance()->sendMessage(*replyMessage); } return (handled); }
// Constructor for use with a matrix configuration, specify w, h for size of matrix // assumes configuration where string starts at coordinate 0,0 and continues to w-1,0, w-1,1 // and on to 0,1, 0,2 and on to w-1,2 and so on. Snaking back and forth till the end. // other function calls with provide access to pixels via an x,y coordinate system Adafruit_WS2801::Adafruit_WS2801(uint16_t w, uint16_t h, uint8_t dpin, uint8_t cpin, uint8_t order) { rgb_order = order; alloc(w * h); width = w; height = h; updatePins(dpin, cpin); }
// Constructor for use with arbitrary clock/data pins: Adafruit_WS2801::Adafruit_WS2801(uint16_t n, uint8_t dpin, uint8_t cpin, uint8_t order) { rgb_order = order; alloc(n,pixels,numLEDs); updatePins(dpin, cpin); }
// via Michael Vogt/neophob: empty constructor is used when strip length // isn't known at compile-time; situations where program config might be // read from internal flash memory or an SD card, or arrive via serial // command. If using this constructor, MUST follow up with updateLength() // and updatePins() to establish the strip length and output pins! LPD8806::LPD8806(void) { numLEDs = numBytes = 0; pixels = NULL; begun = false; updatePins(); // Must assume hardware SPI until pins are set }
// Constructor for use with arbitrary clock/data pins: LPD8806::LPD8806(uint16_t n, uint8_t dpin, uint8_t cpin) { pixels = NULL; begun = false; updateLength(n); updatePins(dpin, cpin); }
// Constructor for use with hardware SPI (specific clock/data pins): LPD8806::LPD8806(uint16_t n) { pixels = NULL; begun = false; updateLength(n); updatePins(); }
// Constructor for use with hardware SPI (specific clock/data pins): Adafruit_WS2801::Adafruit_WS2801(uint16_t n, uint8_t order) { rgb_order = order; alloc(n); updatePins(); }