mirror of
https://git.etud.insa-toulouse.fr/boujon/voilier-team-1.git
synced 2025-06-08 16:00:49 +02:00
découverte des bits à lire
This commit is contained in:
parent
d9a4ae852d
commit
9606282533
5 changed files with 22 additions and 64 deletions
|
@ -58,7 +58,7 @@ void MyUART_ActiveIT(USART_TypeDef * UART, uint8_t Prio)
|
||||||
uint32_t IRQNumber = MyUART_GetInterruptNum(UART);
|
uint32_t IRQNumber = MyUART_GetInterruptNum(UART);
|
||||||
UART->CR1 |= (USART_CR1_RXNEIE); //Interruption active pour la reception UNIQUEMENT
|
UART->CR1 |= (USART_CR1_RXNEIE); //Interruption active pour la reception UNIQUEMENT
|
||||||
NVIC->IP[IRQNumber] |= (Prio << 0x4); //Prio de l'interruption (p.197 manuel reference RM0008 pour ADC1_IRQn)
|
NVIC->IP[IRQNumber] |= (Prio << 0x4); //Prio de l'interruption (p.197 manuel reference RM0008 pour ADC1_IRQn)
|
||||||
NVIC->ISER[1] |= (0x1<<(IRQNumber-32)); //Active l'interruption au niveau NVIC (p.119 manuel programming pour ISER[0])
|
NVIC->ISER[1] |= (0x1<<(IRQNumber-32)); //Active l'interruption au niveau NVIC (p.119 manuel programming pour ISER[1])
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyUART_Init(MyUART_Struct_Typedef * UARTStructPtr){
|
void MyUART_Init(MyUART_Struct_Typedef * UARTStructPtr){
|
||||||
|
@ -88,7 +88,7 @@ void MyUART_InitGPIO(MyUART_Struct_Typedef * UARTStructPtr)
|
||||||
MyGPIO_Struct_TypeDef rxd,txd;
|
MyGPIO_Struct_TypeDef rxd,txd;
|
||||||
if(UARTStructPtr->UART == USART1)
|
if(UARTStructPtr->UART == USART1)
|
||||||
{
|
{
|
||||||
rxd = (MyGPIO_Struct_TypeDef){GPIOA,10,In_PullUp};
|
rxd = (MyGPIO_Struct_TypeDef){GPIOA,10,In_Floating};
|
||||||
txd = (MyGPIO_Struct_TypeDef){GPIOA,9,AltOut_Ppull};
|
txd = (MyGPIO_Struct_TypeDef){GPIOA,9,AltOut_Ppull};
|
||||||
}
|
}
|
||||||
else if(UARTStructPtr->UART == USART2) {
|
else if(UARTStructPtr->UART == USART2) {
|
||||||
|
|
|
@ -5,8 +5,12 @@ MyUART_Struct_Typedef uartCool = {USART1,9600,lengthBit8,parityNone,stopBit1};
|
||||||
|
|
||||||
void remote(uint16_t data)
|
void remote(uint16_t data)
|
||||||
{
|
{
|
||||||
//MyGPIO_Set(GPIOA,5);
|
MyUART_Send(&uartCool,data); //0x97 -> +100 (1001 0111?) 0x64 -> -100 (0110 0100)
|
||||||
MyUART_Send(&uartCool,data);
|
//0xFE -> 2 , 0x02 ->-2
|
||||||
|
if(data > 50)
|
||||||
|
{
|
||||||
|
MyGPIO_Set(GPIOA,5);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void initRemote(void)
|
void initRemote(void)
|
||||||
|
@ -16,3 +20,11 @@ void initRemote(void)
|
||||||
MyUART_Init_Periph(remote);
|
MyUART_Init_Periph(remote);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void testRemote(void)
|
||||||
|
{
|
||||||
|
MyUART_Send(&uartCool,'s');
|
||||||
|
MyUART_Send(&uartCool,'a');
|
||||||
|
MyUART_Send(&uartCool,'l');
|
||||||
|
MyUART_Send(&uartCool,'u');
|
||||||
|
MyUART_Send(&uartCool,'t');
|
||||||
|
}
|
||||||
|
|
|
@ -6,5 +6,6 @@
|
||||||
|
|
||||||
void remote(uint16_t data);
|
void remote(uint16_t data);
|
||||||
void initRemote(void);
|
void initRemote(void);
|
||||||
|
void testRemote(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -10,6 +10,7 @@ int main (void)
|
||||||
MyGPIO_Init(&led); //test des leds pour ignorer les contraintes liées aux différents ports
|
MyGPIO_Init(&led); //test des leds pour ignorer les contraintes liées aux différents ports
|
||||||
|
|
||||||
initRemote();
|
initRemote();
|
||||||
|
testRemote();
|
||||||
|
|
||||||
while(1){
|
while(1){
|
||||||
};
|
};
|
||||||
|
|
|
@ -361,7 +361,7 @@
|
||||||
<SetRegEntry>
|
<SetRegEntry>
|
||||||
<Number>0</Number>
|
<Number>0</Number>
|
||||||
<Key>ST-LINKIII-KEIL_SWO</Key>
|
<Key>ST-LINKIII-KEIL_SWO</Key>
|
||||||
<Name>-U066FFF504955857567155843 -O206 -SF10000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP (ARM Core") -D00(1BA01477) -L00(0) -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8000 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM) -WA0 -WE0 -WVCE4 -WS2710 -WM0 -WP2</Name>
|
<Name>-U066FFF504955857567155843 -O206 -SF10000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP (ARM Core") -D00(1BA01477) -L00(0) -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8000 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM)</Name>
|
||||||
</SetRegEntry>
|
</SetRegEntry>
|
||||||
<SetRegEntry>
|
<SetRegEntry>
|
||||||
<Number>0</Number>
|
<Number>0</Number>
|
||||||
|
@ -388,9 +388,9 @@
|
||||||
<Bp>
|
<Bp>
|
||||||
<Number>0</Number>
|
<Number>0</Number>
|
||||||
<Type>0</Type>
|
<Type>0</Type>
|
||||||
<LineNumber>31</LineNumber>
|
<LineNumber>15</LineNumber>
|
||||||
<EnabledFlag>1</EnabledFlag>
|
<EnabledFlag>1</EnabledFlag>
|
||||||
<Address>134219614</Address>
|
<Address>134219676</Address>
|
||||||
<ByteObject>0</ByteObject>
|
<ByteObject>0</ByteObject>
|
||||||
<HtxType>0</HtxType>
|
<HtxType>0</HtxType>
|
||||||
<ManyObjects>0</ManyObjects>
|
<ManyObjects>0</ManyObjects>
|
||||||
|
@ -399,55 +399,7 @@
|
||||||
<BreakIfRCount>1</BreakIfRCount>
|
<BreakIfRCount>1</BreakIfRCount>
|
||||||
<Filename>.\Source\Principale.c</Filename>
|
<Filename>.\Source\Principale.c</Filename>
|
||||||
<ExecCommand></ExecCommand>
|
<ExecCommand></ExecCommand>
|
||||||
<Expression>\\cool_reel\Source/Principale.c\31</Expression>
|
<Expression>\\cool_reel\Source/Principale.c\15</Expression>
|
||||||
</Bp>
|
|
||||||
<Bp>
|
|
||||||
<Number>1</Number>
|
|
||||||
<Type>0</Type>
|
|
||||||
<LineNumber>28</LineNumber>
|
|
||||||
<EnabledFlag>1</EnabledFlag>
|
|
||||||
<Address>134219606</Address>
|
|
||||||
<ByteObject>0</ByteObject>
|
|
||||||
<HtxType>0</HtxType>
|
|
||||||
<ManyObjects>0</ManyObjects>
|
|
||||||
<SizeOfObject>0</SizeOfObject>
|
|
||||||
<BreakByAccess>0</BreakByAccess>
|
|
||||||
<BreakIfRCount>1</BreakIfRCount>
|
|
||||||
<Filename>.\Source\Principale.c</Filename>
|
|
||||||
<ExecCommand></ExecCommand>
|
|
||||||
<Expression>\\cool_reel\Source/Principale.c\28</Expression>
|
|
||||||
</Bp>
|
|
||||||
<Bp>
|
|
||||||
<Number>2</Number>
|
|
||||||
<Type>0</Type>
|
|
||||||
<LineNumber>30</LineNumber>
|
|
||||||
<EnabledFlag>1</EnabledFlag>
|
|
||||||
<Address>0</Address>
|
|
||||||
<ByteObject>0</ByteObject>
|
|
||||||
<HtxType>0</HtxType>
|
|
||||||
<ManyObjects>0</ManyObjects>
|
|
||||||
<SizeOfObject>0</SizeOfObject>
|
|
||||||
<BreakByAccess>0</BreakByAccess>
|
|
||||||
<BreakIfRCount>0</BreakIfRCount>
|
|
||||||
<Filename>.\Source\Principale.c</Filename>
|
|
||||||
<ExecCommand></ExecCommand>
|
|
||||||
<Expression></Expression>
|
|
||||||
</Bp>
|
|
||||||
<Bp>
|
|
||||||
<Number>3</Number>
|
|
||||||
<Type>0</Type>
|
|
||||||
<LineNumber>14</LineNumber>
|
|
||||||
<EnabledFlag>1</EnabledFlag>
|
|
||||||
<Address>0</Address>
|
|
||||||
<ByteObject>0</ByteObject>
|
|
||||||
<HtxType>0</HtxType>
|
|
||||||
<ManyObjects>0</ManyObjects>
|
|
||||||
<SizeOfObject>0</SizeOfObject>
|
|
||||||
<BreakByAccess>0</BreakByAccess>
|
|
||||||
<BreakIfRCount>0</BreakIfRCount>
|
|
||||||
<Filename>.\Source\Principale.c</Filename>
|
|
||||||
<ExecCommand></ExecCommand>
|
|
||||||
<Expression></Expression>
|
|
||||||
</Bp>
|
</Bp>
|
||||||
</Breakpoint>
|
</Breakpoint>
|
||||||
<WatchWindow1>
|
<WatchWindow1>
|
||||||
|
@ -509,14 +461,6 @@
|
||||||
<Name>System Viewer\USART1</Name>
|
<Name>System Viewer\USART1</Name>
|
||||||
<WinId>35905</WinId>
|
<WinId>35905</WinId>
|
||||||
</Entry>
|
</Entry>
|
||||||
<Entry>
|
|
||||||
<Name>System Viewer\USART2</Name>
|
|
||||||
<WinId>35904</WinId>
|
|
||||||
</Entry>
|
|
||||||
<Entry>
|
|
||||||
<Name>System Viewer\USART3</Name>
|
|
||||||
<WinId>35903</WinId>
|
|
||||||
</Entry>
|
|
||||||
</SystemViewers>
|
</SystemViewers>
|
||||||
<DebugDescription>
|
<DebugDescription>
|
||||||
<Enable>1</Enable>
|
<Enable>1</Enable>
|
||||||
|
|
Loading…
Add table
Reference in a new issue