parts of p60dock handler
This commit is contained in:
parent
fa58479b34
commit
87e121f016
@ -129,6 +129,14 @@ void InitMission::initTasks(){
|
|||||||
sif::error << "Object add component failed" << std::endl;
|
sif::error << "Object add component failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Device Handler */
|
||||||
|
PeriodicTaskIF* DeviceHandler = TaskFactory::instance()->
|
||||||
|
createPeriodicTask("Device Handler", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE,
|
||||||
|
1, nullptr);
|
||||||
|
result = DeviceHandler->addComponent(objects::P60DOCK_HANDLER);
|
||||||
|
if(result!=HasReturnvaluesIF::RETURN_OK){
|
||||||
|
sif::error << "Object add component failed" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
#if ADD_TEST_CODE == 1
|
#if ADD_TEST_CODE == 1
|
||||||
// FixedTimeslotTaskIF* TestTimeslotTask = TaskFactory::instance()->
|
// FixedTimeslotTaskIF* TestTimeslotTask = TaskFactory::instance()->
|
||||||
@ -160,6 +168,8 @@ void InitMission::initTasks(){
|
|||||||
PusHighPrio->startTask();
|
PusHighPrio->startTask();
|
||||||
PusMedPrio->startTask();
|
PusMedPrio->startTask();
|
||||||
PusLowPrio->startTask();
|
PusLowPrio->startTask();
|
||||||
|
|
||||||
|
DeviceHandler->startTask();
|
||||||
#if ADD_TEST_CODE == 1
|
#if ADD_TEST_CODE == 1
|
||||||
// TestTimeslotTask->startTask();
|
// TestTimeslotTask->startTask();
|
||||||
P60DockTestTask->startTask();
|
P60DockTestTask->startTask();
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
CXXSRC += $(wildcard $(CURRENTPATH)/*.cpp)
|
CXXSRC += $(wildcard $(CURRENTPATH)/*.cpp)
|
||||||
|
CXXSRC += $(wildcard $(CURRENTPATH)/comIF/cookies/*.cpp)
|
||||||
|
CXXSRC += $(wildcard $(CURRENTPATH)/comIF/*.cpp)
|
||||||
CSRC += $(wildcard $(CURRENTPATH)/*.c)
|
CSRC += $(wildcard $(CURRENTPATH)/*.c)
|
||||||
|
|
||||||
CSRC += $(wildcard $(CURRENTPATH)/boardconfig/*.c)
|
CSRC += $(wildcard $(CURRENTPATH)/boardconfig/*.c)
|
@ -1,324 +1,324 @@
|
|||||||
#include "ArduinoCookie.h"
|
//#include "cookies/ArduinoCookie.h"
|
||||||
#include "ArduinoComIF.h"
|
//#include "ArduinoComIF.h"
|
||||||
|
//
|
||||||
#include <fsfw/globalfunctions/DleEncoder.h>
|
//#include <fsfw/globalfunctions/DleEncoder.h>
|
||||||
#include <stdio.h>
|
//#include <stdio.h>
|
||||||
#include <string.h>
|
//#include <string.h>
|
||||||
#include <unistd.h>
|
//#include <unistd.h>
|
||||||
#include <fcntl.h>
|
//#include <fcntl.h>
|
||||||
#include <errno.h>
|
//#include <errno.h>
|
||||||
#include <fsfw/globalfunctions/CRC.h>
|
//#include <fsfw/globalfunctions/CRC.h>
|
||||||
|
//
|
||||||
#include <termios.h>
|
//#include <termios.h>
|
||||||
|
//
|
||||||
ArduinoCommInterface::ArduinoCommInterface(object_id_t setObjectId,
|
//ArduinoCommInterface::ArduinoCommInterface(object_id_t setObjectId,
|
||||||
const char *serialDevice) :
|
// const char *serialDevice) :
|
||||||
spiMap(MAX_NUMBER_OF_SPI_DEVICES), rxBuffer(
|
// spiMap(MAX_NUMBER_OF_SPI_DEVICES), rxBuffer(
|
||||||
MAX_PACKET_SIZE * MAX_NUMBER_OF_SPI_DEVICES*10, true), SystemObject(setObjectId) {
|
// MAX_PACKET_SIZE * MAX_NUMBER_OF_SPI_DEVICES*10, true), SystemObject(setObjectId) {
|
||||||
initialized = false;
|
// initialized = false;
|
||||||
serialPort = ::open("/dev/ttyUSB0", O_RDWR);
|
// serialPort = ::open("/dev/ttyUSB0", O_RDWR);
|
||||||
|
//
|
||||||
if (serialPort < 0) {
|
// if (serialPort < 0) {
|
||||||
//configuration error
|
// //configuration error
|
||||||
printf("Error %i from open: %s\n", errno, strerror(errno));
|
// printf("Error %i from open: %s\n", errno, strerror(errno));
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
struct termios tty;
|
// struct termios tty;
|
||||||
memset(&tty, 0, sizeof tty);
|
// memset(&tty, 0, sizeof tty);
|
||||||
|
//
|
||||||
// Read in existing settings, and handle any error
|
// // Read in existing settings, and handle any error
|
||||||
if (tcgetattr(serialPort, &tty) != 0) {
|
// if (tcgetattr(serialPort, &tty) != 0) {
|
||||||
printf("Error %i from tcgetattr: %s\n", errno, strerror(errno));
|
// printf("Error %i from tcgetattr: %s\n", errno, strerror(errno));
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
tty.c_cflag &= ~PARENB; // Clear parity bit, disabling parity
|
// tty.c_cflag &= ~PARENB; // Clear parity bit, disabling parity
|
||||||
tty.c_cflag &= ~CSTOPB; // Clear stop field, only one stop bit used in communication
|
// tty.c_cflag &= ~CSTOPB; // Clear stop field, only one stop bit used in communication
|
||||||
tty.c_cflag |= CS8; // 8 bits per byte
|
// tty.c_cflag |= CS8; // 8 bits per byte
|
||||||
tty.c_cflag &= ~CRTSCTS; // Disable RTS/CTS hardware flow control
|
// tty.c_cflag &= ~CRTSCTS; // Disable RTS/CTS hardware flow control
|
||||||
tty.c_lflag &= ~ICANON; //Disable Canonical Mode
|
// tty.c_lflag &= ~ICANON; //Disable Canonical Mode
|
||||||
tty.c_oflag &= ~OPOST; // Prevent special interpretation of output bytes (e.g. newline chars)
|
// tty.c_oflag &= ~OPOST; // Prevent special interpretation of output bytes (e.g. newline chars)
|
||||||
tty.c_oflag &= ~ONLCR; // Prevent conversion of newline to carriage return/line feed
|
// tty.c_oflag &= ~ONLCR; // Prevent conversion of newline to carriage return/line feed
|
||||||
tty.c_cc[VTIME] = 0; // Non Blocking
|
// tty.c_cc[VTIME] = 0; // Non Blocking
|
||||||
tty.c_cc[VMIN] = 0;
|
// tty.c_cc[VMIN] = 0;
|
||||||
|
//
|
||||||
cfsetispeed(&tty, B9600); //Baudrate
|
// cfsetispeed(&tty, B9600); //Baudrate
|
||||||
|
//
|
||||||
if (tcsetattr(serialPort, TCSANOW, &tty) != 0) {
|
// if (tcsetattr(serialPort, TCSANOW, &tty) != 0) {
|
||||||
//printf("Error %i from tcsetattr: %s\n", errno, strerror(errno));
|
// //printf("Error %i from tcsetattr: %s\n", errno, strerror(errno));
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
initialized = true;
|
// initialized = true;
|
||||||
|
//
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
ArduinoCommInterface::~ArduinoCommInterface() {
|
//ArduinoCommInterface::~ArduinoCommInterface() {
|
||||||
::close(serialPort);
|
// ::close(serialPort);
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
ReturnValue_t ArduinoCommInterface::open(Cookie **cookie, uint32_t address,
|
//ReturnValue_t ArduinoCommInterface::open(Cookie **cookie, uint32_t address,
|
||||||
uint32_t maxReplyLen) {
|
// uint32_t maxReplyLen) {
|
||||||
//This is a hack, will be gone with https://egit.irs.uni-stuttgart.de/fsfw/fsfw/issues/19
|
// //This is a hack, will be gone with https://egit.irs.uni-stuttgart.de/fsfw/fsfw/issues/19
|
||||||
switch ((address >> 8) & 0xff) {
|
// switch ((address >> 8) & 0xff) {
|
||||||
case 0:
|
// case 0:
|
||||||
*cookie = new ArduinoCookie(ArduinoCookie::SPI, address, maxReplyLen);
|
// *cookie = new ArduinoCookie(ArduinoCookie::SPI, address, maxReplyLen);
|
||||||
spiMap.insert(address, (ArduinoCookie*) *cookie); //Yes, I *do* know that it is an ArduinoSpiCookie, I just new'd it
|
// spiMap.insert(address, (ArduinoCookie*) *cookie); //Yes, I *do* know that it is an ArduinoSpiCookie, I just new'd it
|
||||||
break;
|
// break;
|
||||||
default:
|
// default:
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
// return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
// }
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
// return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
ReturnValue_t ArduinoCommInterface::reOpen(Cookie *cookie, uint32_t address,
|
//ReturnValue_t ArduinoCommInterface::reOpen(Cookie *cookie, uint32_t address,
|
||||||
uint32_t maxReplyLen) {
|
// uint32_t maxReplyLen) {
|
||||||
//too lazy right now will be irrelevant with https://egit.irs.uni-stuttgart.de/fsfw/fsfw/issues/19
|
// //too lazy right now will be irrelevant with https://egit.irs.uni-stuttgart.de/fsfw/fsfw/issues/19
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
// return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
void ArduinoCommInterface::close(Cookie *cookie) {
|
//void ArduinoCommInterface::close(Cookie *cookie) {
|
||||||
//too lazy as well, find the correct Map, delete it there, then the cookie...
|
// //too lazy as well, find the correct Map, delete it there, then the cookie...
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
ReturnValue_t ArduinoCommInterface::sendMessage(Cookie *cookie, uint8_t *data,
|
//ReturnValue_t ArduinoCommInterface::sendMessage(Cookie *cookie, uint8_t *data,
|
||||||
uint32_t len) {
|
// uint32_t len) {
|
||||||
ArduinoCookie *arduinoCookie = dynamic_cast<ArduinoCookie*>(cookie);
|
// ArduinoCookie *arduinoCookie = dynamic_cast<ArduinoCookie*>(cookie);
|
||||||
if (arduinoCookie == NULL) {
|
// if (arduinoCookie == NULL) {
|
||||||
return INVALID_COOKIE_TYPE;
|
// return INVALID_COOKIE_TYPE;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
return sendMessage(arduinoCookie->command, arduinoCookie->address, data,
|
// return sendMessage(arduinoCookie->command, arduinoCookie->address, data,
|
||||||
len);
|
// len);
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
ReturnValue_t ArduinoCommInterface::getSendSuccess(Cookie *cookie) {
|
//ReturnValue_t ArduinoCommInterface::getSendSuccess(Cookie *cookie) {
|
||||||
return RETURN_OK;
|
// return RETURN_OK;
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
ReturnValue_t ArduinoCommInterface::requestReceiveMessage(Cookie *cookie) {
|
//ReturnValue_t ArduinoCommInterface::requestReceiveMessage(Cookie *cookie) {
|
||||||
return RETURN_OK;
|
// return RETURN_OK;
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
ReturnValue_t ArduinoCommInterface::readReceivedMessage(Cookie *cookie,
|
//ReturnValue_t ArduinoCommInterface::readReceivedMessage(Cookie *cookie,
|
||||||
uint8_t **buffer, uint32_t *size) {
|
// uint8_t **buffer, uint32_t *size) {
|
||||||
|
//
|
||||||
handleSerialPortRx();
|
// handleSerialPortRx();
|
||||||
|
//
|
||||||
ArduinoCookie *arduinoCookie = dynamic_cast<ArduinoCookie*>(cookie);
|
// ArduinoCookie *arduinoCookie = dynamic_cast<ArduinoCookie*>(cookie);
|
||||||
if (arduinoCookie == NULL) {
|
// if (arduinoCookie == NULL) {
|
||||||
return INVALID_COOKIE_TYPE;
|
// return INVALID_COOKIE_TYPE;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
*buffer = arduinoCookie->replyBuffer;
|
// *buffer = arduinoCookie->replyBuffer;
|
||||||
*size = arduinoCookie->receivedDataLen;
|
// *size = arduinoCookie->receivedDataLen;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
// return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
ReturnValue_t ArduinoCommInterface::setAddress(Cookie *cookie,
|
//ReturnValue_t ArduinoCommInterface::setAddress(Cookie *cookie,
|
||||||
uint32_t address) {
|
// uint32_t address) {
|
||||||
//not implemented
|
// //not implemented
|
||||||
return RETURN_FAILED;
|
// return RETURN_FAILED;
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
uint32_t ArduinoCommInterface::getAddress(Cookie *cookie) {
|
//uint32_t ArduinoCommInterface::getAddress(Cookie *cookie) {
|
||||||
//not implemented
|
// //not implemented
|
||||||
return 0;
|
// return 0;
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
ReturnValue_t ArduinoCommInterface::setParameter(Cookie *cookie,
|
//ReturnValue_t ArduinoCommInterface::setParameter(Cookie *cookie,
|
||||||
uint32_t parameter) {
|
// uint32_t parameter) {
|
||||||
//not implemented
|
// //not implemented
|
||||||
return RETURN_FAILED;
|
// return RETURN_FAILED;
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
uint32_t ArduinoCommInterface::getParameter(Cookie *cookie) {
|
//uint32_t ArduinoCommInterface::getParameter(Cookie *cookie) {
|
||||||
//not implemented
|
// //not implemented
|
||||||
return 0;
|
// return 0;
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
ReturnValue_t ArduinoCommInterface::sendMessage(uint8_t command,
|
//ReturnValue_t ArduinoCommInterface::sendMessage(uint8_t command,
|
||||||
uint8_t address, const uint8_t *data, size_t dataLen) {
|
// uint8_t address, const uint8_t *data, size_t dataLen) {
|
||||||
if (dataLen > UINT16_MAX) {
|
// if (dataLen > UINT16_MAX) {
|
||||||
return TOO_MUCH_DATA;
|
// return TOO_MUCH_DATA;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//being conservative here
|
// //being conservative here
|
||||||
uint8_t sendBuffer[(dataLen + 6) * 2 + 2];
|
// uint8_t sendBuffer[(dataLen + 6) * 2 + 2];
|
||||||
|
//
|
||||||
sendBuffer[0] = DleEncoder::STX;
|
// sendBuffer[0] = DleEncoder::STX;
|
||||||
|
//
|
||||||
uint8_t *currentPosition = sendBuffer + 1;
|
// uint8_t *currentPosition = sendBuffer + 1;
|
||||||
size_t remainingLen = sizeof(sendBuffer) - 1;
|
// size_t remainingLen = sizeof(sendBuffer) - 1;
|
||||||
uint32_t encodedLen;
|
// uint32_t encodedLen;
|
||||||
|
//
|
||||||
ReturnValue_t result = DleEncoder::encode(&command, 1, currentPosition,
|
// ReturnValue_t result = DleEncoder::encode(&command, 1, currentPosition,
|
||||||
remainingLen, &encodedLen, false);
|
// remainingLen, &encodedLen, false);
|
||||||
if (result != RETURN_OK) {
|
// if (result != RETURN_OK) {
|
||||||
return result;
|
// return result;
|
||||||
}
|
// }
|
||||||
currentPosition += encodedLen;
|
// currentPosition += encodedLen;
|
||||||
remainingLen -= encodedLen; //DleEncoder will never return encodedLen > remainingLen
|
// remainingLen -= encodedLen; //DleEncoder will never return encodedLen > remainingLen
|
||||||
|
//
|
||||||
result = DleEncoder::encode(&address, 1, currentPosition, remainingLen,
|
// result = DleEncoder::encode(&address, 1, currentPosition, remainingLen,
|
||||||
&encodedLen, false);
|
// &encodedLen, false);
|
||||||
if (result != RETURN_OK) {
|
// if (result != RETURN_OK) {
|
||||||
return result;
|
// return result;
|
||||||
}
|
// }
|
||||||
currentPosition += encodedLen;
|
// currentPosition += encodedLen;
|
||||||
remainingLen -= encodedLen; //DleEncoder will never return encodedLen > remainingLen
|
// remainingLen -= encodedLen; //DleEncoder will never return encodedLen > remainingLen
|
||||||
|
//
|
||||||
uint8_t temporaryBuffer[2];
|
// uint8_t temporaryBuffer[2];
|
||||||
|
//
|
||||||
//note to Lukas: yes we _could_ use Serialize here, but for 16 bit it is a bit too much...
|
// //note to Lukas: yes we _could_ use Serialize here, but for 16 bit it is a bit too much...
|
||||||
temporaryBuffer[0] = dataLen >> 8; //we checked dataLen above
|
// temporaryBuffer[0] = dataLen >> 8; //we checked dataLen above
|
||||||
temporaryBuffer[1] = dataLen;
|
// temporaryBuffer[1] = dataLen;
|
||||||
|
//
|
||||||
result = DleEncoder::encode(temporaryBuffer, 2, currentPosition,
|
// result = DleEncoder::encode(temporaryBuffer, 2, currentPosition,
|
||||||
remainingLen, &encodedLen, false);
|
// remainingLen, &encodedLen, false);
|
||||||
if (result != RETURN_OK) {
|
// if (result != RETURN_OK) {
|
||||||
return result;
|
// return result;
|
||||||
}
|
// }
|
||||||
currentPosition += encodedLen;
|
// currentPosition += encodedLen;
|
||||||
remainingLen -= encodedLen; //DleEncoder will never return encodedLen > remainingLen
|
// remainingLen -= encodedLen; //DleEncoder will never return encodedLen > remainingLen
|
||||||
|
//
|
||||||
//encoding the actual data
|
// //encoding the actual data
|
||||||
result = DleEncoder::encode(data, dataLen, currentPosition, remainingLen,
|
// result = DleEncoder::encode(data, dataLen, currentPosition, remainingLen,
|
||||||
&encodedLen, false);
|
// &encodedLen, false);
|
||||||
if (result != RETURN_OK) {
|
// if (result != RETURN_OK) {
|
||||||
return result;
|
// return result;
|
||||||
}
|
// }
|
||||||
currentPosition += encodedLen;
|
// currentPosition += encodedLen;
|
||||||
remainingLen -= encodedLen; //DleEncoder will never return encodedLen > remainingLen
|
// remainingLen -= encodedLen; //DleEncoder will never return encodedLen > remainingLen
|
||||||
|
//
|
||||||
uint16_t crc = CRC::crc16ccitt(&command, 1);
|
// uint16_t crc = CRC::crc16ccitt(&command, 1);
|
||||||
crc = CRC::crc16ccitt(&address, 1, crc);
|
// crc = CRC::crc16ccitt(&address, 1, crc);
|
||||||
//fortunately the length is still there
|
// //fortunately the length is still there
|
||||||
crc = CRC::crc16ccitt(temporaryBuffer, 2, crc);
|
// crc = CRC::crc16ccitt(temporaryBuffer, 2, crc);
|
||||||
crc = CRC::crc16ccitt(data, dataLen, crc);
|
// crc = CRC::crc16ccitt(data, dataLen, crc);
|
||||||
|
//
|
||||||
temporaryBuffer[0] = crc >> 8;
|
// temporaryBuffer[0] = crc >> 8;
|
||||||
temporaryBuffer[1] = crc;
|
// temporaryBuffer[1] = crc;
|
||||||
|
//
|
||||||
result = DleEncoder::encode(temporaryBuffer, 2, currentPosition,
|
// result = DleEncoder::encode(temporaryBuffer, 2, currentPosition,
|
||||||
remainingLen, &encodedLen, false);
|
// remainingLen, &encodedLen, false);
|
||||||
if (result != RETURN_OK) {
|
// if (result != RETURN_OK) {
|
||||||
return result;
|
// return result;
|
||||||
}
|
// }
|
||||||
currentPosition += encodedLen;
|
// currentPosition += encodedLen;
|
||||||
remainingLen -= encodedLen; //DleEncoder will never return encodedLen > remainingLen
|
// remainingLen -= encodedLen; //DleEncoder will never return encodedLen > remainingLen
|
||||||
|
//
|
||||||
if (remainingLen > 0) {
|
// if (remainingLen > 0) {
|
||||||
*currentPosition = DleEncoder::ETX;
|
// *currentPosition = DleEncoder::ETX;
|
||||||
}
|
// }
|
||||||
remainingLen -= 1;
|
// remainingLen -= 1;
|
||||||
|
//
|
||||||
encodedLen = sizeof(sendBuffer) - remainingLen;
|
// encodedLen = sizeof(sendBuffer) - remainingLen;
|
||||||
|
//
|
||||||
ssize_t writtenlen = write(serialPort, sendBuffer, encodedLen);
|
// ssize_t writtenlen = write(serialPort, sendBuffer, encodedLen);
|
||||||
if (writtenlen < 0) {
|
// if (writtenlen < 0) {
|
||||||
//we could try to find out what happened...
|
// //we could try to find out what happened...
|
||||||
return RETURN_FAILED;
|
// return RETURN_FAILED;
|
||||||
}
|
// }
|
||||||
if (writtenlen != encodedLen) {
|
// if (writtenlen != encodedLen) {
|
||||||
//the OS failed us, we do not try to block until everything is written, as
|
// //the OS failed us, we do not try to block until everything is written, as
|
||||||
//we can not block the whole system here
|
// //we can not block the whole system here
|
||||||
return RETURN_FAILED;
|
// return RETURN_FAILED;
|
||||||
}
|
// }
|
||||||
return RETURN_OK;
|
// return RETURN_OK;
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
void ArduinoCommInterface::handleSerialPortRx() {
|
//void ArduinoCommInterface::handleSerialPortRx() {
|
||||||
uint32_t availableSpace = rxBuffer.availableWriteSpace();
|
// uint32_t availableSpace = rxBuffer.availableWriteSpace();
|
||||||
|
//
|
||||||
uint8_t dataFromSerial[availableSpace];
|
// uint8_t dataFromSerial[availableSpace];
|
||||||
|
//
|
||||||
ssize_t bytesRead = read(serialPort, dataFromSerial,
|
// ssize_t bytesRead = read(serialPort, dataFromSerial,
|
||||||
sizeof(dataFromSerial));
|
// sizeof(dataFromSerial));
|
||||||
|
//
|
||||||
if (bytesRead < 0) {
|
// if (bytesRead < 0) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
rxBuffer.writeData(dataFromSerial, bytesRead);
|
// rxBuffer.writeData(dataFromSerial, bytesRead);
|
||||||
|
//
|
||||||
uint8_t dataReceivedSoFar[rxBuffer.maxSize()];
|
// uint8_t dataReceivedSoFar[rxBuffer.maxSize()];
|
||||||
|
//
|
||||||
uint32_t dataLenReceivedSoFar = 0;
|
// uint32_t dataLenReceivedSoFar = 0;
|
||||||
|
//
|
||||||
rxBuffer.readData(dataReceivedSoFar, sizeof(dataReceivedSoFar), true,
|
// rxBuffer.readData(dataReceivedSoFar, sizeof(dataReceivedSoFar), true,
|
||||||
&dataLenReceivedSoFar);
|
// &dataLenReceivedSoFar);
|
||||||
|
//
|
||||||
//look for STX
|
// //look for STX
|
||||||
size_t firstSTXinRawData = 0;
|
// size_t firstSTXinRawData = 0;
|
||||||
while ((firstSTXinRawData < dataLenReceivedSoFar)
|
// while ((firstSTXinRawData < dataLenReceivedSoFar)
|
||||||
&& (dataReceivedSoFar[firstSTXinRawData] != DleEncoder::STX)) {
|
// && (dataReceivedSoFar[firstSTXinRawData] != DleEncoder::STX)) {
|
||||||
firstSTXinRawData++;
|
// firstSTXinRawData++;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (dataReceivedSoFar[firstSTXinRawData] != DleEncoder::STX) {
|
// if (dataReceivedSoFar[firstSTXinRawData] != DleEncoder::STX) {
|
||||||
//there is no STX in our data, throw it away...
|
// //there is no STX in our data, throw it away...
|
||||||
rxBuffer.deleteData(dataLenReceivedSoFar);
|
// rxBuffer.deleteData(dataLenReceivedSoFar);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
uint8_t packet[MAX_PACKET_SIZE];
|
// uint8_t packet[MAX_PACKET_SIZE];
|
||||||
uint32_t packetLen;
|
// uint32_t packetLen;
|
||||||
|
//
|
||||||
uint32_t readSize;
|
// uint32_t readSize;
|
||||||
|
//
|
||||||
ReturnValue_t result = DleEncoder::decode(
|
// ReturnValue_t result = DleEncoder::decode(
|
||||||
dataReceivedSoFar + firstSTXinRawData,
|
// dataReceivedSoFar + firstSTXinRawData,
|
||||||
dataLenReceivedSoFar - firstSTXinRawData, &readSize, packet,
|
// dataLenReceivedSoFar - firstSTXinRawData, &readSize, packet,
|
||||||
sizeof(packet), &packetLen);
|
// sizeof(packet), &packetLen);
|
||||||
|
//
|
||||||
size_t toDelete = firstSTXinRawData;
|
// size_t toDelete = firstSTXinRawData;
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
// if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
handlePacket(packet, packetLen);
|
// handlePacket(packet, packetLen);
|
||||||
|
//
|
||||||
//after handling the packet, we can delete it from the raw stream, it has been copied to packet
|
// //after handling the packet, we can delete it from the raw stream, it has been copied to packet
|
||||||
toDelete += readSize;
|
// toDelete += readSize;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//remove Data which was processed
|
// //remove Data which was processed
|
||||||
rxBuffer.deleteData(toDelete);
|
// rxBuffer.deleteData(toDelete);
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
void ArduinoCommInterface::handlePacket(uint8_t *packet, size_t packetLen) {
|
//void ArduinoCommInterface::handlePacket(uint8_t *packet, size_t packetLen) {
|
||||||
uint16_t crc = CRC::crc16ccitt(packet, packetLen);
|
// uint16_t crc = CRC::crc16ccitt(packet, packetLen);
|
||||||
if (crc != 0) {
|
// if (crc != 0) {
|
||||||
//CRC error
|
// //CRC error
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
uint8_t command = packet[0];
|
// uint8_t command = packet[0];
|
||||||
uint8_t address = packet[1];
|
// uint8_t address = packet[1];
|
||||||
|
//
|
||||||
uint16_t size = (packet[2] << 8) + packet[3];
|
// uint16_t size = (packet[2] << 8) + packet[3];
|
||||||
|
//
|
||||||
if (size != packetLen - 6) {
|
// if (size != packetLen - 6) {
|
||||||
//Invalid Length
|
// //Invalid Length
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
switch (command) {
|
// switch (command) {
|
||||||
case ArduinoCookie::SPI: {
|
// case ArduinoCookie::SPI: {
|
||||||
ArduinoCookie **itsComplicated;
|
// ArduinoCookie **itsComplicated;
|
||||||
ReturnValue_t result = spiMap.find(address, &itsComplicated);
|
// ReturnValue_t result = spiMap.find(address, &itsComplicated);
|
||||||
if (result != RETURN_OK) {
|
// if (result != RETURN_OK) {
|
||||||
//we do no know this address
|
// //we do no know this address
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
ArduinoCookie *theActualCookie = *itsComplicated;
|
// ArduinoCookie *theActualCookie = *itsComplicated;
|
||||||
if (packetLen > theActualCookie->maxReplySize + 6) {
|
// if (packetLen > theActualCookie->maxReplySize + 6) {
|
||||||
packetLen = theActualCookie->maxReplySize + 6;
|
// packetLen = theActualCookie->maxReplySize + 6;
|
||||||
}
|
// }
|
||||||
memcpy(theActualCookie->replyBuffer, packet + 4, packetLen - 6);
|
// memcpy(theActualCookie->replyBuffer, packet + 4, packetLen - 6);
|
||||||
theActualCookie->receivedDataLen = packetLen - 6;
|
// theActualCookie->receivedDataLen = packetLen - 6;
|
||||||
}
|
// }
|
||||||
break;
|
// break;
|
||||||
default:
|
// default:
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
120
bsp_linux/comIF/P60DockComIF.cpp
Normal file
120
bsp_linux/comIF/P60DockComIF.cpp
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
#include "P60DockComIF.h"
|
||||||
|
|
||||||
|
#include <csp/csp.h>
|
||||||
|
#include <csp/drivers/can_socketcan.h>
|
||||||
|
#include <bsp_linux/comIF/cookies/P60DockCookie.h>
|
||||||
|
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||||
|
#include <gomspace/libparam_client/include/gs/param/rparam.h>
|
||||||
|
|
||||||
|
P60DockComIF::P60DockComIF(object_id_t objectId) :
|
||||||
|
SystemObject(objectId) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
P60DockComIF::~P60DockComIF() {
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t P60DockComIF::initializeInterface(CookieIF *cookie) {
|
||||||
|
if(cookie == nullptr) {
|
||||||
|
return NULLPOINTER;
|
||||||
|
}
|
||||||
|
|
||||||
|
P60DockCookie* p60DockCookie = dynamic_cast<P60DockCookie*>(cookie);
|
||||||
|
uint8_t cspAddress = p60DockCookie->getCspAddress();
|
||||||
|
char* canInterface = p60DockCookie->getCanIf();
|
||||||
|
int bitrate = p60DockCookie->getBitrate();
|
||||||
|
|
||||||
|
int buf_count = 10;
|
||||||
|
int buf_size = 300;
|
||||||
|
/* Init CSP and CSP buffer system */
|
||||||
|
if (csp_init(cspAddress) != CSP_ERR_NONE
|
||||||
|
|| csp_buffer_init(buf_count, buf_size) != CSP_ERR_NONE) {
|
||||||
|
sif::error << "Failed to init CSP\r\n" << std::endl;
|
||||||
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
int promisc = 0; // Set filter mode on
|
||||||
|
csp_iface_t *csp_if_ptr = &csp_if;
|
||||||
|
csp_if_ptr = csp_can_socketcan_init(canInterface, bitrate, promisc);
|
||||||
|
|
||||||
|
/* Set default route and start router */
|
||||||
|
uint8_t address = CSP_DEFAULT_ROUTE;
|
||||||
|
uint8_t netmask = 0;
|
||||||
|
uint8_t mac = CSP_NODE_MAC;
|
||||||
|
int result = csp_rtable_set(address, netmask, csp_if_ptr, mac);
|
||||||
|
if(result != CSP_ERR_NONE){
|
||||||
|
sif::error << "Failed to add can interface to router table"
|
||||||
|
<< std::endl;
|
||||||
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Start the route task */
|
||||||
|
unsigned int task_stack_size = 512;
|
||||||
|
unsigned int priority = 0;
|
||||||
|
result = csp_route_start_task(task_stack_size, priority);
|
||||||
|
if(result != CSP_ERR_NONE){
|
||||||
|
sif::error << "Failed to start csp route task" << std::endl;
|
||||||
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
|
}
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t P60DockComIF::sendMessage(CookieIF *cookie,
|
||||||
|
const uint8_t * sendData, size_t sendLen) {
|
||||||
|
P60DockCookie* p60DockCookie = dynamic_cast<P60DockCookie*> (cookie);
|
||||||
|
MessageType_t messageType = p60DockCookie->getMessageType();
|
||||||
|
|
||||||
|
switch(messageType){
|
||||||
|
case(P60DockCookie::REBOOT):{
|
||||||
|
csp_reboot(p60DockCookie->getCspAddress());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t P60DockComIF::getSendSuccess(CookieIF *cookie) {
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t P60DockComIF::requestReceiveMessage(CookieIF *cookie,
|
||||||
|
size_t requestLen) {
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t P60DockComIF::readReceivedMessage(CookieIF *cookie,
|
||||||
|
uint8_t** buffer, size_t* size) {
|
||||||
|
P60DockCookie* p60DockCookie = dynamic_cast<P60DockCookie*> (cookie);
|
||||||
|
MessageType_t messageType = p60DockCookie->getMessageType();
|
||||||
|
|
||||||
|
switch(messageType){
|
||||||
|
case(P60DockCookie::READ_MODULE_CONFIG):{
|
||||||
|
uint32_t timeout = 1000;
|
||||||
|
uint8_t p60dockAddress = p60DockCookie->getCspAddress();
|
||||||
|
gs_param_table_instance_t moduleConfig;
|
||||||
|
moduleConfig.rows = moduleConfigTable;
|
||||||
|
moduleConfig.id = p60dockAddress;
|
||||||
|
moduleConfig.row_count = p60dock_hk_count;
|
||||||
|
moduleConfig.memory_size = P60DOCK_HK_SIZE;
|
||||||
|
moduleConfig.memory = *buffer;
|
||||||
|
/* Read complete module configuration table from P60 Dock and store data
|
||||||
|
* in buffer */
|
||||||
|
int result = gs_rparam_get_full_table(&moduleConfig, p60dockAddress,
|
||||||
|
node_hk.id, GS_RPARAM_MAGIC_CHECKSUM, timeout);
|
||||||
|
*size = P60DOCK_HK_SIZE;
|
||||||
|
if (result != GS_OK) {
|
||||||
|
sif::info
|
||||||
|
<< "Failed retrieving module configuration from P60 dock with error code "
|
||||||
|
<< result << std::endl;
|
||||||
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
52
bsp_linux/comIF/P60DockComIF.h
Normal file
52
bsp_linux/comIF/P60DockComIF.h
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* P60DockComIF.h
|
||||||
|
*
|
||||||
|
* Created on: 01.12.2020
|
||||||
|
* Author: jakob
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BSP_LINUX_COMIF_P60DOCKCOMIF_H_
|
||||||
|
#define BSP_LINUX_COMIF_P60DOCKCOMIF_H_
|
||||||
|
|
||||||
|
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
|
||||||
|
#include <fsfw/objectmanager/SystemObject.h>
|
||||||
|
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||||
|
|
||||||
|
#include <gomspace/libcsp/include/csp/csp_types.h>
|
||||||
|
#include <gomspace/libcsp/include/csp/csp_error.h>
|
||||||
|
#include <gomspace/libparam_client/include/gs/param/types.h>
|
||||||
|
#include <gs/param/internal/types.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This is the communication interface to the cubesat space protocol
|
||||||
|
* stack. The physical layer used for this implementation is CAN.
|
||||||
|
* @author Jakob Meier
|
||||||
|
*/
|
||||||
|
class P60DockComIF: public DeviceCommunicationIF, public SystemObject {
|
||||||
|
public:
|
||||||
|
P60DockComIF(object_id_t objectId);
|
||||||
|
virtual ~P60DockComIF();
|
||||||
|
|
||||||
|
ReturnValue_t initializeInterface(CookieIF * cookie) override;
|
||||||
|
ReturnValue_t sendMessage(CookieIF *cookie, const uint8_t * sendData,
|
||||||
|
size_t sendLen) override;
|
||||||
|
ReturnValue_t getSendSuccess(CookieIF *cookie) override;
|
||||||
|
ReturnValue_t requestReceiveMessage(CookieIF *cookie,
|
||||||
|
size_t requestLen) override;
|
||||||
|
ReturnValue_t readReceivedMessage(CookieIF *cookie,
|
||||||
|
uint8_t **readData, size_t *readLen) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
/* Interface struct for csp protocol stack */
|
||||||
|
csp_iface_t csp_if;
|
||||||
|
/* Table definitions. According to gomspace software documentation there
|
||||||
|
* exist four tables each identified by a number*/
|
||||||
|
uint8_t boardConfigTable = 0;
|
||||||
|
uint8_t modulConfigTable = 1;
|
||||||
|
uint8_t calibrationParamTable = 2;
|
||||||
|
uint8_t tmDataTable = 4;
|
||||||
|
unsigned int moduleConfigTableRows = 32;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* BSP_LINUX_COMIF_P60DOCKCOMIF_H_ */
|
38
bsp_linux/comIF/cookies/P60DockCookie.cpp
Normal file
38
bsp_linux/comIF/cookies/P60DockCookie.cpp
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#include "bsp_linux/comIF/cookies/P60DockCookie.h"
|
||||||
|
|
||||||
|
|
||||||
|
P60DockCookie::P60DockCookie(char* canInterface_, uint8_t cspAddress_) :
|
||||||
|
canInterface(canInterface_), cspAddress(cspAddress_) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
P60DockCookie::~P60DockCookie() {
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t P60DockCookie::getCspAddress(){
|
||||||
|
return cspAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
char* P60DockCookie::getCanIf(){
|
||||||
|
return canInterface;
|
||||||
|
}
|
||||||
|
|
||||||
|
int P60DockCookie::getBitrate(){
|
||||||
|
return bitrate;
|
||||||
|
}
|
||||||
|
|
||||||
|
void P60DockCookie::setPingMessage(){
|
||||||
|
nextMessage = PING;
|
||||||
|
}
|
||||||
|
|
||||||
|
void P60DockCookie::setRebootMessage(){
|
||||||
|
nextMessage = REBOOT;
|
||||||
|
}
|
||||||
|
|
||||||
|
void P60DockCookie::setReadModuleCfgMessage(){
|
||||||
|
nextMessage = READ_MODULE_CONFIG;
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageType_t P60DockCookie::getMessageType(){
|
||||||
|
return nextMessage;
|
||||||
|
}
|
49
bsp_linux/comIF/cookies/P60DockCookie.h
Normal file
49
bsp_linux/comIF/cookies/P60DockCookie.h
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#ifndef BSP_LINUX_COMIF_COOKIES_P60DockCookie_H_
|
||||||
|
#define BSP_LINUX_COMIF_COOKIES_P60DockCookie_H_
|
||||||
|
|
||||||
|
#include <fsfw/devicehandlers/CookieIF.h>
|
||||||
|
|
||||||
|
typedef uint32_t MessageType_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This is the cookie for the communication interface to the cubesat
|
||||||
|
* space protocol (CSP) implementation of gomspace. The communication
|
||||||
|
* interface uses CAN as the physical layer. Therefore the cookie also
|
||||||
|
* holds the CAN instance to use.
|
||||||
|
* @author Jakob Meier
|
||||||
|
*/
|
||||||
|
class P60DockCookie: public CookieIF {
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Constructor for the CSP cookie
|
||||||
|
* @param canInterface_ The CAN interface to use. E.g. "can0" or "can1".
|
||||||
|
* @param cspAddress_ The CSP address of the target device.
|
||||||
|
*/
|
||||||
|
P60DockCookie(char* canInterface_, uint8_t cspAddress_);
|
||||||
|
virtual ~P60DockCookie();
|
||||||
|
|
||||||
|
uint8_t getCspAddress();
|
||||||
|
char* getCanIf();
|
||||||
|
int getBitrate();
|
||||||
|
void setPingMessage();
|
||||||
|
void setRebootMessage();
|
||||||
|
void setReadModuleCfgMessage();
|
||||||
|
MessageType_t getMessageType();
|
||||||
|
|
||||||
|
/* Message type defines the type of the next data transfer between the
|
||||||
|
* CSP device and the OBC. */
|
||||||
|
static const MessageType_t MESSAGE_NONE = 0x0;
|
||||||
|
static const MessageType_t PING = 0x1;
|
||||||
|
static const MessageType_t REBOOT = 0x4;
|
||||||
|
static const MessageType_t READ_MODULE_CONFIG = 0x71;
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
char* canInterface;
|
||||||
|
uint8_t cspAddress;
|
||||||
|
int bitrate = 1000;
|
||||||
|
MessageType_t nextMessage = MESSAGE_NONE;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* BSP_LINUX_COMIF_COOKIES_P60DockCookie_H_ */
|
@ -6,7 +6,7 @@
|
|||||||
#ifndef FSFWCONFIG_OBSWCONFIG_H_
|
#ifndef FSFWCONFIG_OBSWCONFIG_H_
|
||||||
#define FSFWCONFIG_OBSWCONFIG_H_
|
#define FSFWCONFIG_OBSWCONFIG_H_
|
||||||
|
|
||||||
#define ADD_TEST_CODE 1
|
#define ADD_TEST_CODE 0
|
||||||
|
|
||||||
// Define not used yet, PUS stack and TMTC tasks are always started
|
// Define not used yet, PUS stack and TMTC tasks are always started
|
||||||
#define ADD_PUS_STACK 1
|
#define ADD_PUS_STACK 1
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* \date 06.11.2019
|
* \date 06.11.2019
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <fsfwconfig/devices/logicalAddresses.h>
|
#include "addresses.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
|||||||
/**
|
/**
|
||||||
* \file logicalAddresses.cpp
|
* \file addresses.cpp
|
||||||
*
|
*
|
||||||
* \date 07.11.2019
|
* \date 07.11.2019
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef FSFWCONFIG_DEVICES_LOGICALADDRESSES_H_
|
#ifndef FSFWCONFIG_DEVICES_ADDRESSES_H_
|
||||||
#define FSFWCONFIG_DEVICES_LOGICALADDRESSES_H_
|
#define FSFWCONFIG_DEVICES_ADDRESSES_H_
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <fsfw/devicehandlers/CookieIF.h>
|
#include <fsfw/devicehandlers/CookieIF.h>
|
||||||
#include <fsfwconfig/objects/systemObjectList.h>
|
#include <fsfwconfig/objects/systemObjectList.h>
|
||||||
@ -20,7 +20,14 @@ namespace addresses {
|
|||||||
DUMMY_GPS0 = 130,
|
DUMMY_GPS0 = 130,
|
||||||
DUMMY_GPS1 = 131,
|
DUMMY_GPS1 = 131,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Addresses of devices supporting the CSP protocol */
|
||||||
|
enum cspAddresses: uint8_t {
|
||||||
|
P60DOCK = 4,
|
||||||
|
/* PDU2 occupies X4 slot of P60Dock */
|
||||||
|
PDU2 = 6
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* FSFWCONFIG_DEVICES_LOGICALADDRESSES_H_ */
|
#endif /* FSFWCONFIG_DEVICES_ADDRESSES_H_ */
|
@ -27,10 +27,14 @@ namespace objects {
|
|||||||
TEST_TASK = 0x42694269,
|
TEST_TASK = 0x42694269,
|
||||||
DUMMY_INTERFACE = 0xCAFECAFE,
|
DUMMY_INTERFACE = 0xCAFECAFE,
|
||||||
DUMMY_HANDLER = 0x4400AFFE,
|
DUMMY_HANDLER = 0x4400AFFE,
|
||||||
|
P60DOCK_TEST_TASK = 0x00005060,
|
||||||
|
|
||||||
/* 0x49 ('I') for Communication Interfaces **/
|
/* 0x49 ('I') for Communication Interfaces **/
|
||||||
ARDUINO_COM_IF = 0x49000001,
|
ARDUINO_COM_IF = 0x49000001,
|
||||||
P60DOCK_TEST_TASK = 0x00005060
|
P60_DOCK_COM_IF = 0x49000002,
|
||||||
|
|
||||||
|
/* 0x44 ('D') for device handlers */
|
||||||
|
P60DOCK_HANDLER = 0x44000001
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include <fsfwconfig/tmtc/apid.h>
|
#include <fsfwconfig/tmtc/apid.h>
|
||||||
#include <fsfwconfig/tmtc/pusIds.h>
|
#include <fsfwconfig/tmtc/pusIds.h>
|
||||||
#include <fsfwconfig/OBSWconfig.h>
|
#include <fsfwconfig/OBSWconfig.h>
|
||||||
|
#include <fsfwconfig/devices/addresses.h>
|
||||||
|
|
||||||
#include <fsfw/events/EventManager.h>
|
#include <fsfw/events/EventManager.h>
|
||||||
#include <fsfw/health/HealthTable.h>
|
#include <fsfw/health/HealthTable.h>
|
||||||
@ -19,6 +20,9 @@
|
|||||||
#include <fsfw/tcdistribution/PUSDistributor.h>
|
#include <fsfw/tcdistribution/PUSDistributor.h>
|
||||||
#include <fsfw/timemanager/TimeStamper.h>
|
#include <fsfw/timemanager/TimeStamper.h>
|
||||||
#include <mission/utility/TmFunnel.h>
|
#include <mission/utility/TmFunnel.h>
|
||||||
|
#include <mission/devices/P60DockHandler.h>
|
||||||
|
#include <bsp_linux/comIF/cookies/P60DockCookie.h>
|
||||||
|
#include <bsp_linux/comIF/P60DockComIF.h>
|
||||||
|
|
||||||
#if ADD_TEST_CODE == 1
|
#if ADD_TEST_CODE == 1
|
||||||
//#include <test/testtasks/TestTask.h>
|
//#include <test/testtasks/TestTask.h>
|
||||||
@ -81,6 +85,17 @@ void ObjectFactory::produceGenericObjects() {
|
|||||||
new CService200ModeCommanding(objects::PUS_SERVICE_200_MODE_MGMT,
|
new CService200ModeCommanding(objects::PUS_SERVICE_200_MODE_MGMT,
|
||||||
apid::EIVE_OBSW, pus::PUS_SERVICE_200);
|
apid::EIVE_OBSW, pus::PUS_SERVICE_200);
|
||||||
|
|
||||||
|
char canInterface[] = "can0";
|
||||||
|
/* Cookies */
|
||||||
|
P60DockCookie* p60DockCookie = new P60DockCookie(canInterface, addresses::P60DOCK);
|
||||||
|
|
||||||
|
/* Communication interfaces */
|
||||||
|
new P60DockComIF(objects::P60_DOCK_COM_IF);
|
||||||
|
|
||||||
|
/* Device Handler */
|
||||||
|
new P60DockHandler(objects::P60DOCK_HANDLER, objects::P60_DOCK_COM_IF,
|
||||||
|
p60DockCookie);
|
||||||
|
|
||||||
/* Test Device Handler */
|
/* Test Device Handler */
|
||||||
#if ADD_TEST_CODE == 1
|
#if ADD_TEST_CODE == 1
|
||||||
// new TestTask(objects::TEST_TASK);
|
// new TestTask(objects::TEST_TASK);
|
||||||
|
@ -1,23 +1,84 @@
|
|||||||
/*
|
|
||||||
* P60DockHandler.cpp
|
|
||||||
*
|
|
||||||
* Created on: 18.11.2020
|
|
||||||
* Author: jakob
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <csp/csp.h>
|
#include <csp/csp.h>
|
||||||
#include <csp/interfaces/csp_if_can.h>
|
#include <csp/interfaces/csp_if_can.h>
|
||||||
#include "P60DockHandler.h"
|
#include <mission/devices/P60DockHandler.h>
|
||||||
|
#include "bsp_linux/comIF/cookies/P60DockCookie.h"
|
||||||
|
#include "bsp_linux/comIF/P60DockComIF.h"
|
||||||
|
|
||||||
|
P60DockHandler::P60DockHandler(object_id_t objectId, object_id_t comIF,
|
||||||
|
CookieIF * comCookie):DeviceHandlerBase(objectId, comIF, comCookie) {
|
||||||
|
}
|
||||||
|
|
||||||
|
P60DockHandler::~P60DockHandler() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void P60DockHandler::doStartUp(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void P60DockHandler::doShutDown(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t P60DockHandler::buildNormalDeviceCommand(DeviceCommandId_t * id){
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t P60DockHandler::buildTransitionDeviceCommand(
|
||||||
|
DeviceCommandId_t * id){
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t P60DockHandler::buildCommandFromCommand(
|
||||||
|
DeviceCommandId_t deviceCommand, const uint8_t * commandData,
|
||||||
|
size_t commandDataLen) {
|
||||||
|
switch(deviceCommand) {
|
||||||
|
case(READ_MODULE_CFG):{
|
||||||
|
internalState = InternalStates::READ_MODULE_CFG;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(PING): {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void P60DockHandler::fillCommandAndReplyMap(){
|
||||||
|
this->insertInCommandAndReplyMap(READ_MODULE_CFG, 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t P60DockHandler::scanForReply(const uint8_t *start,
|
||||||
|
size_t remainingSize, DeviceCommandId_t *foundId, size_t *foundLen) {
|
||||||
|
switch(internalState) {
|
||||||
|
case(InternalStates::READ_MODULE_CFG): {
|
||||||
|
*foundId = READ_MODULE_CFG;
|
||||||
|
*foundLen = moduleCfgTableSize;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return IGNORE_REPLY_DATA;
|
||||||
|
}
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t P60DockHandler::interpretDeviceReply(DeviceCommandId_t id,
|
||||||
|
const uint8_t *packet) {
|
||||||
|
switch(id) {
|
||||||
|
case(READ_MODULE_CFG): {
|
||||||
|
handleDeviceTM((SerializeIF*)packet, id, true, true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setNormalDatapoolEntriesInvalid(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//P60DockHandler::P60DockHandler() {
|
|
||||||
//
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//P60DockHandler::~P60DockHandler() {
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//P60DockHandler::performOperation(uint8_t operationCode) {
|
|
||||||
//
|
|
||||||
//}
|
|
||||||
|
@ -1,18 +1,40 @@
|
|||||||
/*
|
|
||||||
* P60DockHandler.h
|
|
||||||
*
|
|
||||||
* Created on: 18.11.2020
|
|
||||||
* Author: jakob
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef MISSION_DEVICES_P60DOCKHANDLER_H_
|
#ifndef MISSION_DEVICES_P60DOCKHANDLER_H_
|
||||||
#define MISSION_DEVICES_P60DOCKHANDLER_H_
|
#define MISSION_DEVICES_P60DOCKHANDLER_H_
|
||||||
|
|
||||||
//class P60DockHandler: public DeviceHandlerBase {
|
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
||||||
//public:
|
|
||||||
// P60DockHandler();
|
class P60DockHandler: public DeviceHandlerBase {
|
||||||
// virtual ~P60DockHandler();
|
public:
|
||||||
// virtual ReturnValue_t performOperation(uint8_t operationCode = 0);
|
P60DockHandler(object_id_t objectId, object_id_t comIF,
|
||||||
//};
|
CookieIF * comCookie);
|
||||||
|
virtual ~P60DockHandler();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void doStartUp() override;
|
||||||
|
void doShutDown() override;
|
||||||
|
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t * id) override;
|
||||||
|
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t * id) override;
|
||||||
|
void fillCommandAndReplyMap() override;
|
||||||
|
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||||
|
const uint8_t * commandData,size_t commandDataLen) override;
|
||||||
|
ReturnValue_t scanForReply(const uint8_t *start, size_t remainingSize,
|
||||||
|
DeviceCommandId_t *foundId, size_t *foundLen) override;
|
||||||
|
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id,
|
||||||
|
const uint8_t *packet) override;
|
||||||
|
void setNormalDatapoolEntriesInvalid() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
static const DeviceCommandId_t PING = 0x1; //!< [EXPORT] : [COMMAND]
|
||||||
|
static const DeviceCommandId_t READ_MODULE_CFG = 0xE; //!< [EXPORT] : [COMMAND]
|
||||||
|
|
||||||
|
enum class InternalStates {
|
||||||
|
STATE_NONE,
|
||||||
|
READ_MODULE_CFG
|
||||||
|
};
|
||||||
|
InternalStates internalState = InternalStates::STATE_NONE;
|
||||||
|
|
||||||
|
size_t moduleCfgTableSize = 188;
|
||||||
|
};
|
||||||
|
|
||||||
#endif /* MISSION_DEVICES_P60DOCKHANDLER_H_ */
|
#endif /* MISSION_DEVICES_P60DOCKHANDLER_H_ */
|
||||||
|
@ -0,0 +1,58 @@
|
|||||||
|
#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_P60DOCKHANDLERDEFINITIONS_H_
|
||||||
|
#define MISSION_DEVICES_DEVICEDEFINITIONS_P60DOCKHANDLERDEFINITIONS_H_
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This class helps to serialize and deserialze the P60 dock packet
|
||||||
|
* holding information about the module configuration. The parameters
|
||||||
|
* of this table are described in the gs-man-nanopower-p60-dock-2.2.9.pdf
|
||||||
|
* on page 16.
|
||||||
|
*/
|
||||||
|
//class ModuleConfigTable : public SerialLinkedListAdapter<SerializeIF> { //!< [EXPORT] : [SUBSERVICE] 2
|
||||||
|
//public:
|
||||||
|
// typedef char dataBufferType;
|
||||||
|
// typedef uint8_t typeOfMaxData;
|
||||||
|
//
|
||||||
|
// ModuleConfigTable() {
|
||||||
|
// setStart(&objectId);
|
||||||
|
// objectId.setNext(&sizeOfRepositoryPath);
|
||||||
|
// sizeOfRepositoryPath.setNext(&repositoryPath);
|
||||||
|
// repositoryPath.setNext(&sizeOfFilename);
|
||||||
|
// sizeOfFilename.setNext(&filename);
|
||||||
|
// /* Add string terminator to filename and repository path */
|
||||||
|
// repositoryPath.entry.insert('\0');
|
||||||
|
// filename.entry.insert('\0');
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// uint32_t getSizeOfRepositoryPath() {
|
||||||
|
// return sizeOfRepositoryPath;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// uint32_t getSizeOfFilename() {
|
||||||
|
// return sizeOfFilename;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// uint8_t * getRepositoryPath() {
|
||||||
|
// return repositoryPath.entry.front();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// uint8_t getFilename() {
|
||||||
|
// return filename.entry.front();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//private:
|
||||||
|
// /* Prevent object copying */
|
||||||
|
// ModuleConfigTable(const ModuleConfigTable &obj);
|
||||||
|
//
|
||||||
|
// SerializeElement<SerialBufferAdapter<char>> out_name;
|
||||||
|
// SerializeElement<SerialBufferAdapter<uint8_t>> out_en;
|
||||||
|
// SerializeElement<SerialBufferAdapter<uint16_t>> out_on_cnt;
|
||||||
|
// SerializeElement<SerialBufferAdapter<uint16_t>> out_on_cnt;
|
||||||
|
// SerializeElement<uint16_t> sizeOfRepositoryPath;
|
||||||
|
// SerializeElement<SerialFixedArrayListAdapter<dataBufferType, FN_MAXPATHNAME, typeOfMaxData>> repositoryPath;
|
||||||
|
// SerializeElement<uint8_t> sizeOfFilename;
|
||||||
|
// SerializeElement<SerialFixedArrayListAdapter<dataBufferType, FN_MAXNAME, typeOfMaxData>> filename;
|
||||||
|
//};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_P60DOCKHANDLERDEFINITIONS_H_ */
|
@ -20,7 +20,7 @@ SystemObject(objectId_){
|
|||||||
|
|
||||||
ReturnValue_t P60DockTestTask::performOperation(uint8_t operationCode) {
|
ReturnValue_t P60DockTestTask::performOperation(uint8_t operationCode) {
|
||||||
|
|
||||||
if(sendPacket() != HasReturnvaluesIF::RETURN_OK){
|
if(pingP60dock() != HasReturnvaluesIF::RETURN_OK){
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,43 +31,7 @@ ReturnValue_t P60DockTestTask::performOperation(uint8_t operationCode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ReturnValue_t P60DockTestTask::sendPacket(void){
|
ReturnValue_t P60DockTestTask::pingP60dock(void){
|
||||||
|
|
||||||
// char *msg = "HELLO";
|
|
||||||
// /* Get packet buffer for data */
|
|
||||||
// csp_packet_t *packet = csp_buffer_get(strlen(msg));
|
|
||||||
// if (packet == NULL) {
|
|
||||||
// /* Could not get buffer element */
|
|
||||||
// sif::error("Failed to get buffer element\\n");
|
|
||||||
// return HasReturnvaluesIF::RETURN_FAILED;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /* Connect P60 Dock */
|
|
||||||
// csp_conn_t *conn = csp_connect(CSP_PRIO_NORM, c, CSP_PING,
|
|
||||||
// 1000, CSP_O_NONE);
|
|
||||||
//
|
|
||||||
// if (conn == NULL) {
|
|
||||||
// /* Connect failed */
|
|
||||||
// sif::error("Connection failed\\n");
|
|
||||||
// /* Remember to free packet buffer */
|
|
||||||
// csp_buffer_free(packet);
|
|
||||||
// return HasReturnvaluesIF::RETURN_FAILED;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /* Copy message to packet */
|
|
||||||
// strcpy(packet->data, msg);
|
|
||||||
// /* Set packet length */
|
|
||||||
// packet->length = strlen(msg);
|
|
||||||
//
|
|
||||||
// /* Send packet */
|
|
||||||
// if (!csp_send(conn, packet, 1000)) {
|
|
||||||
// /* Send failed */
|
|
||||||
// sif::error("Send failed\\n");
|
|
||||||
// csp_buffer_free(packet);
|
|
||||||
// }
|
|
||||||
// /* Close connection */
|
|
||||||
// csp_close(conn);
|
|
||||||
|
|
||||||
uint32_t timeout = 1000;
|
uint32_t timeout = 1000;
|
||||||
unsigned int pingSize = 100; // 100 bytes
|
unsigned int pingSize = 100; // 100 bytes
|
||||||
uint32_t replyTime = csp_ping(p60dockAddress, timeout, pingSize, CSP_O_NONE);
|
uint32_t replyTime = csp_ping(p60dockAddress, timeout, pingSize, CSP_O_NONE);
|
||||||
@ -78,54 +42,35 @@ ReturnValue_t P60DockTestTask::sendPacket(void){
|
|||||||
|
|
||||||
|
|
||||||
ReturnValue_t P60DockTestTask::getParameters(void) {
|
ReturnValue_t P60DockTestTask::getParameters(void) {
|
||||||
// int result = rparam_get_full_table(&node_hk, p60dock_node, P60_PORT_RPARAM,
|
|
||||||
uint32_t timeout = 1000;
|
uint32_t timeout = 1000;
|
||||||
node_hk.rows = (gs_param_table_row_t*)p60dock_hk;
|
node_hk.rows = (gs_param_table_row_t*)p60dock_hk;
|
||||||
node_hk.id = P60DOCK_HK;
|
node_hk.id = P60DOCK_HK;
|
||||||
node_hk.row_count = p60dock_hk_count;
|
node_hk.row_count = p60dock_hk_count;
|
||||||
node_hk.memory_size = P60DOCK_HK_SIZE;
|
node_hk.memory_size = P60DOCK_HK_SIZE;
|
||||||
node_hk.memory = hk_mem;
|
node_hk.memory = hkMem;
|
||||||
|
/* Retriev all houskeeping data from the P60 dock and store it in hkMem
|
||||||
|
* array */
|
||||||
int result = gs_rparam_get_full_table(&node_hk, p60dockAddress, node_hk.id,
|
int result = gs_rparam_get_full_table(&node_hk, p60dockAddress, node_hk.id,
|
||||||
GS_RPARAM_MAGIC_CHECKSUM, timeout);
|
GS_RPARAM_MAGIC_CHECKSUM, timeout);
|
||||||
|
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
sif::info << "Error retrieving P60 Dock housekeeping\n" << std::endl;
|
sif::info << "Error retrieving P60 Dock housekeeping" << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
} else {
|
} else {
|
||||||
uint8_t tableOffsetTemperature = 0x44;
|
uint8_t tableOffsetTemperature = 0x44;
|
||||||
int16_t temperature[2];
|
int16_t temperature;
|
||||||
size_t parameterSize = sizeof(temperature);
|
size_t parameterSize = sizeof(temperature);
|
||||||
uint32_t flags = 0;
|
uint32_t flags = 0;
|
||||||
result = gs_param_get_data((gs_param_table_instance_t*) &node_hk,
|
result = gs_param_get_data((gs_param_table_instance_t*) &node_hk,
|
||||||
tableOffsetTemperature, temperature, parameterSize, flags);
|
tableOffsetTemperature, &temperature, parameterSize, flags);
|
||||||
sif::info << "P60 Dock Temperature 1: " << temperature[0] << std::endl;
|
sif::info << "P60 Dock Temperature: " << temperature << std::endl;
|
||||||
sif::info << "P60 Dock Temperature 2: " << temperature[1] << std::endl;
|
|
||||||
|
|
||||||
// sif::info << "Retrieved P60 Dock housekeeping\n" << std::endl;
|
uint16_t vbat_v;
|
||||||
// /* List all out_en[] values, using parameter name */
|
parameterSize = sizeof(vbat_v);
|
||||||
// const param_table_t * param = param_find_name(node_hk.table,
|
uint8_t vbat_v_offset = 0x74;
|
||||||
// node_hk.count, "out_en");
|
result = gs_param_get_data((gs_param_table_instance_t*) &node_hk,
|
||||||
// if (param != NULL) {
|
vbat_v_offset, &vbat_v, parameterSize, flags);
|
||||||
// for (uint8_t index = 0; index < 13; index++) {
|
sif::info << "VBAT_V: " << vbat_v << std::endl;
|
||||||
// /* Read parameter using name */
|
|
||||||
// uint8_t *out_en = param_read_addr(
|
|
||||||
// param->addr + param->size * index, &node_hk,
|
|
||||||
// param->size);
|
|
||||||
// sif::info << "out_en" << index << ": " << *out_en << std::endl;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// /* List all c_out[] values, using parameter address */
|
|
||||||
// param = param_find_addr(node_hk.table, node_hk.count, 0x0000);
|
|
||||||
// if (param != NULL) {
|
|
||||||
// for (uint8_t index = 0; index < 13; index++) {
|
|
||||||
// /* Read parameter using address */
|
|
||||||
// int16_t *c_out = param_read_addr(
|
|
||||||
// param->addr + param->size * index, &node_hk,
|
|
||||||
// param->size);
|
|
||||||
// sif::info << "c_out" << index << ": " << *c_out << "mA"
|
|
||||||
// << std::endl;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
@ -133,7 +78,7 @@ ReturnValue_t P60DockTestTask::getParameters(void) {
|
|||||||
|
|
||||||
ReturnValue_t P60DockTestTask::initializeCSPStack(void){
|
ReturnValue_t P60DockTestTask::initializeCSPStack(void){
|
||||||
/* Init CSP and CSP buffer system */
|
/* Init CSP and CSP buffer system */
|
||||||
if (csp_init(cspAddress) != CSP_ERR_NONE
|
if (csp_init(cspClientAddress) != CSP_ERR_NONE
|
||||||
|| csp_buffer_init(10, 300) != CSP_ERR_NONE) {
|
|| csp_buffer_init(10, 300) != CSP_ERR_NONE) {
|
||||||
sif::error << "Failed to init CSP\r\n" << std::endl;
|
sif::error << "Failed to init CSP\r\n" << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
|
@ -30,21 +30,26 @@ public:
|
|||||||
private:
|
private:
|
||||||
/* Interface struct for csp protocol stack */
|
/* Interface struct for csp protocol stack */
|
||||||
csp_iface_t csp_if;
|
csp_iface_t csp_if;
|
||||||
|
/* CSP address of P60 dock */
|
||||||
uint8_t p60dockAddress = 4;
|
uint8_t p60dockAddress = 4;
|
||||||
uint8_t CSP_PING = 1;
|
/* Client CSP address */
|
||||||
uint8_t cspAddress = 1;
|
uint8_t cspClientAddress = 1;
|
||||||
|
/* CAN interface used by CSP */
|
||||||
const char* canIf = "can0";
|
const char* canIf = "can0";
|
||||||
int bitrate = 1000; // bitrate of can
|
int bitrate = 1000; // bitrate of can
|
||||||
int promisc = 0; // set to 0 to enable filter mode
|
int promisc = 0; // set to 0 to enable filter mode
|
||||||
|
/* P60 Dock houskeeping parameters will be stored in this buffer */
|
||||||
uint8_t hk_mem[P60DOCK_HK_SIZE];
|
uint8_t hkMem[P60DOCK_HK_SIZE];
|
||||||
uint8_t p60dock_node = 4;
|
|
||||||
gs_param_table_instance_t node_hk;
|
gs_param_table_instance_t node_hk;
|
||||||
|
/* Port of CSP ping requests on P60 dock */
|
||||||
|
uint8_t CSP_PING = 1;
|
||||||
|
|
||||||
ReturnValue_t sendPacket(void);
|
/* Sends ping request and receives ping reply */
|
||||||
|
ReturnValue_t pingP60dock(void);
|
||||||
ReturnValue_t initializeCSPStack(void);
|
ReturnValue_t initializeCSPStack(void);
|
||||||
|
/* Temperature and raw battery voltage are read from the P60 dock by this
|
||||||
|
* function */
|
||||||
ReturnValue_t getParameters(void);
|
ReturnValue_t getParameters(void);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* TEST_TESTTASKS_P60DOCKTESTTASK_H_ */
|
#endif /* TEST_TESTTASKS_P60DOCKTESTTASK_H_ */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user