hal interface

This commit is contained in:
Rene Hopf
2015-11-28 09:39:12 +01:00
parent 5843780f08
commit 32bc3182e1
3 changed files with 23 additions and 10 deletions
+4 -7
View File
@@ -137,16 +137,16 @@ void start_hal(){
if(hal.frt_func_count > 0){
start_frt();
TIM_ITConfig(TIM2, TIM_IT_Update, ENABLE); // enable frt
enable_frt();
}
TIM_Cmd(TIM2, ENABLE); // enable rt
enable_rt();
}
void stop_hal(){
stop_frt();
stop_rt();
TIM_ITConfig(TIM2, TIM_IT_Update, DISABLE); // disable frt
TIM_Cmd(TIM2, DISABLE); // disable rt
disable_frt();
disable_rt();
for(; hal.rt_deinit_func_count > 0; hal.rt_deinit_func_count--){
hal.rt_deinit[hal.rt_deinit_func_count - 1]();
}
@@ -270,9 +270,6 @@ int link_hal_pins(HPNAME source, HPNAME sink){
s = find_hal_pin(sink);
if(d != 0 && s != 0){
// if(s->source != s){
// printf_("relink %s:%i -> %s:%i to %s:%i -> %s:%i\n", s->source->name, s->source, sink, s, source, d, sink, s);
// }
s->value = s->source->source->value;
s->source = d;
return(1);
+5 -3
View File
@@ -18,9 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "scanf.h"
#include "printf.h"
#include "stm32f4xx_conf.h"
#include <stdint.h>
#pragma once
@@ -153,6 +151,10 @@ int link_hal_pins(HPNAME source, HPNAME sink);
void add_comp(struct hal_comp* comp);
extern void enable_rt();
extern void enable_frt();
extern void disable_rt();
extern void disable_frt();
#define COMP(type) \
{ \
+14
View File
@@ -41,6 +41,20 @@ int __errno;
volatile double systime_s = 0.0;
void Wait(unsigned int ms);
//hal interface
void enable_rt(){
TIM_Cmd(TIM2, ENABLE);
}
void enable_frt(){
TIM_ITConfig(TIM2, TIM_IT_Update, ENABLE);
}
void disable_rt(){
TIM_Cmd(TIM2, DISABLE);
}
void disable_frt(){
TIM_ITConfig(TIM2, TIM_IT_Update, DISABLE);
}
//20kHz
void TIM2_IRQHandler(void){
TIM_ClearITPendingBit(TIM2,TIM_IT_Update);