mirror of
https://github.com/openshwprojects/OpenBK7231T_App.git
synced 2025-10-30 03:54:40 +00:00
IR2 - fix DEBUG_WAVE_WITH_GPIO but leave disabled for testing in future
This commit is contained in:
parent
b5d9d5f5f1
commit
718afdaaad
@ -173,14 +173,25 @@ unsigned int period;
|
||||
|
||||
uint8_t group, channel;
|
||||
|
||||
// define to 1 to enable debug timer io output
|
||||
#if 0
|
||||
#define DEBUG_WAVE_WITH_GPIO 1
|
||||
#endif
|
||||
|
||||
void SendIR2_ISR(uint8_t t) {
|
||||
#if DEBUG_WAVE_WITH_GPIO
|
||||
static int dbg_state = 0;
|
||||
dbg_state = !dbg_state;
|
||||
bk_gpio_output(txpin, dbg_state);
|
||||
return;
|
||||
#endif
|
||||
if (cur == 0)
|
||||
return;
|
||||
curTime += myPeriodUs;
|
||||
int tg = *cur;
|
||||
if (tg <= curTime) {
|
||||
curTime -= tg;
|
||||
state = !state;
|
||||
state = !state;
|
||||
if (state == 0) {
|
||||
MY_SET_DUTY(duty_off);
|
||||
}
|
||||
@ -190,7 +201,7 @@ void SendIR2_ISR(uint8_t t) {
|
||||
cur++;
|
||||
if (cur == stop) {
|
||||
// done
|
||||
cur = 0;
|
||||
cur = 0;
|
||||
|
||||
MY_SET_DUTY(duty_off);
|
||||
}
|
||||
@ -204,7 +215,9 @@ startDriver IR2
|
||||
SetupIR2 50 0.5 0 8
|
||||
// send data
|
||||
SendIR2 3200 1300 950 500 900 1300 900 550 900 650 900
|
||||
//
|
||||
//
|
||||
|
||||
backlog startDriver IR2; SetupIR2 50 0.5 0 9
|
||||
*/
|
||||
static commandResult_t CMD_IR2_SendIR2(const void* context, const char* cmd, const char* args, int cmdFlags) {
|
||||
float frequency = 38000;
|
||||
@ -223,7 +236,7 @@ static commandResult_t CMD_IR2_SendIR2(const void* context, const char* cmd, con
|
||||
if (stop - times < maxTimes) {
|
||||
int x = atoi(args);
|
||||
*stop = x;
|
||||
ADDLOG_INFO(LOG_FEATURE_IR, "Value: %i",x);
|
||||
ADDLOG_INFO(LOG_FEATURE_IR, "Value: %i", x);
|
||||
stop++;
|
||||
}
|
||||
else {
|
||||
@ -234,7 +247,7 @@ static commandResult_t CMD_IR2_SendIR2(const void* context, const char* cmd, con
|
||||
}
|
||||
}
|
||||
state = 0;
|
||||
ADDLOG_INFO(LOG_FEATURE_IR, "Queue size %i",(stop - times));
|
||||
ADDLOG_INFO(LOG_FEATURE_IR, "Queue size %i", (stop - times));
|
||||
|
||||
|
||||
#if PLATFORM_BK7231N && !PLATFORM_BEKEN_NEW
|
||||
@ -284,7 +297,7 @@ static commandResult_t CMD_IR2_SetupIR2(const void* context, const char* cmd, co
|
||||
#if PLATFORM_BEKEN
|
||||
#if PLATFORM_BK7231N && !PLATFORM_BEKEN_NEW
|
||||
// OSStatus bk_pwm_initialize(bk_pwm_t pwm, uint32_t frequency, uint32_t duty_cycle);
|
||||
bk_pwm_initialize((bk_pwm_t)pwmIndex, period, period/2, 0, 0);
|
||||
bk_pwm_initialize((bk_pwm_t)pwmIndex, period, period / 2, 0, 0);
|
||||
#else
|
||||
bk_pwm_initialize((bk_pwm_t)pwmIndex, period, period / 2);
|
||||
#endif
|
||||
@ -332,6 +345,8 @@ static commandResult_t CMD_IR2_SetupIR2(const void* context, const char* cmd, co
|
||||
res = sddev_control((char *)TIMER_DEV_NAME, CMD_TIMER_UNIT_ENABLE, &ir_chan);
|
||||
ADDLOG_INFO(LOG_FEATURE_IR, (char *)"ir timer enabled %u", res);
|
||||
#endif
|
||||
|
||||
//ADDLOG_INFO(LOG_FEATURE_IR, "Time: %i", curTime);
|
||||
return CMD_RES_OK;
|
||||
}
|
||||
|
||||
@ -350,4 +365,4 @@ void DRV_IR2_Init() {
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
Loading…
x
Reference in New Issue
Block a user