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: mbed LCD_DISCO_F469NIa SD_DISCO_F469NI BSP_DISCO_F469NIa EEPROM_DISCO_F469NI
draw_print_library.h
00001 #include "LCD_DISCO_F469NI.h" 00002 #include "SD_DISCO_F469NI.h" 00003 00004 #define PI 3.14159265358979323846 00005 #define BYTE_TO_BINARY_PATTERN "%c%c%c%c%c%c%c%c" //Pattern which converts uint8_t to binary(array of 8 chars) 00006 #define BYTE_TO_BINARY(byte)\ 00007 (byte & 0x80 ? '1' : '0'),\ 00008 (byte & 0x40 ? '1' : '0'),\ 00009 (byte & 0x20 ? '1' : '0'),\ 00010 (byte & 0x10 ? '1' : '0'),\ 00011 (byte & 0x08 ? '1' : '0'),\ 00012 (byte & 0x04 ? '1' : '0'),\ 00013 (byte & 0x02 ? '1' : '0'),\ 00014 (byte & 0x01 ? '1' : '0') 00015 00016 #define LOGOBIG_START_ADDR 0 //Address for Big Logo in SD Card used in Intro 00017 #define LOGOSMALL_START_ADDR 1536000 //Address for Small Logo in SD Card used as header 00018 #define BRANKO_START_ADDR 1576960 //Branko start address 00019 #define NEW_YEAR_CONGAT_START_ADDR 2056960 //New Year start address 00020 00021 const double PHI=53.13010235*PI/180; //Angles used in drawing Speedmeter. 00022 const double ALPHA=73.73979529*PI/180; // 00023 const double Vmax=150; 00024 00025 //Positions of Informations on screen 00026 const uint16_t GearXPos=272,GearYPos=95; //Gear in Main 00027 const uint16_t CapXPos = 300, CapYPos = 140; 00028 const uint16_t BatTempXPos=15,BatTempYPos=200; //Bat Temperature in Main 00029 const uint16_t LogoSmallXPos=625,LogoSmallYPos=5; //Small Logo, all three screens 00030 const uint16_t WaterTempXPos=15,WaterTempYPos=350; //Water Temperature in Main 00031 const uint16_t TPSXPos=569,TPSYPos=200; //TPS in Main 00032 const uint16_t HVVXPos=569,HVVYPos=350; 00033 const uint16_t RpmXPos=330,RpmYPos=30; //Bat Pressure in First Auxiliary 00034 const uint16_t MAPXPos=330,MAPYPos=90; //MAP in First Auxiliary 00035 const uint16_t AirTempXPos=330,AirTempYPos=150; //Air Temperature in First Auxiliary 00036 const uint16_t LambdaXPos=330,LambdaYPos=210; //Lambda Sensor value in First Auxiliary 00037 const uint16_t VoltsXPos=330,VoltsYPos=270; //Volts in Accumulator in First Auxiliary 00038 const uint16_t CrankXPos=330,CrankYPos=330; //Crank Error Message in First Auxiliary 00039 const uint16_t Meter_counterXPos=330,Meter_counterYPos=390; //Kilometer counter in First Auxiliary 00040 //YPos in bottom position for LVDTs 00041 const uint16_t FLLVDTBarXPos=280,FLLVDTBarYPos=200; //Front Left Bar LVDT in Second Auxiliary 00042 const uint16_t FRLVDTBarXPos=440,FRLVDTBarYPos=200; //Front Right Bar LVDT in Second Auxiliary 00043 const uint16_t RLLVDTBarXPos=280,RLLVDTBarYPos=410; //Rear Left Bar LVDT in Second Auxiliary 00044 const uint16_t RRLVDTBarXPos=440,RRLVDTBarYPos=410; //Rear Right Bar LVDT in Second Auxiliary 00045 const uint16_t FLLVDTXPos=10,FLLVDTYPos=100; //Front Left LVDT in Second Auxiliary 00046 const uint16_t FRLVDTXPos=534,FRLVDTYPos=100; //Front Right LVDT in Second Auxiliary 00047 const uint16_t RLLVDTXPos=10,RLLVDTYPos=310; //Rear Left LVDT in Second Auxiliary 00048 const uint16_t RRLVDTXPos=534,RRLVDTYPos=310; //Rear Right LVDT in Second Auxiliary 00049 00050 00051 typedef struct BWImage { //Black-White Image Structure. These are stored on the controller 00052 char name; 00053 uint16_t width; 00054 uint16_t height; 00055 uint8_t *bitmap; 00056 } GEAR,CHAR; 00057 00058 typedef struct RGBImage { //RGB Coloured Image Structure. These are stored on SD Card 00059 uint16_t width; 00060 uint16_t height; 00061 uint32_t START_ADDR; 00062 } IMAGE; 00063 00064 00065 void DrawSpeedMeter(); //Draw Speedmeter function 00066 void PrintChar(CHAR Char,uint16_t StartXPos,uint16_t StartYPos,uint32_t TextColor); //Print Char function 00067 void PrintString(char str[],int font,uint16_t StartXPos,uint16_t StartYPos,uint32_t TextColor); //Print String function 00068 void ChangeNumber(int num,int num0,int Font,uint16_t StartXPos, uint16_t StartYPos, int digits, int dec_point, int sign); //Update number function 00069 void SetNumber(int num,int Font,uint16_t StartXPos,uint16_t StartYPos, int digits, int dec_point, int sign); //Set number to specific value function 00070 void DrawRGBImage(IMAGE Image,uint16_t StartXPos,uint16_t StartYPos); //Draw RGB Coloured image function 00071 void UpdateSpeedMeter(int V,int dV); //Update Speedmeter function 00072 void ChangeCrank(int Crank); 00073 int UpdateCapBar(int H, int H0, uint16_t StartXPos, uint16_t StartYPos); //Update Crank error message function 00074 int UpdateLVDTScale(int H,int H0, uint16_t StartXPos, uint16_t StartYPos); //Update LVDT Bar function 00075 void BrakeSignal(uint16_t brake); //Set Brake signal function 00076 void TestFont(); 00077 void DrawBatTempMap(); 00078 void UpdateBatTempMap(); 00079 uint32_t TempColor(uint8_t temperature); 00080 void UpdateCellTemp(uint8_t hsegment, uint8_t row, uint8_t temp); //Test font 50 function 00081 void SetFixedAccTemp();
Generated on Tue Jul 12 2022 18:36:17 by
