Choses à revoir sur l'uart
This commit is contained in:
parent
d97f0b4c7a
commit
adcecf465c
9 changed files with 3370 additions and 51 deletions
|
@ -4,7 +4,7 @@
|
|||
|
||||
void MyUART_init(void);
|
||||
void UART_send(char data); //à revoir
|
||||
void MyUART_ActiveIT(char Prio, void (*IT_function)(void));
|
||||
void MyUART_ActiveIT(char Prio, void (*IT_function)(void), char mode); //mode permet d'activer soit l'interruption sur RX (mode='r') soit TX (mode='t')
|
||||
char UART_receive();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "ADC.h"
|
||||
|
||||
void (*adc_ptr_func)(void);
|
||||
void (*adc1_ptr_func)(void);
|
||||
void (*adc2_ptr_func)(void);
|
||||
|
||||
void MyADC_init(MyADC_Struct_TypeDef* myADC)
|
||||
{
|
||||
|
@ -111,7 +112,7 @@ void MyADC_init(MyADC_Struct_TypeDef* myADC)
|
|||
ADC1->CR2|= ADC_CR2_ADON; // démarrage ADC1
|
||||
ADC1->SQR1&= ADC_SQR1_L; // fixe le nombre de conversion à 1
|
||||
ADC1->SQR3|= myADC->channel; // indique la voie à convertir
|
||||
ADC1->CR2 |= ADC_CR2_CAL; // dÈbut de la calibration
|
||||
ADC1->CR2 |= ADC_CR2_CAL; // début de la calibration
|
||||
while ((ADC1->CR2 & ADC_CR2_CAL)); // attente de la fin de la calibration
|
||||
}
|
||||
else if(myADC->ADC==ADC2)
|
||||
|
@ -121,7 +122,7 @@ void MyADC_init(MyADC_Struct_TypeDef* myADC)
|
|||
ADC2->CR2|= ADC_CR2_ADON; // démarrage ADC1
|
||||
ADC2->SQR1&= ADC_SQR1_L; // fixe le nombre de conversion à 1
|
||||
ADC2->SQR3|= myADC->channel; // indique la voie à convertir
|
||||
ADC2->CR2 |= ADC_CR2_CAL; // dÈbut de la calibration
|
||||
ADC2->CR2 |= ADC_CR2_CAL; // début de la calibration
|
||||
while ((ADC2->CR2 & ADC_CR2_CAL)); // attente de la fin de la calibration
|
||||
}
|
||||
}
|
||||
|
@ -141,18 +142,36 @@ void MyADC_start_conversion(ADC_TypeDef* ADC)
|
|||
|
||||
void ADC1_2_IRQHandler(void)
|
||||
{
|
||||
ADC1->SR &= ~ADC_SR_EOC ;
|
||||
ADC2->SR &= ~ADC_SR_EOC ;
|
||||
if(adc_ptr_func!=0)
|
||||
if(ADC1->SR & ~ADC_SR_EOC)
|
||||
{
|
||||
(*adc_ptr_func)();
|
||||
ADC1->SR &= ~ADC_SR_EOC ;
|
||||
if(adc1_ptr_func!=0)
|
||||
{
|
||||
(*adc1_ptr_func)();
|
||||
}
|
||||
}
|
||||
else if(ADC2->SR & ~ADC_SR_EOC)
|
||||
{
|
||||
ADC2->SR &= ~ADC_SR_EOC ;
|
||||
if(adc2_ptr_func!=0)
|
||||
{
|
||||
(*adc2_ptr_func)();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void MyADC_ActiveIT (ADC_TypeDef * ADC, char Prio, void (*IT_function)(void))
|
||||
{
|
||||
ADC->CR1 |= ADC_CR1_EOCIE;
|
||||
adc_ptr_func=IT_function;
|
||||
if(ADC==ADC1)
|
||||
{
|
||||
adc1_ptr_func=IT_function;
|
||||
}
|
||||
else if(ADC==ADC2)
|
||||
{
|
||||
adc2_ptr_func=IT_function;
|
||||
}
|
||||
NVIC->ISER[0] |= 0x01<<ADC1_2_IRQn;
|
||||
NVIC->IP[ADC1_2_IRQn] |= Prio << 4;
|
||||
|
||||
|
@ -168,4 +187,5 @@ int MyADC_result(ADC_TypeDef* ADC)
|
|||
{
|
||||
return ADC2->DR & ~((0x0F) << 12); // retour de la conversion
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
#include "UART.h"
|
||||
|
||||
void (*uart_ptr_func)(void);
|
||||
void (*uart_rx_ptr_func)(void);
|
||||
void (*uart_tx_ptr_func)(void);
|
||||
char buffer[1000]={0};
|
||||
|
||||
void MyUART_init(void) // que pour du 9600 bauds
|
||||
|
@ -17,28 +18,46 @@ void MyUART_init(void) // que pour du 9600 bauds
|
|||
void UART_send(char data)
|
||||
{
|
||||
USART1->DR |= data; // Ecriture de la donnée dans le registre DR
|
||||
while(!(USART1->SR & USART_SR_TC)) {} // Attente de la fin de transmission
|
||||
}
|
||||
|
||||
void MyUART_ActiveIT(char Prio, void (*IT_function)(void))
|
||||
void MyUART_ActiveIT(char Prio, void (*IT_function)(void), char mode)
|
||||
{
|
||||
if (mode=='r')
|
||||
{
|
||||
USART1->CR1 |= USART_CR1_RXNEIE;
|
||||
uart_rx_ptr_func=IT_function;
|
||||
}
|
||||
else if (mode=='t')
|
||||
{
|
||||
USART1->CR1 |= USART_CR1_TXEIE;
|
||||
uart_tx_ptr_func=IT_function;
|
||||
}
|
||||
NVIC->ISER[1] |= 0x01<<(USART1_IRQn%32);
|
||||
NVIC->IP[USART1_IRQn] |= Prio << 4;
|
||||
}
|
||||
|
||||
void USART1_IRQHandler()
|
||||
{
|
||||
USART1->SR &= ~USART_SR_RXNE;
|
||||
if(uart_ptr_func!=0)
|
||||
if (USART1->SR & USART_SR_RXNE)
|
||||
{
|
||||
(*uart_ptr_func)();
|
||||
USART1->SR &= ~USART_SR_RXNE;
|
||||
if(uart_rx_ptr_func!=0)
|
||||
{
|
||||
(*uart_rx_ptr_func)();
|
||||
}
|
||||
}
|
||||
else if (USART1->SR & USART_SR_TXE) // à revoir car si rien dedans il va tout le temps y retourner vu qu'il est vide
|
||||
{
|
||||
USART1->SR &= ~USART_SR_TXE;
|
||||
if(uart_tx_ptr_func!=0)
|
||||
{
|
||||
(*uart_tx_ptr_func)();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
char UART_receive()
|
||||
{
|
||||
char carac;
|
||||
carac = USART1->DR;
|
||||
return carac;
|
||||
return USART1->DR;
|
||||
}
|
||||
|
|
1828
Projet_voile/RTE/Device/STM32F103RB/RTE_Device.h.base@1.1.2
Normal file
1828
Projet_voile/RTE/Device/STM32F103RB/RTE_Device.h.base@1.1.2
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,308 @@
|
|||
;******************** (C) COPYRIGHT 2011 STMicroelectronics ********************
|
||||
;* File Name : startup_stm32f10x_md.s
|
||||
;* Author : MCD Application Team
|
||||
;* Version : V3.5.1
|
||||
;* Date : 08-September-2021
|
||||
;* Description : STM32F10x Medium Density Devices vector table for MDK-ARM
|
||||
;* toolchain.
|
||||
;* This module performs:
|
||||
;* - Set the initial SP
|
||||
;* - Set the initial PC == Reset_Handler
|
||||
;* - Set the vector table entries with the exceptions ISR address
|
||||
;* - Configure the clock system
|
||||
;* - Branches to __main in the C library (which eventually
|
||||
;* calls main()).
|
||||
;* After Reset the CortexM3 processor is in Thread mode,
|
||||
;* priority is Privileged, and the Stack is set to Main.
|
||||
;* <<< Use Configuration Wizard in Context Menu >>>
|
||||
;*******************************************************************************
|
||||
;*
|
||||
;* Copyright (c) 2011 STMicroelectronics.
|
||||
;* All rights reserved.
|
||||
;*
|
||||
;* This software is licensed under terms that can be found in the LICENSE file
|
||||
;* in the root directory of this software component.
|
||||
;* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
;
|
||||
;*******************************************************************************
|
||||
|
||||
; Amount of memory (in bytes) allocated for Stack
|
||||
; Tailor this value to your application needs
|
||||
; <h> Stack Configuration
|
||||
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
||||
; </h>
|
||||
|
||||
Stack_Size EQU 0x00000400
|
||||
|
||||
AREA STACK, NOINIT, READWRITE, ALIGN=3
|
||||
Stack_Mem SPACE Stack_Size
|
||||
__initial_sp
|
||||
|
||||
|
||||
; <h> Heap Configuration
|
||||
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
||||
; </h>
|
||||
|
||||
Heap_Size EQU 0x00000200
|
||||
|
||||
AREA HEAP, NOINIT, READWRITE, ALIGN=3
|
||||
__heap_base
|
||||
Heap_Mem SPACE Heap_Size
|
||||
__heap_limit
|
||||
|
||||
PRESERVE8
|
||||
THUMB
|
||||
|
||||
|
||||
; Vector Table Mapped to Address 0 at Reset
|
||||
AREA RESET, DATA, READONLY
|
||||
EXPORT __Vectors
|
||||
EXPORT __Vectors_End
|
||||
EXPORT __Vectors_Size
|
||||
|
||||
__Vectors DCD __initial_sp ; Top of Stack
|
||||
DCD Reset_Handler ; Reset Handler
|
||||
DCD NMI_Handler ; NMI Handler
|
||||
DCD HardFault_Handler ; Hard Fault Handler
|
||||
DCD MemManage_Handler ; MPU Fault Handler
|
||||
DCD BusFault_Handler ; Bus Fault Handler
|
||||
DCD UsageFault_Handler ; Usage Fault Handler
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD SVC_Handler ; SVCall Handler
|
||||
DCD DebugMon_Handler ; Debug Monitor Handler
|
||||
DCD 0 ; Reserved
|
||||
DCD PendSV_Handler ; PendSV Handler
|
||||
DCD SysTick_Handler ; SysTick Handler
|
||||
|
||||
; External Interrupts
|
||||
DCD WWDG_IRQHandler ; Window Watchdog
|
||||
DCD PVD_IRQHandler ; PVD through EXTI Line detect
|
||||
DCD TAMPER_IRQHandler ; Tamper
|
||||
DCD RTC_IRQHandler ; RTC
|
||||
DCD FLASH_IRQHandler ; Flash
|
||||
DCD RCC_IRQHandler ; RCC
|
||||
DCD EXTI0_IRQHandler ; EXTI Line 0
|
||||
DCD EXTI1_IRQHandler ; EXTI Line 1
|
||||
DCD EXTI2_IRQHandler ; EXTI Line 2
|
||||
DCD EXTI3_IRQHandler ; EXTI Line 3
|
||||
DCD EXTI4_IRQHandler ; EXTI Line 4
|
||||
DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
|
||||
DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
|
||||
DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
|
||||
DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
|
||||
DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
|
||||
DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
|
||||
DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
|
||||
DCD ADC1_2_IRQHandler ; ADC1_2
|
||||
DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
|
||||
DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
|
||||
DCD CAN1_RX1_IRQHandler ; CAN1 RX1
|
||||
DCD CAN1_SCE_IRQHandler ; CAN1 SCE
|
||||
DCD EXTI9_5_IRQHandler ; EXTI Line 9..5
|
||||
DCD TIM1_BRK_IRQHandler ; TIM1 Break
|
||||
DCD TIM1_UP_IRQHandler ; TIM1 Update
|
||||
DCD TIM1_TRG_COM_IRQHandler ; TIM1 Trigger and Commutation
|
||||
DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare
|
||||
DCD TIM2_IRQHandler ; TIM2
|
||||
DCD TIM3_IRQHandler ; TIM3
|
||||
DCD TIM4_IRQHandler ; TIM4
|
||||
DCD I2C1_EV_IRQHandler ; I2C1 Event
|
||||
DCD I2C1_ER_IRQHandler ; I2C1 Error
|
||||
DCD I2C2_EV_IRQHandler ; I2C2 Event
|
||||
DCD I2C2_ER_IRQHandler ; I2C2 Error
|
||||
DCD SPI1_IRQHandler ; SPI1
|
||||
DCD SPI2_IRQHandler ; SPI2
|
||||
DCD USART1_IRQHandler ; USART1
|
||||
DCD USART2_IRQHandler ; USART2
|
||||
DCD USART3_IRQHandler ; USART3
|
||||
DCD EXTI15_10_IRQHandler ; EXTI Line 15..10
|
||||
DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
|
||||
DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
|
||||
__Vectors_End
|
||||
|
||||
__Vectors_Size EQU __Vectors_End - __Vectors
|
||||
|
||||
AREA |.text|, CODE, READONLY
|
||||
|
||||
; Reset handler
|
||||
Reset_Handler PROC
|
||||
EXPORT Reset_Handler [WEAK]
|
||||
IMPORT __main
|
||||
IMPORT SystemInit
|
||||
LDR R0, =SystemInit
|
||||
BLX R0
|
||||
LDR R0, =__main
|
||||
BX R0
|
||||
ENDP
|
||||
|
||||
; Dummy Exception Handlers (infinite loops which can be modified)
|
||||
|
||||
NMI_Handler PROC
|
||||
EXPORT NMI_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
HardFault_Handler\
|
||||
PROC
|
||||
EXPORT HardFault_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
MemManage_Handler\
|
||||
PROC
|
||||
EXPORT MemManage_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
BusFault_Handler\
|
||||
PROC
|
||||
EXPORT BusFault_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
UsageFault_Handler\
|
||||
PROC
|
||||
EXPORT UsageFault_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
SVC_Handler PROC
|
||||
EXPORT SVC_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
DebugMon_Handler\
|
||||
PROC
|
||||
EXPORT DebugMon_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
PendSV_Handler PROC
|
||||
EXPORT PendSV_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
SysTick_Handler PROC
|
||||
EXPORT SysTick_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
|
||||
Default_Handler PROC
|
||||
|
||||
EXPORT WWDG_IRQHandler [WEAK]
|
||||
EXPORT PVD_IRQHandler [WEAK]
|
||||
EXPORT TAMPER_IRQHandler [WEAK]
|
||||
EXPORT RTC_IRQHandler [WEAK]
|
||||
EXPORT FLASH_IRQHandler [WEAK]
|
||||
EXPORT RCC_IRQHandler [WEAK]
|
||||
EXPORT EXTI0_IRQHandler [WEAK]
|
||||
EXPORT EXTI1_IRQHandler [WEAK]
|
||||
EXPORT EXTI2_IRQHandler [WEAK]
|
||||
EXPORT EXTI3_IRQHandler [WEAK]
|
||||
EXPORT EXTI4_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel1_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel2_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel3_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel4_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel5_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel6_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel7_IRQHandler [WEAK]
|
||||
EXPORT ADC1_2_IRQHandler [WEAK]
|
||||
EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
|
||||
EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
|
||||
EXPORT CAN1_RX1_IRQHandler [WEAK]
|
||||
EXPORT CAN1_SCE_IRQHandler [WEAK]
|
||||
EXPORT EXTI9_5_IRQHandler [WEAK]
|
||||
EXPORT TIM1_BRK_IRQHandler [WEAK]
|
||||
EXPORT TIM1_UP_IRQHandler [WEAK]
|
||||
EXPORT TIM1_TRG_COM_IRQHandler [WEAK]
|
||||
EXPORT TIM1_CC_IRQHandler [WEAK]
|
||||
EXPORT TIM2_IRQHandler [WEAK]
|
||||
EXPORT TIM3_IRQHandler [WEAK]
|
||||
EXPORT TIM4_IRQHandler [WEAK]
|
||||
EXPORT I2C1_EV_IRQHandler [WEAK]
|
||||
EXPORT I2C1_ER_IRQHandler [WEAK]
|
||||
EXPORT I2C2_EV_IRQHandler [WEAK]
|
||||
EXPORT I2C2_ER_IRQHandler [WEAK]
|
||||
EXPORT SPI1_IRQHandler [WEAK]
|
||||
EXPORT SPI2_IRQHandler [WEAK]
|
||||
EXPORT USART1_IRQHandler [WEAK]
|
||||
EXPORT USART2_IRQHandler [WEAK]
|
||||
EXPORT USART3_IRQHandler [WEAK]
|
||||
EXPORT EXTI15_10_IRQHandler [WEAK]
|
||||
EXPORT RTCAlarm_IRQHandler [WEAK]
|
||||
EXPORT USBWakeUp_IRQHandler [WEAK]
|
||||
|
||||
WWDG_IRQHandler
|
||||
PVD_IRQHandler
|
||||
TAMPER_IRQHandler
|
||||
RTC_IRQHandler
|
||||
FLASH_IRQHandler
|
||||
RCC_IRQHandler
|
||||
EXTI0_IRQHandler
|
||||
EXTI1_IRQHandler
|
||||
EXTI2_IRQHandler
|
||||
EXTI3_IRQHandler
|
||||
EXTI4_IRQHandler
|
||||
DMA1_Channel1_IRQHandler
|
||||
DMA1_Channel2_IRQHandler
|
||||
DMA1_Channel3_IRQHandler
|
||||
DMA1_Channel4_IRQHandler
|
||||
DMA1_Channel5_IRQHandler
|
||||
DMA1_Channel6_IRQHandler
|
||||
DMA1_Channel7_IRQHandler
|
||||
ADC1_2_IRQHandler
|
||||
USB_HP_CAN1_TX_IRQHandler
|
||||
USB_LP_CAN1_RX0_IRQHandler
|
||||
CAN1_RX1_IRQHandler
|
||||
CAN1_SCE_IRQHandler
|
||||
EXTI9_5_IRQHandler
|
||||
TIM1_BRK_IRQHandler
|
||||
TIM1_UP_IRQHandler
|
||||
TIM1_TRG_COM_IRQHandler
|
||||
TIM1_CC_IRQHandler
|
||||
TIM2_IRQHandler
|
||||
TIM3_IRQHandler
|
||||
TIM4_IRQHandler
|
||||
I2C1_EV_IRQHandler
|
||||
I2C1_ER_IRQHandler
|
||||
I2C2_EV_IRQHandler
|
||||
I2C2_ER_IRQHandler
|
||||
SPI1_IRQHandler
|
||||
SPI2_IRQHandler
|
||||
USART1_IRQHandler
|
||||
USART2_IRQHandler
|
||||
USART3_IRQHandler
|
||||
EXTI15_10_IRQHandler
|
||||
RTCAlarm_IRQHandler
|
||||
USBWakeUp_IRQHandler
|
||||
|
||||
B .
|
||||
|
||||
ENDP
|
||||
|
||||
ALIGN
|
||||
|
||||
;*******************************************************************************
|
||||
; User Stack and Heap initialization
|
||||
;*******************************************************************************
|
||||
IF :DEF:__MICROLIB
|
||||
|
||||
EXPORT __initial_sp
|
||||
EXPORT __heap_base
|
||||
EXPORT __heap_limit
|
||||
|
||||
ELSE
|
||||
|
||||
IMPORT __use_two_region_memory
|
||||
EXPORT __user_initial_stackheap
|
||||
|
||||
__user_initial_stackheap
|
||||
|
||||
LDR R0, = Heap_Mem
|
||||
LDR R1, =(Stack_Mem + Stack_Size)
|
||||
LDR R2, = (Heap_Mem + Heap_Size)
|
||||
LDR R3, = Stack_Mem
|
||||
BX LR
|
||||
|
||||
ALIGN
|
||||
|
||||
ENDIF
|
||||
|
||||
END
|
||||
|
1092
Projet_voile/RTE/Device/STM32F103RB/system_stm32f10x.c.update@1.0.1
Normal file
1092
Projet_voile/RTE/Device/STM32F103RB/system_stm32f10x.c.update@1.0.1
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,24 +1,38 @@
|
|||
#include "stm32f10x.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "GPIO.h"
|
||||
#include "TIMER.h"
|
||||
#include "ADC.h"
|
||||
#include "UART.h"
|
||||
|
||||
int val_adc=0;
|
||||
int cpt_buff_tx=0;
|
||||
int cpt_buff_rx=0;
|
||||
MyGPIO_Struct_TypeDef PA5; //PA5 LED
|
||||
MyGPIO_Struct_TypeDef PC13; //PC13 Bouton
|
||||
MyTimer_Struct_TypeDef timer2;
|
||||
MyADC_Struct_TypeDef myADC;
|
||||
void Mafonction_IT (void);
|
||||
void Mafonction_IT2(void);
|
||||
char buffer_tx[100]={0};
|
||||
char buffer_rx[100]={0};
|
||||
void GPIO_led_IT (void);
|
||||
void ADC_IT(void);
|
||||
void UART_RX_IT(void);
|
||||
void UART_TX_IT(void);
|
||||
|
||||
int main ( void )
|
||||
{
|
||||
myADC.ADC=ADC1;
|
||||
myADC.channel=2;
|
||||
MyADC_init(&myADC);
|
||||
MyADC_ActiveIT(myADC.ADC,0,&Mafonction_IT2);
|
||||
MyADC_ActiveIT(myADC.ADC,4,&ADC_IT);
|
||||
MyADC_start_conversion(myADC.ADC);
|
||||
|
||||
MyUART_init();
|
||||
MyUART_ActiveIT(1, &UART_RX_IT, 'r'); //mode permet d'activer soit l'interruption sur RX (mode=0) soit TX (mode=1)
|
||||
MyUART_ActiveIT(3, &UART_TX_IT, 't'); //mode permet d'activer soit l'interruption sur RX (mode=0) soit TX (mode=1)
|
||||
sprintf(buffer_tx,"Test");
|
||||
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
|
@ -27,12 +41,40 @@ int main ( void )
|
|||
|
||||
|
||||
|
||||
void Mafonction_IT (void)
|
||||
void GPIO_led_IT (void)
|
||||
{
|
||||
MyGPIO_Toggle(PA5.GPIO,5);
|
||||
}
|
||||
|
||||
void Mafonction_IT2 (void)
|
||||
void ADC_IT (void)
|
||||
{
|
||||
val_adc=MyADC_result(myADC.ADC);
|
||||
}
|
||||
|
||||
void UART_TX_IT (void)
|
||||
{
|
||||
if(buffer_tx[cpt_buff_tx]!=0)
|
||||
{
|
||||
UART_send(buffer_tx[cpt_buff_tx]);
|
||||
cpt_buff_tx++;
|
||||
}
|
||||
else
|
||||
{
|
||||
cpt_buff_tx=0;
|
||||
memset(buffer_tx, 0, sizeof buffer_tx);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void UART_RX_IT (void)
|
||||
{
|
||||
if((cpt_buff_rx!=-1)&&(cpt_buff_rx<100))
|
||||
{
|
||||
buffer_rx[cpt_buff_rx]=UART_receive();
|
||||
}
|
||||
else
|
||||
{
|
||||
cpt_buff_rx=0;
|
||||
memset(buffer_rx, 0, sizeof buffer_rx);
|
||||
}
|
||||
}
|
|
@ -125,7 +125,7 @@
|
|||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>DLGDARM</Key>
|
||||
<Name>(1010=1184,109,1560,666,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(111=-1,-1,-1,-1,0)(1011=-1,-1,-1,-1,0)(180=-1,-1,-1,-1,0)(120=733,260,1154,687,0)(121=-1,-1,-1,-1,0)(122=1345,565,1766,992,0)(123=-1,-1,-1,-1,0)(140=-1,-1,-1,-1,0)(240=-1,-1,-1,-1,0)(190=-1,-1,-1,-1,0)(200=-1,-1,-1,-1,0)(170=-1,-1,-1,-1,0)(130=-1,-1,-1,-1,0)(131=335,254,929,1005,0)(132=-1,-1,-1,-1,0)(133=-1,-1,-1,-1,0)(160=1126,210,1574,624,0)(161=-1,-1,-1,-1,0)(162=-1,-1,-1,-1,0)(210=-1,-1,-1,-1,0)(211=-1,-1,-1,-1,0)(220=-1,-1,-1,-1,0)(221=-1,-1,-1,-1,0)(230=-1,-1,-1,-1,0)(234=-1,-1,-1,-1,0)(231=-1,-1,-1,-1,0)(232=-1,-1,-1,-1,0)(233=-1,-1,-1,-1,0)(150=298,316,901,1067,0)(151=-1,-1,-1,-1,0)</Name>
|
||||
<Name>(1010=984,109,1360,666,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(111=-1,-1,-1,-1,0)(1011=-1,-1,-1,-1,0)(180=-1,-1,-1,-1,0)(120=733,260,1154,687,0)(121=-1,-1,-1,-1,0)(122=939,341,1360,768,0)(123=-1,-1,-1,-1,0)(140=-1,-1,-1,-1,0)(240=-1,-1,-1,-1,0)(190=-1,-1,-1,-1,0)(200=-1,-1,-1,-1,0)(170=-1,-1,-1,-1,0)(130=-1,-1,-1,-1,0)(131=335,17,929,768,0)(132=-1,-1,-1,-1,0)(133=-1,-1,-1,-1,0)(160=695,235,1143,649,0)(161=-1,-1,-1,-1,0)(162=-1,-1,-1,-1,0)(210=-1,-1,-1,-1,0)(211=-1,-1,-1,-1,0)(220=-1,-1,-1,-1,0)(221=-1,-1,-1,-1,0)(230=-1,-1,-1,-1,0)(234=-1,-1,-1,-1,0)(231=-1,-1,-1,-1,0)(232=-1,-1,-1,-1,0)(233=-1,-1,-1,-1,0)(150=298,17,901,768,0)(151=-1,-1,-1,-1,0)</Name>
|
||||
</SetRegEntry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
|
@ -142,9 +142,9 @@
|
|||
<Bp>
|
||||
<Number>0</Number>
|
||||
<Type>0</Type>
|
||||
<LineNumber>37</LineNumber>
|
||||
<LineNumber>31</LineNumber>
|
||||
<EnabledFlag>1</EnabledFlag>
|
||||
<Address>134218114</Address>
|
||||
<Address>134219858</Address>
|
||||
<ByteObject>0</ByteObject>
|
||||
<HtxType>0</HtxType>
|
||||
<ManyObjects>0</ManyObjects>
|
||||
|
@ -153,9 +153,21 @@
|
|||
<BreakIfRCount>1</BreakIfRCount>
|
||||
<Filename>.\Sources\Principal.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression>\\TP1\Sources/Principal.c\37</Expression>
|
||||
<Expression>\\TP1\Sources/Principal.c\31</Expression>
|
||||
</Bp>
|
||||
</Breakpoint>
|
||||
<WatchWindow1>
|
||||
<Ww>
|
||||
<count>0</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>mode</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>1</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>ADC</ItemText>
|
||||
</Ww>
|
||||
</WatchWindow1>
|
||||
<Tracepoint>
|
||||
<THDelay>0</THDelay>
|
||||
</Tracepoint>
|
||||
|
@ -176,7 +188,7 @@
|
|||
<AscS3>0</AscS3>
|
||||
<aSer3>0</aSer3>
|
||||
<eProf>0</eProf>
|
||||
<aLa>1</aLa>
|
||||
<aLa>0</aLa>
|
||||
<aPa1>0</aPa1>
|
||||
<AscS4>0</AscS4>
|
||||
<aSer4>0</aSer4>
|
||||
|
@ -207,13 +219,9 @@
|
|||
</LogicAnalyzers>
|
||||
<SystemViewers>
|
||||
<Entry>
|
||||
<Name>System Viewer\ADC1</Name>
|
||||
<Name>System Viewer\USART1</Name>
|
||||
<WinId>35905</WinId>
|
||||
</Entry>
|
||||
<Entry>
|
||||
<Name>System Viewer\TIM2</Name>
|
||||
<WinId>35904</WinId>
|
||||
</Entry>
|
||||
</SystemViewers>
|
||||
<DebugDescription>
|
||||
<Enable>1</Enable>
|
||||
|
@ -439,7 +447,7 @@
|
|||
<GroupNumber>1</GroupNumber>
|
||||
<FileNumber>3</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\Drivers\Src\TIMER.c</PathWithFileName>
|
||||
|
|
|
@ -10,13 +10,13 @@
|
|||
<TargetName>Simulé</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<pCCUsed>5060960::V5.06 update 7 (build 960)::.\ARMCC</pCCUsed>
|
||||
<uAC6>0</uAC6>
|
||||
<pCCUsed>6190000::V6.19::ARMCLANG</pCCUsed>
|
||||
<uAC6>1</uAC6>
|
||||
<TargetOption>
|
||||
<TargetCommonOption>
|
||||
<Device>STM32F103RB</Device>
|
||||
<Vendor>STMicroelectronics</Vendor>
|
||||
<PackID>Keil.STM32F1xx_DFP.2.3.0</PackID>
|
||||
<PackID>Keil.STM32F1xx_DFP.2.4.0</PackID>
|
||||
<PackURL>http://www.keil.com/pack/</PackURL>
|
||||
<Cpu>IRAM(0x20000000,0x00005000) IROM(0x08000000,0x00020000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE</Cpu>
|
||||
<FlashUtilSpec></FlashUtilSpec>
|
||||
|
@ -33,8 +33,8 @@
|
|||
<SLE66CMisc></SLE66CMisc>
|
||||
<SLE66AMisc></SLE66AMisc>
|
||||
<SLE66LinkerMisc></SLE66LinkerMisc>
|
||||
<SFDFile>$$Device:STM32F103RB$SVD\STM32F103xx.svd</SFDFile>
|
||||
<bCustSvd>0</bCustSvd>
|
||||
<SFDFile>C:\Users\noelj\AppData\Local\Arm\Packs\Keil\STM32F1xx_DFP\2.4.0\SVD\STM32F103xx.SFR</SFDFile>
|
||||
<bCustSvd>1</bCustSvd>
|
||||
<UseEnv>0</UseEnv>
|
||||
<BinPath></BinPath>
|
||||
<IncludePath></IncludePath>
|
||||
|
@ -186,6 +186,7 @@
|
|||
<RvdsVP>0</RvdsVP>
|
||||
<RvdsMve>0</RvdsMve>
|
||||
<RvdsCdeCp>0</RvdsCdeCp>
|
||||
<nBranchProt>0</nBranchProt>
|
||||
<hadIRAM2>0</hadIRAM2>
|
||||
<hadIROM2>0</hadIROM2>
|
||||
<StupSel>8</StupSel>
|
||||
|
@ -313,7 +314,7 @@
|
|||
</ArmAdsMisc>
|
||||
<Cads>
|
||||
<interw>1</interw>
|
||||
<Optim>1</Optim>
|
||||
<Optim>2</Optim>
|
||||
<oTime>0</oTime>
|
||||
<SplitLS>0</SplitLS>
|
||||
<OneElfS>1</OneElfS>
|
||||
|
@ -322,14 +323,14 @@
|
|||
<PlainCh>0</PlainCh>
|
||||
<Ropi>0</Ropi>
|
||||
<Rwpi>0</Rwpi>
|
||||
<wLevel>2</wLevel>
|
||||
<wLevel>3</wLevel>
|
||||
<uThumb>0</uThumb>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<uC99>0</uC99>
|
||||
<uGnu>0</uGnu>
|
||||
<useXO>0</useXO>
|
||||
<v6Lang>3</v6Lang>
|
||||
<v6LangP>3</v6LangP>
|
||||
<v6Lang>1</v6Lang>
|
||||
<v6LangP>5</v6LangP>
|
||||
<vShortEn>1</vShortEn>
|
||||
<vShortWch>1</vShortWch>
|
||||
<v6Lto>0</v6Lto>
|
||||
|
@ -339,7 +340,7 @@
|
|||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath>.\Includes;..\Drivers\Inc</IncludePath>
|
||||
<IncludePath>..\Drivers\Inc</IncludePath>
|
||||
</VariousControls>
|
||||
</Cads>
|
||||
<Aads>
|
||||
|
@ -598,6 +599,7 @@
|
|||
<RvdsVP>0</RvdsVP>
|
||||
<RvdsMve>0</RvdsMve>
|
||||
<RvdsCdeCp>0</RvdsCdeCp>
|
||||
<nBranchProt>0</nBranchProt>
|
||||
<hadIRAM2>0</hadIRAM2>
|
||||
<hadIROM2>0</hadIROM2>
|
||||
<StupSel>8</StupSel>
|
||||
|
@ -835,15 +837,15 @@
|
|||
<RTE>
|
||||
<apis/>
|
||||
<components>
|
||||
<component Cclass="CMSIS" Cgroup="CORE" Cvendor="ARM" Cversion="5.4.0" condition="ARMv6_7_8-M Device">
|
||||
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.7.0"/>
|
||||
<component Cclass="CMSIS" Cgroup="CORE" Cvendor="ARM" Cversion="5.6.0" condition="ARMv6_7_8-M Device">
|
||||
<package name="CMSIS" schemaVersion="1.7.7" url="http://www.keil.com/pack/" vendor="ARM" version="5.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="Réel"/>
|
||||
<targetInfo name="Simulé"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cclass="Device" Cgroup="Startup" Cvendor="Keil" Cversion="1.0.0" condition="STM32F1xx CMSIS">
|
||||
<package name="STM32F1xx_DFP" schemaVersion="1.4.0" url="http://www.keil.com/pack/" vendor="Keil" version="2.3.0"/>
|
||||
<package name="STM32F1xx_DFP" schemaVersion="1.7.2" url="http://www.keil.com/pack/" vendor="Keil" version="2.4.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="Réel"/>
|
||||
<targetInfo name="Simulé"/>
|
||||
|
@ -854,7 +856,7 @@
|
|||
<file attr="config" category="header" name="RTE_Driver\Config\RTE_Device.h" version="1.1.2">
|
||||
<instance index="0">RTE\Device\STM32F103RB\RTE_Device.h</instance>
|
||||
<component Cclass="Device" Cgroup="Startup" Cvendor="Keil" Cversion="1.0.0" condition="STM32F1xx CMSIS"/>
|
||||
<package name="STM32F1xx_DFP" schemaVersion="1.4.0" url="http://www.keil.com/pack/" vendor="Keil" version="2.3.0"/>
|
||||
<package name="STM32F1xx_DFP" schemaVersion="1.7.2" url="http://www.keil.com/pack/" vendor="Keil" version="2.4.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="Réel"/>
|
||||
<targetInfo name="Simulé"/>
|
||||
|
@ -863,7 +865,7 @@
|
|||
<file attr="config" category="source" condition="STM32F1xx MD ARMCC" name="Device\Source\ARM\startup_stm32f10x_md.s" version="1.0.0">
|
||||
<instance index="0">RTE\Device\STM32F103RB\startup_stm32f10x_md.s</instance>
|
||||
<component Cclass="Device" Cgroup="Startup" Cvendor="Keil" Cversion="1.0.0" condition="STM32F1xx CMSIS"/>
|
||||
<package name="STM32F1xx_DFP" schemaVersion="1.4.0" url="http://www.keil.com/pack/" vendor="Keil" version="2.3.0"/>
|
||||
<package name="STM32F1xx_DFP" schemaVersion="1.7.2" url="http://www.keil.com/pack/" vendor="Keil" version="2.4.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="Réel"/>
|
||||
<targetInfo name="Simulé"/>
|
||||
|
@ -872,7 +874,7 @@
|
|||
<file attr="config" category="source" name="Device\Source\system_stm32f10x.c" version="1.0.0">
|
||||
<instance index="0">RTE\Device\STM32F103RB\system_stm32f10x.c</instance>
|
||||
<component Cclass="Device" Cgroup="Startup" Cvendor="Keil" Cversion="1.0.0" condition="STM32F1xx CMSIS"/>
|
||||
<package name="STM32F1xx_DFP" schemaVersion="1.4.0" url="http://www.keil.com/pack/" vendor="Keil" version="2.3.0"/>
|
||||
<package name="STM32F1xx_DFP" schemaVersion="1.7.2" url="http://www.keil.com/pack/" vendor="Keil" version="2.4.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="Réel"/>
|
||||
<targetInfo name="Simulé"/>
|
||||
|
|
Loading…
Reference in a new issue