diff options
| author | sowgro <tpoke.ferrari@gmail.com> | 2025-09-09 15:16:07 -0400 |
|---|---|---|
| committer | sowgro <tpoke.ferrari@gmail.com> | 2025-09-09 15:16:07 -0400 |
| commit | 94189c8d7c13cc27b3d8dd11f9003cd9587da54d (patch) | |
| tree | 433b4c2221c6d76f3db1852a497f021c7dca3358 /project/Core | |
| parent | 4c7e6af00cacab1d2bdc466310929d6840d6019a (diff) | |
| download | 340-repo-Sowgro-94189c8d7c13cc27b3d8dd11f9003cd9587da54d.tar.gz 340-repo-Sowgro-94189c8d7c13cc27b3d8dd11f9003cd9587da54d.tar.bz2 340-repo-Sowgro-94189c8d7c13cc27b3d8dd11f9003cd9587da54d.zip | |
In class work
Diffstat (limited to 'project/Core')
| -rw-r--r-- | project/Core/Inc/Homework/printf.h | 1 | ||||
| -rw-r--r-- | project/Core/Src/Activties/activity1.txt | 25 | ||||
| -rw-r--r-- | project/Core/Src/Homework/printf.c | 11 | ||||
| -rw-r--r-- | project/Core/Src/main.c | 4 |
4 files changed, 37 insertions, 4 deletions
diff --git a/project/Core/Inc/Homework/printf.h b/project/Core/Inc/Homework/printf.h index 48952dc..4772dfd 100644 --- a/project/Core/Inc/Homework/printf.h +++ b/project/Core/Inc/Homework/printf.h @@ -9,5 +9,6 @@ #define INC_ACTIVITIES_PRINTF_H_ int printf(const char *format, ...); +int puts(const char *string); #endif /* INC_ACTIVITIES_PRINTF_H_ */ diff --git a/project/Core/Src/Activties/activity1.txt b/project/Core/Src/Activties/activity1.txt new file mode 100644 index 0000000..8a46d68 --- /dev/null +++ b/project/Core/Src/Activties/activity1.txt @@ -0,0 +1,25 @@ +73 - 64 = 9 +9 - 8 = 1 + +0100 1001 + +2^2 + 2^3 + 2^0 +4 9 +0x49 + + +-5 + +0000 0000 +0000 0101 +1111 1011 + +8 + 4 + 2 + 1 = F +8 + 2 + 1 = B + +0xFB + +0b 1101 0110 +2 + 4 + 16 + 64 + 128 = + +0xD6
\ No newline at end of file diff --git a/project/Core/Src/Homework/printf.c b/project/Core/Src/Homework/printf.c index 56216ad..60605f8 100644 --- a/project/Core/Src/Homework/printf.c +++ b/project/Core/Src/Homework/printf.c @@ -7,10 +7,19 @@ #include <stdio.h> #include <stdarg.h> +#include <string.h> #include "UART.h" #include "printf.h" -char buffer[80]; +char buffer[120]; + +int puts(const char *string) { + int n = strlen(string); + USART_Write(USART2, (unsigned char *) string, n); + USART_Write(USART2, (unsigned char *) "\n", 1); + return n + 1; +} + int printf(const char *format, ...) { va_list args; va_start(args, format); diff --git a/project/Core/Src/main.c b/project/Core/Src/main.c index f8709f3..1b6d449 100644 --- a/project/Core/Src/main.c +++ b/project/Core/Src/main.c @@ -18,9 +18,7 @@ int main(void){ LED_Init(); UART2_Init(); - int a = 1; - int b = 2; - printf("Hello %i %i \n\r", a, b); + printf("Hello world \r\n"); // application run function // run_demo() ; |
