diff --git a/ProjetsKEIL/Drivers/Source/Principale.c b/ProjetsKEIL/Drivers/Source/Principale.c
index b0c32bb..60e40ca 100644
--- a/ProjetsKEIL/Drivers/Source/Principale.c
+++ b/ProjetsKEIL/Drivers/Source/Principale.c
@@ -3,11 +3,16 @@
int main ( void )
{
- int returnValue=0;
- MyGPIO_Struct_TypeDef gpioA_test = {GPIOB,8,In_PullDown};
- MyGPIO_Init(&gpioA_test);
+ int returnValue;
+ MyGPIO_Struct_TypeDef gpioB8_test = {GPIOB,8,In_PullDown};
+ MyGPIO_Struct_TypeDef gpioB4_test = {GPIOB,4,Out_PullUp};
+ MyGPIO_Init(&gpioB8_test);
returnValue = MyGPIO_Read(GPIOB,8);
- returnValue = returnValue;
+ MyGPIO_Init(&gpioB4_test);
+ MyGPIO_Set(GPIOB,4);
+ MyGPIO_Toggle(GPIOB,4);
+ MyGPIO_Toggle(GPIOB,4);
+ MyGPIO_Reset(GPIOB,4);
do{
}while(1) ;
diff --git a/ProjetsKEIL/Drivers/gpiodriver.c b/ProjetsKEIL/Drivers/gpiodriver.c
index a7a19ae..49b8011 100644
--- a/ProjetsKEIL/Drivers/gpiodriver.c
+++ b/ProjetsKEIL/Drivers/gpiodriver.c
@@ -5,7 +5,7 @@ void MyGPIO_Init(MyGPIO_Struct_TypeDef * GPIOStructPtr)
uint8_t voyons = GPIOStructPtr->GPIO_Pin;
RCC->APB2ENR |= GPIO2Int(GPIOStructPtr->GPIO);
//We get the pointer of the CRH/CRL depending on the IO_Pin number
- volatile uint32_t * CRAny = GPIOStructPtr->GPIO_Pin > 0x08 ? &(GPIOStructPtr->GPIO->CRH):&(GPIOStructPtr->GPIO->CRL);
+ volatile uint32_t * CRAny = GPIOStructPtr->GPIO_Pin >= 0x08 ? &(GPIOStructPtr->GPIO->CRH):&(GPIOStructPtr->GPIO->CRL);
//setup high or low
*CRAny &= ~(0xF << (GPIOStructPtr->GPIO_Pin%8)*4); //reset
//for input pull or push
@@ -30,17 +30,22 @@ int MyGPIO_Read(GPIO_TypeDef * GPIO, uint8_t GPIO_Pin)
void MyGPIO_Set(GPIO_TypeDef * GPIO, uint8_t GPIO_Pin)
{
-
+ GPIO->BSRR = (1 << GPIO_Pin); //BSX set register
}
void MyGPIO_Reset(GPIO_TypeDef * GPIO, uint8_t GPIO_Pin)
{
-
+ GPIO->BSRR = (1 << (GPIO_Pin+0x16)); //BRX = BSX+16 reset register
}
void MyGPIO_Toggle(GPIO_TypeDef * GPIO, uint8_t GPIO_Pin)
{
-
+ if((GPIO->ODR = GPIO->ODR & (1 << GPIO_Pin)) > 0)
+ {
+ GPIO->BSRR = (1 << (GPIO_Pin+0x16)); //reset
+ } else {
+ GPIO->BSRR = (1 << GPIO_Pin); //set
+ }
}
int GPIO2Int(GPIO_TypeDef * GPIOX)
diff --git a/ProjetsKEIL/Drivers/gpiodriver.uvoptx b/ProjetsKEIL/Drivers/gpiodriver.uvoptx
index bd062ca..73aca3c 100644
--- a/ProjetsKEIL/Drivers/gpiodriver.uvoptx
+++ b/ProjetsKEIL/Drivers/gpiodriver.uvoptx
@@ -75,7 +75,7 @@
1
0
- 0
+ 1
18
@@ -125,7 +125,7 @@
0
DLGDARM
- (1010=-1,-1,-1,-1,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=1499,115,1920,542,1)(121=-1,-1,-1,-1,0)(122=875,109,1296,536,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=-1,-1,-1,-1,0)(132=-1,-1,-1,-1,0)(133=-1,-1,-1,-1,0)(160=-1,-1,-1,-1,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=-1,-1,-1,-1,0)(151=-1,-1,-1,-1,0)
+ (1010=-1,-1,-1,-1,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=1468,53,1889,480,1)(121=1469,437,1890,864,1)(122=875,109,1296,536,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=-1,-1,-1,-1,0)(132=-1,-1,-1,-1,0)(133=-1,-1,-1,-1,0)(160=-1,-1,-1,-1,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=-1,-1,-1,-1,0)(151=-1,-1,-1,-1,0)
0
@@ -142,9 +142,9 @@
0
0
- 10
+ 15
1
- 134218742
+ 134218832
0
0
0
@@ -153,14 +153,14 @@
1
.\Source\Principale.c
- \\cool_Simule\Source/Principale.c\10
+ \\cool_Simule\Source/Principale.c\15
1
0
- 9
+ 13
1
- 134218734
+ 134218816
0
0
0
@@ -169,14 +169,14 @@
1
.\Source\Principale.c
- \\cool_Simule\Source/Principale.c\9
+ \\cool_Simule\Source/Principale.c\13
2
0
- 6
+ 14
1
- 134218718
+ 134218824
0
0
0
@@ -185,39 +185,23 @@
1
.\Source\Principale.c
- \\cool_Simule\Source/Principale.c\6
+ \\cool_Simule\Source/Principale.c\14
3
0
- 22
+ 12
1
- 134218326
+ 134218808
0
0
0
0
0
1
- .\gpiodriver.c
+ .\Source\Principale.c
- \\cool_Simule\gpiodriver.c\22
-
-
- 4
- 0
- 4
- 1
- 134218164
- 0
- 0
- 0
- 0
- 0
- 1
- .\gpiodriver.c
-
- \\cool_Simule\gpiodriver.c\4
+ \\cool_Simule\Source/Principale.c\12
@@ -279,6 +263,10 @@
System Viewer\GPIOA
35905
+
+ System Viewer\GPIOB
+ 35904
+
1
@@ -344,7 +332,7 @@
1
0
- 1
+ 0
18
@@ -422,13 +410,51 @@
UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128 -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM))
-
+
+
+ 0
+ 0
+ 6
+ 1
+ 134218782
+ 0
+ 0
+ 0
+ 0
+ 0
+ 1
+ .\Source\Principale.c
+
+ \\cool_reel\Source/Principale.c\6
+
+
+ 1
+ 0
+ 10
+ 1
+ 134218808
+ 0
+ 0
+ 0
+ 0
+ 0
+ 1
+ .\Source\Principale.c
+
+ \\cool_reel\Source/Principale.c\10
+
+
0
1
quelquechose
+
+ 1
+ 1
+ returnValue
+
0
@@ -472,6 +498,12 @@
+
+
+ System Viewer\GPIOB
+ 35905
+
+
1
0