mirror of
https://github.com/rene-dev/stmbl.git
synced 2026-09-26 01:54:24 +08:00
hal interface
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user