parent
bbb2fefe71
commit
e3c1298f55
Binary file not shown.
@ -0,0 +1,68 @@
|
|||||||
|
#include "delay.h"
|
||||||
|
#include "pin.h"
|
||||||
|
#include "deviceSetup.h"
|
||||||
|
#include "interrupt.h"
|
||||||
|
#include "timer.h"
|
||||||
|
|
||||||
|
|
||||||
|
void blinkiTask()
|
||||||
|
{
|
||||||
|
//pinToggle(pinB3);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void EXTI4_15_IRQHandler(void)
|
||||||
|
{
|
||||||
|
if(EXTI->PR & EXTI_PR_PR4)
|
||||||
|
{
|
||||||
|
EXTI->PR |= EXTI_PR_PR4;
|
||||||
|
pinToggle(pinB3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void pinB4IntSetup()
|
||||||
|
{
|
||||||
|
SYSCFG->EXTICR[1] |= SYSCFG_EXTICR2_EXTI4_PB;
|
||||||
|
EXTI->FTSR |= EXTI_FTSR_TR4;
|
||||||
|
EXTI->RTSR |= EXTI_FTSR_TR4;
|
||||||
|
EXTI->IMR |= EXTI_IMR_IM4;
|
||||||
|
NVIC_EnableIRQ(EXTI4_15_IRQn);
|
||||||
|
NVIC_SetPriority(EXTI4_15_IRQn,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void declareInterrupts()
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
timerInitCounter(timer_2,(8E6/40E3)-1, 5000-1, upCounting);
|
||||||
|
timerEnableInterrupt(timer_2,TIM2_UPDATE);
|
||||||
|
timerStart(timer_2);
|
||||||
|
|
||||||
|
intInit(TIM2_UPDATE, blinkiTask, 1);
|
||||||
|
intEnable(TIM2_UPDATE);
|
||||||
|
*/
|
||||||
|
|
||||||
|
intDisableGlobal();
|
||||||
|
|
||||||
|
pinB4IntSetup();
|
||||||
|
|
||||||
|
intEnableGlobal();
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
uint8_t i = 0;
|
||||||
|
|
||||||
|
pinConfig(pinA0, input, def_stage, pullDown, def_speed);
|
||||||
|
pinConfig(pinB3, output, pushPull, def_res, def_speed);
|
||||||
|
|
||||||
|
pinWrite(pinB3, 0);
|
||||||
|
|
||||||
|
pinConfig(pinB4, input, floating, none, def_speed);
|
||||||
|
|
||||||
|
declareInterrupts();
|
||||||
|
|
||||||
|
while(1);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
|||||||
|
#ifndef MAIN_H
|
||||||
|
#define MAIN_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* MAIN_H */
|
@ -0,0 +1,21 @@
|
|||||||
|
#Declareing header directory for the project
|
||||||
|
#To add a new directory
|
||||||
|
# -> list(APPEND PROJECT_HEADERS_DIR ${PROJECT_DIR}/YOUR_DESIRED_DIRECTORY)
|
||||||
|
# list() = List declaration "DON'T CHANGE"
|
||||||
|
# PROJECT_HEADERS_DIR = Variable containing the listed direcotries "DON'T CHANCE
|
||||||
|
# ${PROJECT_DIR} = Direcotry of the main project this is per default the current direcotry it is defined in ked/CMakeLists.txt
|
||||||
|
#list(APPEND PROJECT_HEADERS_DIR ${PROJECT_DIR}/headers)
|
||||||
|
|
||||||
|
#Declaring sources directory for the project
|
||||||
|
#To add a new directory
|
||||||
|
# -> list(APPEND PROJECT_SOURCES_DIR ${PROJECT_DIR}/YOUR_DESIRED_DIRECTORY)
|
||||||
|
# list() = List declaration "DON'T CHANGE"
|
||||||
|
# PROJECT_SOURCES_DIR = Variable containing the listed direcotries "DON'T CHANCE
|
||||||
|
# ${PROJECT_DIR} = Direcotry of the main project this is per default the current direcotry it is defined in ked/CMakeLists.txt
|
||||||
|
#list(APPEND PROJECT_SOURCES_DIR ${PROJECT_DIR}/src)
|
||||||
|
#list(APPEND PROJECT_SOURCES_DIR ${PROJECT_DIR}/sensors)
|
||||||
|
|
||||||
|
#Declaring sources to be compiled for the project.
|
||||||
|
#CMake will look in each previsouly declarec sources directory until to find this files.
|
||||||
|
set(PROJECT_SOURCES_DIR_LIST)
|
||||||
|
|
Loading…
Reference in new issue