Konacan kod

Dependencies:   BSP_DISCO_F469NIa EEPROM_DISCO_F469NI LCD_DISCO_F469NIa SD_DISCO_F469NI mbed

Fork of IntegrationCAN by Nenad Djalovic

Committer:
formulas
Date:
Thu Jun 28 16:33:23 2018 +0000
Revision:
2:f54f01527ebb
Parent:
0:38c3afd99aeb
a

Who changed what in which revision?

UserRevisionLine numberNew contents of line
formulas 0:38c3afd99aeb 1 #include "LCD_DISCO_F469NI.h"
formulas 0:38c3afd99aeb 2 #include "SD_DISCO_F469NI.h"
formulas 0:38c3afd99aeb 3
formulas 2:f54f01527ebb 4 #define PI 3.14159265358979323846
formulas 0:38c3afd99aeb 5 #define BYTE_TO_BINARY_PATTERN "%c%c%c%c%c%c%c%c" //Pattern which converts uint8_t to binary(array of 8 chars)
formulas 0:38c3afd99aeb 6 #define BYTE_TO_BINARY(byte)\
formulas 0:38c3afd99aeb 7 (byte & 0x80 ? '1' : '0'),\
formulas 0:38c3afd99aeb 8 (byte & 0x40 ? '1' : '0'),\
formulas 0:38c3afd99aeb 9 (byte & 0x20 ? '1' : '0'),\
formulas 0:38c3afd99aeb 10 (byte & 0x10 ? '1' : '0'),\
formulas 0:38c3afd99aeb 11 (byte & 0x08 ? '1' : '0'),\
formulas 0:38c3afd99aeb 12 (byte & 0x04 ? '1' : '0'),\
formulas 0:38c3afd99aeb 13 (byte & 0x02 ? '1' : '0'),\
formulas 0:38c3afd99aeb 14 (byte & 0x01 ? '1' : '0')
formulas 0:38c3afd99aeb 15
formulas 0:38c3afd99aeb 16 #define LOGOBIG_START_ADDR 0 //Address for Big Logo in SD Card used in Intro
formulas 0:38c3afd99aeb 17 #define LOGOSMALL_START_ADDR 1536000 //Address for Small Logo in SD Card used as header
formulas 0:38c3afd99aeb 18 #define BRANKO_START_ADDR 1576960 //Branko start address
formulas 0:38c3afd99aeb 19 #define NEW_YEAR_CONGAT_START_ADDR 2056960 //New Year start address
formulas 0:38c3afd99aeb 20
formulas 0:38c3afd99aeb 21 const double PHI=53.13010235*PI/180; //Angles used in drawing Speedmeter.
formulas 0:38c3afd99aeb 22 const double ALPHA=73.73979529*PI/180; //
formulas 0:38c3afd99aeb 23 const double Vmax=150;
formulas 0:38c3afd99aeb 24
formulas 0:38c3afd99aeb 25 //Positions of Informations on screen
formulas 0:38c3afd99aeb 26 const uint16_t GearXPos=272,GearYPos=95; //Gear in Main
formulas 0:38c3afd99aeb 27 const uint16_t OilTempXPos=15,OilTempYPos=200; //Oil Temperature in Main
formulas 0:38c3afd99aeb 28 const uint16_t LogoSmallXPos=635,LogoSmallYPos=5; //Small Logo, all three screens
formulas 0:38c3afd99aeb 29 const uint16_t WaterTempXPos=15,WaterTempYPos=350; //Water Temperature in Main
formulas 0:38c3afd99aeb 30 const uint16_t TPSXPos=569,TPSYPos=200; //TPS in Main
formulas 2:f54f01527ebb 31 const uint16_t OilPXPos=330,OilPYPos=30; //Oil Pressure in First Auxiliary
formulas 2:f54f01527ebb 32 const uint16_t MAPXPos=330,MAPYPos=90; //MAP in First Auxiliary
formulas 2:f54f01527ebb 33 const uint16_t AirTempXPos=330,AirTempYPos=150; //Air Temperature in First Auxiliary
formulas 2:f54f01527ebb 34 const uint16_t LambdaXPos=330,LambdaYPos=210; //Lambda Sensor value in First Auxiliary
formulas 2:f54f01527ebb 35 const uint16_t VoltsXPos=330,VoltsYPos=270; //Volts in Accumulator in First Auxiliary
formulas 2:f54f01527ebb 36 const uint16_t CrankXPos=330,CrankYPos=330; //Crank Error Message in First Auxiliary
formulas 2:f54f01527ebb 37 const uint16_t Meter_counterXPos=330,Meter_counterYPos=390; //Kilometer counter in First Auxiliary
formulas 0:38c3afd99aeb 38 //YPos in bottom position for LVDTs
formulas 0:38c3afd99aeb 39 const uint16_t FLLVDTBarXPos=280,FLLVDTBarYPos=200; //Front Left Bar LVDT in Second Auxiliary
formulas 0:38c3afd99aeb 40 const uint16_t FRLVDTBarXPos=440,FRLVDTBarYPos=200; //Front Right Bar LVDT in Second Auxiliary
formulas 0:38c3afd99aeb 41 const uint16_t RLLVDTBarXPos=280,RLLVDTBarYPos=410; //Rear Left Bar LVDT in Second Auxiliary
formulas 0:38c3afd99aeb 42 const uint16_t RRLVDTBarXPos=440,RRLVDTBarYPos=410; //Rear Right Bar LVDT in Second Auxiliary
formulas 0:38c3afd99aeb 43 const uint16_t FLLVDTXPos=10,FLLVDTYPos=100; //Front Left LVDT in Second Auxiliary
formulas 0:38c3afd99aeb 44 const uint16_t FRLVDTXPos=534,FRLVDTYPos=100; //Front Right LVDT in Second Auxiliary
formulas 0:38c3afd99aeb 45 const uint16_t RLLVDTXPos=10,RLLVDTYPos=310; //Rear Left LVDT in Second Auxiliary
formulas 0:38c3afd99aeb 46 const uint16_t RRLVDTXPos=534,RRLVDTYPos=310; //Rear Right LVDT in Second Auxiliary
formulas 0:38c3afd99aeb 47
formulas 0:38c3afd99aeb 48
formulas 2:f54f01527ebb 49 typedef struct BWImage { //Black-White Image Structure. These are stored on the controller
formulas 0:38c3afd99aeb 50 char name;
formulas 0:38c3afd99aeb 51 uint16_t width;
formulas 0:38c3afd99aeb 52 uint16_t height;
formulas 0:38c3afd99aeb 53 uint8_t *bitmap;
formulas 2:f54f01527ebb 54 } GEAR,CHAR;
formulas 0:38c3afd99aeb 55
formulas 2:f54f01527ebb 56 typedef struct RGBImage { //RGB Coloured Image Structure. These are stored on SD Card
formulas 0:38c3afd99aeb 57 uint16_t width;
formulas 0:38c3afd99aeb 58 uint16_t height;
formulas 0:38c3afd99aeb 59 uint32_t START_ADDR;
formulas 2:f54f01527ebb 60 } IMAGE;
formulas 2:f54f01527ebb 61
formulas 0:38c3afd99aeb 62
formulas 0:38c3afd99aeb 63 void DrawSpeedMeter(); //Draw Speedmeter function
formulas 0:38c3afd99aeb 64 void PrintChar(CHAR Char,uint16_t StartXPos,uint16_t StartYPos,uint32_t TextColor); //Print Char function
formulas 0:38c3afd99aeb 65 void PrintString(char str[],int font,uint16_t StartXPos,uint16_t StartYPos,uint32_t TextColor); //Print String function
formulas 0:38c3afd99aeb 66 void ChangeNumber(int num,int num0,int Font,uint16_t StartXPos, uint16_t StartYPos, int digits, int dec_point, int sign); //Update number function
formulas 0:38c3afd99aeb 67 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
formulas 0:38c3afd99aeb 68 void DrawRGBImage(IMAGE Image,uint16_t StartXPos,uint16_t StartYPos); //Draw RGB Coloured image function
formulas 0:38c3afd99aeb 69 void UpdateSpeedMeter(int V,int dV); //Update Speedmeter function
formulas 0:38c3afd99aeb 70 void ChangeCrank(int Crank); //Update Crank error message function
formulas 0:38c3afd99aeb 71 int UpdateLVDTScale(int H,int H0, uint16_t StartXPos, uint16_t StartYPos); //Update LVDT Bar function
formulas 0:38c3afd99aeb 72 void BrakeSignal(int brake); //Set Brake signal function
formulas 0:38c3afd99aeb 73 void TestFont(); //Test font 50 function