Augustine Kizito / Mbed 2 deprecated Solar_Powered_Smart_Camera

Dependencies:   Adafruit_GFX Adafruit_ST7735 INA219 MODSERIAL MbedJSONValue mbed-rtos mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SettingsIcon.h Source File

SettingsIcon.h

00001 #ifndef SETTINGSICON_H
00002 #define SETTINGSICON_H
00003 
00004 class SettingsIcon
00005 {
00006 public:
00007     SettingsIcon(uint8_t xCoordinate, uint8_t yCoordinate, uint16_t backgroundColor );
00008     void drawSettingsIcon();
00009 
00010 private:    
00011     uint8_t startingWidth;
00012     uint8_t startingHeight;
00013     uint16_t bgColor;
00014     uint16_t drawColor;
00015 };
00016 
00017 SettingsIcon::SettingsIcon(uint8_t xCoordinate, uint8_t yCoordinate, uint16_t backgroundColor){
00018     
00019     // set the centre of the big circle
00020     startingWidth = xCoordinate + 23;
00021     startingHeight = yCoordinate + 23;
00022 
00023     // set the backgroundColor
00024     bgColor = backgroundColor;
00025     
00026     // determine the color of the lines on the solar panel
00027     if (bgColor == ST7735_WHITE ) {
00028         drawColor = ST7735_BLACK;
00029     } else if (bgColor == ST7735_BLACK) {
00030         drawColor = ST7735_WHITE;
00031     }
00032     
00033 }
00034 
00035 void SettingsIcon::drawSettingsIcon(){
00036     
00037     // radii of outer circles (background circles)
00038     int outerRad = 7;
00039     
00040     // radius of inner circle (background circle)
00041     int innerRad = 7;
00042     
00043     // radius of big circle
00044     int rad = 23;
00045     
00046     // distance to radius of circles along the horizontal 
00047     // and vertical axis of the big circle
00048     int horAndVar = 23; 
00049     
00050     // distance to radius of circles at 45 degrees 
00051     // from the centre of the big circle
00052     int sides = 16; 
00053     
00054     
00055     // draw big circle
00056     tft.fillCircle(startingWidth, startingHeight, rad, drawColor);  
00057     
00058     // draw inner small background circle
00059     tft.fillCircle(startingWidth, startingHeight, innerRad, bgColor);
00060     
00061     // draw outer small background circles
00062     
00063     // along vertical and horizontal axis
00064     tft.fillCircle(startingWidth, startingHeight-horAndVar, outerRad, bgColor);
00065     tft.fillCircle(startingWidth, startingHeight+horAndVar, outerRad, bgColor);
00066     
00067     tft.fillCircle(startingWidth-horAndVar, startingHeight, outerRad, bgColor);
00068     tft.fillCircle(startingWidth+horAndVar, startingHeight, outerRad, bgColor);
00069     
00070     // along 45 degrees
00071     tft.fillCircle(startingWidth+sides, startingHeight-sides, outerRad, bgColor);
00072     tft.fillCircle(startingWidth+sides, startingHeight+sides, outerRad, bgColor);
00073     
00074     tft.fillCircle(startingWidth-sides, startingHeight-sides, outerRad, bgColor);
00075     tft.fillCircle(startingWidth-sides, startingHeight+sides, outerRad, bgColor);    
00076 }
00077 #endif