Skip to content

Commit 4371b74

Browse files
committed
add color block
1 parent 4fa0952 commit 4371b74

File tree

4 files changed

+59
-0
lines changed

4 files changed

+59
-0
lines changed

src/AdafruitIO_Dashboard.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,8 @@ ChartBlock* AdafruitIO_Dashboard::addChartBlock(AdafruitIO_Feed *feed)
8888
{
8989
return new ChartBlock(this, feed);
9090
}
91+
92+
ColorBlock* AdafruitIO_Dashboard::addColorBlock(AdafruitIO_Feed *feed)
93+
{
94+
return new ColorBlock(this, feed);
95+
}

src/AdafruitIO_Dashboard.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "blocks/GaugeBlock.h"
2121
#include "blocks/TextBlock.h"
2222
#include "blocks/ChartBlock.h"
23+
#include "blocks/ColorBlock.h"
2324

2425
// forward declaration
2526
class AdafruitIO;
@@ -42,6 +43,7 @@ class AdafruitIO_Dashboard {
4243
GaugeBlock* addGaugeBlock(AdafruitIO_Feed *feed);
4344
TextBlock* addTextBlock(AdafruitIO_Feed *feed);
4445
ChartBlock* addChartBlock(AdafruitIO_Feed *feed);
46+
ColorBlock* addColorBlock(AdafruitIO_Feed *feed);
4547

4648
private:
4749
AdafruitIO *_io;

src/blocks/ColorBlock.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//
2+
// Adafruit invests time and resources providing this open source code.
3+
// Please support Adafruit and open source hardware by purchasing
4+
// products from Adafruit!
5+
//
6+
// Copyright (c) 2015-2016 Adafruit Industries
7+
// Authors: Tony DiCola, Todd Treece
8+
// Licensed under the MIT license.
9+
//
10+
// All text above must be included in any redistribution.
11+
//
12+
#include "ColorBlock.h"
13+
14+
ColorBlock::ColorBlock(AdafruitIO_Dashboard *d, AdafruitIO_Feed *f) : AdafruitIO_Block(d, f) {}
15+
16+
ColorBlock::~ColorBlock(){}
17+
18+
String ColorBlock::properties()
19+
{
20+
String props = "{}";
21+
return props;
22+
}

src/blocks/ColorBlock.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//
2+
// Adafruit invests time and resources providing this open source code.
3+
// Please support Adafruit and open source hardware by purchasing
4+
// products from Adafruit!
5+
//
6+
// Copyright (c) 2015-2016 Adafruit Industries
7+
// Authors: Tony DiCola, Todd Treece
8+
// Licensed under the MIT license.
9+
//
10+
// All text above must be included in any redistribution.
11+
//
12+
#ifndef ADAFRUITIO_COLORBLOCK_H
13+
#define ADAFRUITIO_COLORBLOCK_H
14+
15+
#include "AdafruitIO_Block.h"
16+
17+
class ColorBlock : public AdafruitIO_Block {
18+
19+
public:
20+
ColorBlock(AdafruitIO_Dashboard *d, AdafruitIO_Feed *f);
21+
~ColorBlock();
22+
23+
String properties();
24+
25+
private:
26+
const char *_visual_type = "color_picker";
27+
28+
};
29+
30+
#endif // ADAFRUITIO_COLORBLOCK_H

0 commit comments

Comments
 (0)