Commit bb8857d3 authored by Till Pritzke's avatar Till Pritzke
Browse files

code added

nicht funktional
parent bbaff4f0
......@@ -12,7 +12,7 @@ volatile uint32_t glob::SECOND_TICKS = 0;
#if VOR_ADD_TEST_TASKS == 1
#if VOR_ADD_LED_TASK == 1
LedTask glob::ledTaskHandle("LED", 200, LedTask::LedModes::DISCO);
LedTask glob::ledTaskHandle("LED", 200, LedTask::LedModes::WAVE_UP);
#endif
PayloadPeriodicTask glob::payloadTestTaskHandle("TEST_TASK", 1000);
......
......@@ -2,8 +2,7 @@
#include <mission/core/loop.h>
#include <mission/core/globalObjects.h>
int main(void) {
int setupResult = setup(nullptr);
int main(void) { int setupResult = setup(nullptr);
if(setupResult != 0) {
// failure value for now, can be checked here.
// software reset or command to PCDU to restart?
......
......@@ -8,6 +8,8 @@
#include <array>
#include <cstring>
PayloadPeriodicTask::PayloadPeriodicTask(std::string name, uint32_t period,
void (*deadlineMissedFunction)(void)):
TestTask(name, period, deadlineMissedFunction) {
......@@ -18,13 +20,34 @@ PayloadPeriodicTask::~PayloadPeriodicTask() {
int PayloadPeriodicTask::initialize() {
VOR_CInfo("Hallo allerste Welt\n\r");
//*****************************************************************************
//
//PWM activate
//SPI Initialize
//J-Scope Channel Config
//
/*
static uint32_t ACTIVATE_PWMS_A = (1 << 2);
VOR_SYSCONFIG->TIM_CLK_ENABLE |= ACTIVATE_PWMS_A;
VOR_GPIO_PinMux(GPORTA, 2, FUNSEL1);
pwm::activate_pwm(pwm_fr, pwm_duty, pwm_idx);
*/
//adc9 = new AdcADS8343(nullptr, *spi, SpiBus::SPI_BUS_1, VOR_SPI_SLAVE_SELECT_VAL0, 1000, AdcADS8343::SETUP_0_Internal_Clock);
//adc10 = new AdcADS8343(nullptr, *spi, SpiBus::SPI_BUS_0, VOR_SPI_SLAVE_SELECT_VAL0, 1000, AdcADS8343::SETUP_0_Internal_Clock);
//adc9->initialize();
//adc10->initialize();
//SEGGER_RTT_ConfigUpBuffer(JS_RTT_Channel, J_Scope_ChannelName, &JS_RTT_UpBuffer[0], sizeof(JS_RTT_UpBuffer), SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL);
//*****************************************************************************
int result = 0;
performADCTest = true;
//performADCTest = true;
if(performADCTest) {
/*if(performADCTest) {
result = gpioHandler.initialize();
gpioHandler.switchAdcs(false);
spi = new SpiHandler(&configSpiPinsAdc);
......@@ -42,6 +65,7 @@ int PayloadPeriodicTask::initialize() {
adc2 = new AdcADS8343(nullptr, *spi, SpiBus::SPI_BUS_0, VOR_SPI_SLAVE_SELECT_VAL6, 1000, AdcADS8343::SETUP_0_Internal_Clock);
adc1 = new AdcADS8343(nullptr, *spi, SpiBus::SPI_BUS_0, VOR_SPI_SLAVE_SELECT_VAL7, 1000, AdcADS8343::SETUP_0_Internal_Clock);
}
return result;
adc8->initialize();
......@@ -49,15 +73,16 @@ int PayloadPeriodicTask::initialize() {
return result;
}
}*/
int PayloadPeriodicTask::performOneShotAction() {
return 0;
}
int PayloadPeriodicTask::performPeriodicAction() {
VOR_CInfo("Hallo Welt\n\r");
/*VOR_CInfo("J-Link activ\n\r");
TestTask::performPeriodicAction();
......@@ -82,7 +107,7 @@ int PayloadPeriodicTask::performPeriodicAction() {
testvalue2 [idy] = V_ref + 2* V_ref* testvalue [idy]/ resolution;
}
VOR_Info("ADC 7: CH0 Wun T 4 [%f] CH1 Wun HF 4 [%f] CH2 PT1k1 5 [%f] CH3 PT1k2 5 [%f]\n\r",testvalue2[0],testvalue2[1],testvalue2[2],testvalue2[3]);
VOR_Info("ADC 7: CH0 Wun T 4 [%f] CH1 Wun HF 4 [%f] CH2 PT1k1 5 [%f] CH3 PT1k2 5 [%f]\n\r",testvalue2[0],testvalue2[1],testvalue2[2],testvalue2[3]);
uint16_t valuesAdc6[4] = {0,0,0,0};
......@@ -141,10 +166,10 @@ int PayloadPeriodicTask::performPeriodicAction() {
testvalue2 [idy] = V_ref + 2* V_ref* testvalue [idy]/ resolution;
}
VOR_Info("ADC 2: CH0 PT1k1 2 [%f] CH1 PT1k2 2 [%f] CH2 Wun T 1 [%f] CH3 Wun HF 1 [%f]\n\r",testvalue2[0],testvalue2[1],testvalue2[2],testvalue2[3]);
VOR_Info("ADC 2: CH0 PT1k1 2 [%f] CH1 PT1k2 2 [%f] CH2 Wun T 1 [%f] CH3 Wun HF 1 [%f]\n\r",testvalue2[0],testvalue2[1],testvalue2[2],testvalue2[3]);
uint16_t valuesAdc1[4] = {0,0,0,0};
uint16_t valuesAdc1[4] = {0,0,0,0};
for(uint8_t idy = 0; idy < 4; idy++) {
......@@ -153,10 +178,44 @@ int PayloadPeriodicTask::performPeriodicAction() {
testvalue[idy] = valuesAdc1[idy] ;
testvalue2 [idy] = V_ref + 2* V_ref* testvalue [idy]/ resolution;
}
VOR_Info("ADC 1: CH0 PT1k1 1 [%f] CH1 PT1k2 1 [%f] CH2 P Meas 1 [%f] CH3 P Ref 1 [%f]\n\r",testvalue2[0],testvalue2[1],testvalue2[2],testvalue2[3]);
VOR_Info("ADC 1: CH0 PT1k1 1 [%f] CH1 PT1k2 1 [%f] CH2 P Meas 1 [%f] CH3 P Ref 1 [%f]\n\r",testvalue2[0],testvalue2[1],testvalue2[2],testvalue2[3]);
}
//*******************************************************************************
//J-Scope Test
//
/*if (i > 0) {
acValBuffer.vU32 = 100;
acValBuffer.vI32 = -100;
i = 0;
} else {
acValBuffer.vU32 = 0;
acValBuffer.vI32 = 0;
i++;
}
//pwm::update_pwm(pwm_fr, pwm_duty, pwm_idx);
uint16_t valuesAdc9[4] = {0,0,0,0};
for(uint8_t idy = 0; idy < 4; idy++) {
adc9->readChannel(idy, *(valuesAdc9 + idy), true);
Clock::delayMicroseconds(10);
}
uint16_t valuesAdc10[4] = {0,0,0,0};
for(uint8_t idy = 0; idy < 4; idy++) {
adc10->readChannel(idy, *(valuesAdc10 + idy), true);
Clock::delayMicroseconds(10);
}
//void* pin_porta2 = VOR_GPIO_PERIPHERAL_Type.DATAIN;
//VOR_Info(&pin_porta2);
//SEGGER_RTT_Write(JS_RTT_Channel, , sizeof());
//*******************************************************************************
*/
return 0;
}
......@@ -183,6 +242,8 @@ void PayloadPeriodicTask::configSpiPinsAdc(void) {
VOR_GPIO_PinMux(GPORTA, 23, FUNSEL1);
VOR_GPIO_PinMux(GPORTA, 22, FUNSEL1);
VOR_GPIO_PinMux(GPORTA, 21, FUNSEL1);
}
//void PowerPeriodicTask::configureRs485Pins(void) {
......@@ -203,3 +264,4 @@ void PayloadPeriodicTask::configAdcSsPins(void) {
//VOR_GPIO_PinMux(GPORTB, 16, FUNSEL1);
}
......@@ -13,6 +13,12 @@
#include <vector>
#include "vor_common/common/peripherals/pwm.h"
#include <va108xx.h>
//J-Scope include *************************************************************
#include "vor_common/vorago/hdr/vorago/utilities/segger_rtt.h"
//*****************************************************************************
#define GPIO_NUMBER 31
class PayloadPeriodicTask: public TestTask {
......@@ -31,6 +37,53 @@ public:
private:
//*****************************************************************************
//J-Scope test data
//
struct {
unsigned int vU32;
int vI32;
} acValBuffer;
uint8_t i=0;
//
// J-Scope Buffer
//
char JS_RTT_UpBuffer[4096];
int8_t JS_RTT_Channel = 1;
/* RTT channel naming convention
*
* J-Scope searches for the first RTT channel named JScope_<FORMAT>,
* where FORMAT defines the format of the data written to the buffer by the target application.
* All variable identifiers consist of a type identifier and a size indication (in bytes).
* The data inside a packet has to be in same order as declared in FORMAT.
* If a timestamp is provided, it needs to be declared as first variable.
* There is a limit of twelve variables in total (including timestamp).
*
* |Type |Supported Sizes |Note |
* |t |4 |Indicates that every packet is preceded by a 32bit value containing a timestamp in s |
* |b |1 |Specifies a boolean value |
* |f |4 |Specifies a 32bit floating point value |
* |i |1,2,4 |Specifies a signed 8-, 16- or 32bit value |
* |u |1,2,4 |Specifies a unsigned 8-, 16- or 32bit value |
*
* Example: "JScope_U4I4" for an unsigned 4 byte int followed by an signed 4 byte int
*/
const char *J_Scope_ChannelName = "JScope_U2"; // setup for int readout J-Scope
//
//PWM data
//
uint32_t pwm_fr = 100;
percent_1000_t pwm_duty =50000;
uint8_t pwm_idx = 2;
//*****************************************************************************
GPIO_RESOURCES gpioResource[GPIO_NUMBER] = {};
VOR_DRIVER_GPIO driver[GPIO_NUMBER] = {};
......@@ -40,7 +93,11 @@ private:
GpioHandler gpioHandler;
SpiHandler* spi = nullptr;
AdcADS8343* adc8 = nullptr;
//AdcADS8343* adc10 = nullptr;
//AdcADS8343* adc9 = nullptr;
/*AdcADS8343* adc8 = nullptr;
AdcADS8343* adc7= nullptr;
AdcADS8343* adc6= nullptr;
AdcADS8343* adc5= nullptr;
......@@ -48,7 +105,7 @@ private:
AdcADS8343* adc3= nullptr;
AdcADS8343* adc2= nullptr;
AdcADS8343* adc1= nullptr;
*/
int16_t testvalue [4] = {};
float testvalue2 [4] = {};
float V_ref = 1.25;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment