diff --git a/driver/adc.c b/driver/adc.c
index 366b286..0ddd5df 100644
--- a/driver/adc.c
+++ b/driver/adc.c
@@ -41,4 +41,4 @@ void ADC1_2_IRQHandler(void)
(*pFncADC) (); /* appel indirect de la fonction */
MyADC_Base_Start(ADC1);
ADC1->SR &= ~ADC_SR_EOC; //Prochaine lecture pouvant �tre effectu�e.
-}
\ No newline at end of file
+}
diff --git a/driver/timer.c b/driver/timer.c
index 768cc8b..c21b31f 100644
--- a/driver/timer.c
+++ b/driver/timer.c
@@ -189,4 +189,4 @@ void MyTimer_DutyCycle(TIM_TypeDef * Timer, char Channel, unsigned char DutyCycl
Timer->CCR4 = RC;
break;
}
-}
\ No newline at end of file
+}
diff --git a/driver/uart.c b/driver/uart.c
index 84df976..55222b5 100644
--- a/driver/uart.c
+++ b/driver/uart.c
@@ -2,30 +2,23 @@
#include "gpio.h"
//faire GPIO
-
char data1 = 0x00;
char data2 = 0x00;
char data3 = 0x00;
void MyUART_Init(MyUART_Struct_Typedef * UARTStructPtr){
- if (UARTStructPtr->UART == USART1)
- RCC->APB2ENR |= RCC_APB2ENR_USART1EN;
- if (UARTStructPtr->UART == USART2)
- RCC->APB2ENR |= RCC_APB1ENR_USART2EN;
- if (UARTStructPtr->UART == USART3)
- RCC->APB2ENR |= RCC_APB1ENR_USART3EN;
+ MyUART_setClockBit(UARTStructPtr->UART);
+ UARTStructPtr->UART->BRR = 72000000/(UARTStructPtr->BaudRate);
+ UARTStructPtr->UART->CR1 |= ((UARTStructPtr->Wlengh)<<12);
+ UARTStructPtr->UART->CR1 |= (0x1<<10);
- UARTStructPtr->UART->BRR = 72000000/(UARTStructPtr->BaudRate);
- UARTStructPtr->UART->CR1 |= ((UARTStructPtr->Wlengh)<<12);
- UARTStructPtr->UART->CR1 |= (0x1<<10);
-
if(UARTStructPtr->Wparity == parity_none)
UARTStructPtr->UART->CR1 &= ~(0x1<<10);
if(UARTStructPtr->Wparity == parity_odd)
UARTStructPtr->UART->CR1 |= (0x1<<9);
if(UARTStructPtr->Wparity == parity_even)
UARTStructPtr->UART->CR1 &= ~(0x1<<9);
-
+
if(UARTStructPtr->Wstop == stop1b)
UARTStructPtr->UART->CR2 &= ~(0x3<<12);
if(UARTStructPtr->Wstop == stop2b){
@@ -33,10 +26,32 @@ void MyUART_Init(MyUART_Struct_Typedef * UARTStructPtr){
UARTStructPtr->UART->CR2 |= (0x1<<13);
}
UARTStructPtr->UART->CR1 |= (USART_CR1_TE | USART_CR1_RE | USART_CR1_UE | USART_CR1_RXNEIE);
-
+
NVIC_EnableIRQ(USART1_IRQn);
}
+int MyUART_setClockBit(USART_TypeDef * UART)
+{
+ if (UART == USART1)
+ {
+ RCC->APB2ENR |= RCC_APB2ENR_USART1EN; //72MHz
+ return 0;
+ }
+ else if (UART == USART2)
+ {
+ RCC->APB1ENR |= RCC_APB1ENR_USART2EN; //36MHz
+ return 0;
+ }
+ else if (UART == USART3)
+ {
+ RCC->APB1ENR |= RCC_APB1ENR_USART3EN; //36MHz //Maybe return the clock base mhz ?
+ return 0;
+ }
+ else {
+ return 1;
+ }
+}
+
void USART1_IRQHandler(void)
{
// Check if receive data register not empty
diff --git a/driver/uart.h b/driver/uart.h
index 70aa2d7..0693b2c 100644
--- a/driver/uart.h
+++ b/driver/uart.h
@@ -8,9 +8,13 @@ typedef struct {
unsigned char Wlengh;
unsigned char Wparity;
unsigned char Wstop;
-
}MyUART_Struct_Typedef;
+typedef enum {
+ //DIV_Fraction ->
+ //1D4C
+}MyUART_BRR
+
#define parity_none 0x0
#define parity_even 0x1
#define parity_odd 0x2
@@ -20,8 +24,6 @@ typedef struct {
#define stop2b 0x2
void MyUART_Init(MyUART_Struct_Typedef * UARTStructPtr);
-void USART1_IRQHandler(void);
-void USART2_IRQHandler(void);
-void USART3_IRQHandler(void);
+int MyUART_setClockBit(USART_TypeDef * UART);
char MyUART_Read(MyUART_Struct_Typedef * UARTStructPtr);
-#endif
\ No newline at end of file
+#endif
diff --git a/implementation/remote.c b/implementation/remote.c
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/implementation/remote.c
@@ -0,0 +1 @@
+
diff --git a/implementation/remote.h b/implementation/remote.h
new file mode 100644
index 0000000..cfed997
--- /dev/null
+++ b/implementation/remote.h
@@ -0,0 +1,7 @@
+#ifndef REMOTE_H
+#define REMOTE_H
+#include "../driver/uart.h"
+
+//XBEE 9600 baud, zero parite, 1 bit de stop,
+
+#endif
diff --git a/keilproject/Source/Principale.c b/keilproject/Source/Principale.c
index e4d5a23..82be6d1 100644
--- a/keilproject/Source/Principale.c
+++ b/keilproject/Source/Principale.c
@@ -1,6 +1,7 @@
#include "stm32f10x.h"
#include "../../driver/MyI2C.h"
#include "../../driver/MySPI.h"
+#include "../../implementation/remote.h"
int main (void)
{
diff --git a/keilproject/voilier.uvoptx b/keilproject/voilier.uvoptx
index b667108..99771c9 100644
--- a/keilproject/voilier.uvoptx
+++ b/keilproject/voilier.uvoptx
@@ -203,6 +203,22 @@
+
+ 4
+ 0
+ 9
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ .\Source\Principale.c
+
+
+
@@ -510,6 +526,18 @@
0
0
+
+ 1
+ 2
+ 1
+ 0
+ 0
+ 0
+ ..\implementation\remote.c
+ remote.c
+ 0
+ 0
+
@@ -520,7 +548,7 @@
0
2
- 2
+ 3
4
0
0
@@ -530,6 +558,54 @@
0
0
+
+ 2
+ 4
+ 1
+ 0
+ 0
+ 0
+ ..\driver\adc.c
+ adc.c
+ 0
+ 0
+
+
+ 2
+ 5
+ 1
+ 0
+ 0
+ 0
+ ..\driver\gpio.c
+ gpio.c
+ 0
+ 0
+
+
+ 2
+ 6
+ 1
+ 0
+ 0
+ 0
+ ..\driver\timer.c
+ timer.c
+ 0
+ 0
+
+
+ 2
+ 7
+ 1
+ 0
+ 0
+ 0
+ ..\driver\uart.c
+ uart.c
+ 0
+ 0
+
diff --git a/keilproject/voilier.uvprojx b/keilproject/voilier.uvprojx
index cda4e65..5a8530a 100644
--- a/keilproject/voilier.uvprojx
+++ b/keilproject/voilier.uvprojx
@@ -388,6 +388,11 @@
1
.\Source\Principale.c
+
+ remote.c
+ 1
+ ..\implementation\remote.c
+
@@ -398,6 +403,26 @@
4
..\driver\Lib_Com_Periph_2022.lib
+
+ adc.c
+ 1
+ ..\driver\adc.c
+
+
+ gpio.c
+ 1
+ ..\driver\gpio.c
+
+
+ timer.c
+ 1
+ ..\driver\timer.c
+
+
+ uart.c
+ 1
+ ..\driver\uart.c
+
@@ -790,6 +815,11 @@
1
.\Source\Principale.c
+
+ remote.c
+ 1
+ ..\implementation\remote.c
+
@@ -800,6 +830,26 @@
4
..\driver\Lib_Com_Periph_2022.lib
+
+ adc.c
+ 1
+ ..\driver\adc.c
+
+
+ gpio.c
+ 1
+ ..\driver\gpio.c
+
+
+ timer.c
+ 1
+ ..\driver\timer.c
+
+
+ uart.c
+ 1
+ ..\driver\uart.c
+