forked from stancecoke/BMSBattery_S_controllers_firmware
-
Notifications
You must be signed in to change notification settings - Fork 1
/
SPEED.c
39 lines (32 loc) · 857 Bytes
/
SPEED.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
* OpenSource EBike firmware
*
* Copyright (C) Stancecoke, 2017.
*
* Released under the GPL License, Version 3
*/
#include <stdint.h>
#include "stm8s.h"
#include "stm8s_it.h"
#include "gpio.h"
#include "interrupts.h"
#include "SPEED.h"
#include "cruise_control.h"
#include "motor.h"
#include "pwm.h"
#include "ACAcontrollerState.h"
// SPEED signal
void EXTI_PORTC_IRQHandler(void) __interrupt(EXTI_PORTC_IRQHANDLER)
{
ui8_SPEED_Flag = 1; //just setting flag in interrupt handler
}
void SPEED_init (void)
{
//PAS pin as external input pin interrupt
GPIO_Init(SPEED__PORT,
SPEED__PIN,
GPIO_MODE_IN_PU_IT); // with Pullup and external interrupt
//initialize the Interrupt sensitivity: falling edge only
EXTI_SetExtIntSensitivity(EXTI_PORT_GPIOC,
EXTI_SENSITIVITY_FALL_ONLY);
}