-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add drivers in one folder -fixes #35
- Loading branch information
1 parent
bd7817a
commit dfec29d
Showing
24 changed files
with
1,295 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/**********************************************************/ | ||
/* Author : Gehad Elkoumy */ | ||
/* Date : 30 NOV 2022 */ | ||
/* Version : V01 */ | ||
/**********************************************************/ | ||
|
||
#ifndef AFIO_CONFIG_H | ||
#define AFIO_CONFIG_H | ||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/**********************************************************/ | ||
/* Author : Gehad Elkoumy */ | ||
/* Date : 30 NOV 2022 */ | ||
/* Version : V01 */ | ||
/**********************************************************/ | ||
|
||
#ifndef AFIO_INTERFACE_H | ||
#define AFIO_INTERFACE_H | ||
|
||
void MAFIO_voidSetEXTIConfiguration(u8 Copy_u8Line ,u8 Copy_u8PortMap); | ||
|
||
/*portmap used as an interrupt*/ | ||
#define AFIOA 0b0000 | ||
#define AFIOB 0b0001 | ||
#define AFIOC 0b0010 | ||
|
||
/*lines are in EXTI driver*/ | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/**********************************************************/ | ||
/* Author : Gehad Elkoumy */ | ||
/* Date : 30 NOV 2022 */ | ||
/* Version : V01 */ | ||
/**********************************************************/ | ||
|
||
#ifndef AFIO_PRIVATE_H | ||
#define AFIO_PRIVATE_H | ||
|
||
|
||
typedef struct{ | ||
volatile u32 EVCR; | ||
volatile u32 MAPR; | ||
volatile u32 EXTICR[4]; | ||
volatile u32 MAPR2; | ||
|
||
}AFIO_t; | ||
|
||
|
||
#define AFIO ((volatile AFIO_t *) 0x40010000 ) | ||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/**********************************************************/ | ||
/* Author : Gehad Elkoumy */ | ||
/* Date : 30 NOV 2022 */ | ||
/* Version : V01 */ | ||
/**********************************************************/ | ||
#include "STD_TYPES.h" | ||
#include "BIT_MATH.h" | ||
|
||
#include "AFIO_interface.h" | ||
#include "AFIO_config.h" | ||
#include "AFIO_private.h" | ||
|
||
|
||
void MAFIO_voidSetEXTIConfiguration(u8 Copy_u8EXTILine ,u8 Copy_u8PortMap) | ||
{ | ||
u8 Local_u8RegIndex = 0 ; | ||
/* Assign to EXTICRX register */ | ||
if(Copy_u8EXTILine <= 3 ) | ||
{ | ||
Local_u8RegIndex = 0; | ||
} | ||
else if(Copy_u8EXTILine <= 7) | ||
{ | ||
Local_u8RegIndex = 1; | ||
|
||
/*bit0 to bit3 not 4 to 7*/ | ||
Copy_u8EXTILine -= 4; | ||
} | ||
else if(Copy_u8EXTILine <= 11) | ||
{ | ||
Local_u8RegIndex = 2; | ||
/*4bits from 0 to 3*/ | ||
Copy_u8EXTILine -= 8; | ||
|
||
} | ||
else if(Copy_u8EXTILine <= 15) | ||
{ | ||
Local_u8RegIndex = 3; | ||
/*4bits from 0 to 3*/ | ||
Copy_u8EXTILine -= 12; | ||
} | ||
|
||
/*reset first --> (avoiding overwrite)*/ | ||
AFIO->EXTICR[Local_u8RegIndex] &= ~((0b1111) << (Copy_u8EXTILine * 4)); | ||
|
||
/*set*/ | ||
AFIO->EXTICR[Local_u8RegIndex] |= ((Copy_u8PortMap) << (Copy_u8EXTILine * 4)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/**********************************************************/ | ||
/* Author : Gehad Elkoumy */ | ||
/* Date : 6 DEC 2022 */ | ||
/* Version : V01 */ | ||
/**********************************************************/ | ||
#ifndef EXTI_CONFIG_H | ||
#define EXTI_CONFIG_H | ||
|
||
|
||
/*options : from LINE0 to LINE15*/ | ||
#define EXTI_LINE LINE0 | ||
|
||
|
||
|
||
/*options : RISING | ||
FALLING | ||
ON_CHANGE */ | ||
#define EXTI_MODE FALLING | ||
|
||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/**********************************************************/ | ||
/* Author : Gehad Elkoumy */ | ||
/* Date : 6 DEC 2022 */ | ||
/* Version : V01 */ | ||
/**********************************************************/ | ||
#ifndef EXTI_INTERFACE_H | ||
#define EXTI_INTERFACE_H | ||
|
||
|
||
void MEXTI_voidInit(); | ||
void MEXTI_voidEnableEXTI(u8 Copy_u8EXTILine); | ||
void MEXTI_voidDisableEXTI(u8 Copy_u8EXTILine); | ||
void MEXTI_voidSoftwareTrigger(u8 Copy_u8EXTILine); | ||
void MEXTI_voidSetSignalLatch(u8 Copy_u8EXTILine , u8 Copy_u8EXTIMode); | ||
|
||
/*pointer to function*/ | ||
void EXTI_voidSetCallBack(void (*ptr) (void) , u8 Copy_u8EXTILine); | ||
|
||
|
||
#define LINE0 0 | ||
#define LINE1 1 | ||
#define LINE2 2 | ||
#define LINE3 3 | ||
#define LINE4 4 | ||
#define LINE5 5 | ||
#define LINE6 6 | ||
#define LINE7 7 | ||
#define LINE8 8 | ||
#define LINE9 9 | ||
#define LINE10 10 | ||
#define LINE11 11 | ||
#define LINE12 12 | ||
#define LINE13 13 | ||
#define LINE14 14 | ||
#define LINE15 15 | ||
|
||
|
||
|
||
#define RISING 0 | ||
#define FALLING 1 | ||
#define ON_CHANGE 2 /*any change (rising & falling)*/ | ||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/**********************************************************/ | ||
/* Author : Gehad Elkoumy */ | ||
/* Date : 6 DEC 2022 */ | ||
/* Version : V01 */ | ||
/**********************************************************/ | ||
#ifndef EXTI_PRIVATE_H | ||
#define EXTI_PRIVATE_H | ||
|
||
/*must be ordered*/ | ||
typedef struct{ | ||
volatile u32 IMR; | ||
volatile u32 EMR; | ||
volatile u32 RTSR; | ||
volatile u32 FTSR; | ||
volatile u32 SWIER; | ||
volatile u32 PR; | ||
|
||
}EXTI_t; | ||
|
||
/*without dereference as it act as pointer*/ | ||
#define EXTI ((volatile EXTI_t *) 0x40010400 ) | ||
|
||
static void (*EXTI_GlobalPtr[16]) (void) ; | ||
|
||
#endif |
Oops, something went wrong.