Bidir optical comms working

This commit is contained in:
jaseg 2020-11-27 18:48:54 +01:00
parent 822c8a21d7
commit 2967dcee39
2 changed files with 7 additions and 5 deletions

View file

@ -73,18 +73,20 @@ int main(void) {
int i = 0;
while (23) {
if (tx_st.remaining_bytes == 0) {
if (i > 10000) {
if (i > 1000) {
res_buf.req_seq = req_seq;
res_buf.res_seq = res_seq;
res_seq += 1;
//packetize(&res_buf, &res_buf.trailer);
packetize(&res_buf, &res_buf.trailer);
tx_st.tx_char = tx_buf;
//tx_st.remaining_bytes = cobs_encode((uint8_t *)&res_buf, sizeof(res_buf), tx_buf, sizeof(tx_buf));;
tx_st.remaining_bytes = cobs_encode((uint8_t *)&res_buf, sizeof(res_buf), tx_buf, sizeof(tx_buf));;
/*
for (int k=0; k < 8; k++)
tx_buf[k] = 255-k;
for (int k=0; k < 8; k++)
tx_buf[8+k] = (k + 1) % 8;
tx_st.remaining_bytes = 16;
*/
i = 0;
} else {
i++;