1
0
Fork 0

make format

This commit is contained in:
Arti Zirk 2016-10-11 00:43:31 +03:00
parent 39720c676e
commit 25b1feb71d
2 changed files with 9 additions and 6 deletions

View File

@ -61,7 +61,6 @@ int main (void)
lcd_puts_P(PSTR(" ")); /* Clear the end of the line */
lcd_goto(0x40); /* Got to the beginning of the next line */
/* set pin 3 low to turn led off */
PORTA &= ~_BV(PORTA3);
_delay_ms(BLINK_DELAY_MS);

View File

@ -1,27 +1,31 @@
#include <stdio.h>
#include "print_helper.h"
int print_ascii_tbl (FILE *stream) {
int print_ascii_tbl (FILE *stream)
{
for (char c = ' '; c <= '~'; c++) {
if(!fprintf(stream, "%c ", c)) {
if (!fprintf(stream, "%c ", c)) {
return 0;
}
}
return fprintf(stream, "\n");
}
int print_for_human (FILE *stream, const unsigned char *array, const int len) {
int print_for_human (FILE *stream, const unsigned char *array, const int len)
{
for (int i = 0; i < len; i++) {
if (array[i] >= ' ' && array[i] <= '~') {
if(!fprintf(stream, "%c", array[i])) {
if (!fprintf(stream, "%c", array[i])) {
return 0;
}
} else {
if(!fprintf(stream, "\"0x%02x\"", array[i])) {
if (!fprintf(stream, "\"0x%02x\"", array[i])) {
return 0;
}
}
}
return fprintf(stream, "\n");;
}