-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstm32f0xx_it.c
More file actions
172 lines (144 loc) · 3.27 KB
/
stm32f0xx_it.c
File metadata and controls
172 lines (144 loc) · 3.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
#include "stm32f0xx_it.h"
#include "stm32f0xx_usart.h"
#include "peripheral_config.h"
uint8_t RxBuffer[512]={0};
uint16_t RxCount=0;
/******************************************************************************/
/* STM32F0xx Peripherals Interrupt Handlers */
/* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */
/* available peripheral interrupt handler's name please refer to the startup */
/* file (startup_stm32f0xx.s). */
/******************************************************************************/
/**
* @brief This function handles USART1 global interrupt request.
* @param None
* @retval None
*/
void USART1_IRQHandler(void)
{
static int toggle=0;
if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET)
{
/* Read one byte from the receive data register */
RxBuffer[RxCount++] = USART_ReceiveData(USART1);
if(toggle!=0)
{
toggle=1;
GPIO_ResetBits(LED_GPIO_PORT,LED_PIN);
}
else
{
toggle=0;
GPIO_SetBits(LED_GPIO_PORT,LED_PIN);
}
if(RxCount>5)
{
RxCount=0;
}
}
//USART_ClearITPendingBit(USART1,USART_IT_RXNE);
if(USART_GetITStatus(USART1, USART_IT_TXE) != RESET)
{
// /* Write one byte to the transmit data register */
// USART_SendData(USART1, TxBuffer[TxCount++]);
//
// if(TxCount == NbrOfDataToTransfer)
// {
// /* Disable the USART1 Transmit interrupt */
// USART_ITConfig(USART1, USART_IT_TXE, DISABLE);
// }
}
if(USART_GetITStatus(USART1, USART_IT_CM) != RESET)
{
}
if(USART_GetITStatus(USART1, USART_IT_CTS) != RESET)
{
}
if(USART_GetITStatus(USART1, USART_IT_EOB) != RESET)
{
}
if(USART_GetITStatus(USART1, USART_IT_ERR) != RESET)
{
}
if(USART_GetITStatus(USART1, USART_IT_FE) != RESET)
{
}
if(USART_GetITStatus(USART1, USART_IT_IDLE) != RESET)
{
}
}
/**
* @brief This function handles EXTI0_IRQ Handler.
* @param None
* @retval None
*/
void EXTI0_1_IRQHandler(void)
{
// if(EXTI_GetITStatus(USER_BUTTON_EXTI_LINE) != RESET)
// {
//
// /* Clear the EXTI line pending bit */
// EXTI_ClearITPendingBit(USER_BUTTON_EXTI_LINE);
// }
}
/******************************************************************************/
/* Cortex-M0 Processor Exceptions Handlers */
/******************************************************************************/
/**
* @brief This function handles SysTick Handler.
* @param None
* @retval None
*/
void SysTick_Handler(void)
{
static uint32_t i=0;
char str[]={"AT+GMM=?\n"};
if(i++>900)
{
if (i>=1000)
{
i=0;
USART_Puts(str);
//RxCount=0;
}
}else
{
//GPIO_ResetBits(LED_GPIO_PORT,LED_PIN);
}
}
/**
* @brief This function handles NMI exception.
* @param None
* @retval None
*/
void NMI_Handler(void)
{
}
/**
* @brief This function handles Hard Fault exception.
* @param None
* @retval None
*/
void HardFault_Handler(void)
{
/* Go to infinite loop when Hard Fault exception occurs */
while (1)
{
}
}
/**
* @brief This function handles SVCall exception.
* @param None
* @retval None
*/
void SVC_Handler(void)
{
}
/**
* @brief This function handles PendSVC exception.
* @param None
* @retval None
*/
void PendSV_Handler(void)
{
}