| [b6aa0ba] | 1 | /*******************************************************************************
|
|---|
| 2 | MODULE : Hardware.h
|
|---|
| 3 | DESCRIPTION :
|
|---|
| 4 |
|
|---|
| 5 | 20101117 AB Initial
|
|---|
| 6 | 20180808 AB Adapted to CAN-Tester
|
|---|
| 7 | *******************************************************************************/
|
|---|
| 8 |
|
|---|
| 9 | // --- Includes ---------------------------------------------------------------
|
|---|
| 10 |
|
|---|
| 11 | // --- Pin Definitions --------------------------------------------------------
|
|---|
| 12 |
|
|---|
| 13 | // --- Defines ----------------------------------------------------------------
|
|---|
| 14 | //#define HW_MASTER 1 // set only for Master
|
|---|
| 15 | #undef HW_MASTER // without defined code works for master and slave
|
|---|
| 16 | // on-the-fly switching by DIP-switches (CAN-Tester)
|
|---|
| 17 |
|
|---|
| 18 | #ifdef HW_MASTER
|
|---|
| 19 | #define HW_DESCRIPTION "CAN-Mas" // description text, usually no more than 8 chars
|
|---|
| 20 | #define HW_MAC_ADDRESS 0x50A0 // default hardware MAC address if not defined in NVM
|
|---|
| 21 | #define HW_PRIORITY_CLASS 1 // prefered priority class
|
|---|
| 22 | #else
|
|---|
| 23 | #define HW_SLAVE 1 // set only for Slaves
|
|---|
| 24 |
|
|---|
| 25 | #define HW_DESCRIPTION "CAN-Slv" // description text, usually no more than 8 chars
|
|---|
| 26 | #define HW_MAC_ADDRESS 0xA0A0 // default hardware MAC address if not defined in NVM
|
|---|
| 27 | #define HW_PRIORITY_CLASS 16 // prefered priority class
|
|---|
| 28 | #endif //HW_MASTER
|
|---|
| 29 |
|
|---|
| 30 | #define HW_NUM_PRIORITY_GROUPS 32 // number of priority groups
|
|---|
| 31 | #define HW_NUM_SLAVES_PER_GROUP 16
|
|---|
| 32 |
|
|---|
| 33 | #define HW_LEN_DESC 0 //8
|
|---|
| 34 | #define HW_LEN_DESC_SHORT 0 //4
|
|---|
| 35 | #define HW_LEN_DESC_LONG 0 //64 // lengt of description strings without trailing '/0'
|
|---|
| 36 |
|
|---|
| 37 | #define HW_ADDR_NOT_DEFINED 0x200 // beyond top most address
|
|---|
| 38 | #define HW_FIRST_SLAVE_ADDR 0x10 // first valid slave address for USV_BatteryMonitor & CAN-Tester
|
|---|
| 39 |
|
|---|
| 40 | #define HW_EEPROM_24AA08 // type of EEPROM
|
|---|
| 41 | //#define HW_EEPROM_24LC256
|
|---|
| 42 |
|
|---|
| 43 | // --- Typedefs ---------------------------------------------------------------
|
|---|
| 44 |
|
|---|
| 45 | // --- PUBLIC Variables -------------------------------------------------------
|
|---|
| 46 |
|
|---|
| 47 | // --- Variables --------------------------------------------------------------
|
|---|
| 48 |
|
|---|
| 49 | // --- Macros -----------------------------------------------------------------
|
|---|
| 50 |
|
|---|
| 51 | // --- Functionprototypes -----------------------------------------------------
|
|---|
| 52 | void HwPreInit(void);
|
|---|
| 53 | void HwInit(void);
|
|---|
| 54 | void HwInit1(void);
|
|---|
| 55 | int HwGetMacAddr(void);
|
|---|
| 56 | void HwSetMacAddr(int);
|
|---|
| 57 | char *HwGetDescriptionShort(void);
|
|---|
| 58 | char *HwGetDescription(void);
|
|---|
| 59 | char *HwGetDescriptionLong(void);
|
|---|
| 60 | void HwSetDescriptionShort(char *);
|
|---|
| 61 | void HwSetDescription(char *);
|
|---|
| 62 | void HwSetDescriptionLong(char *);
|
|---|
| 63 |
|
|---|
| 64 | int HwGetIsAB(void);
|
|---|
| 65 | int HwGetType(void);
|
|---|
| 66 | int HwGetVersion(void);
|
|---|
| 67 | int HwGetRevision(void);
|
|---|
| 68 | int HwGetIssue(void);
|
|---|
| 69 | int HwGetBooterType(void);
|
|---|
| 70 | int HwGetBooterVersion(void);
|
|---|
| 71 | int HwGetBooterRevision(void);
|
|---|
| 72 | int HwGetBooterIssue(void);
|
|---|
| 73 | int HwGetAppType(void);
|
|---|
| 74 | int HwGetAppVersion(void);
|
|---|
| 75 | int HwGetAppRevision(void);
|
|---|
| 76 | int HwGetAppIssue(void);
|
|---|
| 77 |
|
|---|
| 78 | int HwGetPriorityClass (void);
|
|---|
| 79 | void HwSetPriorityClass (int);
|
|---|
| 80 | void HwTraceInfo(void);
|
|---|
| 81 | void HwTraceVoltages(void);
|
|---|
| 82 | void HwTicker500ms(void);
|
|---|
| 83 | void HwLoggingToggle(void);
|
|---|
| 84 | void HwLogging(BOOL flag);
|
|---|
| 85 | void HwSetCorrectionVolt(int);
|
|---|
| 86 | void HwSetCorrectionCurrentGain(int);
|
|---|
| 87 | void HwSetCorrectionCurrentZero(void);
|
|---|
| 88 | int HwGetLineVoltage(void);
|
|---|
| 89 | int HwGetVcap(void);
|
|---|
| 90 | int HwGetEnergy(void);
|
|---|
| 91 | int HwGetCurrent(void);
|
|---|
| 92 | void HwTraceCorrection(void);
|
|---|
| 93 | void HwPcmPower(BOOL bState);
|
|---|
| 94 | int HwGetPcmCurrent(void);
|
|---|
| 95 | void HwStartFastStart(BOOL bState);
|
|---|
| 96 | void HwSyncAddrToDIP(void);
|
|---|
| 97 |
|
|---|
| 98 | ;
|
|---|
| 99 | void _delay_us( int us );
|
|---|
| 100 |
|
|---|
| 101 |
|
|---|