stroke verbessert
This commit is contained in:
parent
9ef5fdc9a9
commit
8bf9cfe00d
21
drv/b15f.cpp
21
drv/b15f.cpp
|
@ -28,15 +28,17 @@ void B15F::init()
|
|||
tcflush(usart, TCIFLUSH);
|
||||
|
||||
std::cout << "OK" << std::endl;
|
||||
|
||||
// verwerfe Daten, die µC noch hat
|
||||
discard();
|
||||
|
||||
// Verbindungstest muss dreimal erfolgreich sein
|
||||
std::cout << PRE << "Teste Verbindung... " << std::flush;
|
||||
for(uint8_t i = 0; i < 3; i++)
|
||||
{
|
||||
// verwerfe Daten, die µC noch hat
|
||||
discard();
|
||||
|
||||
if(!testConnection())
|
||||
throw DriverException("Verbindungstest fehlgeschlagen. Neueste Version im Einsatz?");
|
||||
}
|
||||
std::cout << "OK" << std::endl;
|
||||
|
||||
|
||||
|
@ -219,21 +221,20 @@ 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)
|
||||
bool B15F::analogEingabeSequenz(uint8_t channel_a, uint16_t* buffer_a, uint32_t offset_a, uint8_t channel_b, uint16_t* buffer_b, uint32_t offset_b, uint16_t start, int16_t delta, uint16_t count)
|
||||
{
|
||||
try
|
||||
{
|
||||
writeByte(RQ_ADC_DAC_STROKE);
|
||||
writeByte(RQ_ADC_DAC_STROKE);
|
||||
writeByte(channel_a);
|
||||
writeByte(channel_b);
|
||||
writeInt(start);
|
||||
writeInt(delta);
|
||||
writeInt(static_cast<uint16_t>(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++)
|
||||
{
|
||||
|
@ -248,7 +249,7 @@ bool B15F::analogEingabeSequenz(uint16_t* buffer_a, uint16_t* buffer_b, uint32_t
|
|||
catch(DriverException& de)
|
||||
{
|
||||
reconnect();
|
||||
return analogEingabeSequenz(buffer_a, buffer_b, offset_a, offset_b, start, delta, count);
|
||||
return analogEingabeSequenz(channel_a, buffer_a, offset_a, channel_b, buffer_b, offset_b, start, delta, count);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
bool analogeAusgabe0(uint16_t);
|
||||
bool analogeAusgabe1(uint16_t);
|
||||
uint16_t analogeEingabe(uint8_t);
|
||||
bool analogEingabeSequenz(uint16_t*, uint16_t*, uint32_t, uint32_t, uint16_t, uint16_t, uint16_t);
|
||||
bool analogEingabeSequenz(uint8_t channel_a, uint16_t* buffer_a, uint32_t offset_a, uint8_t channel_b, uint16_t* buffer_b, uint32_t offset_b, uint16_t start, int16_t delta, uint16_t count);
|
||||
|
||||
// Serielle Verbindung
|
||||
inline void writeByte(uint8_t);
|
||||
|
|
BIN
drv/b15f.o
BIN
drv/b15f.o
Binary file not shown.
2
main.cpp
2
main.cpp
|
@ -19,7 +19,7 @@ int main()
|
|||
|
||||
uint16_t ba[1024];
|
||||
uint16_t bb[1024];
|
||||
drv.analogEingabeSequenz(&ba[0], &bb[0], 0, 0, 0, 10, 100);
|
||||
drv.analogEingabeSequenz(1, &ba[0], 0, 0, &bb[0], 0, 1000, -10, 101);
|
||||
|
||||
std::cout << "Schluss." << std::endl;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue