40 #define _________________________________________LOCAL_MACROS_SECTION_______________________________________________________________________ 42 #define PORT(Pins) oC_Pin_GetPort(Pins) 43 #define PORT_INDEX(Pins) oC_Channel_ToIndex(GPIO , PORT(Pins)) 44 #define PINS(Pins) oC_Pin_GetPinsInPort(Pins) 45 #define IsPoweredOn(Pins) oC_Machine_IsChannelPoweredOn(PORT(Pins)) 46 #define GPIOx_MODER(Pins) oC_Machine_Register(PORT(Pins),GPIOx_MODER) 47 #define GPIOx_OTYPER(Pins) oC_Machine_Register(PORT(Pins),GPIOx_OTYPER) 48 #define GPIOx_PUPDR(Pins) oC_Machine_Register(PORT(Pins),GPIOx_PUPDR) 49 #define GPIOx_IDR(Pins) oC_Machine_Register(PORT(Pins),GPIOx_IDR) 50 #define GPIOx_ODR(Pins) oC_Machine_Register(PORT(Pins),GPIOx_ODR) 51 #define GPIOx_OSPEEDR(Pins) oC_Machine_Register(PORT(Pins),GPIOx_OSPEEDR) 52 #define GPIOx_LCKR(Pins) oC_Machine_Register(PORT(Pins),GPIOx_LCKR) 53 #define GPIOx_AFRL(Pins) oC_Machine_Register(PORT(Pins),GPIOx_AFRL) 54 #define GPIOx_AFRH(Pins) oC_Machine_Register(PORT(Pins),GPIOx_AFRH) 55 #define SYSCFG_EXTICR1 oC_Register(SYSCFG , SYSCFG_EXTICR1) 56 #define SYSCFG_EXTICR2 oC_Register(SYSCFG , SYSCFG_EXTICR2) 57 #define SYSCFG_EXTICR3 oC_Register(SYSCFG , SYSCFG_EXTICR3) 58 #define SYSCFG_EXTICR4 oC_Register(SYSCFG , SYSCFG_EXTICR4) 59 #define EXTI_IMR oC_Register(EXTI , EXTI_IMR) 60 #define EXTI_EMR oC_Register(EXTI , EXTI_EMR) 61 #define EXTI_RTSR oC_Register(EXTI , EXTI_RTSR) 62 #define EXTI_FTSR oC_Register(EXTI , EXTI_FTSR) 63 #define EXTI_PR oC_Register(EXTI , EXTI_PR) 64 #define IsRam(Address) (oC_LSF_IsRamAddress(Address) || oC_LSF_IsExternalAddress(Address)) 65 #define IsRom(Address) oC_LSF_IsRomAddress(Address) 66 #define IsExtiUsed(ExtiLine) (ExtiUsedBits & (1<<ExtiLine)) 67 #define SetExtiUsed(ExtiLine) ExtiUsedBits |= (1<<ExtiLine) 68 #define SetExtiUnused(ExtiLine) ExtiUsedBits &= ~(1<<ExtiLine) 70 #undef _________________________________________LOCAL_MACROS_SECTION_______________________________________________________________________ 77 #define _________________________________________REDEFINITIONS_SECTION______________________________________________________________________ 79 oC_LLD_ConnectToMainDriver(GPIO,IsPortCorrect);
80 oC_LLD_ConnectToMainDriver(GPIO,IsPortIndexCorrect);
81 oC_LLD_ConnectToMainDriver(GPIO,GetPinsMaskOfPins);
82 oC_LLD_ConnectToMainDriver(GPIO,GetPortOfPins);
83 oC_LLD_ConnectToMainDriver(GPIO,PortToPortIndex);
84 oC_LLD_ConnectToMainDriver(GPIO,PortIndexToPort);
85 oC_LLD_ConnectToMainDriver(GPIO,IsPinDefined);
86 oC_LLD_ConnectToMainDriver(GPIO,ArePinsDefined);
87 oC_LLD_ConnectToMainDriver(GPIO,ArePinsCorrect);
88 oC_LLD_ConnectToMainDriver(GPIO,IsSinglePin);
89 oC_LLD_ConnectToMainDriver(GPIO,GetPinsFor);
90 oC_LLD_ConnectToMainDriver(GPIO,GetPortName);
91 oC_LLD_ConnectToMainDriver(GPIO,GetPinName);
92 oC_LLD_ConnectToMainDriver(GPIO,SetPower);
93 oC_LLD_ConnectToMainDriver(GPIO,ReadPower);
94 oC_LLD_ConnectToMainDriver(GPIO,CheckIsPinUsed);
95 oC_LLD_ConnectToMainDriver(GPIO,ArePinsUnused);
96 oC_LLD_ConnectToMainDriver(GPIO,
WriteData);
97 oC_LLD_ConnectToMainDriver(GPIO,
ReadData);
98 oC_LLD_ConnectToMainDriver(GPIO,ReadDataReference);
99 oC_LLD_ConnectToMainDriver(GPIO,GetHighStatePins);
100 oC_LLD_ConnectToMainDriver(GPIO,GetLowStatePins);
101 oC_LLD_ConnectToMainDriver(GPIO,IsPinsState);
102 oC_LLD_ConnectToMainDriver(GPIO,SetPinsState);
103 oC_LLD_ConnectToMainDriver(GPIO,TogglePinsState);
104 oC_LLD_ConnectToMainDriver(GPIO,GetPinName);
106 #undef _________________________________________REDEFINITIONS_SECTION______________________________________________________________________ 113 #define _________________________________________LOCAL_PROTOTYPES_SECTION___________________________________________________________________ 115 static void SetConfigurationBitsInRegister(
oC_Register_t * outRegister , oC_PinsInPort_t PinsInPort , uint8_t Value );
116 static uint8_t GetConfigurationBitsInRegister(
oC_Register_t Register , oC_PinsInPort_t PinsInPort );
117 static oC_ErrorCode_t ConnectPinsToExti ( oC_Pins_t Pins );
118 static oC_ErrorCode_t DisconnectPinsFromExti ( oC_Pins_t Pins );
119 static oC_Port_t GetPortOfExtiLine ( uint8_t ExtiLine );
120 static bool SetExtiLineInterruptState ( uint8_t ExtiLine ,
bool Enabled );
121 static bool SetInterruptsStateForPins ( oC_Pins_t Pins ,
bool Enabled );
123 #undef _________________________________________LOCAL_PROTOTYPES_SECTION___________________________________________________________________ 131 #define _________________________________________LOCAL_VARIABLES_SECTION____________________________________________________________________ 135 static uint16_t ExtiUsedBits = 0;
137 #undef _________________________________________LOCAL_VARIABLES_SECTION____________________________________________________________________ 145 #define _________________________________________INTERFACE_FUNCTIONS_SECTION_______________________________________________________________ 153 oC_ErrorCode_t oC_GPIO_LLD_TurnOnDriver(
void )
155 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
163 oC_GPIO_LLD_ForEachPort(port)
165 UsedPinsArray[PORT_INDEX(port)] = 0;
170 errorCode = oC_ErrorCode_None;
184 oC_ErrorCode_t oC_GPIO_LLD_TurnOffDriver(
void )
186 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
195 errorCode = oC_ErrorCode_None;
209 bool oC_GPIO_LLD_IsPortCorrect( oC_Port_t Port )
220 bool oC_GPIO_LLD_IsPortIndexCorrect( oC_PortIndex_t PortIndex )
231 oC_PinsMask_t oC_GPIO_LLD_GetPinsMaskOfPins( oC_Pins_t Pins )
242 oC_Port_t oC_GPIO_LLD_GetPortOfPins( oC_Pins_t Pins )
253 oC_PortIndex_t oC_GPIO_LLD_PortToPortIndex( oC_Port_t Port )
264 oC_Port_t oC_GPIO_LLD_PortIndexToPort( oC_PortIndex_t PortIndex )
275 bool oC_GPIO_LLD_IsPinDefined( oC_Pin_t Pin )
277 bool defined =
false;
279 oC_Pin_ForeachDefined(pin)
297 bool oC_GPIO_LLD_ArePinsDefined( oC_Pins_t Pins )
299 bool allDefined =
false;
300 oC_Port_t port = PORT(Pins);
301 oC_PinsInPort_t pins = PINS(Pins);
307 for(uint8_t bitIndex = 0; bitIndex < oC_PORT_WIDTH && allDefined; bitIndex++ )
309 if(pins & (1<<bitIndex))
311 allDefined = oC_GPIO_LLD_IsPinDefined(oC_Pins_ToSinglePin(Pins,bitIndex));
325 bool oC_GPIO_LLD_ArePinsCorrect( oC_Pins_t Pins )
336 bool oC_GPIO_LLD_IsSinglePin( oC_Pins_t Pins )
338 bool isSinglePin =
false;
339 oC_PinsInPort_t pins = PINS(Pins);
341 for(uint8_t bitIndex = 0; bitIndex < oC_PORT_WIDTH ; bitIndex++)
343 if(pins & (1<<bitIndex))
345 isSinglePin = oC_Pins_ToSinglePin(Pins,bitIndex) == Pins;
359 oC_Pins_t oC_GPIO_LLD_GetPinsFor( oC_Port_t Port , oC_PinsMask_t Pins )
361 return oC_Pin_Make(Port,Pins);
370 const char * oC_GPIO_LLD_GetPortName( oC_Port_t Port )
381 const char * oC_GPIO_LLD_GetPinName( oC_Pin_t Pin )
383 const char * name =
"<INCORRECT_PIN>";
384 oC_Port_t port = PORT(Pin);
388 name =
"<UNDEFINED_PIN>";
390 oC_Pin_ForeachDefined(pinData)
392 if(pinData->Pin == Pin)
394 name = pinData->Name;
409 oC_ErrorCode_t oC_GPIO_LLD_SetDriverInterruptHandler( oC_GPIO_LLD_Interrupt_t Handler )
411 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
416 ErrorCondition( IsRam(Handler) || IsRom(Handler), oC_ErrorCode_WrongEventHandlerAddress) &&
421 errorCode = oC_ErrorCode_None;
434 oC_ErrorCode_t oC_GPIO_LLD_BeginConfiguration( oC_Pins_t Pins )
436 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
441 ErrorCondition( oC_GPIO_LLD_ArePinsCorrect(Pins) , oC_ErrorCode_WrongChannel) &&
442 ErrorCondition( PINS(Pins) != 0 , oC_ErrorCode_PinNotDefined) &&
447 errorCode = oC_ErrorCode_None;
460 oC_ErrorCode_t oC_GPIO_LLD_FinishConfiguration( oC_Pins_t Pins )
462 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
467 ErrorCondition( oC_GPIO_LLD_ArePinsCorrect(Pins), oC_ErrorCode_WrongChannel) &&
468 ErrorCondition( PINS(Pins) != 0, oC_ErrorCode_PinNotDefined)
471 errorCode = oC_ErrorCode_None;
484 oC_ErrorCode_t oC_GPIO_LLD_SetPower( oC_Pins_t Pins ,
oC_Power_t Power )
486 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
491 ErrorCondition( oC_GPIO_LLD_ArePinsCorrect(Pins), oC_ErrorCode_WrongChannel) &&
492 ErrorCondition( PINS(Pins) != 0, oC_ErrorCode_PinNotDefined) &&
498 errorCode = oC_ErrorCode_None;
502 errorCode = oC_ErrorCode_CannotEnableChannel;
516 oC_ErrorCode_t oC_GPIO_LLD_ReadPower( oC_Pins_t Pins ,
oC_Power_t * outPower )
518 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
523 ErrorCondition( oC_GPIO_LLD_ArePinsCorrect(Pins), oC_ErrorCode_WrongChannel) &&
524 ErrorCondition( PINS(Pins) != 0, oC_ErrorCode_PinNotDefined) &&
525 ErrorCondition( IsRam(outPower), oC_ErrorCode_OutputAddressNotInRAM)
533 errorCode = oC_ErrorCode_None;
537 *outPower = powerState;
538 errorCode = oC_ErrorCode_None;
542 errorCode = oC_ErrorCode_MachineCanBeDamaged;
556 bool oC_GPIO_LLD_IsPinProtected( oC_Pins_t Pins )
558 bool pinProtected =
false;
562 pinProtected = GPIOx_LCKR(Pins)->Value & PINS(Pins);
574 oC_ErrorCode_t oC_GPIO_LLD_UnlockProtection( oC_Pins_t Pins , oC_GPIO_LLD_Protection_t Protection )
576 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
581 ErrorCondition( oC_GPIO_LLD_ArePinsCorrect(Pins), oC_ErrorCode_WrongChannel) &&
582 ErrorCondition( PINS(Pins) != 0, oC_ErrorCode_PinNotDefined) &&
583 ErrorCondition( IsPoweredOn(Pins), oC_ErrorCode_ChannelNotPoweredOn) &&
584 ErrorCondition( Protection == oC_GPIO_LLD_Protection_UnlockProtectedPins, oC_ErrorCode_PinNeedUnlock)
588 volatile uint32_t oldValue = GPIOx_LCKR(Pins)->Value;
589 GPIOx_LCKR(Pins)->Value = (1<<16) | ~PINS(Pins) | oldValue;
590 GPIOx_LCKR(Pins)->Value = (0<<16) | ~PINS(Pins) | oldValue;
591 GPIOx_LCKR(Pins)->Value = (1<<16) | ~PINS(Pins) | oldValue;
593 volatile uint32_t Unused(value) = GPIOx_LCKR(Pins)->Value;
595 errorCode = oC_ErrorCode_None;
610 oC_ErrorCode_t oC_GPIO_LLD_LockProtection( oC_Pins_t Pins )
612 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
617 ErrorCondition( oC_GPIO_LLD_ArePinsCorrect(Pins), oC_ErrorCode_WrongChannel) &&
618 ErrorCondition( PINS(Pins) != 0, oC_ErrorCode_PinNotDefined) &&
619 ErrorCondition( IsPoweredOn(Pins), oC_ErrorCode_ChannelNotPoweredOn)
623 volatile uint32_t oldValue = GPIOx_LCKR(Pins)->Value;
624 GPIOx_LCKR(Pins)->Value = (1<<16) | PINS(Pins) | oldValue;
625 GPIOx_LCKR(Pins)->Value = (0<<16) | PINS(Pins) | oldValue;
626 GPIOx_LCKR(Pins)->Value = (1<<16) | PINS(Pins) | oldValue;
628 volatile uint32_t Unused(value) = GPIOx_LCKR(Pins)->Value;
630 errorCode = oC_ErrorCode_None;
645 oC_ErrorCode_t oC_GPIO_LLD_CheckIsPinUnlocked( oC_Pins_t Pins ,
bool * outPinUnlocked )
647 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
652 ErrorCondition( oC_GPIO_LLD_ArePinsCorrect(Pins), oC_ErrorCode_WrongChannel) &&
653 ErrorCondition( PINS(Pins) != 0, oC_ErrorCode_PinNotDefined) &&
654 ErrorCondition( IsPoweredOn(Pins), oC_ErrorCode_ChannelNotPoweredOn) &&
655 ErrorCondition( IsRam(outPinUnlocked), oC_ErrorCode_OutputAddressNotInRAM)
659 *outPinUnlocked = !(GPIOx_LCKR(Pins)->Value & PINS(Pins));
660 errorCode = oC_ErrorCode_None;
674 oC_ErrorCode_t oC_GPIO_LLD_SetSpeed( oC_Pins_t Pins , oC_GPIO_LLD_Speed_t Speed )
676 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
681 ErrorCondition( oC_GPIO_LLD_ArePinsCorrect(Pins), oC_ErrorCode_WrongChannel) &&
682 ErrorCondition( PINS(Pins) != 0, oC_ErrorCode_PinNotDefined) &&
683 ErrorCondition( IsPoweredOn(Pins), oC_ErrorCode_ChannelNotPoweredOn)
688 errorCode = oC_ErrorCode_None;
692 case oC_GPIO_LLD_Speed_Minimum:
693 SetConfigurationBitsInRegister(&GPIOx_OSPEEDR(Pins)->Value , PINS(Pins) , 0);
695 case oC_GPIO_LLD_Speed_Medium:
696 case oC_GPIO_LLD_Speed_Default:
697 SetConfigurationBitsInRegister(&GPIOx_OSPEEDR(Pins)->Value , PINS(Pins) , 0x1);
699 case oC_GPIO_LLD_Speed_Maximum:
700 SetConfigurationBitsInRegister(&GPIOx_OSPEEDR(Pins)->Value , PINS(Pins) , 0x3);
703 errorCode = oC_ErrorCode_SpeedNotCorrect;
720 oC_ErrorCode_t oC_GPIO_LLD_ReadSpeed( oC_Pins_t Pins , oC_GPIO_LLD_Speed_t * outSpeed )
722 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
727 ErrorCondition( oC_GPIO_LLD_ArePinsCorrect(Pins), oC_ErrorCode_WrongChannel) &&
728 ErrorCondition( PINS(Pins) != 0, oC_ErrorCode_PinNotDefined) &&
729 ErrorCondition( IsPoweredOn(Pins), oC_ErrorCode_ChannelNotPoweredOn) &&
730 ErrorCondition( IsRam(outSpeed), oC_ErrorCode_OutputAddressNotInRAM)
735 uint8_t value = GetConfigurationBitsInRegister(GPIOx_OSPEEDR(Pins)->Value , PINS(Pins));
736 errorCode = oC_ErrorCode_None;
740 case 0: *outSpeed = oC_GPIO_LLD_Speed_Minimum;
break;
741 case 1: *outSpeed = oC_GPIO_LLD_Speed_Medium;
break;
742 case 2: *outSpeed = oC_GPIO_LLD_Speed_Medium;
break;
743 case 3: *outSpeed = oC_GPIO_LLD_Speed_Maximum;
break;
745 errorCode = oC_ErrorCode_MachineCanBeDamaged;
762 oC_ErrorCode_t oC_GPIO_LLD_SetCurrent( oC_Pins_t Pins , oC_GPIO_LLD_Current_t Current )
764 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
769 ErrorCondition( oC_GPIO_LLD_ArePinsCorrect(Pins), oC_ErrorCode_WrongChannel) &&
770 ErrorCondition( PINS(Pins) != 0, oC_ErrorCode_PinNotDefined) &&
771 ErrorCondition( IsPoweredOn(Pins), oC_ErrorCode_ChannelNotPoweredOn)
774 errorCode = oC_ErrorCode_None;
787 oC_ErrorCode_t oC_GPIO_LLD_ReadCurrent( oC_Pins_t Pins , oC_GPIO_LLD_Current_t * outCurrent )
789 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
794 ErrorCondition( oC_GPIO_LLD_ArePinsCorrect(Pins), oC_ErrorCode_WrongChannel) &&
795 ErrorCondition( PINS(Pins) != 0, oC_ErrorCode_PinNotDefined) &&
796 ErrorCondition( IsPoweredOn(Pins), oC_ErrorCode_ChannelNotPoweredOn) &&
797 ErrorCondition( IsRam(outCurrent), oC_ErrorCode_OutputAddressNotInRAM)
800 *outCurrent = oC_GPIO_LLD_Current_Maximum;
801 errorCode = oC_ErrorCode_None;
814 oC_ErrorCode_t oC_GPIO_LLD_SetMode( oC_Pins_t Pins , oC_GPIO_LLD_Mode_t Mode )
816 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
821 ErrorCondition( oC_GPIO_LLD_ArePinsCorrect(Pins), oC_ErrorCode_WrongChannel) &&
822 ErrorCondition( PINS(Pins) != 0, oC_ErrorCode_PinNotDefined) &&
823 ErrorCondition( IsPoweredOn(Pins), oC_ErrorCode_ChannelNotPoweredOn)
828 errorCode = oC_ErrorCode_None;
832 case oC_GPIO_LLD_Mode_Input:
833 SetConfigurationBitsInRegister(&GPIOx_MODER(Pins)->Value , PINS(Pins) , 0);
835 case oC_GPIO_LLD_Mode_Output:
836 case oC_GPIO_LLD_Mode_Default:
837 SetConfigurationBitsInRegister(&GPIOx_MODER(Pins)->Value , PINS(Pins) , 0x1);
839 case oC_GPIO_LLD_Mode_Alternate:
840 SetConfigurationBitsInRegister(&GPIOx_MODER(Pins)->Value , PINS(Pins) , 0x2);
843 errorCode = oC_ErrorCode_ModeNotCorrect;
860 oC_ErrorCode_t oC_GPIO_LLD_ReadMode( oC_Pins_t Pins , oC_GPIO_LLD_Mode_t * outMode )
862 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
867 ErrorCondition( oC_GPIO_LLD_ArePinsCorrect(Pins), oC_ErrorCode_WrongChannel) &&
868 ErrorCondition( PINS(Pins) != 0, oC_ErrorCode_PinNotDefined) &&
869 ErrorCondition( IsPoweredOn(Pins), oC_ErrorCode_ChannelNotPoweredOn) &&
870 ErrorCondition( IsRam(outMode), oC_ErrorCode_OutputAddressNotInRAM)
875 uint8_t value = GetConfigurationBitsInRegister(GPIOx_MODER(Pins)->Value , PINS(Pins));
876 errorCode = oC_ErrorCode_None;
880 case 0: *outMode = oC_GPIO_LLD_Mode_Input;
break;
881 case 1: *outMode = oC_GPIO_LLD_Mode_Output;
break;
882 case 2: *outMode = oC_GPIO_LLD_Mode_Alternate;
break;
883 case 3: *outMode = oC_GPIO_LLD_Mode_Alternate;
break;
885 errorCode = oC_ErrorCode_MachineCanBeDamaged;
902 oC_ErrorCode_t oC_GPIO_LLD_SetPull( oC_Pins_t Pins , oC_GPIO_LLD_Pull_t Pull )
904 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
909 ErrorCondition( oC_GPIO_LLD_ArePinsCorrect(Pins), oC_ErrorCode_WrongChannel) &&
910 ErrorCondition( PINS(Pins) != 0, oC_ErrorCode_PinNotDefined) &&
911 ErrorCondition( IsPoweredOn(Pins), oC_ErrorCode_ChannelNotPoweredOn)
916 errorCode = oC_ErrorCode_None;
920 case oC_GPIO_LLD_Pull_Down:
921 SetConfigurationBitsInRegister(&GPIOx_PUPDR(Pins)->Value , PINS(Pins) , 0x2);
923 case oC_GPIO_LLD_Pull_Up:
924 SetConfigurationBitsInRegister(&GPIOx_PUPDR(Pins)->Value , PINS(Pins) , 0x1);
926 case oC_GPIO_LLD_Mode_Default:
927 SetConfigurationBitsInRegister(&GPIOx_PUPDR(Pins)->Value , PINS(Pins) , 0);
930 errorCode = oC_ErrorCode_PullNotCorrect;
947 oC_ErrorCode_t oC_GPIO_LLD_ReadPull( oC_Pins_t Pins , oC_GPIO_LLD_Pull_t * outPull )
949 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
954 ErrorCondition( oC_GPIO_LLD_ArePinsCorrect(Pins), oC_ErrorCode_WrongChannel) &&
955 ErrorCondition( PINS(Pins) != 0, oC_ErrorCode_PinNotDefined) &&
956 ErrorCondition( IsPoweredOn(Pins), oC_ErrorCode_ChannelNotPoweredOn) &&
957 ErrorCondition( IsRam(outPull), oC_ErrorCode_OutputAddressNotInRAM)
962 uint8_t value = GetConfigurationBitsInRegister(GPIOx_PUPDR(Pins)->Value , PINS(Pins));
963 errorCode = oC_ErrorCode_None;
967 case 0: *outPull = oC_GPIO_LLD_Pull_Default;
break;
968 case 1: *outPull = oC_GPIO_LLD_Pull_Up;
break;
969 case 2: *outPull = oC_GPIO_LLD_Pull_Down;
break;
971 errorCode = oC_ErrorCode_MachineCanBeDamaged;
988 oC_ErrorCode_t oC_GPIO_LLD_SetOutputCircuit( oC_Pins_t Pins , oC_GPIO_LLD_OutputCircuit_t OutputCircuit )
990 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
995 ErrorCondition( oC_GPIO_LLD_ArePinsCorrect(Pins), oC_ErrorCode_WrongChannel) &&
996 ErrorCondition( PINS(Pins) != 0, oC_ErrorCode_PinNotDefined) &&
997 ErrorCondition( IsPoweredOn(Pins), oC_ErrorCode_ChannelNotPoweredOn)
1002 if(OutputCircuit == oC_GPIO_LLD_OutputCircuit_OpenDrain)
1004 GPIOx_OTYPER(Pins)->Value |= PINS(Pins);
1005 errorCode = oC_ErrorCode_None;
1007 else if (OutputCircuit == oC_GPIO_LLD_OutputCircuit_PushPull || OutputCircuit == oC_GPIO_LLD_OutputCircuit_Default)
1009 GPIOx_OTYPER(Pins)->Value &= ~(PINS(Pins));
1010 errorCode = oC_ErrorCode_None;
1014 errorCode = oC_ErrorCode_OutputCircuitNotCorrect;
1030 oC_ErrorCode_t oC_GPIO_LLD_ReadOutputCircuit( oC_Pins_t Pins , oC_GPIO_LLD_OutputCircuit_t * outOutputCircuit )
1032 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
1037 ErrorCondition( oC_GPIO_LLD_ArePinsCorrect(Pins), oC_ErrorCode_WrongChannel) &&
1038 ErrorCondition( PINS(Pins) != 0, oC_ErrorCode_PinNotDefined) &&
1039 ErrorCondition( IsPoweredOn(Pins), oC_ErrorCode_ChannelNotPoweredOn) &&
1040 ErrorCondition( IsRam(outOutputCircuit), oC_ErrorCode_OutputAddressNotInRAM)
1045 oC_PinsInPort_t pinsInPort = PINS(Pins);
1046 uint32_t value = GPIOx_OTYPER(Pins)->Value & pinsInPort;
1048 if(value == pinsInPort)
1050 errorCode = oC_ErrorCode_None;
1051 *outOutputCircuit = oC_GPIO_LLD_OutputCircuit_OpenDrain;
1055 errorCode = oC_ErrorCode_None;
1056 *outOutputCircuit = oC_GPIO_LLD_OutputCircuit_PushPull;
1060 errorCode = oC_ErrorCode_NotAllPinsInTheSameState;
1076 oC_ErrorCode_t oC_GPIO_LLD_SetInterruptTrigger( oC_Pins_t Pins , oC_GPIO_LLD_IntTrigger_t InterruptTrigger )
1078 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
1083 ErrorCondition( oC_GPIO_LLD_ArePinsCorrect(Pins), oC_ErrorCode_WrongChannel) &&
1084 ErrorCondition( PINS(Pins) != 0, oC_ErrorCode_PinNotDefined) &&
1085 ErrorCondition( IsPoweredOn(Pins), oC_ErrorCode_ChannelNotPoweredOn)
1088 if(InterruptTrigger == oC_GPIO_LLD_IntTrigger_Off)
1090 if(ErrorCondition(SetInterruptsStateForPins(Pins,
false) , oC_ErrorCode_CannotDisableInterrupt))
1092 errorCode = DisconnectPinsFromExti(Pins);
1095 else if(oC_AssignErrorCode(&errorCode , ConnectPinsToExti(Pins)))
1097 oC_PinsInPort_t pinsInPort = oC_Pin_GetPinsInPort(Pins);
1099 if(InterruptTrigger & oC_GPIO_LLD_IntTrigger_FallingEdge)
1101 EXTI_IMR->Value |= ((uint32_t)pinsInPort);
1102 EXTI_FTSR->Value |= ((uint32_t)pinsInPort);
1104 if(ErrorCondition(SetInterruptsStateForPins(Pins,
true) , oC_ErrorCode_CannotEnableInterrupt))
1106 errorCode = oC_ErrorCode_None;
1109 if(InterruptTrigger & oC_GPIO_LLD_IntTrigger_RisingEdge)
1111 EXTI_IMR->Value |= ((uint32_t)pinsInPort);
1112 EXTI_RTSR->Value |= ((uint32_t)pinsInPort);
1114 if(ErrorCondition(SetInterruptsStateForPins(Pins,
true) , oC_ErrorCode_CannotEnableInterrupt))
1116 errorCode = oC_ErrorCode_None;
1120 if(InterruptTrigger & oC_GPIO_LLD_IntTrigger_HighLevel)
1122 errorCode = oC_ErrorCode_NotSupportedOnTargetMachine;
1125 if(InterruptTrigger & oC_GPIO_LLD_IntTrigger_LowLevel)
1127 errorCode = oC_ErrorCode_NotSupportedOnTargetMachine;
1143 oC_ErrorCode_t oC_GPIO_LLD_ReadInterruptTrigger( oC_Pins_t Pins , oC_GPIO_LLD_IntTrigger_t * outInterruptTrigger )
1145 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
1151 ErrorCondition( oC_GPIO_LLD_ArePinsCorrect(Pins), oC_ErrorCode_WrongChannel) &&
1152 ErrorCondition( PINS(Pins) != 0, oC_ErrorCode_PinNotDefined) &&
1153 ErrorCondition( IsPoweredOn(Pins), oC_ErrorCode_ChannelNotPoweredOn) &&
1154 ErrorCondition( IsRam(outInterruptTrigger), oC_ErrorCode_OutputAddressNotInRAM)
1157 errorCode = oC_ErrorCode_NotImplemented;
1171 oC_ErrorCode_t oC_GPIO_LLD_SetPinsUsed( oC_Pins_t Pins )
1173 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
1179 ErrorCondition( oC_GPIO_LLD_ArePinsCorrect(Pins), oC_ErrorCode_WrongChannel ) &&
1180 ErrorCondition( PINS(Pins) != 0, oC_ErrorCode_PinNotDefined )
1184 errorCode = oC_ErrorCode_None;
1198 oC_ErrorCode_t oC_GPIO_LLD_SetPinsUnused( oC_Pins_t Pins )
1200 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
1206 ErrorCondition( oC_GPIO_LLD_ArePinsCorrect(Pins), oC_ErrorCode_WrongChannel) &&
1207 ErrorCondition( PINS(Pins) != 0, oC_ErrorCode_PinNotDefined)
1211 DisconnectPinsFromExti(Pins);
1213 errorCode = oC_ErrorCode_None;
1227 oC_ErrorCode_t oC_GPIO_LLD_CheckIsPinUsed( oC_Pins_t Pins ,
bool * outPinUsed )
1229 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
1235 ErrorCondition( oC_GPIO_LLD_ArePinsCorrect(Pins), oC_ErrorCode_WrongChannel) &&
1236 ErrorCondition( PINS(Pins) != 0, oC_ErrorCode_PinNotDefined) &&
1237 ErrorCondition( oC_GPIO_LLD_IsSinglePin(Pins), oC_ErrorCode_NotSinglePin) &&
1238 ErrorCondition( IsRam(outPinUsed), oC_ErrorCode_OutputAddressNotInRAM)
1244 errorCode = oC_ErrorCode_None;
1248 *outPinUsed =
false;
1249 errorCode = oC_ErrorCode_None;
1253 errorCode = oC_ErrorCode_NotAllPinsInTheSameState;
1268 oC_ErrorCode_t oC_GPIO_LLD_ArePinsUnused( oC_Pins_t Pins ,
bool * outPinsUnused )
1270 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
1276 ErrorCondition( oC_GPIO_LLD_ArePinsCorrect(Pins), oC_ErrorCode_WrongChannel) &&
1277 ErrorCondition( PINS(Pins) != 0, oC_ErrorCode_PinNotDefined) &&
1278 ErrorCondition( IsRam(outPinsUnused), oC_ErrorCode_OutputAddressNotInRAM)
1283 *outPinsUnused =
false;
1284 errorCode = oC_ErrorCode_None;
1288 *outPinsUnused =
true;
1289 errorCode = oC_ErrorCode_None;
1293 errorCode = oC_ErrorCode_NotAllPinsInTheSameState;
1308 oC_ErrorCode_t oC_GPIO_LLD_WriteData( oC_Pins_t Pins , oC_PinsMask_t Data )
1310 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
1316 ErrorCondition( oC_GPIO_LLD_ArePinsCorrect(Pins), oC_ErrorCode_WrongChannel) &&
1317 ErrorCondition( IsPoweredOn(Pins), oC_ErrorCode_ChannelNotPoweredOn) &&
1318 ErrorCondition( PINS(Pins) != 0, oC_ErrorCode_PinNotDefined)
1321 oC_PinsInPort_t pinsInPort = PINS(Pins);
1322 GPIOx_ODR(Pins)->Value = (GPIOx_ODR(Pins)->Value & ~pinsInPort) | (GPIOx_ODR(Pins)->Value & pinsInPort & Data);
1323 errorCode = oC_ErrorCode_None;
1337 oC_ErrorCode_t oC_GPIO_LLD_ReadData( oC_Pins_t Pins , oC_PinsMask_t * outData )
1339 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
1345 ErrorCondition( oC_GPIO_LLD_ArePinsCorrect(Pins), oC_ErrorCode_WrongChannel) &&
1346 ErrorCondition( IsPoweredOn(Pins), oC_ErrorCode_ChannelNotPoweredOn) &&
1347 ErrorCondition( PINS(Pins) != 0, oC_ErrorCode_PinNotDefined) &&
1348 ErrorCondition( IsRam(outData), oC_ErrorCode_OutputAddressNotInRAM)
1351 *outData = GPIOx_IDR(Pins)->Value & PINS(Pins);
1352 errorCode= oC_ErrorCode_None;
1366 oC_ErrorCode_t oC_GPIO_LLD_ReadDataReference( oC_Pins_t Pins , oC_UInt_t ** outDataReference )
1368 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
1374 ErrorCondition( oC_GPIO_LLD_ArePinsCorrect(Pins), oC_ErrorCode_WrongChannel) &&
1375 ErrorCondition( IsPoweredOn(Pins), oC_ErrorCode_ChannelNotPoweredOn) &&
1376 ErrorCondition( PINS(Pins) != 0, oC_ErrorCode_PinNotDefined) &&
1377 ErrorCondition( IsRam(outDataReference), oC_ErrorCode_OutputAddressNotInRAM)
1380 *outDataReference = (oC_UInt_t*)&GPIOx_IDR(Pins)->Value;
1381 errorCode = oC_ErrorCode_None;
1396 oC_Pins_t oC_GPIO_LLD_GetHighStatePins( oC_Pins_t Pins )
1398 return oC_Pin_Make(PORT(Pins),(GPIOx_IDR(Pins)->Value & PINS(Pins)));
1407 oC_Pins_t oC_GPIO_LLD_GetLowStatePins( oC_Pins_t Pins )
1409 return oC_Pin_Make(PORT(Pins),(~GPIOx_IDR(Pins)->Value & PINS(Pins)));
1418 bool oC_GPIO_LLD_IsPinsState( oC_Pins_t Pins , oC_GPIO_LLD_PinsState_t ExpectedPinsState )
1429 void oC_GPIO_LLD_SetPinsState( oC_Pins_t Pins , oC_GPIO_LLD_PinsState_t PinsState )
1440 void oC_GPIO_LLD_TogglePinsState( oC_Pins_t Pins )
1442 GPIOx_ODR(Pins)->Value = (GPIOx_ODR(Pins)->Value & (~PINS(Pins))) | ((GPIOx_ODR(Pins)->Value ^ PINS(Pins)) & PINS(Pins));
1446 #undef _________________________________________INTERFACE_FUNCTIONS_SECTION_______________________________________________________________ 1453 #define _________________________________________MSLLD_INTERFACE_FUNCTIONS_SECTION__________________________________________________________ 1461 oC_ErrorCode_t oC_GPIO_MSLLD_SetAlternateNumber( oC_Pin_t Pin , oC_PinAlternateNumber_t Function )
1463 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
1468 ErrorCondition(oC_GPIO_LLD_IsSinglePin(Pin) , oC_ErrorCode_NotSinglePin) &&
1469 ErrorCondition(oC_GPIO_LLD_IsPinDefined(Pin) , oC_ErrorCode_PinNotDefined) &&
1470 ErrorCondition( IsPoweredOn(Pin), oC_ErrorCode_ChannelNotPoweredOn) &&
1471 ErrorCondition(Function <= oC_PinAlternateNumberMask , oC_ErrorCode_ValueTooBig)
1474 oC_PinsInPort_t pinsInPort = oC_Pin_GetPinsInPort(Pin);
1476 oC_Register_t * regPointer = (bitIndex < 8) ? &GPIOx_AFRL(Pin)->Value : &GPIOx_AFRH(Pin)->Value;
1478 bitIndex = (bitIndex >= 8) ? bitIndex - 8 : bitIndex;
1481 oC_Bits_SetValueU32((uint32_t*)regPointer , Function , bitIndex * 4 , (bitIndex * 4) + 3);
1484 errorCode = oC_ErrorCode_None;
1497 oC_ErrorCode_t oC_GPIO_MSLLD_ConnectPin( oC_Pin_t Pin , oC_PinAlternateNumber_t Function )
1499 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
1505 ErrorCondition(oC_GPIO_LLD_IsSinglePin(Pin) , oC_ErrorCode_NotSinglePin) &&
1506 ErrorCondition(oC_GPIO_LLD_IsPinDefined(Pin) , oC_ErrorCode_PinNotDefined) &&
1507 ErrorCondition(Function <= oC_PinAlternateNumberMask , oC_ErrorCode_ValueTooBig)
1512 oC_AssignErrorCode(&errorCode , oC_GPIO_LLD_BeginConfiguration(Pin)) &&
1513 oC_AssignErrorCode(&errorCode , oC_GPIO_LLD_SetMode(Pin , oC_GPIO_LLD_Mode_Alternate)) &&
1514 oC_AssignErrorCode(&errorCode , oC_GPIO_LLD_SetSpeed(Pin , oC_GPIO_LLD_Speed_Maximum)) &&
1515 oC_AssignErrorCode(&errorCode , oC_GPIO_MSLLD_SetAlternateNumber(Pin , Function )) &&
1516 oC_AssignErrorCode(&errorCode , oC_GPIO_LLD_FinishConfiguration(Pin))
1519 errorCode = oC_ErrorCode_None;
1535 oC_ErrorCode_t oC_GPIO_MSLLD_DisconnectPin( oC_Pin_t Pin , oC_PinAlternateNumber_t Function )
1537 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
1542 ErrorCondition(oC_GPIO_LLD_IsSinglePin(Pin) , oC_ErrorCode_NotSinglePin) &&
1543 ErrorCondition(oC_GPIO_LLD_IsPinDefined(Pin) , oC_ErrorCode_PinNotDefined) &&
1544 ErrorCondition(Function <= oC_PinAlternateNumberMask , oC_ErrorCode_ValueTooBig)
1549 oC_AssignErrorCode(&errorCode , oC_GPIO_LLD_BeginConfiguration(Pin)) &&
1550 oC_AssignErrorCode(&errorCode , oC_GPIO_LLD_SetMode(Pin , oC_GPIO_LLD_Mode_Default)) &&
1551 oC_AssignErrorCode(&errorCode , oC_GPIO_MSLLD_SetAlternateNumber(Pin , 0)) &&
1552 oC_AssignErrorCode(&errorCode , oC_GPIO_LLD_FinishConfiguration(Pin))
1555 errorCode = oC_ErrorCode_None;
1570 oC_ErrorCode_t oC_GPIO_MSLLD_FindModulePin( oC_Pin_t Pin ,
oC_Channel_t Channel , oC_PinFunction_t PinFunction , oC_ModulePinIndex_t * outModulePinIndex )
1572 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
1577 ErrorCondition(oC_GPIO_LLD_IsSinglePin(Pin) , oC_ErrorCode_NotSinglePin ) &&
1578 ErrorCondition(oC_GPIO_LLD_IsPinDefined(Pin) , oC_ErrorCode_PinNotDefined ) &&
1579 ErrorCondition(IsRam(outModulePinIndex) , oC_ErrorCode_OutputAddressNotInRAM )
1582 errorCode = oC_ErrorCode_NoneOfModulePinAssigned;
1584 oC_ModulePin_ForeachDefined(pinDefinition)
1586 if(pinDefinition->Pin == Pin && pinDefinition->PinFunction == PinFunction && pinDefinition->Channel == Channel)
1588 *outModulePinIndex = pinDefinition->ModulePinIndex;
1589 errorCode = oC_ErrorCode_None;
1599 #undef _________________________________________MSLLD_INTERFACE_FUNCTIONS_SECTION__________________________________________________________ 1606 #define _________________________________________LOCAL_FUNCTIONS_SECTION____________________________________________________________________ 1622 static void SetConfigurationBitsInRegister(
oC_Register_t * outRegister , oC_PinsInPort_t PinsInPort , uint8_t Value )
1624 const uint8_t fieldWidth = 2;
1626 for(uint8_t bitIndex = 0; bitIndex < oC_PORT_WIDTH ; bitIndex++ )
1628 if(PinsInPort & (1<<bitIndex))
1630 oC_Bits_SetValueU32((uint32_t*)outRegister,Value,bitIndex*fieldWidth,(bitIndex+1)*fieldWidth-1);
1652 static uint8_t GetConfigurationBitsInRegister(
oC_Register_t Register , oC_PinsInPort_t PinsInPort )
1655 const uint8_t fieldWidth = 2;
1657 for(uint8_t bitIndex = 0; bitIndex < oC_PORT_WIDTH ; bitIndex++ )
1659 if(PinsInPort & (1<<bitIndex))
1661 value =
oC_Bits_GetValueU32((uint32_t)Register,bitIndex*fieldWidth,(bitIndex+1)*fieldWidth-1);
1674 static oC_ErrorCode_t ConnectPinsToExti( oC_Pins_t Pins )
1676 oC_ErrorCode_t errorCode = oC_ErrorCode_None;
1677 oC_PinsInPort_t pinsInPort = oC_Pin_GetPinsInPort(Pins);
1681 for(uint8_t bitIndex = 0; bitIndex < oC_PORT_WIDTH ; bitIndex++ )
1683 if(pinsInPort & (1<<bitIndex))
1685 if(ErrorCondition(!IsExtiUsed(bitIndex) , oC_ErrorCode_ExtiLineIsUsed))
1687 SetExtiUsed(bitIndex);
1693 else if(bitIndex <= 7)
1697 else if(bitIndex <= 11)
1718 static oC_ErrorCode_t DisconnectPinsFromExti( oC_Pins_t Pins )
1720 oC_ErrorCode_t errorCode = oC_ErrorCode_None;
1721 oC_PinsInPort_t pinsInPort = oC_Pin_GetPinsInPort(Pins);
1723 for(uint8_t bitIndex = 0; bitIndex < oC_PORT_WIDTH ; bitIndex++ )
1725 if(pinsInPort & (1<<bitIndex))
1727 uint8_t startBit = 0;
1733 startBit = bitIndex * 4;
1734 endBit = bitIndex * 4 + 3;
1735 SYSCFG_EXTICR = &SYSCFG_EXTICR1->Value;
1737 else if(bitIndex <= 7)
1739 startBit = (bitIndex - 4) * 4;
1740 endBit = (bitIndex - 4) * 4 + 3;
1741 SYSCFG_EXTICR = &SYSCFG_EXTICR2->Value;
1743 else if(bitIndex <= 11)
1745 startBit = (bitIndex - 8) * 4;
1746 endBit = (bitIndex - 8) * 4 + 3;
1747 SYSCFG_EXTICR = &SYSCFG_EXTICR3->Value;
1751 startBit = (bitIndex - 12) * 4;
1752 endBit = (bitIndex - 12) * 4 + 3;
1753 SYSCFG_EXTICR = &SYSCFG_EXTICR4->Value;
1760 SetExtiUnused(bitIndex);
1775 static oC_Port_t GetPortOfExtiLine( uint8_t ExtiLine )
1777 uint8_t startBit = 0;
1783 startBit = ExtiLine * 4;
1784 endBit = ExtiLine * 4 + 3;
1785 SYSCFG_EXTICR = &SYSCFG_EXTICR1->Value;
1787 else if(ExtiLine <= 7)
1789 startBit = (ExtiLine - 4) * 4;
1790 endBit = (ExtiLine - 4) * 4 + 3;
1791 SYSCFG_EXTICR = &SYSCFG_EXTICR2->Value;
1793 else if(ExtiLine <= 11)
1795 startBit = (ExtiLine - 8) * 4;
1796 endBit = (ExtiLine - 8) * 4 + 3;
1797 SYSCFG_EXTICR = &SYSCFG_EXTICR3->Value;
1801 startBit = (ExtiLine - 12) * 4;
1802 endBit = (ExtiLine - 12) * 4 + 3;
1803 SYSCFG_EXTICR = &SYSCFG_EXTICR4->Value;
1816 static bool SetExtiLineInterruptState( uint8_t ExtiLine ,
bool Enabled )
1829 EXTI10_15EXTI_IRQn ,
1830 EXTI10_15EXTI_IRQn ,
1831 EXTI10_15EXTI_IRQn ,
1832 EXTI10_15EXTI_IRQn ,
1833 EXTI10_15EXTI_IRQn ,
1847 static bool SetInterruptsStateForPins( oC_Pins_t Pins ,
bool Enabled )
1849 oC_PinsInPort_t pinsInPort = oC_Pin_GetPinsInPort(Pins);
1850 oC_Port_t port = oC_Pin_GetPort(Pins);
1851 bool allEnabled =
true;
1853 for(uint8_t bitIndex = 0; bitIndex < oC_PORT_WIDTH ; bitIndex++ )
1855 if(pinsInPort & (1<<bitIndex))
1857 oC_Port_t extiPort = GetPortOfExtiLine(bitIndex);
1859 if(port == extiPort)
1861 allEnabled = allEnabled && SetExtiLineInterruptState(bitIndex , Enabled);
1874 #undef _________________________________________LOCAL_FUNCTIONS_SECTION____________________________________________________________________ 1882 #define _________________________________________INTERRUPTS_SECTION________________________________________________________________________ 1891 oC_Port_t port = GetPortOfExtiLine(0);
1898 EXTI_PR->Value |= (1<<0);
1908 oC_Port_t port = GetPortOfExtiLine(1);
1915 EXTI_PR->Value |= (1<<1);
1925 oC_Port_t port = GetPortOfExtiLine(2);
1932 EXTI_PR->Value |= (1<<2);
1942 oC_Port_t port = GetPortOfExtiLine(3);
1949 EXTI_PR->Value |= (1<<3);
1959 oC_Port_t port = GetPortOfExtiLine(4);
1966 EXTI_PR->Value |= (1<<4);
1978 for(uint8_t extiLine = 5; extiLine < 10 ; extiLine++)
1980 oC_Port_t port = GetPortOfExtiLine(extiLine);
2003 for(uint8_t extiLine = 10; extiLine < 16 ; extiLine++)
2005 oC_Port_t port = GetPortOfExtiLine(extiLine);
2018 #undef _________________________________________INTERRUPTS_SECTION________________________________________________________________________ #define oC_InterruptHandler(BASE_NAME, TYPE_NAME)
Define handler for interrupt.
The file with interface for LLD layer.
static bool oC_Bits_AreBitsSetU16(uint16_t BitMask, uint16_t BitsToCheck)
checks if all bits in field are set
#define oC_ARRAY_SIZE(ARRAY)
returns size of static array
static uint16_t oC_Bits_SetBitsU16(uint16_t *outVariable, uint16_t Mask)
static bool oC_Bits_AreBitsClearU16(uint16_t BitMask, uint16_t BitsToCheck)
checks if all bits in field are clear
Something power is not handled.
#define oC_Bits_Mask_U32(FROM, TO)
volatile oC_UInt_t oC_Register_t
type for storing registers
static uint32_t oC_Bits_SetValueU32(uint32_t *outVariable, uint32_t Value, uint8_t StartBitNr, uint8_t EndBitNr)
static uint32_t oC_Bits_GetValueU32(uint32_t Variable, uint8_t StartBitNr, uint8_t EndBitNr)
The file with interface for LSF module.
#define oC_Channel_GetName(Channel)
returns name of channel
The file with LLD interface for the MEM driver.
The file with LLD interface for the GPIO driver.
bool oC_MCS_EnableInterrupt(IRQn_Type InterruptNumber)
enables interrupt with specified number
The file with interface for the module library.
static bool oC_Module_IsTurnedOn(oC_Module_t Module)
checks if the module is turned on
Something is powered off.
static oC_ErrorCode_t ReadData(oC_FMC_Context_t Context, char *outData)
Reads one byte from the configured buffer.
oC_Channel_t
stores machine channel
static int8_t oC_Bits_GetBitNumberU32(uint32_t BitMask)
#define oC_Channel_IsCorrect(MODULE_NAME, Channel)
checks if channel is correct
#define oC_Channel_FromIndex(MODULE_NAME, ChannelIndex)
returns channel according to index in module
#define oC_ModuleChannel_NumberOfElements(MODULE_NAME)
Number of elements in module channel.
static void oC_Module_TurnOn(oC_Module_t Module)
sets module as turned on
Contains machine core specific functions.
The file with functions for the bits operation.
IRQn_Type
type for the CMSIS library, that contains definitions of interrupts
static void oC_MCS_EnterCriticalSection(void)
Enters to critical section.
static bool oC_Bits_IsBitSetU32(uint32_t BitMask, uint8_t BitIndex)
checks if bit is set
static oC_Power_t oC_Machine_GetPowerStateForChannel(oC_Channel_t Channel)
returns power state for channel
static uint16_t oC_Bits_ClearBitsU16(uint16_t *outVariable, uint16_t Mask)
static oC_ErrorCode_t WriteData(oC_FMC_Context_t Context, char Data)
Writes one byte to the configured buffer.
static bool oC_Module_TurnOffVerification(oC_ErrorCode_t *outErrorCode, oC_Module_t Module)
verify if module is turned off
static bool oC_MCS_ExitCriticalSection(void)
Exits from critical section.
static bool oC_Module_TurnOnVerification(oC_ErrorCode_t *outErrorCode, oC_Module_t Module)
verify if module is turned on
#define oC_Channel_ToIndex(MODULE_NAME, Channel)
returns index in module according to channel
static void InterruptHandler(oC_ETH_LLD_InterruptSource_t Source)
handler for interrupts
bool oC_MCS_DisableInterrupt(IRQn_Type InterruptNumber)
disables interrupt with specified number
static bool oC_Machine_SetPowerStateForChannel(oC_Channel_t Channel, oC_Power_t Power)
configures power state for machine channel
oC_Power_t
stores registers power state
#define NULL
pointer to a zero
static void oC_Module_TurnOff(oC_Module_t Module)
sets module as turned off