/* * Alink.h * * Created on: 16. 6. 2020 * Author: Adcis */ #ifndef INC_ALINK_H_ #define INC_ALINK_H_ #include "main.h" #define ALINK_CTL_ENABLE //povoleni rizeni pres Alink #define VERSION 0x02 //verze hardware #define SUB_VERSION 0x01 //verze software #define RELEASE 0x00 //je = 1 / neni = 0 release verze softwaru #define BUGFIX 0x00 //cislo bugfixu (HW verze desky) //Flash data #define SERIAL_ADDRESS ((uint32_t)0x0800F000) #define ALINK_CTL_ADDRESS ((uint32_t)0x0800F400) #define ALINK_CTLB_ADDRES ((uint32_t)0x0800F404) #define CALIB_ADDRESS ((uint32_t)0x0800FC00) //komunikace #define CRC_CHCK #define ADDRESS 0x31 //adresa desky na SS sbernici #define DEF_BYTES_IN_RX 0xFF //velikost RX bufferu #define RX_BUFFER DEF_BYTES_IN_RX #define DEBUG_BUFFER 0xFF #define COMMAND_MASK 0x7F #define BROADCAST_MSK 0x80 #define STATE_ASK 0x03 //otazka na stav desky (errory) //0x03 #define STATE_REPLY 0x04 //odpoved na stav //0x04 #define SW_VER_ASK 0x05 //otazka na verzi sw //0x05 #define STATUS 0x06 //otazka na status chyb //0x06 #define ALINK_TOGGLE 0x40 //toggle Alink rizeni //address space #define LCBADDRMIN 0x10 #define LCBADDRMAX 0x17 #ifdef ALINK_CTL_ENABLE #define ALINK_CTRL 0x30 //prikaz pro manualni rizeni #define ALINK_CHARGE_ON 0x01 //turn on charging #define ALINK_CHARGE_OFF 0x00 //turn off charging #define ALINK_RE_ERR_ON 0x02 //turn on RE_ERR #define ALINK_RE_ERR_OFF 0x03 //turn off RE_ERR #define ALINK_EMERG_STOP 0x10 //emergency state of softstart disable #define ALINK_EMERG_GO 0x11 //emergency state of softstart enable #define ALINK_FLASH_SN 0x20 //flash serial number #define ALINK_CRG_CAL 0x21 //calibrate charging by C- #define ALINK_BRD_RST 0xFA //reset whole board - comment to disable #endif void TxParseMSG(UART_HandleTypeDef *huart, int type, uint8_t CMD, uint8_t mess, uint8_t addr); void RxParseMSG(UART_HandleTypeDef *huart, uint8_t *dataBuffer); #endif /* INC_ALINK_H_ */