3rd year group project. Electronic and Electrical Engineering. Heriot-Watt University. This is the code for the mbed for the Automatic Little Object Organiser (ALOO).
Dependencies: MCP23017 TCS3472_I2C WattBob_TextLCD mbed
Diff: Block.h
- Revision:
- 6:98fe30430194
- Child:
- 7:b6e31bfdb2af
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Block.h Mon Nov 16 05:10:17 2015 +0000 @@ -0,0 +1,71 @@ +/* + * Block.h + * + * Created on: 16 Nov 2015 + * Author: chandansiyag + */ + +#ifndef _block_h_ +#define _block_h_ + +class Block { +public: + enum Size {Small = 0, Big = 1}; + Block(); + Block(Size size); + Block(const Block& rhs); + virtual ~Block(); + + Size size; + Colour *minColour = &_minColour; + Colour *maxColour = &_maxColour; + +private: + Colour _minColour = Colour(); + Colour _maxColour = Colour(); +}; + +class Colour{ + public: + Colour(); + Colour(const Colour& rhs); + virtual ~Colour(); + + enum Components {Red = 0, Blue = 1, Green = 2, Alpha = 3}; + + unsigned int components [4]; + + unsigned int getAlpha() const { + return components[Alpha]; + } + + void setAlpha(unsigned int alpha) { + this->components[Alpha] = alpha; + } + + unsigned int getBlue() const { + return components[Blue]; + } + + void setBlue(unsigned int blue) { + this->components[Blue] = blue; + } + + unsigned int getGreen() const { + return components[Green]; + } + + void setGreen(unsigned int green) { + this->components[Green] = green; + } + + unsigned int getRed() const { + return components[Red]; + } + + void setRed(unsigned int red) { + this->components[Red] = red; + } +}; + +#endif /* _block_h_ */