voilier/projetLEDD/Application/principal.c
2025-12-03 08:19:23 +01:00

22 lines
490 B
C

#include "stm32f10x.h"
#include "gpio.h"
int main ( void )
{
RCC->APB2ENR |= (0x01 << 2) | (0x01 << 3) | (0x01 << 4) ;
GPIOC->CRH=GPIOC->CRH&~(0xF<<((9-8)*4));
GPIOC->CRH|=0x4<<((9-8)*4);//PC9 en floating input
GPIOC->CRH=GPIOC->CRH&~(0xF<<((8-8)*4));
GPIOC->CRH|=0x2<<((8-8)*4);//PC8 en pull-up 2MHz
while (1)
{
//GPIOC->ODR<<8 = GPIOC->IDR<<9;
//GPIOC->IDR<<9=(GPIOC->ODR<<8 & 0x1);
if (GPIOC->IDR&(0x1<<9==0x01)){
GPIOC->ODR|=0x01<<7;
}
}
}