C++20 driver to ds18b20

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi, I'm developing a C++20 driver to the digital thermometer ds18b20. The strong points of this work are the usage of: 1. stackless coroutines to allow an asynchronous approach to read the temperature value; 2. policies that enables/disables some features at compile-time with the purpose to optimize the code size. I'm using avr-gcc 10.2.0 with avr-libc 2.0.0.

 

https://github.com/ricardocosme/...

 

Any feedback is welcome.

 

github.com/ricardocosme

avrIO: Operation of I/O port pins and I/O registers.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Good luck! I realize this is a learning exercise, but I see some serious challenges ahead.

 

The original code has delays inside ATOMIC_BLOCK. This is going to necessitate a timer source that you can hook or subscribe too.

 

Asynchronous access to an IO bus will need a semaphore at a minimum, and possibly a supervisor to negotiate scheduling.

 

Stackless coroutines typically use heap memory for persistence. On a resource limited microcontroller you'll need to implement memory pools for scalability.

 

Ultimately, you'll probably arrive at yet another RTOS or cooperative multitasking microkernel for AVRs.