teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

2021/12/18 07:18

投稿

imahh
imahh

スコア2

title CHANGED
File without changes
body CHANGED
@@ -50,7 +50,58 @@
50
50
  return status;
51
51
  }
52
52
 
53
+ ---------------加筆しました。-----------------
53
54
 
55
+
56
+ void UART1_RX_InterruptHandler (void)
57
+ {
58
+ if(uart1Obj.rxBusyStatus == true)
59
+ {
60
+ while((_U1STA_URXDA_MASK == (U1STA & _U1STA_URXDA_MASK)) && (uart1Obj.rxSize > uart1Obj.rxProcessedSize) )
61
+ {
62
+ if (( U1MODE & (_U1MODE_PDSEL0_MASK | _U1MODE_PDSEL1_MASK)) == (_U1MODE_PDSEL0_MASK | _U1MODE_PDSEL1_MASK))
63
+ {
64
+ /* 9-bit mode */
65
+ ((uint16_t*)uart1Obj.rxBuffer)[uart1Obj.rxProcessedSize++] = (uint16_t )(U1RXREG);
66
+ }
67
+ else
68
+ {
69
+ /* 8-bit mode */
70
+ uart1Obj.rxBuffer[uart1Obj.rxProcessedSize++] = (uint8_t )(U1RXREG);
71
+
72
+
73
+ }
74
+ }
75
+
76
+ /* Clear UART1 RX Interrupt flag */
77
+ IFS1CLR = _IFS1_U1RXIF_MASK;
78
+
79
+
80
+ /* Check if the buffer is done */
81
+ if(uart1Obj.rxProcessedSize >= uart1Obj.rxSize)
82
+ {
83
+ uart1Obj.rxBusyStatus = false;
84
+
85
+ /* Disable the fault interrupt */
86
+ IEC1CLR = _IEC1_U1EIE_MASK;
87
+
88
+ /* Disable the receive interrupt */
89
+ IEC1CLR = _IEC1_U1RXIE_MASK;
90
+
91
+ if(uart1Obj.rxCallback != NULL)
92
+ {
93
+ uart1Obj.rxCallback(uart1Obj.rxContext);
94
+ }
95
+ }
96
+ }
97
+ else
98
+ {
99
+ // Nothing to process
100
+ ;
101
+ }
102
+ }
103
+
104
+
54
105
  ### 試したこと
55
106
 
56
107
  調べたことはconstが定数を表していること、size_tは長さを表すってことを調べて分かったくらいです。何も調べていないに等しいです。