basic usart skeleton

This commit is contained in:
2018-01-12 12:03:46 +01:00
parent 9c5d889cfc
commit e88bf84ea1
9 changed files with 459 additions and 6 deletions
+7
View File
@@ -98,3 +98,10 @@ uint32_t iw_measure_total(void (*handler)(IniWriter *))
handler(&iw);
return 0xFFFFFFFF - iw.skip;
}
void iw_cmt_newline(IniWriter *iw)
{
if (SystemSettings.ini_comments) iw_newline(iw);
}
+2 -3
View File
@@ -45,10 +45,9 @@ static inline void iw_string(IniWriter *iw, const char *str)
}
}
void iw_cmt_newline(IniWriter *iw);
#define iw_newline(iw) iw_string(iw, "\r\n")
#define iw_cmt_newline(iw) do { \
if (SystemSettings.ini_comments) iw_string(iw, "\r\n"); \
} while (0)
/**
* Try to snprintf to the file
+15
View File
@@ -110,6 +110,21 @@ uint8_t str_parse_012(const char *str, const char *a, const char *b, const char
/** Convert bool to one of two options */
#define str_01(cond, a, b) ((cond) ? (b) : (a))
/** Convert number to one of three options */
#define str_3(cond, na, a, nb, b, nc, c) (\
((cond)==(na)) ? (a) : \
((cond)==(nb)) ? (b) : \
(c) \
)
/** Convert number to one of three options */
#define str_4(cond, na, a, nb, b, nc, c, nd, d) (\
((cond)==(na)) ? (a) : \
((cond)==(nb)) ? (b) : \
((cond)==(nc)) ? (c) : \
(d) \
)
/** Convert bool to Y or N */
#define str_yn(cond) ((cond) ? ("Y") : ("N"))