This project provides a diagnostic printing module using FreeRTOS for task and queue management, designed for serial communication. It includes functionalities for initialization, deinitialization, and printing of diagnostic messages.
- Initialization and Deinitialization:
- Default and custom initialization (
init
) and deinitialization (deinit
) functions.
- Default and custom initialization (
- Printing:
- Default and custom print functions.
- Thread Safety:
- Uses mutex and queue for thread-safe printing.
- Task Management:
- A FreeRTOS task for handling queued messages.
To initialize the diagnostic print module:
if (!diagnostic_print_init()) {
// Handle initialization error
}
You can set custom initialization, deinitialization, and print functions:
diagnostic_print_set_init_func(custom_init_func);
diagnostic_print_set_deinit_func(custom_deinit_func);
diagnostic_print_set_print_func(custom_print_func);
To print a formatted message:
diagnostic_printf("Formatted message: %d", value);
To print a message with a newline:
diagnostic_println("Message with newline");
To deinitialize the diagnostic print module:
diagnostic_print_deinit();
Unit tests are provided in the unit_test.ino
file. These tests demonstrate the usage of the diagnostic print module and verify its functionality.
- Open the
unit_test.ino
file in the Arduino IDE. - Upload the code to your Arduino board.
- Open the Serial Monitor to view the test results.
This file contains the implementation of the diagnostic print module, including default functions, mutex and queue management, and the diagnostic print task.
This file provides the function prototypes and necessary includes for the diagnostic print module.
This file contains unit tests for the diagnostic print module, demonstrating its initialization, printing, and deinitialization functionalities.
- FreeRTOS
- Adafruit TinyUSB Library
This project is licensed under the MIT License.
Contributions are welcome! Please submit pull requests or open issues for any bugs or feature requests.
Special thanks to the contributors and the open-source community.
For any questions or inquiries, please contact [your email].