Téléverser les fichiers vers "CantoOrvikPilotes/Source"
This commit is contained in:
parent
5a7f6e10e6
commit
4d895d45b6
1 changed files with 14 additions and 1 deletions
|
|
@ -14,7 +14,20 @@ void SetBroche(uint32_t GPIO, int Broche){
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureGPIO(uint32_t GPIO, int Broche, int IO, char Mode){
|
void ConfigureGPIO(uint32_t GPIO, int Broche, int IO, char Mode){
|
||||||
RCC->APB2ENR |= RCC_APB2ENR_IOPAEN; // Clock GPIOA enable
|
//Start clock
|
||||||
|
if(GPIO == GPIOA){
|
||||||
|
RCC -> APB2ENR |= RCC_APB2ENR_IOPAEN;
|
||||||
|
}
|
||||||
|
else if(GPIO == GPIOB){
|
||||||
|
RCC -> APB2ENR |= RCC_APB2ENR_IOPBEN;
|
||||||
|
}
|
||||||
|
else if(GPIO == GPIOC){
|
||||||
|
RCC -> APB2ENR |= RCC_APB2ENR_IOPCEN;
|
||||||
|
}
|
||||||
|
else if(GPIO == GPIOD){
|
||||||
|
RCC -> APB2ENR |= RCC_APB2ENR_IOPDEN;
|
||||||
|
}
|
||||||
|
|
||||||
if (Broche < 8) {
|
if (Broche < 8) {
|
||||||
GPIO -> CRL &= ~(0x1 << Broche *4) & ~(0x1 << Broche *4 +1) & ~(0x1 << Broche *4 + 2) & ~(0x1 << Broche *4 + 3); // Clean bits
|
GPIO -> CRL &= ~(0x1 << Broche *4) & ~(0x1 << Broche *4 +1) & ~(0x1 << Broche *4 + 2) & ~(0x1 << Broche *4 + 3); // Clean bits
|
||||||
if (IO == 0){ //Input
|
if (IO == 0){ //Input
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue