summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsowgro <tpoke.ferrari@gmail.com>2025-09-09 15:16:07 -0400
committersowgro <tpoke.ferrari@gmail.com>2025-09-09 15:16:07 -0400
commit94189c8d7c13cc27b3d8dd11f9003cd9587da54d (patch)
tree433b4c2221c6d76f3db1852a497f021c7dca3358
parent4c7e6af00cacab1d2bdc466310929d6840d6019a (diff)
download340-repo-Sowgro-94189c8d7c13cc27b3d8dd11f9003cd9587da54d.tar.gz
340-repo-Sowgro-94189c8d7c13cc27b3d8dd11f9003cd9587da54d.tar.bz2
340-repo-Sowgro-94189c8d7c13cc27b3d8dd11f9003cd9587da54d.zip
In class work
-rw-r--r--project/Core/Inc/Homework/printf.h1
-rw-r--r--project/Core/Src/Activties/activity1.txt25
-rw-r--r--project/Core/Src/Homework/printf.c11
-rw-r--r--project/Core/Src/main.c4
-rw-r--r--project/project Debug.launch1
5 files changed, 38 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() ;
diff --git a/project/project Debug.launch b/project/project Debug.launch
index b736426..9240703 100644
--- a/project/project Debug.launch
+++ b/project/project Debug.launch
@@ -81,5 +81,6 @@
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
+ <stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;memoryBlockExpressionList context=&quot;reserved-for-future-use&quot;/&gt;"/>
<stringAttribute key="process_factory_id" value="com.st.stm32cube.ide.mcu.debug.launch.HardwareDebugProcessFactory"/>
</launchConfiguration>