Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: Adafruit_GFX Adafruit_ST7735 INA219 MODSERIAL MbedJSONValue mbed-rtos mbed
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
Generated on Wed Jul 13 2022 02:31:29 by
