PlatformIO Community

Simple project file structure - multiple .cpp/.h files in a single directory?

I want to arrange files of a simple firmware project in the following way:

├── drivers
│   ├── ads1256.cpp
│   ├── ads1256.h
│   ├── ads1256_regmap.h
│   ├── tlc59208.cpp
│   └── tlc59208.h
├── app
│   ├── assert.cpp
│   ├── assert.h
│   ├── command.cpp
│   ├── command.h
│   ├── led.cpp
│   ├── led.h
│   └── main.cpp
├── test
│   └── test_ads1256.cpp
│   └── test_tlc59208.cpp
└── platformio.ini

But by default, PlatformIO assumes a more… nested file organization for libs/ and tests/, requiring a subdirectory for each library or test. How can I achieve this simpler, flatter structure for small projects?

I know I can come close to the desired structure by using lib_extra_dirs = drivers and putting each driver in a dedicated subdir + also tests need to be in a dedicated subdir each… but, do I really NEED to?

And an more philosophical/educational subquestion: why wouldn’t I want to do this kind of file layout in smal projects? Why is the one-subdirectory-per-lib preferred?