complex stroke erste version
This commit is contained in:
parent
a3e9e1ce27
commit
9ef5fdc9a9
6 changed files with 57 additions and 21 deletions
46
drv/b15f.cpp
46
drv/b15f.cpp
|
@ -45,20 +45,6 @@ void B15F::init()
|
||||||
if(!testIntConv())
|
if(!testIntConv())
|
||||||
throw DriverException("Konvertierung fehlgeschlagen.");
|
throw DriverException("Konvertierung fehlgeschlagen.");
|
||||||
std::cout << "OK" << std::endl;
|
std::cout << "OK" << std::endl;
|
||||||
|
|
||||||
while(1)
|
|
||||||
{
|
|
||||||
digitaleAusgabe0(0xFF);
|
|
||||||
digitaleAusgabe0(0x00);
|
|
||||||
//analogeEingabe(0);
|
|
||||||
/*for(uint16_t i = 0; i < 1024; )
|
|
||||||
{
|
|
||||||
i = analogeEingabe(0);
|
|
||||||
analogeAusgabe0(i);
|
|
||||||
delay(0);
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void B15F::reconnect()
|
void B15F::reconnect()
|
||||||
|
@ -233,6 +219,38 @@ uint16_t B15F::analogeEingabe(uint8_t channel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool B15F::analogEingabeSequenz(uint16_t* buffer_a, uint16_t* buffer_b, uint32_t offset_a, uint32_t offset_b, uint16_t start, uint16_t delta, uint16_t count)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
writeByte(RQ_ADC_DAC_STROKE);
|
||||||
|
writeInt(start);
|
||||||
|
writeInt(delta);
|
||||||
|
writeInt(count);
|
||||||
|
uint8_t aw = readByte();
|
||||||
|
|
||||||
|
if(aw != MSG_OK)
|
||||||
|
{
|
||||||
|
std::cout << "nein: " << (int) aw << std::endl;
|
||||||
|
throw DriverException("Mikrocontroller nicht synchronisiert");
|
||||||
|
}
|
||||||
|
|
||||||
|
for(uint16_t i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
buffer_a[offset_a + i] = readInt();
|
||||||
|
buffer_b[offset_b + i] = readInt();
|
||||||
|
std::cout << "(" << i << ") " << buffer_a[offset_a + i] << " \t| " << buffer_b[offset_b + i] << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
aw = readByte();
|
||||||
|
return aw == MSG_OK;
|
||||||
|
}
|
||||||
|
catch(DriverException& de)
|
||||||
|
{
|
||||||
|
reconnect();
|
||||||
|
return analogEingabeSequenz(buffer_a, buffer_b, offset_a, offset_b, start, delta, count);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void B15F::writeByte(uint8_t b)
|
void B15F::writeByte(uint8_t b)
|
||||||
|
|
16
drv/b15f.h
16
drv/b15f.h
|
@ -27,13 +27,14 @@ public:
|
||||||
bool testIntConv(void);
|
bool testIntConv(void);
|
||||||
|
|
||||||
// Board Befehle
|
// Board Befehle
|
||||||
inline bool digitaleAusgabe0(uint8_t);
|
bool digitaleAusgabe0(uint8_t);
|
||||||
inline bool digitaleAusgabe1(uint8_t);
|
bool digitaleAusgabe1(uint8_t);
|
||||||
inline uint8_t digitaleEingabe0(void);
|
uint8_t digitaleEingabe0(void);
|
||||||
inline uint8_t digitaleEingabe1(void);
|
uint8_t digitaleEingabe1(void);
|
||||||
inline bool analogeAusgabe0(uint16_t);
|
bool analogeAusgabe0(uint16_t);
|
||||||
inline bool analogeAusgabe1(uint16_t);
|
bool analogeAusgabe1(uint16_t);
|
||||||
inline uint16_t analogeEingabe(uint8_t);
|
uint16_t analogeEingabe(uint8_t);
|
||||||
|
bool analogEingabeSequenz(uint16_t*, uint16_t*, uint32_t, uint32_t, uint16_t, uint16_t, uint16_t);
|
||||||
|
|
||||||
// Serielle Verbindung
|
// Serielle Verbindung
|
||||||
inline void writeByte(uint8_t);
|
inline void writeByte(uint8_t);
|
||||||
|
@ -73,6 +74,7 @@ private:
|
||||||
constexpr static uint8_t RQ_AA0 = 9;
|
constexpr static uint8_t RQ_AA0 = 9;
|
||||||
constexpr static uint8_t RQ_AA1 = 10;
|
constexpr static uint8_t RQ_AA1 = 10;
|
||||||
constexpr static uint8_t RQ_ADC = 11;
|
constexpr static uint8_t RQ_ADC = 11;
|
||||||
|
constexpr static uint8_t RQ_ADC_DAC_STROKE = 12;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // B15F_h
|
#endif // B15F_h
|
||||||
|
|
BIN
drv/b15f.o
BIN
drv/b15f.o
Binary file not shown.
BIN
main
BIN
main
Binary file not shown.
16
main.cpp
16
main.cpp
|
@ -5,5 +5,21 @@ int main()
|
||||||
{
|
{
|
||||||
B15F& drv = B15F::getInstance();
|
B15F& drv = B15F::getInstance();
|
||||||
drv.init();
|
drv.init();
|
||||||
|
|
||||||
|
/*
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
for(uint16_t i = 0; i < 1024; i++)
|
||||||
|
{
|
||||||
|
drv.analogeAusgabe0(drv.analogeEingabe(5));
|
||||||
|
//drv.delay(10);
|
||||||
|
//drv.digitaleAusgabe0(drv.digitaleEingabe0());
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
uint16_t ba[1024];
|
||||||
|
uint16_t bb[1024];
|
||||||
|
drv.analogEingabeSequenz(&ba[0], &bb[0], 0, 0, 0, 10, 100);
|
||||||
|
|
||||||
std::cout << "Schluss." << std::endl;
|
std::cout << "Schluss." << std::endl;
|
||||||
}
|
}
|
||||||
|
|
BIN
main.o
BIN
main.o
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue