#endif
#ifdef ROTARYENCODER_MIXO
-// extern void mixo_int_callback(pin_t pin, uintptr_t param);
+extern void mixo_int_callback(pin_t pin, uintptr_t param);
#endif
#ifdef SUPPORT_CYWEE_SERVICE
#endif
#endif
#ifdef ROTARYENCODER_MIXO
- // { S_AGPIO_L0, HAL_GPIO_DIRECTION_INPUT, NULL, GPIO_INTERRUPT_FALLING_EDGE, mixo_int_callback},
+ { S_AGPIO_L0, HAL_GPIO_DIRECTION_INPUT, NULL, GPIO_INTERRUPT_FALLING_EDGE, mixo_int_callback},
#endif
};
/**
void mixo_int_callback(pin_t pin, uintptr_t param)
{
- PRINT("mixo_int_callback %d 0x%X\n",pin,param);
+ // PRINT("mixo_int_callback %d 0x%X\n",pin,param);
uapi_gpio_clear_interrupt(pin);
- // uapi_pin_set_ie(MIXO_INT_PIN,HAL_PIO_IE_DISABLE);
+ uapi_pin_set_ie(MIXO_INT_PIN,HAL_PIO_IE_DISABLE);
mixo_start(); // 启动定时器
}
void mixo_check(void)
{
+ // printf("mixo_check : %d\n",mixo_get_check_mode());
// if(mixo_get_check_mode() == TIMER_MODE)
- mixo_ots_timer_callback();
- // else if(mixo_get_check_mode() == INT_MODE)
// {
- // mixo_stop(); // 关闭定时器
- // // uapi_pin_set_ie(MIXO_INT_PIN,HAL_PIO_IE_ENBALE);
+ mixo_ots_timer_callback();
// }
+
+ if(mixo_get_check_mode() == INT_MODE)
+ {
+ mixo_stop(); // 关闭定时器
+ uapi_pin_set_ie(MIXO_INT_PIN,HAL_PIO_IE_ENBALE);
+ }
}
static ext_errno mixo_encoder_resume(void)
{
re_print("mixo_encoder_resume\r\n");
- mixo_start();
+ // mixo_start();
+ mixo_resume();
return EXT_ERR_SUCCESS;
}
static ext_errno mixo_encoder_sleep(void)
{
re_print("mixo_encoder_sleep\r\n");
- mixo_stop();
+ // mixo_stop();
+ mixo_suspend();
return EXT_ERR_SUCCESS;
}
static ext_errno mixo_encoder_reset(void)
}
else
{
- // timer_cnt++;
- // if (timer_cnt == 20) // 20*10 = // 200ms:200ms内sensor没有检测到表冠转动就会关闭定时器重新开启中断响应
- // {
- // printf("mixo enter int mode\n");
- // /**
- // * 此处注意 mixo_ots_forced_clear_int
- // * 必须放在 external_int_init 之前去做
- // * 否则可能造成功耗异常的问题
- // */
- // mixo_ots_forced_clear_int(); // 强制拉高MOT脚
- // int_mode = 1;
- // }
+ timer_cnt++;
+ if (timer_cnt == 100) // 20*10 = // 200ms:200ms内sensor没有检测到表冠转动就会关闭定时器重新开启中断响应
+ {
+ // printf("mixo enter int mode\n");
+ /**
+ * 此处注意 mixo_ots_forced_clear_int
+ * 必须放在 external_int_init 之前去做
+ * 否则可能造成功耗异常的问题
+ */
+ mixo_ots_forced_clear_int(); // 强制拉高MOT脚
+ int_mode = 1;
+ }
if (stand_still == 0)
{
//上次是转动,上报状态改变
{
if(mixo_service_timer_running == false && g_mixo_service_timer)
{
- mixo_resume();
+ // mixo_resume();
osTimerStart(g_mixo_service_timer,MIXO_SERVICE_TIMER_CHECK_MS);
mixo_service_timer_running = true;
}
{
if(mixo_service_timer_running == true && g_mixo_service_timer)
{
- mixo_suspend();
+ // mixo_suspend();
// mixo_clean_result();
osTimerStop(g_mixo_service_timer);
mixo_service_timer_running = false;