質問編集履歴

1

2021/12/18 07:18

投稿

imahh
imahh

スコア2

test CHANGED
File without changes
test CHANGED
@@ -102,6 +102,108 @@
102
102
 
103
103
 
104
104
 
105
+ ---------------加筆しました。-----------------
106
+
107
+
108
+
109
+
110
+
111
+ void UART1_RX_InterruptHandler (void)
112
+
113
+ {
114
+
115
+ if(uart1Obj.rxBusyStatus == true)
116
+
117
+ {
118
+
119
+ while((_U1STA_URXDA_MASK == (U1STA & _U1STA_URXDA_MASK)) && (uart1Obj.rxSize > uart1Obj.rxProcessedSize) )
120
+
121
+ {
122
+
123
+ if (( U1MODE & (_U1MODE_PDSEL0_MASK | _U1MODE_PDSEL1_MASK)) == (_U1MODE_PDSEL0_MASK | _U1MODE_PDSEL1_MASK))
124
+
125
+ {
126
+
127
+ /* 9-bit mode */
128
+
129
+ ((uint16_t*)uart1Obj.rxBuffer)[uart1Obj.rxProcessedSize++] = (uint16_t )(U1RXREG);
130
+
131
+ }
132
+
133
+ else
134
+
135
+ {
136
+
137
+ /* 8-bit mode */
138
+
139
+ uart1Obj.rxBuffer[uart1Obj.rxProcessedSize++] = (uint8_t )(U1RXREG);
140
+
141
+
142
+
143
+
144
+
145
+ }
146
+
147
+ }
148
+
149
+
150
+
151
+ /* Clear UART1 RX Interrupt flag */
152
+
153
+ IFS1CLR = _IFS1_U1RXIF_MASK;
154
+
155
+
156
+
157
+
158
+
159
+ /* Check if the buffer is done */
160
+
161
+ if(uart1Obj.rxProcessedSize >= uart1Obj.rxSize)
162
+
163
+ {
164
+
165
+ uart1Obj.rxBusyStatus = false;
166
+
167
+
168
+
169
+ /* Disable the fault interrupt */
170
+
171
+ IEC1CLR = _IEC1_U1EIE_MASK;
172
+
173
+
174
+
175
+ /* Disable the receive interrupt */
176
+
177
+ IEC1CLR = _IEC1_U1RXIE_MASK;
178
+
179
+
180
+
181
+ if(uart1Obj.rxCallback != NULL)
182
+
183
+ {
184
+
185
+ uart1Obj.rxCallback(uart1Obj.rxContext);
186
+
187
+ }
188
+
189
+ }
190
+
191
+ }
192
+
193
+ else
194
+
195
+ {
196
+
197
+ // Nothing to process
198
+
199
+ ;
200
+
201
+ }
202
+
203
+ }
204
+
205
+
206
+
105
207
 
106
208
 
107
209
  ### 試したこと