Added MyGPIO_Read function

This commit is contained in:
Yohan Boujon 2023-03-20 15:01:54 +01:00
parent 8bb9290fa5
commit bfa10cb61f
3 changed files with 65 additions and 41 deletions

View file

@ -3,8 +3,11 @@
int main ( void )
{
MyGPIO_Struct_TypeDef gpioA_test = {GPIOA,13,In_PullUp};
int returnValue=0;
MyGPIO_Struct_TypeDef gpioA_test = {GPIOB,8,In_PullDown};
MyGPIO_Init(&gpioA_test);
returnValue = MyGPIO_Read(GPIOB,8);
returnValue = returnValue;
do{
}while(1) ;

View file

@ -25,7 +25,7 @@ void MyGPIO_Init(MyGPIO_Struct_TypeDef * GPIOStructPtr)
int MyGPIO_Read(GPIO_TypeDef * GPIO, uint8_t GPIO_Pin)
{
return 0;
return (GPIO->IDR & (0x1 << GPIO_Pin)) > 0;
}
void MyGPIO_Set(GPIO_TypeDef * GPIO, uint8_t GPIO_Pin)

View file

@ -75,7 +75,7 @@
<OPTFL>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>1</IsCurrentTarget>
<IsCurrentTarget>0</IsCurrentTarget>
</OPTFL>
<CpuCode>18</CpuCode>
<DebugOpt>
@ -125,7 +125,7 @@
<SetRegEntry>
<Number>0</Number>
<Key>DLGDARM</Key>
<Name>(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=1508,115,1929,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)</Name>
<Name>(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)</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
@ -142,9 +142,57 @@
<Bp>
<Number>0</Number>
<Type>0</Type>
<LineNumber>23</LineNumber>
<LineNumber>10</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134218316</Address>
<Address>134218742</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_Simule\Source/Principale.c\10</Expression>
</Bp>
<Bp>
<Number>1</Number>
<Type>0</Type>
<LineNumber>9</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134218734</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_Simule\Source/Principale.c\9</Expression>
</Bp>
<Bp>
<Number>2</Number>
<Type>0</Type>
<LineNumber>6</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134218718</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_Simule\Source/Principale.c\6</Expression>
</Bp>
<Bp>
<Number>3</Number>
<Type>0</Type>
<LineNumber>22</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134218326</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
@ -153,10 +201,10 @@
<BreakIfRCount>1</BreakIfRCount>
<Filename>.\gpiodriver.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\cool_Simule\gpiodriver.c\23</Expression>
<Expression>\\cool_Simule\gpiodriver.c\22</Expression>
</Bp>
<Bp>
<Number>1</Number>
<Number>4</Number>
<Type>0</Type>
<LineNumber>4</LineNumber>
<EnabledFlag>1</EnabledFlag>
@ -171,38 +219,6 @@
<ExecCommand></ExecCommand>
<Expression>\\cool_Simule\gpiodriver.c\4</Expression>
</Bp>
<Bp>
<Number>2</Number>
<Type>0</Type>
<LineNumber>11</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134218228</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>.\gpiodriver.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\cool_Simule\gpiodriver.c\11</Expression>
</Bp>
<Bp>
<Number>3</Number>
<Type>0</Type>
<LineNumber>22</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>.\gpiodriver.c</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
</Breakpoint>
<WatchWindow1>
<Ww>
@ -210,6 +226,11 @@
<WinNumber>1</WinNumber>
<ItemText>voyons</ItemText>
</Ww>
<Ww>
<count>1</count>
<WinNumber>1</WinNumber>
<ItemText>returnValue</ItemText>
</Ww>
</WatchWindow1>
<Tracepoint>
<THDelay>0</THDelay>
@ -323,7 +344,7 @@
<OPTFL>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>0</IsCurrentTarget>
<IsCurrentTarget>1</IsCurrentTarget>
</OPTFL>
<CpuCode>18</CpuCode>
<DebugOpt>