How to parse data from sensor (UART)

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
mravenca
Posts: 7
Joined: Tue Mar 05, 2019 2:18 pm

How to parse data from sensor (UART)

Post by mravenca »

Hello, I have a circuit with encoder that sends data to serial port in format "value\n". The length of value is variable.

I want to read the value by ChibiOS serial.

What is the best approach?

I had a look on shell.c, maybe I could get inspired.

Thanks

Vaclav
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: How to parse data from sensor (UART)

Post by Giovanni »

Hi,

There are two UART drivers in HAL: the Serial driver and the UART driver, you need to use the Serial driver. In the shell you could take code from the function that reads the input line, it should be very simple, just remove the echo code if you don't need it.

Giovanni
Post Reply