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 "mbed.h"
formulas 2:f54f01527ebb 2 #include "SD_DISCO_F469NI.h"
formulas 2:f54f01527ebb 3 #include "EEPROM_DISCO_F469NI.h"
formulas 2:f54f01527ebb 4
formulas 0:38c3afd99aeb 5
formulas 0:38c3afd99aeb 6 //CAN Identificators
formulas 0:38c3afd99aeb 7 #define DTA_1 0x2000
formulas 0:38c3afd99aeb 8 #define DTA_2 0x2001
formulas 0:38c3afd99aeb 9 #define DTA_3 0x2002
formulas 0:38c3afd99aeb 10 #define DTA_4 0x2003
formulas 0:38c3afd99aeb 11 #define DTA_5 0x2004
formulas 2:f54f01527ebb 12 #define DTA_6 0x2005
formulas 0:38c3afd99aeb 13 // This IDs can be changed as they are our own IDs
formulas 2:f54f01527ebb 14 #define LVDT_FRONT 0x1006
formulas 2:f54f01527ebb 15 #define LVDT_REAR 0x1007
formulas 2:f54f01527ebb 16 #define BRAKES 0x1008
formulas 2:f54f01527ebb 17 #define DISTANCE 0x0009
formulas 0:38c3afd99aeb 18 // If we add some other IDs in the vehicle add them here
formulas 0:38c3afd99aeb 19
formulas 2:f54f01527ebb 20 #define DISTANCE_MEMORY_ADDR 3592960 //Start address in SD card memory reserved for Distance Statistics.
formulas 2:f54f01527ebb 21
formulas 0:38c3afd99aeb 22
formulas 0:38c3afd99aeb 23 //List of functions
formulas 2:f54f01527ebb 24
formulas 2:f54f01527ebb 25 void CANMsgReceive(); // CAN RX Interrupt Function
formulas 0:38c3afd99aeb 26
formulas 0:38c3afd99aeb 27 void UpdateInfo(); // Update info for DTA values
formulas 0:38c3afd99aeb 28
formulas 0:38c3afd99aeb 29 uint16_t * AllocData(CANMessage msg); // Unpack CAN message
formulas 0:38c3afd99aeb 30
formulas 2:f54f01527ebb 31 void InitDistanceMeter(uint16_t newData[4]); // Initialise Distance Meter
formulas 2:f54f01527ebb 32
formulas 0:38c3afd99aeb 33 //Update values
formulas 0:38c3afd99aeb 34 void UpdateInfoDTA1(uint16_t newData[4]); // Update values for DTA1 message
formulas 0:38c3afd99aeb 35 void UpdateInfoDTA2(uint16_t newData[4]); // Update values for DTA2 message
formulas 0:38c3afd99aeb 36 void UpdateInfoDTA3(uint16_t newData[4]); // Update values for DTA3 message
formulas 0:38c3afd99aeb 37 void UpdateInfoDTA4(uint16_t newData[4]); // Update values for DTA4 message
formulas 0:38c3afd99aeb 38 void UpdateInfoDTA5(uint16_t newData[4]); // Update values for DTA5 message
formulas 0:38c3afd99aeb 39 void UpdateInfoDTA6(uint16_t newData[4]); // Update values for DTA6 message
formulas 2:f54f01527ebb 40 void UpdateMeterCounter();
formulas 2:f54f01527ebb 41 void send(uint16_t ID, char dta[8]);
formulas 0:38c3afd99aeb 42 void UpdateInfoLVDTFront(uint16_t newData[4]); // Update values for LVDTFront message
formulas 0:38c3afd99aeb 43 void UpdateInfoLVDTRear(uint16_t newData[4]); // Update values for LVDTRear message
formulas 0:38c3afd99aeb 44 void UpdateInfoBrakes(uint16_t newData[4]); // Update values for Brakes message