mirror of
https://github.com/sergeyyarkov/avr128da48_web-serial-example.git
synced 2026-10-11 10:19:02 +03:00
feat: reading data from serial port
This commit is contained in:
parent
f9f5b707f7
commit
c524b034e1
Binary file not shown.
Binary file not shown.
@ -30,11 +30,13 @@ uint8_t command_process(char *cmd_name) {
|
||||
execute = commands[i].addr;
|
||||
execute();
|
||||
USART1_SendString("[LOG]: Command completed successfully with code \"0\".\n");
|
||||
USART1_SendChar(EOT);
|
||||
return 0;
|
||||
}
|
||||
} while (i++ < COMMAND_SIZE);
|
||||
|
||||
USART1_SendString("[LOG]: Invalid command name!\n");
|
||||
USART1_SendChar(EOT);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
#include <avr/io.h>
|
||||
#include <string.h>
|
||||
|
||||
#define EOT 0x04
|
||||
#define COMMAND_SIZE 5
|
||||
#define COMMAND_MAX_NAME_LENGTH 20
|
||||
|
||||
|
||||
Binary file not shown.
@ -1,24 +1,24 @@
|
||||
:100000000C9477000C946B020C946B020C946B02B2
|
||||
:100010000C946B020C946B020C946B020C946B02AC
|
||||
:100020000C946B020C946B020C946B020C946B029C
|
||||
:100030000C946B020C946B020C946B020C946B028C
|
||||
:100040000C946B020C946B020C946B020C946B027C
|
||||
:100050000C946B020C946B020C946B020C946B026C
|
||||
:100060000C946B020C946B020C946B020C946B025C
|
||||
:100070000C946B020C946B020C946B020C94FA00BF
|
||||
:100080000C946B020C946B020C946B020C946B023C
|
||||
:100090000C946B020C946B020C946B020C946B022C
|
||||
:1000A0000C946B020C946B020C946B020C946B021C
|
||||
:1000B0000C946B020C946B020C946B020C946B020C
|
||||
:1000C0000C946B020C946B020C946B020C946B02FC
|
||||
:1000D0000C946B020C946B020C946B020C946B02EC
|
||||
:1000E0000C946B020C946B02400040848000809161
|
||||
:100000000C9477000C9471020C9471020C947102A0
|
||||
:100010000C9471020C9471020C9471020C94710294
|
||||
:100020000C9471020C9471020C9471020C94710284
|
||||
:100030000C9471020C9471020C9471020C94710274
|
||||
:100040000C9471020C9471020C9471020C94710264
|
||||
:100050000C9471020C9471020C9471020C94710254
|
||||
:100060000C9471020C9471020C9471020C94710244
|
||||
:100070000C9471020C9471020C9471020C94FA00AD
|
||||
:100080000C9471020C9471020C9471020C94710224
|
||||
:100090000C9471020C9471020C9471020C94710214
|
||||
:1000A0000C9471020C9471020C9471020C94710204
|
||||
:1000B0000C9471020C9471020C9471020C947102F4
|
||||
:1000C0000C9471020C9471020C9471020C947102E4
|
||||
:1000D0000C9471020C9471020C9471020C947102D4
|
||||
:1000E0000C9471020C947102400040848000809155
|
||||
:1000F00001108F7C806080688093011011241FBEE6
|
||||
:10010000CFEFCDBFDFE7DEBFE8EEF0E040E019C0A3
|
||||
:10011000B791A79137912791079107FD0EC097914D
|
||||
:100120008791EF01F92FE82F0BBF07900D92A217CF
|
||||
:10013000B307D9F7FE011BBE04C01D92A217B30777
|
||||
:10014000E1F7ED3EF40721F70E9401020C943E0214
|
||||
:10014000E1F7ED3EF40721F70E9407020C94440208
|
||||
:04015000F894FFCF51
|
||||
:100154005B4C4F475D3A20436F6D6D616E64206365
|
||||
:100164006F6D706C65746564207375636365737318
|
||||
@ -38,54 +38,54 @@
|
||||
:100234008240F0E0E259FF4B808315C08EE690E4E3
|
||||
:100244000E94480110928240EEE6F0E40190002002
|
||||
:10025400E9F73197AF014E56504460E070E08EE606
|
||||
:1002640090E40E944902FF91EF91BF91AF919F9159
|
||||
:1002640090E40E944F02FF91EF91BF91AF919F9153
|
||||
:100274008F917F916F915F914F913F912F910F904B
|
||||
:0C0284000BBE0F900FBE0F901F9018953E
|
||||
:10029000CF92DF92EF92FF920F931F93CF93DF9352
|
||||
:1002A0007C0102E010E4C0E0D0E0B801C7010E9488
|
||||
:1002B0003002892B91F486E18C9FF0018D9FF00D27
|
||||
:1002B0003602892BA9F486E18C9FF0018D9FF00D09
|
||||
:1002C0001124E050F04C0190F081E02D099584E577
|
||||
:1002D00091E80E94DF0180E00BC021960A5E1F4F6B
|
||||
:1002E000C630D10511F78AE891E80E94DF0181E06C
|
||||
:1002F000DF91CF911F910F91FF90EF90DF90CF9002
|
||||
:0203000008955E
|
||||
:10030200CF93DF93CDB7DEB76697CDBFDEBFFB01DC
|
||||
:1003120001900020E9F73197E61BF70B759708F576
|
||||
:1003220020918340253010F01092834089839A8374
|
||||
:10033200CE0103960E945A02A091834081E08A0F67
|
||||
:100342008093834086E1A89FD0011124A050B04C35
|
||||
:1003520086E1FE01319601900D928A95E1F781E0E6
|
||||
:1003620001C080E06696CDBFDEBFDF91CF910895D8
|
||||
:100372000F931F93CF9388EA91E80E94DF0100E078
|
||||
:1003820010E4C1E3F80180819181892B71F08C2FF7
|
||||
:100392000E9452028CEC91E80E94DF01C801029691
|
||||
:1003A2000E94DF018AE00E9452020A5E1F4FCF5F65
|
||||
:0C03B200C63341F7CF911F910F910895C1
|
||||
:1003BE00EF92FF920F931F93CF93DF938C017C01EB
|
||||
:1003CE00C0E0D0E006C0F70181917F010E94520289
|
||||
:1003DE002196F80101900020E9F73197E01BF10B0F
|
||||
:1003EE00CE17DF0780F3DF91CF911F910F91FF9012
|
||||
:0403FE00EF900895DF
|
||||
:1004020080E4809341040E941A0278946DED71E8B1
|
||||
:1004120087E692E00E94810168EE71E882E692E04E
|
||||
:100422000E9481016EEE71E889EB91E00E948101E8
|
||||
:02043200FFCFFA
|
||||
:10043400E0E2F8E083E896E08087918783E08783B1
|
||||
:10044400A0E4B4E081E011968C93119782E01296B7
|
||||
:0C0454008C9380E8858380EC86830895FB
|
||||
:10046000DC01FB019D912191921303C09111FACF00
|
||||
:0C047000292F892F90E0821B910908952C
|
||||
:10047C00EC010E9470020E946F02CE010E94710278
|
||||
:06048C00CE010E946D028A
|
||||
:10049200FC01480F591FE417F50711F06193FBCFD8
|
||||
:0204A2000895BB
|
||||
:1004A400E0E2F8E0948195FFFDCF8093220808955F
|
||||
:1004B400FC01DB012D91BD0121932111FACF089597
|
||||
:0A04C4008FEC91E80E94DF0108951B
|
||||
:0804CE0080E4809347040895C7
|
||||
:0404D6000C94000082
|
||||
:0404DA000E94A800D4
|
||||
:0204DE0008957F
|
||||
:0204E00008957D
|
||||
:0204E20008957B
|
||||
:1002D00091E80E94E50184E00E94580280E00EC08F
|
||||
:1002E00021960A5E1F4FC630D105F9F68AE891E8DB
|
||||
:1002F0000E94E50184E00E94580281E0DF91CF91E5
|
||||
:0E0300001F910F91FF90EF90DF90CF90089526
|
||||
:10030E00CF93DF93CDB7DEB76697CDBFDEBFFB01D0
|
||||
:10031E0001900020E9F73197E61BF70B759708F56A
|
||||
:10032E0020918340253010F01092834089839A8368
|
||||
:10033E00CE0103960E946002A091834081E08A0F55
|
||||
:10034E008093834086E1A89FD0011124A050B04C29
|
||||
:10035E0086E1FE01319601900D928A95E1F781E0DA
|
||||
:10036E0001C080E06696CDBFDEBFDF91CF910895CC
|
||||
:10037E000F931F93CF9388EA91E80E94E50100E066
|
||||
:10038E0010E4C1E3F80180819181892B71F08C2FEB
|
||||
:10039E000E9458028CEC91E80E94E501C801029679
|
||||
:1003AE000E94E5018AE00E9458020A5E1F4FCF5F4D
|
||||
:0C03BE00C63341F7CF911F910F910895B5
|
||||
:1003CA00EF92FF920F931F93CF93DF938C017C01DF
|
||||
:1003DA00C0E0D0E006C0F70181917F010E94580277
|
||||
:1003EA002196F80101900020E9F73197E01BF10B03
|
||||
:1003FA00CE17DF0780F3DF91CF911F910F91FF9006
|
||||
:04040A00EF900895D2
|
||||
:10040E0080E4809341040E94200278946DED71E89F
|
||||
:10041E008DE692E00E94870168EE71E888E692E030
|
||||
:10042E000E9487016EEE71E88FEB91E00E948701CA
|
||||
:02043E00FFCFEE
|
||||
:10044000E0E2F8E083E896E08087918783E08783A5
|
||||
:10045000A0E4B4E081E011968C93119782E01296AB
|
||||
:0C0460008C9380E8858380EC86830895EF
|
||||
:10046C00DC01FB019D912191921303C09111FACFF4
|
||||
:0C047C00292F892F90E0821B9109089520
|
||||
:10048800EC010E9476020E947502CE010E9477025A
|
||||
:06049800CE010E94730278
|
||||
:10049E00FC01480F591FE417F50711F06193FBCFCC
|
||||
:0204AE000895AF
|
||||
:1004B000E0E2F8E0948195FFFDCF80932208089553
|
||||
:1004C000FC01DB012D91BD0121932111FACF08958B
|
||||
:0A04D0008FEC91E80E94E501089509
|
||||
:0804DA0080E4809347040895BB
|
||||
:0404E2000C94000076
|
||||
:0404E6000E94A800C8
|
||||
:0204EA00089573
|
||||
:0204EC00089571
|
||||
:0204EE0008956F
|
||||
:00000001FF
|
||||
|
||||
@ -410,12 +410,12 @@ END GROUP
|
||||
.debug_pubnames
|
||||
*(.debug_pubnames)
|
||||
|
||||
.debug_info 0x0000000000000000 0x401a
|
||||
.debug_info 0x0000000000000000 0x4040
|
||||
*(.debug_info .gnu.linkonce.wi.*)
|
||||
.debug_info 0x0000000000000000 0x2c24 C:/Program Files/Microchip/MPLABX/v6.00/packs/Microchip/AVR-Dx_DFP/1.10.124/xc8/avr/lib/avrxmega4/memx-const/mapped/crtavr128da48.o
|
||||
.debug_info 0x0000000000002c24 0x80b build/default/production/main.o
|
||||
.debug_info 0x000000000000342f 0x6b2 build/default/production/usart.o
|
||||
.debug_info 0x0000000000003ae1 0x539 build/default/production/command.o
|
||||
.debug_info 0x0000000000003ae1 0x55f build/default/production/command.o
|
||||
|
||||
.debug_abbrev 0x0000000000000000 0x2e21
|
||||
*(.debug_abbrev)
|
||||
@ -424,12 +424,12 @@ END GROUP
|
||||
.debug_abbrev 0x0000000000002b76 0x14c build/default/production/usart.o
|
||||
.debug_abbrev 0x0000000000002cc2 0x15f build/default/production/command.o
|
||||
|
||||
.debug_line 0x0000000000000000 0x6f5
|
||||
.debug_line 0x0000000000000000 0x701
|
||||
*(.debug_line .debug_line.* .debug_line_end)
|
||||
.debug_line 0x0000000000000000 0x222 C:/Program Files/Microchip/MPLABX/v6.00/packs/Microchip/AVR-Dx_DFP/1.10.124/xc8/avr/lib/avrxmega4/memx-const/mapped/crtavr128da48.o
|
||||
.debug_line 0x0000000000000222 0x1bc build/default/production/main.o
|
||||
.debug_line 0x00000000000003de 0x175 build/default/production/usart.o
|
||||
.debug_line 0x0000000000000553 0x1a2 build/default/production/command.o
|
||||
.debug_line 0x0000000000000553 0x1ae build/default/production/command.o
|
||||
|
||||
.debug_frame 0x0000000000000000 0x19c
|
||||
*(.debug_frame)
|
||||
@ -514,151 +514,151 @@ LOAD data_init
|
||||
0x00000000000001f4 __vector_31
|
||||
|
||||
.text.command_process
|
||||
0x0000000000000290 0x72
|
||||
0x0000000000000290 0x7e
|
||||
.text.command_process
|
||||
0x0000000000000290 0x72 build/default/production/command.o
|
||||
0x0000000000000290 0x7e build/default/production/command.o
|
||||
0x0000000000000290 command_process
|
||||
|
||||
.text.command_define
|
||||
0x0000000000000302 0x70
|
||||
0x000000000000030e 0x70
|
||||
.text.command_define
|
||||
0x0000000000000302 0x70 build/default/production/command.o
|
||||
0x0000000000000302 command_define
|
||||
0x000000000000030e 0x70 build/default/production/command.o
|
||||
0x000000000000030e command_define
|
||||
|
||||
.text.command_list
|
||||
0x0000000000000372 0x4c
|
||||
0x000000000000037e 0x4c
|
||||
.text.command_list
|
||||
0x0000000000000372 0x4c build/default/production/command.o
|
||||
0x0000000000000372 command_list
|
||||
0x000000000000037e 0x4c build/default/production/command.o
|
||||
0x000000000000037e command_list
|
||||
|
||||
.text.USART1_SendString
|
||||
0x00000000000003be 0x44
|
||||
0x00000000000003ca 0x44
|
||||
.text.USART1_SendString
|
||||
0x00000000000003be 0x44 build/default/production/usart.o
|
||||
0x00000000000003be USART1_SendString
|
||||
0x00000000000003ca 0x44 build/default/production/usart.o
|
||||
0x00000000000003ca USART1_SendString
|
||||
|
||||
.text.main 0x0000000000000402 0x32
|
||||
.text.main 0x0000000000000402 0x32 build/default/production/main.o
|
||||
0x0000000000000402 main
|
||||
.text.main 0x000000000000040e 0x32
|
||||
.text.main 0x000000000000040e 0x32 build/default/production/main.o
|
||||
0x000000000000040e main
|
||||
|
||||
.text.USART1_Initialize
|
||||
0x0000000000000434 0x2c
|
||||
0x0000000000000440 0x2c
|
||||
.text.USART1_Initialize
|
||||
0x0000000000000434 0x2c build/default/production/usart.o
|
||||
0x0000000000000434 USART1_Initialize
|
||||
0x0000000000000440 0x2c build/default/production/usart.o
|
||||
0x0000000000000440 USART1_Initialize
|
||||
|
||||
.text.strcmp 0x0000000000000460 0x1c
|
||||
.text.strcmp 0x0000000000000460 0x1c c:/program files/microchip/xc8/v2.36/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avrxmega4/memx-const/mapped\libc.a(strcmp.o)
|
||||
0x0000000000000460 strcmp
|
||||
.text.strcmp 0x000000000000046c 0x1c
|
||||
.text.strcmp 0x000000000000046c 0x1c c:/program files/microchip/xc8/v2.36/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avrxmega4/memx-const/mapped\libc.a(strcmp.o)
|
||||
0x000000000000046c strcmp
|
||||
|
||||
.text.exit 0x000000000000047c 0x16
|
||||
.text.exit 0x000000000000047c 0x16 c:/program files/microchip/xc8/v2.36/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avrxmega4/memx-const/mapped\libc.a(exit.o)
|
||||
0x000000000000047c exit
|
||||
.text.exit 0x0000000000000488 0x16
|
||||
.text.exit 0x0000000000000488 0x16 c:/program files/microchip/xc8/v2.36/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avrxmega4/memx-const/mapped\libc.a(exit.o)
|
||||
0x0000000000000488 exit
|
||||
|
||||
.text.memset 0x0000000000000492 0x12
|
||||
.text.memset 0x0000000000000492 0x12 c:/program files/microchip/xc8/v2.36/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avrxmega4/memx-const/mapped\libc.a(memset.o)
|
||||
0x0000000000000492 memset
|
||||
.text.memset 0x000000000000049e 0x12
|
||||
.text.memset 0x000000000000049e 0x12 c:/program files/microchip/xc8/v2.36/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avrxmega4/memx-const/mapped\libc.a(memset.o)
|
||||
0x000000000000049e memset
|
||||
|
||||
.text.USART1_SendChar
|
||||
0x00000000000004a4 0x10
|
||||
0x00000000000004b0 0x10
|
||||
.text.USART1_SendChar
|
||||
0x00000000000004a4 0x10 build/default/production/usart.o
|
||||
0x00000000000004a4 USART1_SendChar
|
||||
0x00000000000004b0 0x10 build/default/production/usart.o
|
||||
0x00000000000004b0 USART1_SendChar
|
||||
|
||||
.text.strcpy 0x00000000000004b4 0x10
|
||||
.text.strcpy 0x00000000000004b4 0x10 c:/program files/microchip/xc8/v2.36/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avrxmega4/memx-const/mapped\libc.a(strcpy.o)
|
||||
0x00000000000004b4 strcpy
|
||||
.text.strcpy 0x00000000000004c0 0x10
|
||||
.text.strcpy 0x00000000000004c0 0x10 c:/program files/microchip/xc8/v2.36/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avrxmega4/memx-const/mapped\libc.a(strcpy.o)
|
||||
0x00000000000004c0 strcpy
|
||||
|
||||
.text.hello_world
|
||||
0x00000000000004c4 0xa
|
||||
0x00000000000004d0 0xa
|
||||
.text.hello_world
|
||||
0x00000000000004c4 0xa build/default/production/main.o
|
||||
0x00000000000004c4 hello_world
|
||||
0x00000000000004d0 0xa build/default/production/main.o
|
||||
0x00000000000004d0 hello_world
|
||||
|
||||
.text.led_toggle
|
||||
0x00000000000004ce 0x8
|
||||
0x00000000000004da 0x8
|
||||
.text.led_toggle
|
||||
0x00000000000004ce 0x8 build/default/production/main.o
|
||||
0x00000000000004ce led_toggle
|
||||
0x00000000000004da 0x8 build/default/production/main.o
|
||||
0x00000000000004da led_toggle
|
||||
|
||||
.text 0x00000000000004d6 0x4
|
||||
.text 0x00000000000004d6 0x4 C:/Program Files/Microchip/MPLABX/v6.00/packs/Microchip/AVR-Dx_DFP/1.10.124/xc8/avr/lib/avrxmega4/memx-const/mapped/crtavr128da48.o
|
||||
0x00000000000004d6 __vector_38
|
||||
0x00000000000004d6 __vector_22
|
||||
0x00000000000004d6 __vector_28
|
||||
0x00000000000004d6 __vector_1
|
||||
0x00000000000004d6 __vector_32
|
||||
0x00000000000004d6 __vector_34
|
||||
0x00000000000004d6 __vector_24
|
||||
0x00000000000004d6 __vector_12
|
||||
0x00000000000004d6 __vector_55
|
||||
0x00000000000004d6 __vector_46
|
||||
0x00000000000004d6 __bad_interrupt
|
||||
0x00000000000004d6 __vector_6
|
||||
0x00000000000004d6 __vector_35
|
||||
0x00000000000004d6 __vector_39
|
||||
0x00000000000004d6 __vector_3
|
||||
0x00000000000004d6 __vector_23
|
||||
0x00000000000004d6 __vector_30
|
||||
0x00000000000004d6 __vector_45
|
||||
0x00000000000004d6 __vector_25
|
||||
0x00000000000004d6 __vector_11
|
||||
0x00000000000004d6 __vector_54
|
||||
0x00000000000004d6 __vector_13
|
||||
0x00000000000004d6 __vector_17
|
||||
0x00000000000004d6 __vector_19
|
||||
0x00000000000004d6 __vector_56
|
||||
0x00000000000004d6 __vector_7
|
||||
0x00000000000004d6 __vector_49
|
||||
0x00000000000004d6 __vector_41
|
||||
0x00000000000004d6 __vector_43
|
||||
0x00000000000004d6 __vector_27
|
||||
0x00000000000004d6 __vector_5
|
||||
0x00000000000004d6 __vector_33
|
||||
0x00000000000004d6 __vector_47
|
||||
0x00000000000004d6 __vector_52
|
||||
0x00000000000004d6 __vector_37
|
||||
0x00000000000004d6 __vector_4
|
||||
0x00000000000004d6 __vector_44
|
||||
0x00000000000004d6 __vector_51
|
||||
0x00000000000004d6 __vector_9
|
||||
0x00000000000004d6 __vector_2
|
||||
0x00000000000004d6 __vector_21
|
||||
0x00000000000004d6 __vector_15
|
||||
0x00000000000004d6 __vector_36
|
||||
0x00000000000004d6 __vector_29
|
||||
0x00000000000004d6 __vector_40
|
||||
0x00000000000004d6 __vector_8
|
||||
0x00000000000004d6 __vector_26
|
||||
0x00000000000004d6 __vector_48
|
||||
0x00000000000004d6 __vector_14
|
||||
0x00000000000004d6 __vector_57
|
||||
0x00000000000004d6 __vector_53
|
||||
0x00000000000004d6 __vector_10
|
||||
0x00000000000004d6 __vector_50
|
||||
0x00000000000004d6 __vector_16
|
||||
0x00000000000004d6 __vector_18
|
||||
0x00000000000004d6 __vector_20
|
||||
0x00000000000004d6 __vector_42
|
||||
.text 0x00000000000004e2 0x4
|
||||
.text 0x00000000000004e2 0x4 C:/Program Files/Microchip/MPLABX/v6.00/packs/Microchip/AVR-Dx_DFP/1.10.124/xc8/avr/lib/avrxmega4/memx-const/mapped/crtavr128da48.o
|
||||
0x00000000000004e2 __vector_38
|
||||
0x00000000000004e2 __vector_22
|
||||
0x00000000000004e2 __vector_28
|
||||
0x00000000000004e2 __vector_1
|
||||
0x00000000000004e2 __vector_32
|
||||
0x00000000000004e2 __vector_34
|
||||
0x00000000000004e2 __vector_24
|
||||
0x00000000000004e2 __vector_12
|
||||
0x00000000000004e2 __vector_55
|
||||
0x00000000000004e2 __vector_46
|
||||
0x00000000000004e2 __bad_interrupt
|
||||
0x00000000000004e2 __vector_6
|
||||
0x00000000000004e2 __vector_35
|
||||
0x00000000000004e2 __vector_39
|
||||
0x00000000000004e2 __vector_3
|
||||
0x00000000000004e2 __vector_23
|
||||
0x00000000000004e2 __vector_30
|
||||
0x00000000000004e2 __vector_45
|
||||
0x00000000000004e2 __vector_25
|
||||
0x00000000000004e2 __vector_11
|
||||
0x00000000000004e2 __vector_54
|
||||
0x00000000000004e2 __vector_13
|
||||
0x00000000000004e2 __vector_17
|
||||
0x00000000000004e2 __vector_19
|
||||
0x00000000000004e2 __vector_56
|
||||
0x00000000000004e2 __vector_7
|
||||
0x00000000000004e2 __vector_49
|
||||
0x00000000000004e2 __vector_41
|
||||
0x00000000000004e2 __vector_43
|
||||
0x00000000000004e2 __vector_27
|
||||
0x00000000000004e2 __vector_5
|
||||
0x00000000000004e2 __vector_33
|
||||
0x00000000000004e2 __vector_47
|
||||
0x00000000000004e2 __vector_52
|
||||
0x00000000000004e2 __vector_37
|
||||
0x00000000000004e2 __vector_4
|
||||
0x00000000000004e2 __vector_44
|
||||
0x00000000000004e2 __vector_51
|
||||
0x00000000000004e2 __vector_9
|
||||
0x00000000000004e2 __vector_2
|
||||
0x00000000000004e2 __vector_21
|
||||
0x00000000000004e2 __vector_15
|
||||
0x00000000000004e2 __vector_36
|
||||
0x00000000000004e2 __vector_29
|
||||
0x00000000000004e2 __vector_40
|
||||
0x00000000000004e2 __vector_8
|
||||
0x00000000000004e2 __vector_26
|
||||
0x00000000000004e2 __vector_48
|
||||
0x00000000000004e2 __vector_14
|
||||
0x00000000000004e2 __vector_57
|
||||
0x00000000000004e2 __vector_53
|
||||
0x00000000000004e2 __vector_10
|
||||
0x00000000000004e2 __vector_50
|
||||
0x00000000000004e2 __vector_16
|
||||
0x00000000000004e2 __vector_18
|
||||
0x00000000000004e2 __vector_20
|
||||
0x00000000000004e2 __vector_42
|
||||
|
||||
.text._Exit 0x00000000000004da 0x4
|
||||
.text._Exit 0x00000000000004da 0x4 c:/program files/microchip/xc8/v2.36/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avrxmega4/memx-const/mapped\libc.a(_Exit.o)
|
||||
0x00000000000004da _Exit
|
||||
.text._Exit 0x00000000000004e6 0x4
|
||||
.text._Exit 0x00000000000004e6 0x4 c:/program files/microchip/xc8/v2.36/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avrxmega4/memx-const/mapped\libc.a(_Exit.o)
|
||||
0x00000000000004e6 _Exit
|
||||
|
||||
.text.__dummy_fini
|
||||
0x00000000000004de 0x2
|
||||
0x00000000000004ea 0x2
|
||||
.text.__dummy_fini
|
||||
0x00000000000004de 0x2 c:/program files/microchip/xc8/v2.36/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avrxmega4/memx-const/mapped\libc.a(exit.o)
|
||||
0x00000000000004de _fini
|
||||
0x00000000000004ea 0x2 c:/program files/microchip/xc8/v2.36/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avrxmega4/memx-const/mapped\libc.a(exit.o)
|
||||
0x00000000000004ea _fini
|
||||
|
||||
.text.__dummy_funcs_on_exit
|
||||
0x00000000000004e0 0x2
|
||||
0x00000000000004ec 0x2
|
||||
.text.__dummy_funcs_on_exit
|
||||
0x00000000000004e0 0x2 c:/program files/microchip/xc8/v2.36/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avrxmega4/memx-const/mapped\libc.a(exit.o)
|
||||
0x00000000000004e0 __funcs_on_exit
|
||||
0x00000000000004ec 0x2 c:/program files/microchip/xc8/v2.36/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avrxmega4/memx-const/mapped\libc.a(exit.o)
|
||||
0x00000000000004ec __funcs_on_exit
|
||||
|
||||
.text.__dummy_simulator_exit
|
||||
0x00000000000004e2 0x2
|
||||
0x00000000000004ee 0x2
|
||||
.text.__dummy_simulator_exit
|
||||
0x00000000000004e2 0x2 c:/program files/microchip/xc8/v2.36/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avrxmega4/memx-const/mapped\libc.a(exit.o)
|
||||
0x00000000000004e2 __simulator_exit
|
||||
0x00000000000004ee 0x2 c:/program files/microchip/xc8/v2.36/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avrxmega4/memx-const/mapped\libc.a(exit.o)
|
||||
0x00000000000004ee __simulator_exit
|
||||
|
||||
4
dist/default/production/memoryfile.xml
vendored
4
dist/default/production/memoryfile.xml
vendored
@ -4,8 +4,8 @@
|
||||
<memory name="program">
|
||||
<units>bytes</units>
|
||||
<length>131072</length>
|
||||
<used>1251</used>
|
||||
<free>129821</free>
|
||||
<used>1263</used>
|
||||
<free>129809</free>
|
||||
</memory>
|
||||
<memory name="data">
|
||||
<units>bytes</units>
|
||||
|
||||
@ -3,7 +3,9 @@
|
||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
||||
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
|
||||
<group>
|
||||
<file>file:/D:/Apps/avr128da48_web-serial-example.X/command.h</file>
|
||||
<file>file:/D:/Apps/avr128da48_web-serial-example.X/main.c</file>
|
||||
<file>file:/D:/Apps/avr128da48_web-serial-example.X/command.c</file>
|
||||
</group>
|
||||
</open-files>
|
||||
</project-private>
|
||||
|
||||
39
web/app.js
39
web/app.js
@ -6,8 +6,6 @@ class SerialPortHandler {
|
||||
this.onDisconnect = onDisconnect;
|
||||
this.options = options;
|
||||
this.port = null;
|
||||
this.writer = null;
|
||||
this.reader = null;
|
||||
this.isOpened = false;
|
||||
this.#setupListeners();
|
||||
}
|
||||
@ -19,8 +17,6 @@ class SerialPortHandler {
|
||||
await port.open(this.options);
|
||||
|
||||
this.port = port;
|
||||
this.writer = port.writable.getWriter();
|
||||
this.reader = port.readable.getReader();
|
||||
this.isOpened = true;
|
||||
|
||||
return this.port.getInfo();
|
||||
@ -35,22 +31,33 @@ class SerialPortHandler {
|
||||
|
||||
async close() {
|
||||
await this.port.close();
|
||||
this.isOpened = false;
|
||||
}
|
||||
|
||||
async write(data) {
|
||||
const writer = this.port.writable.getWriter();
|
||||
const encoded = this.encoder.encode(data);
|
||||
await this.writer.write(encoded);
|
||||
await writer.write(encoded);
|
||||
writer.releaseLock();
|
||||
}
|
||||
|
||||
async read() {
|
||||
const reader = this.port.readable.getReader();
|
||||
const chunks = [];
|
||||
while (true) {
|
||||
const { value, done } = await this.reader.read();
|
||||
if (done) {
|
||||
this.reader.releaseLock();
|
||||
const { value, done } = await reader.read();
|
||||
const decoded = this.decoder.decode(value);
|
||||
|
||||
chunks.push(decoded);
|
||||
|
||||
if (done || decoded.includes('\u0004')) {
|
||||
console.log('done');
|
||||
reader.releaseLock();
|
||||
break;
|
||||
}
|
||||
console.log(this.decoder.decode(value));
|
||||
}
|
||||
|
||||
return chunks.join('');
|
||||
}
|
||||
|
||||
#setupListeners() {
|
||||
@ -80,9 +87,9 @@ const serialPortHandler = new SerialPortHandler(
|
||||
|
||||
async function onConnect() {
|
||||
try {
|
||||
if (serialPortHandler.isOpened) return;
|
||||
const info = await serialPortHandler.open();
|
||||
console.log('Device connected: ', info);
|
||||
console.log(serialPortHandler.port);
|
||||
console.log('Port opened: ', info);
|
||||
$terminalForm.elements.input.removeAttribute('disabled');
|
||||
$vendorId.textContent = '0x' + info.usbVendorId.toString(16);
|
||||
$productId.textContent = '0x' + info.usbProductId.toString(16);
|
||||
@ -93,6 +100,7 @@ async function onConnect() {
|
||||
}
|
||||
|
||||
async function onDisconnect() {
|
||||
if (!serialPortHandler.isOpened) return;
|
||||
await serialPortHandler.close();
|
||||
$vendorId.textContent = '-';
|
||||
$productId.textContent = '-';
|
||||
@ -104,10 +112,15 @@ async function onSend(e) {
|
||||
const $form = e.target;
|
||||
const data = $form.elements.input.value;
|
||||
$form.reset();
|
||||
if (serialPortHandler.isOpened) {
|
||||
if (serialPortHandler.isOpened && data) {
|
||||
$serialLog.innerHTML += data + '\n';
|
||||
await serialPortHandler.write(data + '\n');
|
||||
await serialPortHandler.read();
|
||||
const message = await serialPortHandler.read();
|
||||
$serialLog.textContent += message;
|
||||
$serialLog.textContent += '\n';
|
||||
console.log(message);
|
||||
}
|
||||
$serialLog.scrollTo(0, $serialLog.scrollHeight);
|
||||
}
|
||||
|
||||
$connectButton.addEventListener('click', onConnect);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user