diff options
author | skullY <skullydazed@gmail.com> | 2019-08-30 11:19:03 -0700 |
---|---|---|
committer | skullydazed <skullydazed@users.noreply.github.com> | 2019-08-30 15:01:52 -0700 |
commit | b624f32f944acdc59dcb130674c09090c5c404cb (patch) | |
tree | bc13adbba137d122d9a2c2fb2fafcbb08ac10e25 /tmk_core/common/arm_atsam/printf.c | |
parent | 61af76a10d00aba185b8338604171de490a13e3b (diff) | |
download | qmk_firmware-b624f32f944acdc59dcb130674c09090c5c404cb.tar.gz |
clang-format changes
Diffstat (limited to 'tmk_core/common/arm_atsam/printf.c')
-rw-r--r-- | tmk_core/common/arm_atsam/printf.c | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/tmk_core/common/arm_atsam/printf.c b/tmk_core/common/arm_atsam/printf.c index 7f298d1fd..cd7cdb52e 100644 --- a/tmk_core/common/arm_atsam/printf.c +++ b/tmk_core/common/arm_atsam/printf.c @@ -17,50 +17,52 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifdef CONSOLE_ENABLE -#include "samd51j18a.h" -#include "arm_atsam_protocol.h" -#include "printf.h" -#include <string.h> -#include <stdarg.h> +# include "samd51j18a.h" +# include "arm_atsam_protocol.h" +# include "printf.h" +# include <string.h> +# include <stdarg.h> void console_printf(char *fmt, ...) { - while (udi_hid_con_b_report_trans_ongoing) {} //Wait for any previous transfers to complete + while (udi_hid_con_b_report_trans_ongoing) { + } // Wait for any previous transfers to complete - static char console_printbuf[CONSOLE_PRINTBUF_SIZE]; //Print and send buffer - va_list va; - int result; + static char console_printbuf[CONSOLE_PRINTBUF_SIZE]; // Print and send buffer + va_list va; + int result; va_start(va, fmt); result = vsnprintf(console_printbuf, CONSOLE_PRINTBUF_SIZE, fmt, va); va_end(va); uint32_t irqflags; - char *pconbuf = console_printbuf; //Pointer to start send from - int send_out = CONSOLE_EPSIZE; //Bytes to send per transfer + char * pconbuf = console_printbuf; // Pointer to start send from + int send_out = CONSOLE_EPSIZE; // Bytes to send per transfer - while (result > 0) { //While not error and bytes remain - while (udi_hid_con_b_report_trans_ongoing) {} //Wait for any previous transfers to complete + while (result > 0) { // While not error and bytes remain + while (udi_hid_con_b_report_trans_ongoing) { + } // Wait for any previous transfers to complete irqflags = __get_PRIMASK(); __disable_irq(); __DMB(); - if (result < CONSOLE_EPSIZE) { //If remaining bytes are less than console epsize - memset(udi_hid_con_report, 0, CONSOLE_EPSIZE); //Clear the buffer - send_out = result; //Send remaining size + if (result < CONSOLE_EPSIZE) { // If remaining bytes are less than console epsize + memset(udi_hid_con_report, 0, CONSOLE_EPSIZE); // Clear the buffer + send_out = result; // Send remaining size } - memcpy(udi_hid_con_report, pconbuf, send_out); //Copy data into the send buffer + memcpy(udi_hid_con_report, pconbuf, send_out); // Copy data into the send buffer - udi_hid_con_b_report_valid = 1; //Set report valid - udi_hid_con_send_report(); //Send report + udi_hid_con_b_report_valid = 1; // Set report valid + udi_hid_con_send_report(); // Send report __DMB(); __set_PRIMASK(irqflags); - result -= send_out; //Decrement result by bytes sent - pconbuf += send_out; //Increment buffer point by bytes sent + result -= send_out; // Decrement result by bytes sent + pconbuf += send_out; // Increment buffer point by bytes sent } } -#endif //CONSOLE_ENABLE +#endif // CONSOLE_ENABLE |