analogSequence repaired
This commit is contained in:
parent
ff84de538a
commit
bff5ff42e9
85 changed files with 1180 additions and 287 deletions
|
@ -125,7 +125,7 @@ bool B15F::testIntConv()
|
|||
usart.transmit(&rq[0], 0, sizeof(rq));
|
||||
|
||||
uint16_t aw;
|
||||
usart.receive(reinterpret_cast<uint8_t*>(&aw), 0, sizeof(aw));
|
||||
usart.receive(reinterpret_cast<uint8_t *>(&aw), 0, sizeof(aw));
|
||||
|
||||
return aw == dummy * 3;
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ uint16_t B15F::analogRead(uint8_t channel)
|
|||
usart.transmit(&rq[0], 0, sizeof(rq));
|
||||
|
||||
uint16_t aw;
|
||||
usart.receive(reinterpret_cast<uint8_t*>(&aw), 0, sizeof(aw));
|
||||
usart.receive(reinterpret_cast<uint8_t *>(&aw), 0, sizeof(aw));
|
||||
|
||||
if (aw > 1023)
|
||||
abort("Bad ADC data detected (1)");
|
||||
|
@ -302,45 +302,58 @@ void
|
|||
B15F::analogSequence(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)
|
||||
{
|
||||
/*
|
||||
// prepare pointers
|
||||
buffer_a += offset_a;
|
||||
buffer_b += offset_b;
|
||||
|
||||
|
||||
usart.clearInputBuffer();
|
||||
usart.writeByte(RQ_ADC_DAC_STROKE);
|
||||
usart.writeByte(channel_a);
|
||||
usart.writeByte(channel_b);
|
||||
usart.writeInt(start);
|
||||
usart.writeInt(static_cast<uint16_t>(delta));
|
||||
usart.writeInt(count);
|
||||
uint8_t rq[] =
|
||||
{
|
||||
RQ_ADC_DAC_STROKE,
|
||||
channel_a,
|
||||
channel_b,
|
||||
static_cast<uint8_t >(start & 0xFF),
|
||||
static_cast<uint8_t >(start >> 8),
|
||||
static_cast<uint8_t >(delta & 0xFF),
|
||||
static_cast<uint8_t >(delta >> 8),
|
||||
static_cast<uint8_t >(count & 0xFF),
|
||||
static_cast<uint8_t >(count >> 8)
|
||||
};
|
||||
|
||||
for (uint16_t i = 0; i < count; i++) {
|
||||
if (buffer_a) {
|
||||
buffer_a[i] = usart.readInt();
|
||||
usart.transmit(&rq[0], 0, sizeof(rq));
|
||||
|
||||
for (uint16_t i = 0; i < count; i++)
|
||||
{
|
||||
if (buffer_a)
|
||||
{
|
||||
usart.receive(reinterpret_cast<uint8_t *>(&buffer_a[i]), 0, 2);
|
||||
|
||||
if (buffer_a[i] > 1023) // check for broken usart connection
|
||||
abort("Bad ADC data detected (2)");
|
||||
} else {
|
||||
usart.readInt();
|
||||
}
|
||||
else
|
||||
{
|
||||
usart.drop(2);
|
||||
}
|
||||
|
||||
if (buffer_b) {
|
||||
buffer_b[i] = usart.readInt();
|
||||
if (buffer_b)
|
||||
{
|
||||
usart.receive(reinterpret_cast<uint8_t *>(&buffer_b[i]), 0, 2);
|
||||
|
||||
if (buffer_b[i] > 1023) // check for broken usart connection
|
||||
abort("Bad ADC data detected (3)");
|
||||
} else {
|
||||
usart.readInt();
|
||||
}
|
||||
else
|
||||
{
|
||||
usart.drop(2);
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t aw = usart.readByte();
|
||||
if (aw != MSG_OK)
|
||||
uint8_t aw;
|
||||
usart.receive(&aw, 0, sizeof(aw));
|
||||
if(aw != MSG_OK)
|
||||
abort("Sequenz unterbrochen");
|
||||
|
||||
delay_us(10);*/
|
||||
}
|
||||
|
||||
uint8_t B15F::pwmSetFrequency(uint32_t freq)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue