|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include "DSP28x_Project.h"
|
|
|
|
#include "DSP2833x_Device.h"
|
|
|
|
#include "Protocol/CAN.h"
|
|
|
|
#include "Protocol/CAN_data.h"
|
|
|
|
#include "Protocol/DigitalIO.h"
|
|
|
|
#include "Protocol/MemoryMap.h"
|
|
|
|
|
|
|
|
#include "DSP28335/SCIBase.h"
|
|
|
|
#include "DSP28335/SCIB.h"
|
|
|
|
|
|
|
|
#include "ModbusRTU.h"
|
|
|
|
|
|
|
|
|
|
|
|
struct SoftwareVersion{
|
|
|
|
uint16_t DSP;
|
|
|
|
uint16_t CPLD;
|
|
|
|
};
|
|
|
|
|
|
|
|
class Periphery{
|
|
|
|
public:
|
|
|
|
Periphery();
|
|
|
|
void config();
|
|
|
|
uint16_t getVersionFPGA();
|
|
|
|
void updateVersionFPGA();
|
|
|
|
|
|
|
|
void receiveModbusParameters();
|
|
|
|
void getModbusConfiguration();
|
|
|
|
|
|
|
|
void processDigitalInput();
|
|
|
|
void processDigitalOutput();
|
|
|
|
|
|
|
|
void sendModbusDataToCPU();
|
|
|
|
void receiveCpuModbusData();
|
|
|
|
|
|
|
|
void canInterruptHandle();
|
|
|
|
|
|
|
|
private:
|
|
|
|
can_space::CAN _cana;
|
|
|
|
interface::DigitalIO _digitalIO;
|
|
|
|
uint16_t* _zone6_ptr;
|
|
|
|
|
|
|
|
DSP28335::SCIB _scib;
|
|
|
|
|
|
|
|
SoftwareVersion _softVersion;
|
|
|
|
can_space::CANMessage _message;
|
|
|
|
uint16_t _modbusRegCounter;
|
|
|
|
bool _error;
|
|
|
|
|
|
|
|
public:
|
|
|
|
MODBUSRTU::ModbusRTU modbusRTU;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|