Hi.
I'm developing a sensor driver for the Spec Sensors DGS-O3 968-042 UART gas sensor for the nRF9160 (Thingy:91 to be precise)
The general gist of it is that I need to send a character command to the sensor, and get a sensor value in return with some additional information (I'm guessing around 1024 bits) through UART.
After looking around a bit online, I'm seeing a lot of different ways of going about this. I have a sense of some of the API commands that I can use through the Zephyr UART library, but there are some details that are unclear to me. Maybe some of you could help me out?
Some questions I have:
1. To what extent do I need to implement threading to maintain a relative low amount of power? Should I thread RX, TX or both?
2. What are the advantages of making it interrupt based vs. asyncronous? (I guess this is where polling comes in)
3. My sensor has a specific baudrate and UART settings. Should I use the uart_configure command to set up my sensor?
There are also some examples of how to implement UART for both Zephyr and the nRF9160, but I felt that none of them really made it clear what I should do:
Low Power UART: https://github.com/nrfconnect/sdk-nrf/tree/master/samples/peripheral/lpuart
UART RX sample: https://github.com/Rallare/fw-nrfconnect-nrf/blob/nrf9160_samples/samples/nrf9160/uart/src/main.c
Old example for the pms7003: https://elixir.bootlin.com/zephyr/v1.11.0-rc1/source/drivers/sensor/pms7003/pms7003.c
If I get some clarity in how to best implement this, then I'll throw up some generic samples on my Github ;)