Change all IR protocols to hardware PWM
This commit is contained in:
parent
72b06f49f1
commit
fcfd4792f9
16 changed files with 22 additions and 38 deletions
|
@ -71,9 +71,9 @@ proc betty_init { } {
|
|||
|
||||
# Memory Bank Configuration
|
||||
# BCFG0: 16bit, rble, 2wst - 30 mhz : Betty: FLASH 0 @ 0x80000000
|
||||
mww 0xffe00000 0x10000420
|
||||
mww 0xffe00000 0x10001CA0
|
||||
# BCFG2: 16bit, rble, 2wst - 30 mhz : Betty: FLASH 1 @ 0x82000000
|
||||
mww 0xffe00008 0x10000420
|
||||
mww 0xffe00008 0x10001CA0
|
||||
|
||||
# BCFG1: 8 bit, 3 sram wst, rble, 5 wst 3 idcy : Betty: LCD @ 0x81000000
|
||||
mww 0xffe00004 0x00000400
|
||||
|
|
Binary file not shown.
|
@ -114,6 +114,12 @@ void runIR(void)
|
|||
|
||||
}
|
||||
|
||||
void setIRspeed(struct irModule module)
|
||||
{
|
||||
PWM_set_frequency(15000000 / (module.tval * module.lo_border));
|
||||
ir.duty_cycle =(module.hi_border * 100) / module.lo_border;
|
||||
}
|
||||
|
||||
void stopIR(void)
|
||||
{
|
||||
T1TCR = 0x03;
|
||||
|
|
|
@ -78,7 +78,7 @@ struct IR_VARS_ {
|
|||
|
||||
|
||||
//#define setIRspeed( _m ) { if(sysInfo & 0x80) T1MR0 = _m.tval1; else T1MR0 = _m.tval; }
|
||||
#define setIRspeed( _m ) { T1MR0 = _m.tval; }
|
||||
//#define setIRspeed( _m ) { T1MR0 = _m.tval; }
|
||||
|
||||
void __attribute__ ((section(".text.fastcode"))) defIR(void);
|
||||
void defSender(unsigned long cmd);
|
||||
|
@ -90,6 +90,7 @@ void startIrIRQ(void);
|
|||
void setIR(struct irModule module);
|
||||
void runIR(void);
|
||||
void stopIR(void);
|
||||
void setIRspeed(struct irModule module);
|
||||
|
||||
unsigned long setEncoder( unsigned char _x, unsigned char _y );
|
||||
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
#include "cc1100.h"
|
||||
#include "pwm.h"
|
||||
|
||||
static unsigned int c_cnt = 0;
|
||||
static unsigned int b_len = 0;
|
||||
extern volatile unsigned char mod_enable;
|
||||
extern volatile unsigned char hi_border;
|
||||
extern volatile unsigned char lo_border;
|
||||
|
@ -36,7 +34,6 @@ extern ir_fn irEncoder;
|
|||
|
||||
void __attribute__ ((section(".text.fastcode"))) irIRQ(void)
|
||||
{
|
||||
c_cnt++;
|
||||
|
||||
irEncoder();
|
||||
|
||||
|
@ -46,36 +43,6 @@ void __attribute__ ((section(".text.fastcode"))) irIRQ(void)
|
|||
PWM_set_IR_duty_cycle(0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
if(c_cnt <= hi_border)
|
||||
{
|
||||
FIOSET0 = (mod_enable<<21);
|
||||
}
|
||||
else
|
||||
{
|
||||
FIOCLR0 = (1<<21);
|
||||
if(c_cnt >= lo_border)
|
||||
{
|
||||
c_cnt = 0;
|
||||
b_len++;
|
||||
if(b_len >= cycles)
|
||||
{
|
||||
irEncoder();
|
||||
b_len = 0;
|
||||
|
||||
if(!hi_border) { //RF mode
|
||||
if(mod_enable)
|
||||
FIOCLR0 = GDO0;
|
||||
else
|
||||
FIOSET0 = GDO0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
//T1TCR = 0x03;
|
||||
|
||||
T1IR = 1;
|
||||
// VICVectAddr = 0;
|
||||
|
||||
}
|
||||
|
|
|
@ -126,6 +126,7 @@ void __attribute__ ((section(".text.fastcode"))) ITT_Encode (void)
|
|||
}
|
||||
break;
|
||||
}
|
||||
T1MR0 = cycles * ITT2_Module.lo_border * ITT2_Module.tval;
|
||||
}
|
||||
|
||||
void ITT_LoadMap(unsigned char map)
|
||||
|
|
|
@ -300,7 +300,6 @@ void __attribute__ ((section(".text.fastcode"))) LIRC_Encode (void) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
T1MR0 = 15 * cycles;
|
||||
|
||||
}
|
||||
|
|
|
@ -115,6 +115,7 @@ void __attribute__ ((section(".text.fastcode"))) NRC17_Encode(void)
|
|||
break;
|
||||
|
||||
}
|
||||
T1MR0 = cycles * NRC17_Module.lo_border * NRC17_Module.tval;
|
||||
}
|
||||
/*
|
||||
void NRC17_CopyMap(unsigned char xtra, unsigned short *map)
|
||||
|
|
|
@ -98,6 +98,7 @@ void __attribute__ ((section(".text.fastcode"))) RC5_Encode (void)
|
|||
}
|
||||
break;
|
||||
}
|
||||
T1MR0 = cycles * RC5_Module.lo_border * RC5_Module.tval;
|
||||
}
|
||||
|
||||
void RC5_Init(unsigned char map)
|
||||
|
|
|
@ -148,6 +148,7 @@ void __attribute__ ((section(".text.fastcode"))) RC6_Encode (void)
|
|||
}
|
||||
break;
|
||||
}
|
||||
T1MR0 = cycles * RC6_Module.lo_border * RC6_Module.tval;
|
||||
}
|
||||
|
||||
void RC6_Init(unsigned char map)
|
||||
|
|
|
@ -120,6 +120,7 @@ void __attribute__ ((section(".text.fastcode"))) RCA_Encode (void)
|
|||
}
|
||||
break;
|
||||
}
|
||||
T1MR0 = cycles * RCA_Module.lo_border * RCA_Module.tval;
|
||||
}
|
||||
|
||||
void RCA_LoadMap(unsigned char map)
|
||||
|
|
|
@ -117,6 +117,7 @@ void __attribute__ ((section(".text.fastcode"))) RCMM_Encode (void)
|
|||
|
||||
|
||||
}
|
||||
T1MR0 = cycles * RCMM_Module.lo_border * RCMM_Module.tval;
|
||||
}
|
||||
|
||||
void RCMM_LoadMap(unsigned char map)
|
||||
|
|
|
@ -117,6 +117,7 @@ void __attribute__ ((section(".text.fastcode"))) REC80_Encode (void)
|
|||
}
|
||||
break;
|
||||
}
|
||||
T1MR0 = cycles * REC80_Module.lo_border * REC80_Module.tval;
|
||||
}
|
||||
|
||||
void REC80_LoadMap(unsigned char map)
|
||||
|
|
|
@ -90,6 +90,7 @@ void __attribute__ ((section(".text.fastcode"))) RECS80_Encode (void)
|
|||
}
|
||||
break;
|
||||
}
|
||||
T1MR0 = cycles * RECS80_Module.lo_border * RECS80_Module.tval;
|
||||
}
|
||||
|
||||
void RECS80_Init(unsigned char map)
|
||||
|
|
|
@ -103,6 +103,8 @@ void __attribute__ ((section(".text.fastcode"))) SIRC_Encode (void)
|
|||
break;
|
||||
|
||||
}
|
||||
|
||||
T1MR0 = cycles * SIRC_Module.lo_border * SIRC_Module.tval;
|
||||
}
|
||||
|
||||
void SIRC_Init(unsigned char map)
|
||||
|
|
|
@ -137,6 +137,7 @@ void __attribute__ ((section(".text.fastcode"))) SPACEENC_Encode (void)
|
|||
}
|
||||
break;
|
||||
}
|
||||
T1MR0 = cycles * SPACEENC_Module.lo_border * SPACEENC_Module.tval;
|
||||
}
|
||||
|
||||
void SPACEENC_LoadMap(unsigned char map)
|
||||
|
|
Loading…
Reference in a new issue