Add USART support #1

Merged
alex merged 17 commits from uart into main 2025-01-01 12:52:15 +01:00
9 changed files with 328 additions and 312 deletions
Showing only changes of commit 3f95f00852 - Show all commits

Binary file not shown.

View File

@@ -52,7 +52,7 @@ Discarded input sections
.debug_macro 0x00000000 0x89 build/main.o
.debug_macro 0x00000000 0x4cc build/main.o
.debug_macro 0x00000000 0x22 build/main.o
.debug_macro 0x00000000 0x2e build/main.o
.debug_macro 0x00000000 0x34 build/main.o
.group 0x00000000 0xc build/startup.o
.group 0x00000000 0xc build/startup.o
.group 0x00000000 0xc build/startup.o
@@ -294,7 +294,7 @@ LOAD linker stubs
.debug_rnglists
0x00000053 0x19 build/timer.o
.debug_macro 0x00000000 0x3b9a
.debug_macro 0x00000000 0x3ba0
.debug_macro 0x00000000 0xb56 build/gpio.o
.debug_macro 0x00000b56 0x22 build/gpio.o
.debug_macro 0x00000b78 0x75 build/gpio.o
@@ -309,17 +309,17 @@ LOAD linker stubs
.debug_macro 0x0000108c 0x89 build/gpio.o
.debug_macro 0x00001115 0x4cc build/gpio.o
.debug_macro 0x000015e1 0x22 build/gpio.o
.debug_macro 0x00001603 0x2e build/gpio.o
.debug_macro 0x00001631 0xb80 build/main.o
.debug_macro 0x000021b1 0x12a build/main.o
.debug_macro 0x000022db 0x46 build/main.o
.debug_macro 0x00002321 0x2e build/main.o
.debug_macro 0x0000234f 0x22 build/main.o
.debug_macro 0x00002371 0xb02 build/startup.o
.debug_macro 0x00002e73 0x56 build/startup.o
.debug_macro 0x00002ec9 0x51 build/startup.o
.debug_macro 0x00002f1a 0xb5c build/timer.o
.debug_macro 0x00003a76 0x124 build/timer.o
.debug_macro 0x00001603 0x34 build/gpio.o
.debug_macro 0x00001637 0xb80 build/main.o
.debug_macro 0x000021b7 0x12a build/main.o
.debug_macro 0x000022e1 0x46 build/main.o
.debug_macro 0x00002327 0x2e build/main.o
.debug_macro 0x00002355 0x22 build/main.o
.debug_macro 0x00002377 0xb02 build/startup.o
.debug_macro 0x00002e79 0x56 build/startup.o
.debug_macro 0x00002ecf 0x51 build/startup.o
.debug_macro 0x00002f20 0xb5c build/timer.o
.debug_macro 0x00003a7c 0x124 build/timer.o
.debug_line 0x00000000 0x4b3
.debug_line 0x00000000 0x116 build/gpio.o
@@ -327,14 +327,14 @@ LOAD linker stubs
.debug_line 0x000002ea 0xea build/startup.o
.debug_line 0x000003d4 0xdf build/timer.o
.debug_str 0x00000000 0x5ea4
.debug_str 0x00000000 0x535f build/gpio.o
0x5507 (size before relaxing)
.debug_str 0x0000535f 0xab1 build/main.o
0x5f68 (size before relaxing)
.debug_str 0x00005e10 0x88 build/startup.o
.debug_str 0x00000000 0x5eba
.debug_str 0x00000000 0x5375 build/gpio.o
0x551d (size before relaxing)
.debug_str 0x00005375 0xab1 build/main.o
0x5f7e (size before relaxing)
.debug_str 0x00005e26 0x88 build/startup.o
0x3cdc (size before relaxing)
.debug_str 0x00005e98 0xc build/timer.o
.debug_str 0x00005eae 0xc build/timer.o
0x5b16 (size before relaxing)
.comment 0x00000000 0x45

View File

@@ -188,10 +188,10 @@ gpio_write:
.byte 0x4
.4byte .Ldebug_abbrev0
.uleb128 0x8
.4byte .LASF893
.byte 0x1d
.4byte .LASF894
.byte 0x1d
.4byte .LASF895
.4byte .LASF896
.4byte .LLRL0
.4byte 0
.4byte .Ldebug_line0
@@ -199,17 +199,17 @@ gpio_write:
.uleb128 0x1
.byte 0x1
.byte 0x6
.4byte .LASF862
.4byte .LASF863
.uleb128 0x1
.byte 0x1
.byte 0x8
.4byte .LASF863
.4byte .LASF864
.uleb128 0x1
.byte 0x2
.byte 0x5
.4byte .LASF864
.4byte .LASF865
.uleb128 0x3
.4byte .LASF867
.4byte .LASF868
.byte 0x2
.byte 0x39
.byte 0x1c
@@ -217,13 +217,13 @@ gpio_write:
.uleb128 0x1
.byte 0x2
.byte 0x7
.4byte .LASF865
.4byte .LASF866
.uleb128 0x1
.byte 0x4
.byte 0x5
.4byte .LASF866
.4byte .LASF867
.uleb128 0x3
.4byte .LASF868
.4byte .LASF869
.byte 0x2
.byte 0x4f
.byte 0x1b
@@ -231,21 +231,21 @@ gpio_write:
.uleb128 0x1
.byte 0x4
.byte 0x7
.4byte .LASF869
.uleb128 0x1
.byte 0x8
.byte 0x5
.4byte .LASF870
.uleb128 0x1
.byte 0x8
.byte 0x7
.byte 0x5
.4byte .LASF871
.uleb128 0x1
.byte 0x8
.byte 0x7
.4byte .LASF872
.uleb128 0x9
.byte 0x4
.byte 0x5
.ascii "int\000"
.uleb128 0x3
.4byte .LASF872
.4byte .LASF873
.byte 0x2
.byte 0xe8
.byte 0x16
@@ -253,15 +253,15 @@ gpio_write:
.uleb128 0x1
.byte 0x4
.byte 0x7
.4byte .LASF873
.uleb128 0x3
.4byte .LASF874
.uleb128 0x3
.4byte .LASF875
.byte 0x3
.byte 0x24
.byte 0x14
.4byte 0x3f
.uleb128 0x3
.4byte .LASF875
.4byte .LASF876
.byte 0x3
.byte 0x30
.byte 0x14
@@ -269,35 +269,35 @@ gpio_write:
.uleb128 0xa
.4byte 0xa0
.uleb128 0x3
.4byte .LASF876
.4byte .LASF877
.byte 0x3
.byte 0x52
.byte 0x15
.4byte 0x81
.uleb128 0xb
.4byte .LASF892
.4byte .LASF893
.byte 0x28
.byte 0x4
.byte 0x7
.byte 0x8
.4byte 0x139
.uleb128 0x2
.4byte .LASF877
.4byte .LASF878
.byte 0x8
.4byte 0xac
.byte 0
.uleb128 0x2
.4byte .LASF878
.4byte .LASF879
.byte 0x9
.4byte 0xac
.byte 0x4
.uleb128 0x2
.4byte .LASF879
.4byte .LASF880
.byte 0xa
.4byte 0xac
.byte 0x8
.uleb128 0x2
.4byte .LASF880
.4byte .LASF881
.byte 0xb
.4byte 0xac
.byte 0xc
@@ -312,22 +312,22 @@ gpio_write:
.4byte 0xac
.byte 0x14
.uleb128 0x2
.4byte .LASF881
.4byte .LASF882
.byte 0xe
.4byte 0xac
.byte 0x18
.uleb128 0x2
.4byte .LASF882
.4byte .LASF883
.byte 0xf
.4byte 0xac
.byte 0x1c
.uleb128 0x2
.4byte .LASF883
.4byte .LASF884
.byte 0x10
.4byte 0xac
.byte 0x20
.uleb128 0x2
.4byte .LASF884
.4byte .LASF885
.byte 0x11
.4byte 0xac
.byte 0x24
@@ -337,30 +337,30 @@ gpio_write:
.byte 0x1
.4byte 0x31
.byte 0x4
.byte 0x1f
.byte 0x21
.byte 0xe
.4byte 0x160
.uleb128 0x4
.4byte .LASF885
.4byte .LASF886
.byte 0
.uleb128 0x4
.4byte .LASF886
.4byte .LASF887
.byte 0x1
.uleb128 0x4
.4byte .LASF887
.4byte .LASF888
.byte 0x2
.uleb128 0x4
.4byte .LASF888
.4byte .LASF889
.byte 0x3
.byte 0
.uleb128 0x3
.4byte .LASF889
.4byte .LASF890
.byte 0x4
.byte 0x24
.byte 0x26
.byte 0x3
.4byte 0x139
.uleb128 0xd
.4byte .LASF896
.4byte .LASF897
.byte 0x1
.byte 0xd
.byte 0x6
@@ -386,7 +386,7 @@ gpio_write:
.byte 0x91
.sleb128 -19
.uleb128 0x7
.4byte .LASF892
.4byte .LASF893
.byte 0xe
.4byte 0x1b3
.uleb128 0x2
@@ -396,12 +396,12 @@ gpio_write:
.uleb128 0x1
.byte 0x1
.byte 0x2
.4byte .LASF890
.4byte .LASF891
.uleb128 0xe
.byte 0x4
.4byte 0xbd
.uleb128 0xf
.4byte .LASF897
.4byte .LASF898
.byte 0x1
.byte 0x6
.byte 0x6
@@ -418,7 +418,7 @@ gpio_write:
.byte 0x91
.sleb128 -18
.uleb128 0x10
.4byte .LASF891
.4byte .LASF892
.byte 0x1
.byte 0x6
.byte 0x2c
@@ -427,7 +427,7 @@ gpio_write:
.byte 0x91
.sleb128 -19
.uleb128 0x7
.4byte .LASF892
.4byte .LASF893
.byte 0x7
.4byte 0x1b3
.uleb128 0x2
@@ -3525,7 +3525,7 @@ gpio_write:
.uleb128 0x32
.4byte .LASF854
.byte 0
.section .debug_macro,"G",%progbits,wm4.gpio.h.2.ca8518d3facb6a329deaeb59004fd0a1,comdat
.section .debug_macro,"G",%progbits,wm4.gpio.h.2.3af2911851c1c29c51024d0f06788d31,comdat
.Ldebug_macro15:
.2byte 0x5
.byte 0
@@ -3550,6 +3550,9 @@ gpio_write:
.byte 0x5
.uleb128 0x1d
.4byte .LASF861
.byte 0x5
.uleb128 0x1f
.4byte .LASF862
.byte 0
.section .debug_line,"",%progbits
.Ldebug_line0:
@@ -3594,7 +3597,7 @@ gpio_write:
.ascii "__PTRDIFF_MAX__ 0x7fffffff\000"
.LASF541:
.ascii "_LONG_DOUBLE long double\000"
.LASF892:
.LASF893:
.ascii "gpio\000"
.LASF591:
.ascii "INT_LEAST8_MIN (-__INT_LEAST8_MAX__ - 1)\000"
@@ -3602,7 +3605,7 @@ gpio_write:
.ascii "_UINT32_T_DECLARED \000"
.LASF90:
.ascii "__INTMAX_MAX__ 0x7fffffffffffffffLL\000"
.LASF887:
.LASF888:
.ascii "GPIO_MODE_AF\000"
.LASF335:
.ascii "__TQ_IBIT__ 0\000"
@@ -3716,7 +3719,7 @@ gpio_write:
.ascii "__need_wchar_t\000"
.LASF199:
.ascii "__FLT32_MIN_EXP__ (-125)\000"
.LASF893:
.LASF894:
.ascii "GNU C2X 12.3.1 20230626 -mcpu=cortex-m4 -mthumb -mf"
.ascii "loat-abi=hard -mfpu=fpv4-sp-d16 -march=armv7e-m+fp "
.ascii "-g3 -ggdb -O0 -std=c2x -ffunction-sections -fdata-s"
@@ -3837,7 +3840,7 @@ gpio_write:
.ascii "PRId64 __PRI64(d)\000"
.LASF302:
.ascii "__UACCUM_IBIT__ 16\000"
.LASF866:
.LASF867:
.ascii "long int\000"
.LASF818:
.ascii "PRIXFAST64 __PRI64FAST(X)\000"
@@ -3933,7 +3936,7 @@ gpio_write:
.ascii "PRIoLEAST16 __PRI16LEAST(o)\000"
.LASF458:
.ascii "__NEWLIB__ 4\000"
.LASF885:
.LASF886:
.ascii "GPIO_MODE_INPUT\000"
.LASF720:
.ascii "SCNi16 __SCN16(i)\000"
@@ -3943,7 +3946,7 @@ gpio_write:
.ascii "__FLT_DECIMAL_DIG__ 9\000"
.LASF562:
.ascii "_UINT8_T_DECLARED \000"
.LASF862:
.LASF863:
.ascii "signed char\000"
.LASF805:
.ascii "PRIuLEAST64 __PRI64LEAST(u)\000"
@@ -3955,7 +3958,7 @@ gpio_write:
.ascii "__ARM_FEATURE_FMA 1\000"
.LASF364:
.ascii "__GNUC_STDC_INLINE__ 1\000"
.LASF889:
.LASF890:
.ascii "GPIO_MODE\000"
.LASF256:
.ascii "__FRACT_FBIT__ 15\000"
@@ -3979,7 +3982,7 @@ gpio_write:
.ascii "__FLT64_MAX_10_EXP__ 308\000"
.LASF65:
.ascii "__UINT_FAST32_TYPE__ unsigned int\000"
.LASF863:
.LASF864:
.ascii "unsigned char\000"
.LASF3:
.ascii "__STDC_UTF_32__ 1\000"
@@ -4027,13 +4030,13 @@ gpio_write:
.ascii "__int_fast64_t_defined 1\000"
.LASF837:
.ascii "__PRIPTR(x) __STRINGIFY(x)\000"
.LASF874:
.LASF875:
.ascii "uint16_t\000"
.LASF417:
.ascii "__thumb2__ 1\000"
.LASF321:
.ascii "__ULLACCUM_FBIT__ 32\000"
.LASF890:
.LASF891:
.ascii "_Bool\000"
.LASF366:
.ascii "__STRICT_ANSI__ 1\000"
@@ -4051,7 +4054,9 @@ gpio_write:
.ascii "__PRAGMA_REDEFINE_EXTNAME 1\000"
.LASF36:
.ascii "__WCHAR_TYPE__ unsigned int\000"
.LASF886:
.LASF859:
.ascii "PORT(port) (((port) - 'A') << 8)\000"
.LASF887:
.ascii "GPIO_MODE_OUTPUT\000"
.LASF357:
.ascii "__USA_IBIT__ 16\000"
@@ -4089,7 +4094,7 @@ gpio_write:
.ascii "__SCN64(x) __INT64 __STRINGIFY(x)\000"
.LASF646:
.ascii "_GCC_WRAP_STDINT_H \000"
.LASF867:
.LASF868:
.ascii "__uint16_t\000"
.LASF224:
.ascii "__FLT64_EPSILON__ 2.2204460492503131e-16F64\000"
@@ -4145,8 +4150,6 @@ gpio_write:
.ascii "__FLT_EPSILON__ 1.1920928955078125e-7F\000"
.LASF376:
.ascii "__GCC_ATOMIC_SHORT_LOCK_FREE 2\000"
.LASF859:
.ascii "PIN(port,num) ((((port) - 'A') << 8) | num)\000"
.LASF806:
.ascii "PRIxLEAST64 __PRI64LEAST(x)\000"
.LASF419:
@@ -4301,7 +4304,7 @@ gpio_write:
.ascii "___int8_t_defined 1\000"
.LASF248:
.ascii "__SFRACT_MIN__ (-0.5HR-0.5HR)\000"
.LASF869:
.LASF870:
.ascii "long unsigned int\000"
.LASF349:
.ascii "__SA_IBIT__ 16\000"
@@ -4317,7 +4320,7 @@ gpio_write:
.ascii "__ARM_FP16_FORMAT_IEEE\000"
.LASF48:
.ascii "__UINT16_TYPE__ short unsigned int\000"
.LASF896:
.LASF897:
.ascii "gpio_write\000"
.LASF569:
.ascii "__int32_t_defined 1\000"
@@ -4361,7 +4364,7 @@ gpio_write:
.ascii "SCNx8 __SCN8(x)\000"
.LASF208:
.ascii "__FLT32_DENORM_MIN__ 1.4012984643248171e-45F32\000"
.LASF897:
.LASF898:
.ascii "gpio_set_mode\000"
.LASF125:
.ascii "__UINT64_C(c) c ## ULL\000"
@@ -4381,7 +4384,7 @@ gpio_write:
.ascii "__GCC_ATOMIC_CHAR16_T_LOCK_FREE 2\000"
.LASF789:
.ascii "__PRI64FAST(x) __FAST64 __STRINGIFY(x)\000"
.LASF876:
.LASF877:
.ascii "uintptr_t\000"
.LASF168:
.ascii "__DBL_MAX_EXP__ 1024\000"
@@ -4429,7 +4432,7 @@ gpio_write:
.ascii "PRIX32 __PRI32(X)\000"
.LASF773:
.ascii "SCNxLEAST32 __SCN32LEAST(x)\000"
.LASF879:
.LASF880:
.ascii "OSPEEDR\000"
.LASF711:
.ascii "__SCN16LEAST(x) __LEAST16 __STRINGIFY(x)\000"
@@ -4459,7 +4462,7 @@ gpio_write:
.ascii "__ULACCUM_MIN__ 0.0ULK\000"
.LASF461:
.ascii "_ATEXIT_DYNAMIC_ALLOC 1\000"
.LASF868:
.LASF869:
.ascii "__uint32_t\000"
.LASF188:
.ascii "__LDBL_MAX__ 1.7976931348623157e+308L\000"
@@ -4469,7 +4472,7 @@ gpio_write:
.ascii "__FLT_RADIX__ 2\000"
.LASF454:
.ascii "_INTTYPES_H \000"
.LASF870:
.LASF871:
.ascii "long long int\000"
.LASF401:
.ascii "__ARM_FEATURE_CMSE\000"
@@ -4574,7 +4577,7 @@ gpio_write:
.ascii "\000"
.LASF582:
.ascii "__int_fast16_t_defined 1\000"
.LASF877:
.LASF878:
.ascii "MODER\000"
.LASF482:
.ascii "__FLOAT_TYPE float\000"
@@ -4585,9 +4588,9 @@ gpio_write:
.ascii "L)\000"
.LASF607:
.ascii "INT64_MAX (__INT64_MAX__)\000"
.LASF873:
.LASF874:
.ascii "unsigned int\000"
.LASF872:
.LASF873:
.ascii "__uintptr_t\000"
.LASF459:
.ascii "__NEWLIB_MINOR__ 3\000"
@@ -4619,7 +4622,7 @@ gpio_write:
.ascii "__CHAR_BIT__ 8\000"
.LASF143:
.ascii "__FLT_EVAL_METHOD__ 0\000"
.LASF864:
.LASF865:
.ascii "short int\000"
.LASF685:
.ascii "PRIdLEAST8 __PRI8LEAST(d)\000"
@@ -4757,7 +4760,7 @@ gpio_write:
.ascii "SCNuFAST16 __SCN16FAST(u)\000"
.LASF801:
.ascii "SCNx64 __SCN64(x)\000"
.LASF861:
.LASF862:
.ascii "PINPORT(pin) (pin >> 8)\000"
.LASF198:
.ascii "__FLT32_DIG__ 6\000"
@@ -4805,7 +4808,7 @@ gpio_write:
.ascii "__ORDER_LITTLE_ENDIAN__ 1234\000"
.LASF155:
.ascii "__FLT_NORM_MAX__ 3.4028234663852886e+38F\000"
.LASF871:
.LASF872:
.ascii "long long unsigned int\000"
.LASF611:
.ascii "UINT_LEAST64_MAX (__UINT_LEAST64_MAX__)\000"
@@ -4883,11 +4886,11 @@ gpio_write:
.ascii "SCNdFAST8 __SCN8FAST(d)\000"
.LASF576:
.ascii "_UINTPTR_T_DECLARED \000"
.LASF884:
.LASF885:
.ascii "AFRH\000"
.LASF314:
.ascii "__ULACCUM_MAX__ 0XFFFFFFFFFFFFFFFFP-32ULK\000"
.LASF883:
.LASF884:
.ascii "AFRL\000"
.LASF273:
.ascii "__ULFRACT_MIN__ 0.0ULR\000"
@@ -4901,7 +4904,7 @@ gpio_write:
.ascii "__INT32_TYPE__ long int\000"
.LASF118:
.ascii "__UINT_LEAST8_MAX__ 0xff\000"
.LASF882:
.LASF883:
.ascii "LCKR\000"
.LASF520:
.ascii "__int20__ +2\000"
@@ -4915,6 +4918,8 @@ gpio_write:
.ascii "__SCN32(x) __INT32 __STRINGIFY(x)\000"
.LASF743:
.ascii "SCNoFAST16 __SCN16FAST(o)\000"
.LASF860:
.ascii "PIN(port,num) (PORT(port) | num)\000"
.LASF345:
.ascii "__UTQ_IBIT__ 0\000"
.LASF348:
@@ -4947,7 +4952,7 @@ gpio_write:
.ascii "__QQ_IBIT__ 0\000"
.LASF763:
.ascii "PRIdLEAST32 __PRI32LEAST(d)\000"
.LASF878:
.LASF879:
.ascii "OTYPER\000"
.LASF811:
.ascii "SCNuLEAST64 __SCN64LEAST(u)\000"
@@ -4967,7 +4972,7 @@ gpio_write:
.ascii "__GNUC_MINOR__ 3\000"
.LASF57:
.ascii "__UINT_LEAST32_TYPE__ long unsigned int\000"
.LASF894:
.LASF895:
.ascii "src/gpio.c\000"
.LASF405:
.ascii "__ARM_FEATURE_NUMERIC_MAXMIN\000"
@@ -5041,7 +5046,7 @@ gpio_write:
.ascii "__ACCUM_IBIT__ 16\000"
.LASF509:
.ascii "unsigned\000"
.LASF880:
.LASF881:
.ascii "PUPDR\000"
.LASF835:
.ascii "SCNuMAX __SCNMAX(u)\000"
@@ -5051,7 +5056,7 @@ gpio_write:
.ascii "_ATTRIBUTE(attrs) __attribute__ (attrs)\000"
.LASF359:
.ascii "__UDA_IBIT__ 32\000"
.LASF891:
.LASF892:
.ascii "mode\000"
.LASF586:
.ascii "INTPTR_MAX (__INTPTR_MAX__)\000"
@@ -5065,7 +5070,7 @@ gpio_write:
.ascii "__UHQ_FBIT__ 16\000"
.LASF443:
.ascii "__ARM_FEATURE_COPROC\000"
.LASF888:
.LASF889:
.ascii "GPIO_MODE_ANALOG\000"
.LASF177:
.ascii "__DBL_HAS_INFINITY__ 1\000"
@@ -5103,7 +5108,7 @@ gpio_write:
.ascii "__FAST8 \000"
.LASF496:
.ascii "__XSI_VISIBLE 0\000"
.LASF881:
.LASF882:
.ascii "BSRR\000"
.LASF794:
.ascii "PRIu64 __PRI64(u)\000"
@@ -5191,7 +5196,7 @@ gpio_write:
.ascii "PRIx32 __PRI32(x)\000"
.LASF278:
.ascii "__LLFRACT_MIN__ (-0.5LLR-0.5LLR)\000"
.LASF875:
.LASF876:
.ascii "uint32_t\000"
.LASF689:
.ascii "PRIxLEAST8 __PRI8LEAST(x)\000"
@@ -5239,13 +5244,13 @@ gpio_write:
.ascii "__INT_LEAST16_TYPE__ short int\000"
.LASF326:
.ascii "__QQ_FBIT__ 7\000"
.LASF860:
.LASF861:
.ascii "PINNUM(pin) (pin & 0b1111)\000"
.LASF768:
.ascii "PRIXLEAST32 __PRI32LEAST(X)\000"
.LASF171:
.ascii "__DBL_MAX__ ((double)1.7976931348623157e+308L)\000"
.LASF865:
.LASF866:
.ascii "short unsigned int\000"
.LASF276:
.ascii "__LLFRACT_FBIT__ 63\000"
@@ -5293,7 +5298,7 @@ gpio_write:
.ascii "__SCN64LEAST(x) __LEAST64 __STRINGIFY(x)\000"
.LASF280:
.ascii "__LLFRACT_EPSILON__ 0x1P-63LLR\000"
.LASF895:
.LASF896:
.ascii "/home/alex/code/own/stm32-falling-sand\000"
.LASF249:
.ascii "__SFRACT_MAX__ 0X7FP-7HR\000"

View File

@@ -2004,7 +2004,9 @@ struct gpio {
#define GPIO(port) ((struct gpio*)(uintptr_t)(GPIO_BASE_ADDR + (GPIO_PORT_OFFSET * port)))
#define PIN(port,num) ((((port) - 'A') << 8) | num)
#define PORT(port) (((port) - 'A') << 8)
#define PIN(port,num) (PORT(port) | num)
#define PINNUM(pin) (pin & 0b1111)
@@ -2019,9 +2021,9 @@ typedef enum {
void gpio_set_mode(uint16_t pin, GPIO_MODE mode);
void gpio_write(uint16_t pin,
# 39 "src/gpio.h" 3 4
# 41 "src/gpio.h" 3 4
_Bool
# 39 "src/gpio.h"
# 41 "src/gpio.h"
val);
# 5 "src/gpio.c" 2

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -2128,7 +2128,9 @@ struct gpio {
#define GPIO(port) ((struct gpio*)(uintptr_t)(GPIO_BASE_ADDR + (GPIO_PORT_OFFSET * port)))
#define PIN(port,num) ((((port) - 'A') << 8) | num)
#define PORT(port) (((port) - 'A') << 8)
#define PIN(port,num) (PORT(port) | num)
#define PINNUM(pin) (pin & 0b1111)
@@ -2143,9 +2145,9 @@ typedef enum {
void gpio_set_mode(uint16_t pin, GPIO_MODE mode);
void gpio_write(uint16_t pin,
# 39 "src/gpio.h" 3 4
# 41 "src/gpio.h" 3 4
_Bool
# 39 "src/gpio.h"
# 41 "src/gpio.h"
val);
# 6 "src/main.c" 2
# 1 "src/flash.h" 1

Binary file not shown.

View File

@@ -21,8 +21,10 @@ struct gpio {
#define GPIO_PORT_OFFSET (0x400U)
#define GPIO(port) ((struct gpio*)(uintptr_t)(GPIO_BASE_ADDR + (GPIO_PORT_OFFSET * port)))
// Create a 8bit number from a port
#define PORT(port) (((port) - 'A') << 8)
// Create a 16bit number from a port and pin
#define PIN(port, num) ((((port) - 'A') << 8) | num)
#define PIN(port, num) (PORT(port) | num)
// get the lower byte from a PIN
#define PINNUM(pin) (pin & 0b1111)
// get the upper byte from a PIN