Changeset 65 in svn


Ignore:
Timestamp:
May 29, 2015 10:20:09 AM (11 years ago)
Author:
megakiss
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/remocon/zasc/app_c/DST_nec_ir_sender.c

    r63 r65  
    2121} 
    2222 
     23static void signal38k(bool bOn) 
     24{ 
     25        int i; 
     26        SetIRLED(bOn ? 1 : 0); 
     27        for (i = 0; i < 1616; i++) 
     28        { 
     29                 
     30        } 
     31        SetIRLED(0); 
     32        for (i = 0; i < 1616; i++) 
     33        { 
     34                 
     35        } 
     36} 
     37 
     38static void signal(bool bOn, int nCount) 
     39{ 
     40        int i; 
     41        for (i = 0; i < nCount; i++) 
     42        { 
     43                signal38k(bOn); 
     44        } 
     45} 
     46 
    2347static void SendBit(int bOn) 
    2448{ 
    25         SetIRLED(1); 
    26         DHL_Delay562_5us(1); 
    27         SetIRLED(0); 
    28         DHL_Delay562_5us(bOn == 0 ? 1 : 2); 
     49        signal(true, 22); 
     50        signal(false, bOn == 0 ? 21 : 64); 
    2951} 
    3052 
     
    4163} 
    4264 
     65 
     66 
    4367void DST_NEC_IR_Send(unsigned char custom0, unsigned char custom1, unsigned char code) 
    4468{ 
     69        unsigned int flags = bos_enter_critical(); 
    4570        // http://techdocs.altium.com/display/FPGA/NEC+Infrared+Transmission+Protocol 
    4671        // a 9ms leading pulse burst (16 times the pulse burst length used for a logical data bit) 
    47         SetIRLED(1); 
    48         DHL_Delay562_5us(16); 
     72        signal(true, 38*9); 
    4973        // a 4.5ms space 
    50         SetIRLED(0); 
    51         DHL_Delay562_5us(8); 
     74        signal(false, (38*9)/2); 
    5275        // the 8-bit address for the receiving device 
    5376        SendByte(custom0); 
     
    6083        // a final 562.5¥ìs pulse burst to signify the end of message transmission. 
    6184        SendBit(0); 
     85        bos_exit_critical(flags); 
    6286} 
    6387 
Note: See TracChangeset for help on using the changeset viewer.