int receive geht

This commit is contained in:
Tristan Krause 2019-04-02 11:53:38 +02:00
parent 987f5590ce
commit 25f313fbf2
5 changed files with 11 additions and 6 deletions

View file

@ -49,6 +49,7 @@ void B15F::init()
if(!testConnection())
continue;
if(!testIntConv())
continue;
@ -106,7 +107,6 @@ bool B15F::testConnection()
usart.writeByte(RQ_TEST);
usart.writeByte(dummy);
usart.writeByte(0x80);
uint8_t aw = usart.readByte();
uint8_t mirror = usart.readByte();
@ -121,7 +121,6 @@ bool B15F::testIntConv()
usart.writeByte(RQ_INT);
usart.writeInt(dummy);
usart.writeByte(0x80);
uint16_t aw = usart.readInt();
return aw == dummy * 3;
@ -133,7 +132,6 @@ std::vector<std::string> B15F::getBoardInfo(void)
std::vector<std::string> info;
usart.writeByte(RQ_INFO);
usart.writeByte(0x80);
uint8_t n = usart.readByte();
while(n--)
@ -228,10 +226,13 @@ bool B15F::analogSequence(uint8_t channel_a, uint16_t* buffer_a, uint32_t offset
usart.writeInt(start);
usart.writeInt(static_cast<uint16_t>(delta));
usart.writeInt(count);
/*
uint8_t aw = usart.readByte();
if(aw != MSG_OK)
throw DriverException("Mikrocontroller nicht synchron");
*/
for(uint16_t i = 0; i < count; i++)
{
@ -239,7 +240,7 @@ bool B15F::analogSequence(uint8_t channel_a, uint16_t* buffer_a, uint32_t offset
buffer_b[i] = usart.readInt();
}
aw = usart.readByte();
uint8_t aw = usart.readByte();
if(aw == MSG_OK)
return aw;

Binary file not shown.

Binary file not shown.

View file

@ -129,17 +129,21 @@ void testFunktionen()
std::cout << "adc: " << (int) drv.analogRead(4) << std::endl;
std::cout << "Kennlinie..." << std::endl;
uint16_t a[1024];
uint16_t b[1024];
drv.analogSequence(0, &a[0], 0, 1, &b[0], 0, 0, 1, 1024);
for(uint16_t i= 0; i < sizeof(a) / sizeof(uint16_t); i++)
{
std::cout << (int) i << " : " << a[i] << " " << b[i] << std::endl;
}
}
int main()
{
kennlinieZweiterQuadrant();
testFunktionen();
std::cout << "Schluss." << std::endl;
}

Binary file not shown.