-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
252 additions
and
31 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
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
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 @@ | ||
#include "systick.h" | ||
#include "tm4c123gh6pm.h" | ||
#include "std_types.h" | ||
|
||
void systick_init(void){ | ||
NVIC_ST_CTRL_R &= ~NVIC_ST_CTRL_ENABLE; | ||
NVIC_ST_RELOAD_R = NVIC_ST_RELOAD_M; | ||
NVIC_ST_CURRENT_R = NVIC_ST_CURRENT_S; | ||
NVIC_ST_CTRL_R |= (NVIC_ST_CTRL_CLK_SRC | NVIC_ST_CTRL_ENABLE); | ||
|
||
} | ||
|
||
void systick_wait1ms(void){ | ||
NVIC_ST_RELOAD_R = 16000 - 1; | ||
NVIC_ST_CURRENT_R = 0; | ||
while((NVIC_ST_CTRL_R&NVIC_ST_CTRL_COUNT) != NVIC_ST_CTRL_COUNT); | ||
} | ||
|
||
void delay(uint16_t i){ | ||
for(uint16_t j=0; j<i; j++){ | ||
systick_wait1ms(); | ||
} | ||
} |
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,10 @@ | ||
#ifndef __SYSTICK_H__ | ||
#define __SYSTICK_H__ | ||
|
||
void systick_init(void); | ||
|
||
void systick_wait1ms(void); | ||
|
||
void delay(uint16_t); | ||
|
||
#endif // __SYSTICK_H__ |
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
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 |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
|
||
uint8_t UART0_Read (void); | ||
|
||
|
||
void UART0_Write(uint8_t data); | ||
|
||
|
||
#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,26 @@ | ||
#include "adc.h" | ||
|
||
|
||
void ADC0_SS3_Init (void) | ||
{ | ||
SYSCTL_RCGCADC_R |= (1<<0); //enable ADC0 clock | ||
ADC0_ACTSS_R &= ~(1<<SS_num); //disable sample sequncer during configuration | ||
ADC0_EMUX_R = (ADC0_EMUX_R& ~(0xF<<SS_num*4)) | (trigger_select<<SS_num*4) ; //choosing the triggering method | ||
ADC0_SSMUX3_R = 0x0; //input from channel 0 i.e PE3 | ||
ADC0_SSCTL3_R |= ( (ADC0_SSCTL3_TS0<<3) | (ADC0_SSCTL3_IE0<<2) | (ADC0_SSCTL3_END0<<1)); //configuring sample sequncer 3 control port | ||
if(ADC0_SSCTL3_IE0 == 0x1) | ||
{ | ||
ADC0_IM_R |= (1<<3); | ||
NVIC_EN0_R |= (1<<17); | ||
} | ||
ADC0_ACTSS_R |= (1<<SS_num); //enable sample sequncer during configuration | ||
} | ||
void ADC_Init_Potentiometer (void) | ||
{ | ||
ADC0_SS3_Init (); | ||
Port_AnalogOrDigital (PORTE, 0X08, 0); | ||
//Port_AlternateFunction (PORTE,0X08,1, uint32_t pctl_mask); | ||
GPIO_PORTE_AFSEL_R|=0x08; | ||
|
||
|
||
} |
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,20 @@ | ||
|
||
#ifndef ADC_H_ | ||
#define ADC_H_ | ||
|
||
#include "port.h" | ||
#include "DIO.h" | ||
#include "tm4c123gh6pm.h" | ||
#include "std_types.h" | ||
|
||
#define trigger_select 0x0F | ||
#define SS_num 3 | ||
#define ADC0_SSCTL3_IE0 0x1 | ||
#define ADC0_SSCTL3_END0 0x1 | ||
#define ADC0_SSCTL3_TS0 0x1 | ||
|
||
|
||
void ADC0_SS3_Init (void); | ||
void ADC_Init_Potentiometer (void); | ||
|
||
#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
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,12 @@ | ||
#include "lcd.h" | ||
void pushButtons_Init (void) | ||
{ | ||
void Port_Init (PF); | ||
void Port_SetPinDirection (PF, 0x11, PORT_PIN_IN); | ||
void Port_AnalogOrDigital (PF,0x11, 1); | ||
void Port_AlternateFunction (PF, 0x11, 0, 0x00); | ||
void Port_SetPinPullUp (PF, 0x11, 1); | ||
|
||
|
||
} | ||
#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,8 @@ | ||
#ifndef PushB_H_ | ||
#define PushB_H_ | ||
|
||
#include "tm4c123gh6pm.h" | ||
#include "std_types.h" | ||
#include "lcd.h" | ||
|
||
void pushButtons_Init (void); |
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