bla
This commit is contained in:
parent
09f82d5258
commit
22968ef6a4
@ -25,15 +25,16 @@ int main (void)
|
|||||||
PSTR(GIT_DESCR), PSTR(__DATE__), PSTR(__TIME__));
|
PSTR(GIT_DESCR), PSTR(__DATE__), PSTR(__TIME__));
|
||||||
fprintf_P(stderr, PSTR(VER_LIBC), PSTR(__AVR_LIBC_VERSION_STRING__));
|
fprintf_P(stderr, PSTR(VER_LIBC), PSTR(__AVR_LIBC_VERSION_STRING__));
|
||||||
/* End stdio init and info print */
|
/* End stdio init and info print */
|
||||||
|
|
||||||
fprintf_P(stdout, PSTR(STUD_NAME "\n"));
|
fprintf_P(stdout, PSTR(STUD_NAME "\n"));
|
||||||
lcd_puts_P(PSTR(STUD_NAME));
|
lcd_puts_P(PSTR(STUD_NAME));
|
||||||
/* ASCII table print */
|
/* ASCII table print */
|
||||||
print_ascii_tbl(stdout);
|
print_ascii_tbl(stdout);
|
||||||
unsigned char ascii[128] = {0};
|
unsigned char ascii[128] = {0};
|
||||||
|
|
||||||
for (unsigned char i = 0; i < sizeof(ascii); i++) {
|
for (unsigned char i = 0; i < sizeof(ascii); i++) {
|
||||||
ascii[i] = i;
|
ascii[i] = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
print_for_human(stdout, ascii, sizeof(ascii));
|
print_for_human(stdout, ascii, sizeof(ascii));
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
@ -42,6 +43,7 @@ int main (void)
|
|||||||
fscanf(stdin, "%c", &month_first_leter);
|
fscanf(stdin, "%c", &month_first_leter);
|
||||||
fprintf(stdout, "%c\n", month_first_leter);
|
fprintf(stdout, "%c\n", month_first_leter);
|
||||||
lcd_goto(0x40);
|
lcd_goto(0x40);
|
||||||
|
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
if (!strncmp_P(&month_first_leter, (PGM_P)pgm_read_word(&months_table[i]), 1)) {
|
if (!strncmp_P(&month_first_leter, (PGM_P)pgm_read_word(&months_table[i]), 1)) {
|
||||||
fprintf_P(stdout, PSTR("%S\n"), (PGM_P)pgm_read_word(&months_table[i]));
|
fprintf_P(stdout, PSTR("%S\n"), (PGM_P)pgm_read_word(&months_table[i]));
|
||||||
@ -49,9 +51,11 @@ int main (void)
|
|||||||
lcd_putc(' ');
|
lcd_putc(' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
lcd_putc(' ');
|
lcd_putc(' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set pin 3 high to turn led on */
|
/* set pin 3 high to turn led on */
|
||||||
PORTA |= _BV(PORTA3);
|
PORTA |= _BV(PORTA3);
|
||||||
_delay_ms(BLINK_DELAY_MS);
|
_delay_ms(BLINK_DELAY_MS);
|
||||||
|
@ -1,17 +1,20 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "print_helper.h"
|
#include "print_helper.h"
|
||||||
|
|
||||||
int print_ascii_tbl (FILE *stream) {
|
int print_ascii_tbl (FILE *stream)
|
||||||
|
{
|
||||||
for (char c = ' '; c <= '~'; c++) {
|
for (char c = ' '; c <= '~'; c++) {
|
||||||
if (!fprintf(stream, "%c ", c)) {
|
if (!fprintf(stream, "%c ", c)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return fprintf(stream, "\n");
|
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++) {
|
for (int i = 0; i < len; i++) {
|
||||||
if (array[i] >= ' ' && array[i] <= '~') {
|
if (array[i] >= ' ' && array[i] <= '~') {
|
||||||
if (!fprintf(stream, "%c", array[i])) {
|
if (!fprintf(stream, "%c", array[i])) {
|
||||||
@ -23,5 +26,6 @@ int print_for_human (FILE *stream, const unsigned char *array, const int len) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return fprintf(stream, "\n");;
|
return fprintf(stream, "\n");;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user