From 40f7237cf1b08c692234996bf1abeee55b5d415a Mon Sep 17 00:00:00 2001 From: strawmanbobi Date: Sun, 24 Dec 2017 17:01:51 +0800 Subject: [PATCH] update 2017-12-24 1. removed arduino example 2. added CC254X example --- arduino-example/IRSendRev.cpp | 370 --- arduino-example/IRSendRev.h | 87 - arduino-example/IRSendRevInt.h | 341 -- arduino-example/examples/revTest/revTest.ino | 34 - .../examples/sendTest/sendTest.ino | 24 - arduino-example/keywords.txt | 29 - .../SimpleProfile/simpleGATTprofile.c | 4 +- .../CC2541DB/SimpleBLEPeripheral.dep | 2790 ++++++++++------- .../CC2541DB/SimpleBLEPeripheral.ewp | 35 +- .../settings/SimpleBLEPeripheral.wsdt | 8 +- .../settings/SimpleBLEPeripheral.wspos | 2 +- .../Source/Irext/include/ir_ac_apply.h | 43 + .../Source/Irext/include/ir_ac_binary_parse.h | 35 + .../Source/Irext/include/ir_ac_build_frame.h | 28 + .../Source/Irext/include/ir_ac_control.h | 439 +++ .../include/ir_ac_parse_forbidden_info.h | 29 + .../Irext/include/ir_ac_parse_frame_info.h | 44 + .../Irext/include/ir_ac_parse_parameter.h | 58 + .../Source/Irext/include/ir_decode.h | 160 + .../Source/Irext/include/ir_defs.h | 63 + .../Source/Irext/include/ir_tv_control.h | 215 ++ .../Source/Irext/include/ir_utils.h | 36 + .../Source/Irext/src/ir_ac_apply.c | 772 +++++ .../Source/Irext/src/ir_ac_binary_parse.c | 121 + .../Source/Irext/src/ir_ac_build_frame.c | 145 + .../Source/Irext/src/ir_ac_control.c | 548 ++++ .../Irext/src/ir_ac_parse_forbidden_info.c | 143 + .../Source/Irext/src/ir_ac_parse_frame_info.c | 329 ++ .../Source/Irext/src/ir_ac_parse_parameter.c | 1190 +++++++ .../Source/Irext/src/ir_decode.c | 640 ++++ .../Source/Irext/src/ir_tv_control.c | 448 +++ .../Source/Irext/src/ir_utils.c | 98 + .../Irext/src/ir_ac_parse_parameter.c | 3 - 33 files changed, 7344 insertions(+), 1967 deletions(-) delete mode 100644 arduino-example/IRSendRev.cpp delete mode 100644 arduino-example/IRSendRev.h delete mode 100644 arduino-example/IRSendRevInt.h delete mode 100644 arduino-example/examples/revTest/revTest.ino delete mode 100644 arduino-example/examples/sendTest/sendTest.ino delete mode 100644 arduino-example/keywords.txt create mode 100644 cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_ac_apply.h create mode 100644 cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_ac_binary_parse.h create mode 100644 cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_ac_build_frame.h create mode 100644 cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_ac_control.h create mode 100644 cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_ac_parse_forbidden_info.h create mode 100644 cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_ac_parse_frame_info.h create mode 100644 cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_ac_parse_parameter.h create mode 100644 cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_decode.h create mode 100644 cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_defs.h create mode 100644 cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_tv_control.h create mode 100644 cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_utils.h create mode 100644 cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_ac_apply.c create mode 100644 cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_ac_binary_parse.c create mode 100644 cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_ac_build_frame.c create mode 100644 cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_ac_control.c create mode 100644 cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_ac_parse_forbidden_info.c create mode 100644 cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_ac_parse_frame_info.c create mode 100644 cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_ac_parse_parameter.c create mode 100644 cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_decode.c create mode 100644 cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_tv_control.c create mode 100644 cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_utils.c diff --git a/arduino-example/IRSendRev.cpp b/arduino-example/IRSendRev.cpp deleted file mode 100644 index bab5b02..0000000 --- a/arduino-example/IRSendRev.cpp +++ /dev/null @@ -1,370 +0,0 @@ -/* - * IRremote - * Version 0.11 August, 2009 - * Copyright 2009 Ken Shirriff - * For details, see http://arcfn.com/2009/08/multi-protocol-infrared-remote-library.html - * - * Modified by Paul Stoffregen to support other boards and timers - * Modified by Mitra Ardron - * Added Sanyo and Mitsubishi controllers - * Modified Sony to spot the repeat codes that some Sony's send - * - * Modifier by - * Interrupt code based on NECIRrcv by Joe Knapp - * http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1210243556 - * Also influenced by http://zovirl.com/2008/11/12/building-a-universal-remote-with-an-arduino/ - * - */ - -#include "IRSendrev.h" -#include "IRsendRevInt.h" - -// Provides ISR -#include - -volatile irparams_t irparams; - -void IRSendRev::sendRaw(unsigned int buf[], int len, int hz) -{ - enableIROut(hz); - - for (int i = 0; i < len; i++) { - if (i & 1) { - space(buf[i]); - } - else { - mark(buf[i]); - } - } - space(0); // Just to be sure -} - -void IRSendRev::mark(int time) { - // Sends an IR mark for the specified number of microseconds. - // The mark output is modulated at the PWM frequency. - TIMER_ENABLE_PWM; // Enable pin 3 PWM output - delayMicroseconds(time); -} - -/* Leave pin off for time (given in microseconds) */ -void IRSendRev::space(int time) { - // Sends an IR space for the specified number of microseconds. - // A space is no output, so the PWM output is disabled. - TIMER_DISABLE_PWM; // Disable pin 3 PWM output - delayMicroseconds(time); -} - -void IRSendRev::enableIROut(int khz) { - // Enables IR output. The khz value controls the modulation frequency in kilohertz. - // The IR output will be on pin 3 (OC2B). - // This routine is designed for 36-40KHz; if you use it for other values, it's up to you - // to make sure it gives reasonable results. (Watch out for overflow / underflow / rounding.) - // TIMER2 is used in phase-correct PWM mode, with OCR2A controlling the frequency and OCR2B - // controlling the duty cycle. - // There is no prescaling, so the output frequency is 16MHz / (2 * OCR2A) - // To turn the output on and off, we leave the PWM running, but connect and disconnect the output pin. - // A few hours staring at the ATmega documentation and this will all make sense. - // See my Secrets of Arduino PWM at http://arcfn.com/2009/07/secrets-of-arduino-pwm.html for details. - - // Disable the Timer2 Interrupt (which is used for receiving IR) - TIMER_DISABLE_INTR; //Timer2 Overflow Interrupt - - pinMode(TIMER_PWM_PIN, OUTPUT); - digitalWrite(TIMER_PWM_PIN, LOW); // When not sending PWM, we want it low - - TIMER_CONFIG_KHZ(khz); - TIMER_ENABLE_PWM; - -} - -void IRSendRev::Init(int revPin) -{ - irparams.recvpin = revPin; - - enableIRIn(); // Start the receiver - delay(20); - Clear(); -} - -void IRSendRev::Init() -{ - delay(20); - Clear(); -} -// initialization -void IRSendRev::enableIRIn() { - cli(); - // setup pulse clock timer interrupt - //Prescale /8 (16M/8 = 0.5 microseconds per tick) - // Therefore, the timer interval can range from 0.5 to 128 microseconds - // depending on the reset value (255 to 0) - TIMER_CONFIG_NORMAL(); - - //Timer2 Overflow Interrupt Enable - TIMER_ENABLE_INTR; - - TIMER_RESET; - - sei(); // enable interrupts - - // initialize state machine variables - irparams.rcvstate = STATE_IDLE; - irparams.rawlen = 0; - - // set pin modes - pinMode(irparams.recvpin, INPUT); -} - -// TIMER2 interrupt code to collect raw data. -// Widths of alternating SPACE, MARK are recorded in rawbuf. -// Recorded in ticks of 50 microseconds. -// rawlen counts the number of entries recorded so far. -// First entry is the SPACE between transmissions. -// As soon as a SPACE gets long, ready is set, state switches to IDLE, timing of SPACE continues. -// As soon as first MARK arrives, gap width is recorded, ready is cleared, and new logging starts - -ISR(TIMER_INTR_NAME) -{ - TIMER_RESET; - - uint8_t irdata = (uint8_t)digitalRead(irparams.recvpin); - - irparams.timer++; // One more 50us tick - if (irparams.rawlen >= RAWBUF) { - // Buffer overflow - irparams.rcvstate = STATE_STOP; - } - switch(irparams.rcvstate) { - case STATE_IDLE: // In the middle of a gap - if (irdata == MARK) { - if (irparams.timer < GAP_TICKS) { - // Not big enough to be a gap. - irparams.timer = 0; - } - else { - // gap just ended, record duration and start recording transmission - irparams.rawlen = 0; - irparams.rawbuf[irparams.rawlen++] = irparams.timer; - irparams.timer = 0; - irparams.rcvstate = STATE_MARK; - } - } - break; - case STATE_MARK: // timing MARK - if (irdata == SPACE) { // MARK ended, record time - irparams.rawbuf[irparams.rawlen++] = irparams.timer; - irparams.timer = 0; - irparams.rcvstate = STATE_SPACE; - } - break; - case STATE_SPACE: // timing SPACE - if (irdata == MARK) { // SPACE just ended, record it - irparams.rawbuf[irparams.rawlen++] = irparams.timer; - irparams.timer = 0; - irparams.rcvstate = STATE_MARK; - } - else { // SPACE - if (irparams.timer > GAP_TICKS) { - // big SPACE, indicates gap between codes - // Mark current code as ready for processing - // Switch to STOP - // Don't reset timer; keep counting space width - irparams.rcvstate = STATE_STOP; - } - } - break; - case STATE_STOP: // waiting, measuring gap - if (irdata == MARK) { // reset gap timer - irparams.timer = 0; - } - break; - } - -} - -void IRSendRev::Clear() { - irparams.rcvstate = STATE_IDLE; - irparams.rawlen = 0; -} - -// Decodes the received IR message -// Returns 0 if no data ready, 1 if data ready. -// Results of decoding are stored in results -int IRSendRev::decode(decode_results *results) { - results->rawbuf = irparams.rawbuf; - results->rawlen = irparams.rawlen; - if (irparams.rcvstate != STATE_STOP) { - return ERR; - } - // Throw away and start over - Clear(); - return 1; -} - -unsigned char IRSendRev::Recv(unsigned char *revData) -{ - int count = results.rawlen; - int nshort = 0; - int nlong = 0; - int count_data = 0; - - count_data = (count-4)/16; - - for(int i = 0; i<10; i++) // count nshort - { - nshort += results.rawbuf[3+2*i]; - } - nshort /= 10; - - int i = 0; - int j = 0; - while(1) // count nlong - { - if(results.rawbuf[4+2*i] > (2*nshort)) - { - nlong += results.rawbuf[4+2*i]; - j++; - } - i++; - if(j==10)break; - if((4+2*i)>(count-10))break; - } - nlong /= j; - - int doubleshort = 2*nshort; - for(i = 0; i doubleshort) // 1 - { - revData[i+D_DATA] |= 0x01<< (7-j); - } - else - { - revData[i+D_DATA] &= ~(0x01<<(7-j)); - } - } - } - revData[D_LEN] = count_data+5; - revData[D_STARTH] = results.rawbuf[1]; - revData[D_STARTL] = results.rawbuf[2]; - revData[D_SHORT] = nshort; - revData[D_LONG] = nlong; - revData[D_DATALEN] = count_data; - -#if __DEBUG - Serial.print("\r\n*************************************************************\r\n"); - Serial.print("len\t = ");Serial.println(revData[D_LEN]); - Serial.print("start_h\t = ");Serial.println(revData[D_STARTH]); - Serial.print("start_l\t = ");Serial.println(revData[D_STARTL]); - Serial.print("short\t = ");Serial.println(revData[D_SHORT]); - Serial.print("long\t = ");Serial.println(revData[D_LONG]); - Serial.print("data_len = ");Serial.println(revData[D_DATALEN]); - for(int i = 0; i to support other boards and timers - * Modified by Mitra Ardron - * Added Sanyo and Mitsubishi controllers - * Modified Sony to spot the repeat codes that some Sony's send - * - * Modifier by - * Interrupt code based on NECIRrcv by Joe Knapp - * http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1210243556 - * Also influenced by http://zovirl.com/2008/11/12/building-a-universal-remote-with-an-arduino/ - * - */ - -#ifndef _IRSENDREV_H_ -#define _IRSENDREV_H_ - -// len, start_H, start_L, nshort, nlong, data_len, data[data_len].... -#define D_LEN 0 -#define D_STARTH 1 -#define D_STARTL 2 -#define D_SHORT 3 -#define D_LONG 4 -#define D_DATALEN 5 -#define D_DATA 6 - - -#define USECPERTICK 50 // microseconds per clock interrupt tick -#define RAWBUF 300 // Length of raw duration buffer - -// Marks tend to be 100us too long, and spaces 100us too short -// when received due to sensor lag. -#define MARK_EXCESS 100 - -#define __DEBUG 0 - -// Results returned from the decoder -class decode_results { - - public: - volatile unsigned int *rawbuf; // Raw intervals in .5 us ticks - int rawlen; // Number of records in rawbuf. -}; - -// main class for receiving IR -class IRSendRev -{ - private: - decode_results results; - //**************************rev********************************** - - private: - int decode(decode_results *results); - void enableIRIn(); - - public: - - void Init(int revPin); // init - void Init(); - unsigned char Recv(unsigned char *revData); // - unsigned char IsDta(); // if IR get data - void Clear(); // clear IR data - - //**************************send********************************* - private: - - void sendRaw(unsigned int buf[], int len, int hz); - - // private: - - void mark(int usec); - void space(int usec); - void enableIROut(int khz); - - public: - - void Send(unsigned char *idata, unsigned char ifreq); - -}; - -extern IRSendRev IR; - -#endif diff --git a/arduino-example/IRSendRevInt.h b/arduino-example/IRSendRevInt.h deleted file mode 100644 index 23cfe6b..0000000 --- a/arduino-example/IRSendRevInt.h +++ /dev/null @@ -1,341 +0,0 @@ -/* - * IRremote - * Version 0.1 July, 2009 - * Copyright 2009 Ken Shirriff - * For details, see http://arcfn.com/2009/08/multi-protocol-infrared-remote-library.html - * - * Modified by Paul Stoffregen to support other boards and timers - * - * Interrupt code based on NECIRrcv by Joe Knapp - * http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1210243556 - * Also influenced by http://zovirl.com/2008/11/12/building-a-universal-remote-with-an-arduino/ - * - * JVC and Panasonic protocol added by Kristian Lauszus (Thanks to zenwheel and other people at the original blog post) - */ - -#ifndef _IRSENDREVINT_H_ -#define _IRSENDREVINT_H_ - -#if defined(ARDUINO) && ARDUINO >= 100 -#include -#else -#include -#endif - -// define which timer to use -// -// Uncomment the timer you wish to use on your board. If you -// are using another library which uses timer2, you have options -// to switch IRremote to use a different timer. - -// Arduino Mega -#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) -//#define IR_USE_TIMER1 // tx = pin 11 - #define IR_USE_TIMER2 // tx = pin 9 -//#define IR_USE_TIMER3 // tx = pin 5 -//#define IR_USE_TIMER4 // tx = pin 6 -//#define IR_USE_TIMER5 // tx = pin 46 - -// Teensy 1.0 -#elif defined(__AVR_AT90USB162__) - #define IR_USE_TIMER1 // tx = pin 17 - -// Teensy 2.0 -#elif defined(__AVR_ATmega32U4__) -//#define IR_USE_TIMER1 // tx = pin 14 -//#define IR_USE_TIMER3 // tx = pin 9 - #define IR_USE_TIMER4_HS // tx = pin 10 - -// Teensy++ 1.0 & 2.0 -#elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__) -//#define IR_USE_TIMER1 // tx = pin 25 - #define IR_USE_TIMER2 // tx = pin 1 -//#define IR_USE_TIMER3 // tx = pin 16 - -// Sanguino -#elif defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644__) -//#define IR_USE_TIMER1 // tx = pin 13 - #define IR_USE_TIMER2 // tx = pin 14 - -// Atmega8 -#elif defined(__AVR_ATmega8P__) || defined(__AVR_ATmega8__) - #define IR_USE_TIMER1 // tx = pin 9 - -// Arduino Duemilanove, Diecimila, LilyPad, Mini, Fio, etc -#else -//#define IR_USE_TIMER1 // tx = pin 9 - #define IR_USE_TIMER2 // tx = pin 3 -#endif - - - -#ifdef F_CPU -#define SYSCLOCK F_CPU // main Arduino clock -#else -#define SYSCLOCK 16000000 // main Arduino clock -#endif - -#define ERR 0 -#define DECODED 1 - - -// defines for setting and clearing register bits -#ifndef cbi -#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) -#endif -#ifndef sbi -#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit)) -#endif - - -#define TOLERANCE 25 // percent tolerance in measurements -#define LTOL (1.0 - TOLERANCE/100.) -#define UTOL (1.0 + TOLERANCE/100.) - -#define _GAP 5000 // Minimum map between transmissions -#define GAP_TICKS (_GAP/USECPERTICK) - -#define TICKS_LOW(us) (int) (((us)*LTOL/USECPERTICK)) -#define TICKS_HIGH(us) (int) (((us)*UTOL/USECPERTICK + 1)) - - -// receiver states -#define STATE_IDLE 2 -#define STATE_MARK 3 -#define STATE_SPACE 4 -#define STATE_STOP 5 - -// information for the interrupt handler -typedef struct { - uint8_t recvpin; // pin for IR data from detector - uint8_t rcvstate; // state machine - unsigned int timer; // state timer, counts 50uS ticks. - unsigned int rawbuf[RAWBUF]; // raw data - uint8_t rawlen; // counter of entries in rawbuf -} irparams_t; - -// Defined in IRremote.cpp -extern volatile irparams_t irparams; - -// IR detector output is active low -#define MARK 0 -#define SPACE 1 - -#define TOPBIT 0x80000000 - -// defines for timer2 (8 bits) -#if defined(IR_USE_TIMER2) -#define TIMER_RESET -#define TIMER_ENABLE_PWM (TCCR2A |= _BV(COM2B1)) -#define TIMER_DISABLE_PWM (TCCR2A &= ~(_BV(COM2B1))) -#define TIMER_ENABLE_INTR (TIMSK2 = _BV(OCIE2A)) -#define TIMER_DISABLE_INTR (TIMSK2 = 0) -#define TIMER_INTR_NAME TIMER2_COMPA_vect -#define TIMER_CONFIG_KHZ(val) ({ \ - const uint8_t pwmval = SYSCLOCK / 2000 / (val); \ - TCCR2A = _BV(WGM20); \ - TCCR2B = _BV(WGM22) | _BV(CS20); \ - OCR2A = pwmval; \ - OCR2B = pwmval / (100/10); \ -}) -#define TIMER_COUNT_TOP (SYSCLOCK * USECPERTICK / 1000000) -#if (TIMER_COUNT_TOP < 256) -#define TIMER_CONFIG_NORMAL() ({ \ - TCCR2A = _BV(WGM21); \ - TCCR2B = _BV(CS20); \ - OCR2A = TIMER_COUNT_TOP; \ - TCNT2 = 0; \ -}) -#else -#define TIMER_CONFIG_NORMAL() ({ \ - TCCR2A = _BV(WGM21); \ - TCCR2B = _BV(CS21); \ - OCR2A = TIMER_COUNT_TOP / 8; \ - TCNT2 = 0; \ -}) -#endif -#if defined(CORE_OC2B_PIN) -#define TIMER_PWM_PIN CORE_OC2B_PIN /* Teensy */ -#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) -#define TIMER_PWM_PIN 9 /* Arduino Mega */ -#elif defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644__) -#define TIMER_PWM_PIN 14 /* Sanguino */ -#else -#define TIMER_PWM_PIN 3 /* Arduino Duemilanove, Diecimi */ - /* la, LilyPad, etc */ -#endif - - -// defines for timer1 (16 bits) -#elif defined(IR_USE_TIMER1) -#define TIMER_RESET -#define TIMER_ENABLE_PWM (TCCR1A |= _BV(COM1A1)) -#define TIMER_DISABLE_PWM (TCCR1A &= ~(_BV(COM1A1))) -#if defined(__AVR_ATmega8P__) || defined(__AVR_ATmega8__) - #define TIMER_ENABLE_INTR (TIMSK = _BV(OCIE1A)) - #define TIMER_DISABLE_INTR (TIMSK = 0) -#else - #define TIMER_ENABLE_INTR (TIMSK1 = _BV(OCIE1A)) - #define TIMER_DISABLE_INTR (TIMSK1 = 0) -#endif -#define TIMER_INTR_NAME TIMER1_COMPA_vect -#define TIMER_CONFIG_KHZ(val) ({ \ - const uint16_t pwmval = SYSCLOCK / 2000 / (val); \ - TCCR1A = _BV(WGM11); \ - TCCR1B = _BV(WGM13) | _BV(CS10); \ - ICR1 = pwmval; \ - OCR1A = pwmval / 3; \ -}) -#define TIMER_CONFIG_NORMAL() ({ \ - TCCR1A = 0; \ - TCCR1B = _BV(WGM12) | _BV(CS10); \ - OCR1A = SYSCLOCK * USECPERTICK / 1000000; \ - TCNT1 = 0; \ -}) -#if defined(CORE_OC1A_PIN) -#define TIMER_PWM_PIN CORE_OC1A_PIN /* Teensy */ -#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) -#define TIMER_PWM_PIN 11 /* Arduino Mega */ -#elif defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644__) -#define TIMER_PWM_PIN 13 /* Sanguino */ -#else -#define TIMER_PWM_PIN 9 /* Arduino Duemilanove, Diecimi */ - /* la, LilyPad, etc */ -#endif - - -// defines for timer3 (16 bits) -#elif defined(IR_USE_TIMER3) -#define TIMER_RESET -#define TIMER_ENABLE_PWM (TCCR3A |= _BV(COM3A1)) -#define TIMER_DISABLE_PWM (TCCR3A &= ~(_BV(COM3A1))) -#define TIMER_ENABLE_INTR (TIMSK3 = _BV(OCIE3A)) -#define TIMER_DISABLE_INTR (TIMSK3 = 0) -#define TIMER_INTR_NAME TIMER3_COMPA_vect -#define TIMER_CONFIG_KHZ(val) ({ \ - const uint16_t pwmval = SYSCLOCK / 2000 / (val); \ - TCCR3A = _BV(WGM31); \ - TCCR3B = _BV(WGM33) | _BV(CS30); \ - ICR3 = pwmval; \ - OCR3A = pwmval / 3; \ -}) -#define TIMER_CONFIG_NORMAL() ({ \ - TCCR3A = 0; \ - TCCR3B = _BV(WGM32) | _BV(CS30); \ - OCR3A = SYSCLOCK * USECPERTICK / 1000000; \ - TCNT3 = 0; \ -}) -#if defined(CORE_OC3A_PIN) -#define TIMER_PWM_PIN CORE_OC3A_PIN /* Teensy */ -#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) -#define TIMER_PWM_PIN 5 /* Arduino Mega */ -#else -#error "Please add OC3A pin number here\n" -#endif - - -// defines for timer4 (10 bits, high speed option) -#elif defined(IR_USE_TIMER4_HS) -#define TIMER_RESET -#define TIMER_ENABLE_PWM (TCCR4A |= _BV(COM4A1)) -#define TIMER_DISABLE_PWM (TCCR4A &= ~(_BV(COM4A1))) -#define TIMER_ENABLE_INTR (TIMSK4 = _BV(TOIE4)) -#define TIMER_DISABLE_INTR (TIMSK4 = 0) -#define TIMER_INTR_NAME TIMER4_OVF_vect -#define TIMER_CONFIG_KHZ(val) ({ \ - const uint16_t pwmval = SYSCLOCK / 2000 / (val); \ - TCCR4A = (1<> 8; \ - OCR4C = pwmval; \ - TC4H = (pwmval / 3) >> 8; \ - OCR4A = (pwmval / 3) & 255; \ -}) -#define TIMER_CONFIG_NORMAL() ({ \ - TCCR4A = 0; \ - TCCR4B = _BV(CS40); \ - TCCR4C = 0; \ - TCCR4D = 0; \ - TCCR4E = 0; \ - TC4H = (SYSCLOCK * USECPERTICK / 1000000) >> 8; \ - OCR4C = (SYSCLOCK * USECPERTICK / 1000000) & 255; \ - TC4H = 0; \ - TCNT4 = 0; \ -}) -#if defined(CORE_OC4A_PIN) -#define TIMER_PWM_PIN CORE_OC4A_PIN /* Teensy */ -#else -#error "Please add OC4A pin number here\n" -#endif - - -// defines for timer4 (16 bits) -#elif defined(IR_USE_TIMER4) -#define TIMER_RESET -#define TIMER_ENABLE_PWM (TCCR4A |= _BV(COM4A1)) -#define TIMER_DISABLE_PWM (TCCR4A &= ~(_BV(COM4A1))) -#define TIMER_ENABLE_INTR (TIMSK4 = _BV(OCIE4A)) -#define TIMER_DISABLE_INTR (TIMSK4 = 0) -#define TIMER_INTR_NAME TIMER4_COMPA_vect -#define TIMER_CONFIG_KHZ(val) ({ \ - const uint16_t pwmval = SYSCLOCK / 2000 / (val); \ - TCCR4A = _BV(WGM41); \ - TCCR4B = _BV(WGM43) | _BV(CS40); \ - ICR4 = pwmval; \ - OCR4A = pwmval / 3; \ -}) -#define TIMER_CONFIG_NORMAL() ({ \ - TCCR4A = 0; \ - TCCR4B = _BV(WGM42) | _BV(CS40); \ - OCR4A = SYSCLOCK * USECPERTICK / 1000000; \ - TCNT4 = 0; \ -}) -#if defined(CORE_OC4A_PIN) -#define TIMER_PWM_PIN CORE_OC4A_PIN -#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) -#define TIMER_PWM_PIN 6 /* Arduino Mega */ -#else -#error "Please add OC4A pin number here\n" -#endif - - -// defines for timer5 (16 bits) -#elif defined(IR_USE_TIMER5) -#define TIMER_RESET -#define TIMER_ENABLE_PWM (TCCR5A |= _BV(COM5A1)) -#define TIMER_DISABLE_PWM (TCCR5A &= ~(_BV(COM5A1))) -#define TIMER_ENABLE_INTR (TIMSK5 = _BV(OCIE5A)) -#define TIMER_DISABLE_INTR (TIMSK5 = 0) -#define TIMER_INTR_NAME TIMER5_COMPA_vect -#define TIMER_CONFIG_KHZ(val) ({ \ - const uint16_t pwmval = SYSCLOCK / 2000 / (val); \ - TCCR5A = _BV(WGM51); \ - TCCR5B = _BV(WGM53) | _BV(CS50); \ - ICR5 = pwmval; \ - OCR5A = pwmval / 3; \ -}) -#define TIMER_CONFIG_NORMAL() ({ \ - TCCR5A = 0; \ - TCCR5B = _BV(WGM52) | _BV(CS50); \ - OCR5A = SYSCLOCK * USECPERTICK / 1000000; \ - TCNT5 = 0; \ -}) -#if defined(CORE_OC5A_PIN) -#define TIMER_PWM_PIN CORE_OC5A_PIN -#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) -#define TIMER_PWM_PIN 46 /* Arduino Mega */ -#else -#error "Please add OC5A pin number here\n" -#endif - - -#else // unknown timer -#error "Internal code configuration error, no known IR_USE_TIMER# defined\n" -#endif - - - -#endif diff --git a/arduino-example/examples/revTest/revTest.ino b/arduino-example/examples/revTest/revTest.ino deleted file mode 100644 index 5f2619b..0000000 --- a/arduino-example/examples/revTest/revTest.ino +++ /dev/null @@ -1,34 +0,0 @@ -//************** -//IR receive demo v1.0 -//****************************** -#include -//#include -#define IR_OUT_PIN 2//The OUT pin of the Infrared Receiver is connected to D2 of Arduino/Catduino -void setup() -{ - Serial.begin(38400); - IR.Init(IR_OUT_PIN); - Serial.println("init over"); -} - -unsigned char dta[20]; - -void loop() -{ - if(IR.IsDta()) - { - // IR.Recv(dta); - int length= IR.Recv(dta); - for (int i =0;i - -void setup() -{ - //enableIROut(38); -} -//unsigned char d[] = {9, 90, 91, 11, 31, 4, 1, 2, 3, 4}; -unsigned char d[] = {15, 70, 70, 20, 60, 10, 1, 2, 3, 4,5,6,7,8,9,10}; -//Very Important: -//the first parameter(15): the length of data that needs to be sent;15 = 15Bytes -//the next 2 parameter(70,70): the logic high and low duration of "Start"; -//the next 2 parameter(20,60): the logic "short" and "long"duration in the communication -// that to say: if "0", the high duration is 20ms and low is 20 ms; while logic "1", -// the high duration is 20 ms and low is 60 ms; -//the next 2 parameter(10): number of data you will sent; -//the next parameter(1, 2, 3, 4,5,6,7,8,9,10): data you will sent ; -void loop() -{ - IR.Send(d, 38);//sent the data via 38Kz IR - delay(1000); -} diff --git a/arduino-example/keywords.txt b/arduino-example/keywords.txt deleted file mode 100644 index 3fe1ba5..0000000 --- a/arduino-example/keywords.txt +++ /dev/null @@ -1,29 +0,0 @@ -####################################### -# IRSendRev -####################################### - -####################################### -# Datatypes (KEYWORD1) -####################################### -IRSendRev KEYWORD1 -IRSendRevInt KEYWORD1 -IR KEYWORD1 -####################################### -# Methods and Functions (KEYWORD2) -####################################### -Init KEYWORD2 -Recv KEYWORD2 -IsDta KEYWORD2 -Clear KEYWORD2 -Send KEYWORD2 - -####################################### -# Constants (LITERAL1) -####################################### -D_LEN LITERAL1 -D_STARTH LITERAL1 -D_STARTL LITERAL1 -D_SHORT LITERAL1 -D_LONG LITERAL1 -D_DATALEN LITERAL1 -D_DATA LITERAL1 diff --git a/cc25xx-example/ti/BLE-CC254x/Projects/ble/Profiles/SimpleProfile/simpleGATTprofile.c b/cc25xx-example/ti/BLE-CC254x/Projects/ble/Profiles/SimpleProfile/simpleGATTprofile.c index bfdce88..7ab3353 100644 --- a/cc25xx-example/ti/BLE-CC254x/Projects/ble/Profiles/SimpleProfile/simpleGATTprofile.c +++ b/cc25xx-example/ti/BLE-CC254x/Projects/ble/Profiles/SimpleProfile/simpleGATTprofile.c @@ -53,11 +53,11 @@ #include "hal_lcd.h" #include "simpleBle.h" - +/* #define LCD_WRITE_STRING(str, option) #define LCD_WRITE_SCREEN(line1, line2) #define LCD_WRITE_STRING_VALUE(title, value, format, line) - +*/ /********************************************************************* diff --git a/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/CC2541DB/SimpleBLEPeripheral.dep b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/CC2541DB/SimpleBLEPeripheral.dep index 7a9902a..6be5864 100644 --- a/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/CC2541DB/SimpleBLEPeripheral.dep +++ b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/CC2541DB/SimpleBLEPeripheral.dep @@ -2,260 +2,872 @@ 2 - 819807562 + 726517773 CC2541 - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_flash.c - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_lcd.c - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_sleep.c - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_key.c - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_dma.c - $PROJ_DIR$\CC2541\Obj\osal_cbtimer.pbi - $PROJ_DIR$\CC2541\Obj\hal_key.pbi - $PROJ_DIR$\..\..\..\..\Components\osal\include\OSAL.h - $TOOLKIT_DIR$\inc\clib\stdio.h - $PROJ_DIR$\CC2541\Obj\hal_startup.pbi - $PROJ_DIR$\CC2541\Obj\hal_drivers.r51 - $PROJ_DIR$\CC2541\Obj\central.pbi - $PROJ_DIR$\CC2541\Obj\hal_timer.r51 - $PROJ_DIR$\CC2541\Obj\OSAL_Memory.pbi - $PROJ_DIR$\CC2541\Obj\OSAL.pbi - $PROJ_DIR$\CC2541\Obj\OnBoard.pbi - $PROJ_DIR$\CC2541\Obj\osal_snv.r51 - $PROJ_DIR$\CC2541\Obj\gapbondmgr.r51 - $PROJ_DIR$\CC2541\Obj\hal_led.pbi - $PROJ_DIR$\..\..\..\..\Components\osal\include\OSAL_Tasks.h - $PROJ_DIR$\CC2541\Obj\simpleBLEPeripheral.pbi - $PROJ_DIR$\..\..\..\..\Components\osal\include\OSAL_Memory.h - $PROJ_DIR$\CC2541\Obj\OSAL_Memory.r51 - $PROJ_DIR$\CC2541\Obj\hal_timer.pbi - $PROJ_DIR$\CC2541\Obj\gatt_uuid.pbi - $PROJ_DIR$\CC2541\Obj\hal_aes.r51 - $PROJ_DIR$\CC2541\Obj\hal_drivers.pbi - $TOOLKIT_DIR$\inc\clib\limits.h - $PROJ_DIR$\CC2541\Exe\SimpleBLEPeripheral.d51 - $PROJ_DIR$\CC2541\Obj\npi.r51 - $PROJ_DIR$\CC2541\Obj\hal_adc.pbi - $TOOLKIT_DIR$\inc\ioCC2541.h - $PROJ_DIR$\CC2541\Obj\hal_uart.pbi - $PROJ_DIR$\..\..\..\..\Components\ble\hci\hci_data.h - $PROJ_DIR$\CC2541\Obj\hal_aes.pbi - $PROJ_DIR$\CC2541\Obj\OSAL_ClockBLE.pbi - $PROJ_DIR$\CC2541\Obj\hal_crc.pbi - $PROJ_DIR$\CC2541\Obj\OSAL_PwrMgr.pbi - $TOOLKIT_DIR$\inc\clib\stdarg.h - $PROJ_DIR$\..\..\..\..\Components\ble\hci\hci_tl.h - $PROJ_DIR$\CC2541\Obj\hal_key.r51 - $PROJ_DIR$\CC2541\Obj\devinfoservice.pbi - $PROJ_DIR$\CC2541\Obj\central.r51 - $PROJ_DIR$\CC2541\Obj\OSAL_SimpleBLEPeripheral.pbi - $PROJ_DIR$\CC2541\Obj\hal_adc.r51 - $PROJ_DIR$\CC2541\Obj\hal_startup.r51 - $PROJ_DIR$\CC2541\Obj\hal_flash.pbi - $PROJ_DIR$\..\..\..\..\Components\osal\include\osal_snv.h - $PROJ_DIR$\CC2541\Obj\OSAL_PwrMgr.r51 - $PROJ_DIR$\CC2541\Obj\gatt_uuid.r51 - $PROJ_DIR$\CC2541\Obj\OSAL_Timers.pbi - $PROJ_DIR$\..\..\..\..\Components\osal\include\OSAL_Timers.h - $PROJ_DIR$\CC2541\Obj\OSAL_simpleBLECentral.pbi - $PROJ_DIR$\CC2541\Obj\OSAL.r51 - $PROJ_DIR$\CC2541\Obj\SimpleBLEPeripheral_Main.r51 - $PROJ_DIR$\CC2541\Obj\hal_sleep.r51 - $PROJ_DIR$\CC2541\Obj\gap.pbi - $PROJ_DIR$\CC2541\Obj\osal_snv.pbi - $PROJ_DIR$\CC2541\Obj\gap.r51 - $PROJ_DIR$\CC2541\Obj\peripheral.pbi - $PROJ_DIR$\CC2541\Obj\hal_lcd.r51 - $PROJ_DIR$\CC2541\Obj\osal_bufmgr.pbi - $PROJ_DIR$\CC2541\Obj\simpleBLE.pbi - $PROJ_DIR$\CC2541\Obj\OSAL_SimpleBLEPeripheral.r51 - $PROJ_DIR$\CC2541\Obj\SimpleBLEPeripheral.pbd - $PROJ_DIR$\CC2541\Obj\hal_led.r51 - $PROJ_DIR$\CC2541\Obj\OnBoard.r51 - $PROJ_DIR$\CC2541\Obj\OSAL_ClockBLE.r51 - $PROJ_DIR$\..\..\..\..\Components\osal\include\comdef.h - $PROJ_DIR$\CC2541\Obj\simpleGATTprofile.r51 - $PROJ_DIR$\CC2541\Obj\hal_dma.r51 - $PROJ_DIR$\CC2541\Obj\devinfoservice.r51 - $PROJ_DIR$\CC2541\Obj\osal_cbtimer.r51 - $PROJ_DIR$\CC2541\Obj\peripheral.r51 - $PROJ_DIR$\CC2541\Obj\simpleBLEPeripheral.r51 - $PROJ_DIR$\CC2541\Obj\simpleGATTprofile.pbi - $PROJ_DIR$\..\..\..\..\Components\osal\include\osal_cbtimer.h - $PROJ_DIR$\CC2541\Obj\hal_crc.r51 - $PROJ_DIR$\CC2541\Obj\hal_flash.r51 - $PROJ_DIR$\CC2541\Obj\hal_sleep.pbi - $PROJ_DIR$\CC2541\Obj\hal_uart.r51 - $PROJ_DIR$\CC2541\Obj\OSAL_Timers.r51 - $PROJ_DIR$\..\..\..\..\Components\osal\include\osal_bufmgr.h - $PROJ_DIR$\..\..\..\..\Components\ble\hci\hci_event.h - $PROJ_DIR$\CC2541\Obj\npi.pbi - $PROJ_DIR$\CC2541\Obj\osal_bufmgr.r51 - $PROJ_DIR$\CC2541\Obj\hal_lcd.pbi - $PROJ_DIR$\CC2541\Obj\simpleBLECentral.r51 - $PROJ_DIR$\CC2541\Obj\hal_dma.pbi - $PROJ_DIR$\CC2541\Obj\simpleBLECentral.pbi - $TOOLKIT_DIR$\inc\clib\sysmac.h - $PROJ_DIR$\CC2541\Obj\SimpleBLEPeripheral_Main.pbi - $PROJ_DIR$\CC2541\Obj\gapbondmgr.pbi - $PROJ_DIR$\CC2541\Obj\simpleBLE.r51 - $PROJ_DIR$\..\Source\simpleBLE.c - $PROJ_DIR$\..\Source\OSAL_SimpleBLEPeripheral.c - $PROJ_DIR$\..\Source\OSAL_simpleBLECentral.c - $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_assert.h + $PROJ_DIR$\..\Source\Irext\src\ir_ac_apply.c + $PROJ_DIR$\..\Source\Irext\src\ir_ac_binary_parse.c + $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_led.h + $PROJ_DIR$\..\Source\Irext\src\ir_decode.c + $PROJ_DIR$\..\Source\simpleBLEPeripheral.h + $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_board.h + $PROJ_DIR$\..\Source\Irext\src\ir_utils.c + $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_defs.h + $PROJ_DIR$\..\..\..\..\Components\hal\common\hal_drivers.c $PROJ_DIR$\..\Source\simpleBLECentral.c - $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_lcd.h - $PROJ_DIR$\..\Source\simpleble.h + $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_drivers.h $PROJ_DIR$\..\Source\simpleBLECentral.h $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_key.h - $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_led.h - $PROJ_DIR$\..\..\..\..\Components\hal\common\hal_drivers.c - $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_uart.h - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_board_cfg.h - $PROJ_DIR$\..\Source\simpleBLEPeripheral.c - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_adc.c - $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_sleep.h - $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_defs.h - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_crc.c - $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_adc.h - $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_board.h - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_aes.c - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_led.c - $PROJ_DIR$\..\Source\simpleBLEPeripheral.h + $PROJ_DIR$\..\Source\OSAL_SimpleBLEPeripheral.c + $PROJ_DIR$\..\Source\Irext\src\ir_ac_parse_forbidden_info.c + $PROJ_DIR$\..\Source\Irext\src\ir_ac_build_frame.c + $PROJ_DIR$\..\Source\Irext\src\ir_ac_control.c + $PROJ_DIR$\..\Source\Irext\src\ir_ac_parse_parameter.c $PROJ_DIR$\..\Source\SimpleBLEPeripheral_Main.c - $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_drivers.h - $PROJ_DIR$\..\..\Profiles\Roles\peripheralBroadcaster.h + $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_adc.h + $PROJ_DIR$\..\Source\simpleBLEPeripheral.c + $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_assert.h + $PROJ_DIR$\..\Source\Irext\src\ir_tv_control.c + $PROJ_DIR$\..\Source\OSAL_simpleBLECentral.c + $PROJ_DIR$\..\Source\simpleBLE.c + $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_flash.h + $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_lcd.h + $PROJ_DIR$\..\Source\simpleBle.h + $PROJ_DIR$\..\Source\Irext\src\ir_ac_parse_frame_info.c + $TOOLKIT_DIR$\lib\clib\cl-pli-blxd-1e16x01.r51 + $PROJ_DIR$\..\..\common\cc2540\ti_51ew_cc2540b.xcl $PROJ_DIR$\..\..\Profiles\Roles\gapbondmgr.c - $PROJ_DIR$\..\..\Profiles\SimpleProfile\simpleGATTprofile.c - $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL_Timers.c - $PROJ_DIR$\..\..\Profiles\DevInfo\devinfoservice.h - $PROJ_DIR$\..\..\Profiles\Keys\simplekeys.c - $PROJ_DIR$\..\..\Profiles\Keys\simplekeys.h - $PROJ_DIR$\..\..\common\cc2540\OnBoard.h - $PROJ_DIR$\..\..\Profiles\Roles\central.h $PROJ_DIR$\..\..\Include\gattservapp.h - $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL_ClockBLE.c - $PROJ_DIR$\..\..\Include\gapgattserver.h - $PROJ_DIR$\..\..\Profiles\Roles\peripheralBroadcaster.c - $PROJ_DIR$\..\..\..\..\Components\osal\mcu\cc2540\osal_snv.c - $PROJ_DIR$\..\..\Profiles\SimpleProfile\simpleGATTprofile.h - $PROJ_DIR$\..\..\Profiles\Roles\gapbondmgr.h - $PROJ_DIR$\..\..\common\cc2540\OnBoard.c - $PROJ_DIR$\..\..\Profiles\Roles\peripheral.h - $PROJ_DIR$\..\..\..\..\Components\osal\include\OSAL_PwrMgr.h - $PROJ_DIR$\..\..\Profiles\OAD\oad_target.c - $PROJ_DIR$\..\..\..\..\Components\ble\host\gatt_uuid.c - $PROJ_DIR$\..\..\..\..\Components\osal\common\osal_cbtimer.c - $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL_Memory.c - $PROJ_DIR$\..\..\Profiles\Roles\peripheral.c - $PROJ_DIR$\..\..\Profiles\DevInfo\devinfoservice.c - $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL_PwrMgr.c - $PROJ_DIR$\..\..\Profiles\Roles\gap.c - $PROJ_DIR$\..\..\Profiles\Roles\central.c $PROJ_DIR$\..\..\Profiles\OAD\oad.h $PROJ_DIR$\..\..\Profiles\OAD\oad_target.h - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_mcu.h - $PROJ_DIR$\..\..\..\..\Components\ble\include\gap.h - $PROJ_DIR$\..\..\..\..\Components\ble\include\gatt.h - $PROJ_DIR$\..\..\..\..\Components\ble\include\l2cap.h - $PROJ_DIR$\..\..\..\..\Components\ble\controller\include\ll.h + $PROJ_DIR$\..\..\Profiles\Roles\central.c + $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL_Timers.c + $PROJ_DIR$\..\..\Include\gapgattserver.h + $PROJ_DIR$\..\..\Profiles\OAD\oad_target.c + $PROJ_DIR$\..\..\Profiles\Roles\peripheral.c + $PROJ_DIR$\..\..\..\..\Components\osal\common\osal_bufmgr.c + $PROJ_DIR$\..\..\Profiles\Roles\peripheral.h $PROJ_DIR$\..\..\Libraries\CC2541DB\bin\CC2541_BLE.lib + $PROJ_DIR$\..\..\Profiles\Roles\peripheralBroadcaster.c + $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL.c + $PROJ_DIR$\..\..\common\npi\npi_np\npi.h + $PROJ_DIR$\..\..\Profiles\Roles\gap.c + $PROJ_DIR$\..\..\..\..\Components\ble\controller\include\ll.h $PROJ_DIR$\..\..\Libraries\Common\bin\CC254x_BLE_HCI_TL_None.lib $PROJ_DIR$\..\..\common\npi\npi_np\npi.c - $PROJ_DIR$\..\..\..\..\Components\ble\include\hci.h - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_startup.c - $PROJ_DIR$\..\..\common\npi\npi_np\npi.h - $PROJ_DIR$\..\..\..\..\Components\ble\include\sm.h + $PROJ_DIR$\..\..\..\..\Components\osal\common\osal_cbtimer.c + $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL_Memory.c + $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL_PwrMgr.c + $PROJ_DIR$\..\..\..\..\Components\osal\mcu\cc2540\osal_snv.c + $PROJ_DIR$\..\..\Profiles\Roles\central.h + $PROJ_DIR$\..\..\..\..\Components\ble\controller\include\phy.h + $PROJ_DIR$\..\..\Profiles\DevInfo\devinfoservice.c + $PROJ_DIR$\..\..\Profiles\DevInfo\devinfoservice.h $PROJ_DIR$\..\..\..\..\Components\ble\include\bcomdef.h - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_types.h - $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL.c - $PROJ_DIR$\..\..\..\..\Components\osal\common\osal_bufmgr.c - $PROJ_DIR$\CC2541\Obj\OSAL_simpleBLECentral.r51 + $PROJ_DIR$\..\..\Profiles\Roles\gapbondmgr.h + $PROJ_DIR$\..\..\..\..\Components\ble\include\sm.h + $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL_ClockBLE.c + $PROJ_DIR$\..\..\..\..\Components\ble\host\gatt_uuid.c + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_adc.c + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_aes.c + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_sleep.c + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_startup.c + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_lcd.c $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_timer.c + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_dma.h + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_mcu.h + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_flash.c + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_key.c + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_dma.c $PROJ_DIR$\..\..\..\..\Components\ble\include\att.h + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_led.c + $PROJ_DIR$\..\..\..\..\Components\ble\include\gatt.h + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_crc.c + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_ccm.h + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_types.h $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_uart.c + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_aes.h + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_board_cfg.h + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_crc.h + $PROJ_DIR$\..\..\..\..\Components\ble\include\gatt_uuid.h + $PROJ_DIR$\..\..\..\..\Components\ble\include\hci.h + $PROJ_DIR$\..\..\..\..\Components\ble\host\linkdb.h + $PROJ_DIR$\..\..\Profiles\Roles\peripheralBroadcaster.h + $PROJ_DIR$\..\..\..\..\Components\ble\include\gap.h + $PROJ_DIR$\..\..\..\..\Components\ble\include\l2cap.h + $PROJ_DIR$\CC2541\Obj\gatt_uuid.r51 + $PROJ_DIR$\CC2541\Obj\hal_uart.pbi + $PROJ_DIR$\CC2541\Obj\gap.pbi + $PROJ_DIR$\CC2541\Obj\OSAL_PwrMgr.r51 + $PROJ_DIR$\..\..\Profiles\SimpleProfile\simpleGATTprofile.h + $PROJ_DIR$\CC2541\Obj\OSAL_Memory.r51 + $PROJ_DIR$\CC2541\Obj\hal_sleep.r51 + $PROJ_DIR$\CC2541\Obj\gap.r51 + $PROJ_DIR$\..\..\Profiles\Keys\simplekeys.c + $TOOLKIT_DIR$\inc\clib\stdarg.h + $PROJ_DIR$\CC2541\Obj\OSAL_Timers.pbi + $PROJ_DIR$\CC2541\Obj\osal_snv.pbi + $PROJ_DIR$\..\..\Profiles\SimpleProfile\simpleGATTprofile.c + $PROJ_DIR$\..\..\Profiles\Keys\simplekeys.h + $PROJ_DIR$\..\..\common\cc2540\OnBoard.c + $PROJ_DIR$\CC2541\Obj\devinfoservice.pbi + $PROJ_DIR$\CC2541\Obj\OSAL_simpleBLECentral.pbi + $PROJ_DIR$\CC2541\Obj\peripheral.pbi + $PROJ_DIR$\CC2541\Obj\simpleBLE.pbi + $PROJ_DIR$\CC2541\Obj\hal_aes.pbi + $PROJ_DIR$\CC2541\Obj\SimpleBLEPeripheral_Main.r51 + $PROJ_DIR$\CC2541\Obj\OSAL_SimpleBLEPeripheral.pbi + $PROJ_DIR$\..\..\common\cc2540\OnBoard.h + $PROJ_DIR$\..\..\..\..\Components\osal\include\osal_snv.h + $PROJ_DIR$\..\..\config\buildComponents.cfg + $PROJ_DIR$\..\..\..\..\Components\ble\hci\hci_tl.h + $PROJ_DIR$\buildConfig.cfg + $PROJ_DIR$\..\..\..\..\Components\ble\hci\hci_data.h + $PROJ_DIR$\CC2541\Obj\OSAL.r51 + $PROJ_DIR$\CC2541\Obj\simpleGATTprofile.r51 + $PROJ_DIR$\..\..\..\..\Components\osal\include\OSAL.h + $PROJ_DIR$\CC2541\Obj\hal_uart.r51 + $PROJ_DIR$\CC2541\Obj\osal_bufmgr.r51 + $PROJ_DIR$\CC2541\Obj\OSAL_PwrMgr.pbi + $PROJ_DIR$\CC2541\Obj\devinfoservice.r51 + $PROJ_DIR$\CC2541\Obj\hal_key.r51 + $PROJ_DIR$\..\..\..\..\Components\osal\include\osal_bufmgr.h + $PROJ_DIR$\CC2541\Obj\gapbondmgr.pbi + $PROJ_DIR$\..\..\..\..\Components\osal\include\comdef.h + $PROJ_DIR$\..\..\..\..\Components\osal\include\osal_cbTimer.h + $PROJ_DIR$\CC2541\Obj\simpleBLECentral.r51 + $PROJ_DIR$\CC2541\Obj\hal_timer.r51 + $PROJ_DIR$\CC2541\Obj\OnBoard.pbi + $PROJ_DIR$\CC2541\Obj\central.r51 + $PROJ_DIR$\CC2541\Obj\hal_dma.pbi + $PROJ_DIR$\CC2541\Obj\OSAL.pbi + $PROJ_DIR$\CC2541\Obj\hal_adc.pbi + $PROJ_DIR$\CC2541\Obj\hal_drivers.r51 + $PROJ_DIR$\CC2541\Obj\gatt_uuid.pbi + $PROJ_DIR$\CC2541\Obj\hal_crc.r51 + $TOOLKIT_DIR$\inc\clib\sysmac.h + $PROJ_DIR$\CC2541\Obj\OnBoard.r51 + $PROJ_DIR$\CC2541\Obj\hal_drivers.pbi + $PROJ_DIR$\CC2541\Obj\hal_flash.r51 + $PROJ_DIR$\CC2541\Obj\simpleGATTprofile.pbi + $PROJ_DIR$\CC2541\Obj\hal_key.pbi + $PROJ_DIR$\CC2541\Obj\OSAL_ClockBLE.r51 + $PROJ_DIR$\CC2541\Obj\hal_lcd.pbi + $PROJ_DIR$\CC2541\Obj\OSAL_Timers.r51 + $PROJ_DIR$\CC2541\Obj\hal_aes.r51 + $PROJ_DIR$\CC2541\Obj\ir_utils.pbi + $PROJ_DIR$\..\..\..\..\Components\osal\include\OSAL_Timers.h + $PROJ_DIR$\CC2541\Obj\OSAL_ClockBLE.pbi + $PROJ_DIR$\CC2541\Obj\OSAL_Memory.pbi + $TOOLKIT_DIR$\inc\clib\stdio.h + $TOOLKIT_DIR$\inc\clib\limits.h + $PROJ_DIR$\CC2541\Obj\hal_flash.pbi + $PROJ_DIR$\CC2541\Obj\SimpleBLEPeripheral.pbd + $PROJ_DIR$\CC2541\Obj\simpleBLEPeripheral.pbi + $PROJ_DIR$\CC2541\Obj\gapbondmgr.r51 + $PROJ_DIR$\CC2541\Obj\hal_adc.r51 + $PROJ_DIR$\..\..\..\..\Components\osal\include\OSAL_Memory.h + $PROJ_DIR$\CC2541\Obj\osal_snv.r51 + $PROJ_DIR$\CC2541\Obj\npi.r51 + $PROJ_DIR$\CC2541\Obj\OSAL_SimpleBLEPeripheral.r51 + $PROJ_DIR$\CC2541\Obj\hal_lcd.r51 + $PROJ_DIR$\CC2541\Obj\hal_startup.r51 + $PROJ_DIR$\..\..\..\..\Components\osal\include\OSAL_Tasks.h + $PROJ_DIR$\CC2541\Obj\hal_sleep.pbi + $PROJ_DIR$\CC2541\Obj\osal_cbtimer.pbi + $PROJ_DIR$\CC2541\Obj\hal_led.pbi + $PROJ_DIR$\CC2541\Obj\hal_timer.pbi + $PROJ_DIR$\CC2541\Obj\central.pbi + $PROJ_DIR$\CC2541\Obj\hal_startup.pbi + $PROJ_DIR$\CC2541\Exe\SimpleBLEPeripheral.d51 + $PROJ_DIR$\CC2541\Obj\osal_bufmgr.pbi + $PROJ_DIR$\CC2541\Obj\hal_crc.pbi + $TOOLKIT_DIR$\inc\ioCC2541.h + $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_rpc.h + $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_sleep.h + $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_uart.h + $PROJ_DIR$\..\..\..\..\Components\services\saddr\saddr.h + $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_timer.h + $PROJ_DIR$\CC2541\Obj\simpleBLE.r51 + $PROJ_DIR$\CC2541\Obj\ir_ac_apply.r51 + $PROJ_DIR$\CC2541\Obj\ir_ac_build_frame.pbi + $PROJ_DIR$\..\..\..\..\Components\ble\controller\include\ll_timer2.h + $PROJ_DIR$\CC2541\Obj\ir_tv_control.r51 + $PROJ_DIR$\..\Source\Irext\include\ir_ac_parse_frame_info.h + $PROJ_DIR$\..\..\..\..\Components\ble\controller\include\ll_math.h + $PROJ_DIR$\..\Source\Irext\include\ir_ac_parse_forbidden_info.h + $PROJ_DIR$\..\Source\Irext\include\ir_ac_build_frame.h + $PROJ_DIR$\..\Source\Irext\include\ir_ac_binary_parse.h + $PROJ_DIR$\CC2541\Obj\SimpleBLEPeripheral_Main.pbi + $PROJ_DIR$\..\..\..\..\Components\osal\include\OSAL_Clock.h + $PROJ_DIR$\CC2541\Obj\simpleBLEPeripheral.r51 + $PROJ_DIR$\CC2541\Obj\ir_ac_parse_forbidden_info.pbi + $PROJ_DIR$\..\..\..\..\Components\ble\controller\include\ll_sleep.h + $PROJ_DIR$\CC2541\Obj\npi.pbi + $TOOLKIT_DIR$\inc\clib\stdlib.h + $PROJ_DIR$\CC2541\Obj\simpleBLECentral.pbi + $PROJ_DIR$\CC2541\Obj\peripheral.r51 + $PROJ_DIR$\CC2541\Obj\osal_cbtimer.r51 + $PROJ_DIR$\CC2541\Obj\ir_utils.r51 + $PROJ_DIR$\..\Source\Irext\include\ir_ac_parse_parameter.h + $PROJ_DIR$\..\..\..\..\Components\ble\hci\hci_event.h + $PROJ_DIR$\CC2541\Obj\ir_ac_control.pbi + $PROJ_DIR$\..\..\..\..\Components\osal\include\OSAL_PwrMgr.h + $PROJ_DIR$\CC2541\Obj\hal_led.r51 + $PROJ_DIR$\CC2541\Obj\OSAL_simpleBLECentral.r51 + $PROJ_DIR$\CC2541\Obj\ir_ac_parse_frame_info.pbi + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\_hal_uart_dma.c + $TOOLKIT_DIR$\inc\clib\string.h + $PROJ_DIR$\CC2541\Obj\hal_dma.r51 + $PROJ_DIR$\CC2541\Obj\ir_ac_parse_parameter.pbi + $PROJ_DIR$\CC2541\Obj\ir_tv_control.pbi + $PROJ_DIR$\CC2541\Obj\ir_ac_parse_parameter.r51 + $PROJ_DIR$\..\Source\Irext\include\ir_defs.h + $PROJ_DIR$\CC2541\Obj\ir_ac_parse_frame_info.r51 + $PROJ_DIR$\CC2541\Obj\ir_ac_parse_forbidden_info.r51 + $PROJ_DIR$\..\Source\Irext\include\ir_utils.h + $PROJ_DIR$\CC2541\Obj\ir_ac_apply.pbi + $PROJ_DIR$\..\Source\Irext\include\ir_ac_apply.h + $PROJ_DIR$\CC2541\Obj\ir_ac_binary_parse.pbi + $PROJ_DIR$\..\Source\Irext\include\ir_decode.h + $PROJ_DIR$\CC2541\Obj\ir_ac_build_frame.r51 + $PROJ_DIR$\..\Source\Irext\include\ir_tv_control.h + $PROJ_DIR$\..\Source\Irext\include\ir_ac_control.h + $PROJ_DIR$\CC2541\Obj\ir_ac_binary_parse.r51 + $PROJ_DIR$\CC2541\Obj\ir_decode.pbi + $PROJ_DIR$\CC2541\Obj\ir_ac_control.r51 + $PROJ_DIR$\CC2541\Obj\ir_decode.r51 + $PROJ_DIR$\CC2541\List\SimpleBLEPeripheral.map + $PROJ_DIR$\CC2541\Exe\BLE_MasteSlave_V1.3_cc2541.hex - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_flash.c + $PROJ_DIR$\..\Source\Irext\src\ir_ac_apply.c BICOMP - 46 + 221 ICC8051 - 78 + 184 + + + BICOMP + 220 217 224 154 99 140 227 226 222 + + + ICC8051 + 114 116 220 217 224 154 99 140 227 226 222 + + - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_lcd.c + $PROJ_DIR$\..\Source\Irext\src\ir_ac_binary_parse.c BICOMP - 86 + 223 ICC8051 - 60 + 228 + + + BICOMP + 199 140 192 217 224 154 99 227 226 + + + ICC8051 + 114 116 199 140 192 217 224 154 99 227 226 + + - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_sleep.c + $PROJ_DIR$\..\Source\Irext\src\ir_decode.c BICOMP - 79 + 229 ICC8051 - 55 + 231 + + + BICOMP + 154 99 140 199 212 224 217 227 226 220 191 222 + + + ICC8051 + 114 116 154 99 140 199 212 224 217 227 226 220 191 222 + + - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_key.c + $PROJ_DIR$\..\Source\Irext\src\ir_utils.c BICOMP - 6 + 150 ICC8051 - 40 + 203 + + + BICOMP + 220 217 224 154 99 140 227 226 + + + ICC8051 + 114 116 220 217 224 154 99 140 227 226 + + - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_dma.c + $PROJ_DIR$\..\..\..\..\Components\hal\common\hal_drivers.c BICOMP - 88 + 142 ICC8051 - 70 + 137 + + + BICOMP + 19 79 5 82 70 7 177 81 69 10 12 26 2 179 182 180 120 155 140 128 161 151 + + + ICC8051 + 114 116 19 79 5 82 70 7 177 81 69 10 12 26 2 179 182 180 120 155 140 128 161 151 + + - [ROOT_NODE] + $PROJ_DIR$\..\Source\simpleBLECentral.c - XLINK - 28 + BICOMP + 200 + + + ICC8051 + 130 + + + BICOMP + 58 128 79 7 120 155 140 161 151 207 112 70 177 179 2 5 82 12 26 76 74 89 47 85 21 37 32 54 88 60 59 94 11 45 180 27 + + + ICC8051 + 114 116 58 128 79 7 120 155 140 161 151 207 112 70 177 179 2 5 82 12 26 76 74 89 47 85 21 37 32 54 88 60 59 94 11 45 180 27 + + + + + $PROJ_DIR$\..\Source\OSAL_SimpleBLEPeripheral.c + + + BICOMP + 111 + + + ICC8051 + 164 + + + + + BICOMP + 79 120 155 140 128 7 161 151 167 10 47 58 115 85 21 180 5 82 70 177 117 126 205 129 89 88 60 37 59 76 74 32 41 4 + + + ICC8051 + 114 116 79 120 155 140 128 7 161 151 167 10 47 58 115 85 21 180 5 82 70 177 117 126 205 129 89 88 60 37 59 76 74 32 41 4 + + + + + $PROJ_DIR$\..\Source\Irext\src\ir_ac_parse_forbidden_info.c + + + BICOMP + 196 + + + ICC8051 + 219 + + + + + BICOMP + 154 99 140 199 212 224 217 227 226 190 + + + ICC8051 + 114 116 154 99 140 199 212 224 217 227 226 190 + + + + + $PROJ_DIR$\..\Source\Irext\src\ir_ac_build_frame.c + + + BICOMP + 185 + + + ICC8051 + 225 + + + + + BICOMP + 191 217 224 154 99 140 227 226 + + + ICC8051 + 114 116 191 217 224 154 99 140 227 226 + + + + + $PROJ_DIR$\..\Source\Irext\src\ir_ac_control.c + + + BICOMP + 206 + + + ICC8051 + 230 + + + + + BICOMP + 199 140 154 99 212 227 217 192 224 226 204 190 188 220 + + + ICC8051 + 114 116 199 140 154 99 212 227 217 192 224 226 204 190 188 220 + + + + + $PROJ_DIR$\..\Source\Irext\src\ir_ac_parse_parameter.c + + + BICOMP + 214 + + + ICC8051 + 216 + + + + + BICOMP + 199 140 154 99 212 220 217 224 227 226 204 + + + ICC8051 + 114 116 199 140 154 99 212 220 217 224 227 226 204 + + + + + $PROJ_DIR$\..\Source\SimpleBLEPeripheral_Main.c + + + BICOMP + 193 + + + ICC8051 + 110 + + + + + BICOMP + 79 12 5 82 70 7 177 182 10 2 120 155 140 128 161 151 167 207 113 112 179 27 + + + ICC8051 + 114 116 79 12 5 82 70 7 177 182 10 2 120 155 140 128 161 151 167 207 113 112 179 27 + + + + + $PROJ_DIR$\..\Source\simpleBLEPeripheral.c + + + BICOMP + 158 + + + ICC8051 + 195 + + + + + BICOMP + 58 128 79 7 120 155 140 161 151 207 112 70 177 179 19 5 82 2 12 26 76 74 89 85 47 21 37 32 57 94 41 59 88 60 4 27 45 180 + + + ICC8051 + 114 116 58 128 79 7 120 155 140 161 151 207 112 70 177 179 19 5 82 2 12 26 76 74 89 85 47 21 37 32 57 94 41 59 88 60 4 27 45 180 + + + + + $PROJ_DIR$\..\Source\Irext\src\ir_tv_control.c + + + BICOMP + 215 + + + ICC8051 + 187 + + + + + BICOMP + 212 140 217 224 154 99 227 226 + + + ICC8051 + 114 116 212 140 217 224 154 99 227 226 + + + + + $PROJ_DIR$\..\Source\OSAL_simpleBLECentral.c + + + BICOMP + 106 + + + ICC8051 + 209 + + + + + BICOMP + 79 120 155 140 128 7 161 151 167 10 47 58 115 85 21 180 5 82 70 177 117 126 205 129 89 88 60 37 59 76 74 32 54 11 + + + ICC8051 + 114 116 79 120 155 140 128 7 161 151 167 10 47 58 115 85 21 180 5 82 70 177 117 126 205 129 89 88 60 37 59 76 74 32 54 11 + + $PROJ_DIR$\..\Source\simpleBLE.c BICOMP - 62 + 108 + + + ICC8051 + 183 + + + + + BICOMP + 58 128 79 7 120 155 140 161 151 207 112 70 177 179 2 5 82 12 26 76 74 89 47 85 21 37 32 54 88 60 41 59 94 45 180 113 27 154 99 + + + ICC8051 + 114 116 58 128 79 7 120 155 140 161 151 207 112 70 177 179 2 5 82 12 26 76 74 89 47 85 21 37 32 54 88 60 41 59 94 45 180 113 27 154 99 + + + + + $PROJ_DIR$\..\Source\Irext\src\ir_ac_parse_frame_info.c + + + BICOMP + 210 + + + ICC8051 + 218 + + + + + BICOMP + 199 140 154 99 212 220 217 224 227 226 188 + + + ICC8051 + 114 116 199 140 154 99 212 220 217 224 227 226 188 + + + + + $PROJ_DIR$\..\..\Profiles\Roles\gapbondmgr.c + + + BICOMP + 127 + + + ICC8051 + 159 + + + + + BICOMP + 58 128 79 7 120 155 140 161 151 113 88 60 86 76 74 89 84 85 47 21 32 37 59 + + + ICC8051 + 114 116 58 128 79 7 120 155 140 161 151 113 88 60 86 76 74 89 84 85 47 21 32 37 59 + + + + + $PROJ_DIR$\..\..\Profiles\Roles\central.c + + + BICOMP + 172 + + + ICC8051 + 133 + + + + + BICOMP + 58 128 79 7 120 155 140 161 151 129 113 115 85 47 21 180 5 82 70 177 117 126 205 89 86 88 60 59 54 + + + ICC8051 + 114 116 58 128 79 7 120 155 140 161 151 129 113 115 85 47 21 180 5 82 70 177 117 126 205 89 86 88 60 59 54 + + + + + $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL_Timers.c + + + BICOMP + 100 + + + ICC8051 + 148 + + + + + BICOMP + 128 79 7 112 70 177 179 120 155 140 161 151 182 5 82 + + + ICC8051 + 114 116 128 79 7 112 70 177 179 120 155 140 161 151 182 5 82 + + + + + $PROJ_DIR$\..\..\Profiles\Roles\peripheral.c + + + BICOMP + 107 + + + ICC8051 + 201 + + + + + BICOMP + 58 128 79 7 120 155 140 161 151 115 85 47 21 180 5 82 70 177 117 126 205 89 88 60 86 74 76 113 41 59 + + + ICC8051 + 114 116 58 128 79 7 120 155 140 161 151 115 85 47 21 180 5 82 70 177 117 126 205 89 88 60 86 74 76 113 41 59 + + + + + $PROJ_DIR$\..\..\..\..\Components\osal\common\osal_bufmgr.c + + + BICOMP + 175 + + + ICC8051 + 122 + + + + + BICOMP + 120 155 140 128 79 7 161 151 112 70 177 179 126 + + + ICC8051 + 114 116 120 155 140 128 79 7 161 151 112 70 177 179 126 + + + + + $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL.c + + + BICOMP + 135 + + + ICC8051 + 118 + + + + + BICOMP + 212 140 128 79 7 5 82 70 177 120 155 161 151 167 207 194 112 179 10 + + + ICC8051 + 114 116 212 140 128 79 7 5 82 70 177 120 155 161 151 167 207 194 112 179 10 + + + + + $PROJ_DIR$\..\..\Profiles\Roles\gap.c + + + BICOMP + 92 + + + ICC8051 + 97 + + + + + BICOMP + 58 128 79 7 88 120 155 140 161 151 60 + + + ICC8051 + 114 116 58 128 79 7 88 120 155 140 161 151 60 + + + + + $PROJ_DIR$\..\..\common\npi\npi_np\npi.c + + + BICOMP + 198 + + + ICC8051 + 163 + + + + + BICOMP + 79 5 82 70 7 177 45 180 + + + ICC8051 + 114 116 79 5 82 70 7 177 45 180 + + + + + $PROJ_DIR$\..\..\..\..\Components\osal\common\osal_cbtimer.c + + + BICOMP + 169 + + + ICC8051 + 202 + + + + + BICOMP + 120 155 140 128 79 7 161 151 167 129 + + + ICC8051 + 114 116 120 155 140 128 79 7 161 151 167 129 + + + + + $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL_Memory.c + + + BICOMP + 153 + + + ICC8051 + 95 + + + + + BICOMP + 128 79 7 120 155 140 161 151 112 70 177 179 21 + + + ICC8051 + 114 116 128 79 7 120 155 140 161 151 112 70 177 179 21 + + + + + $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL_PwrMgr.c + + + BICOMP + 123 ICC8051 @@ -265,35 +877,204 @@ BICOMP - 161 68 162 110 7 27 90 21 51 137 126 149 31 109 103 113 106 102 99 151 167 152 153 157 97 130 128 127 150 160 136 134 133 159 105 47 100 8 38 + 128 79 7 112 70 177 179 120 155 140 161 151 167 207 + + + ICC8051 + 114 116 128 79 7 112 70 177 179 120 155 140 161 151 167 207 - $PROJ_DIR$\..\Source\OSAL_SimpleBLEPeripheral.c + $PROJ_DIR$\..\..\..\..\Components\osal\mcu\cc2540\osal_snv.c BICOMP - 43 + 101 ICC8051 - 63 + 162 BICOMP - 162 7 27 90 68 110 21 51 19 118 153 161 39 157 97 105 113 106 149 31 33 82 83 76 152 150 160 130 134 151 167 128 136 116 + 19 79 5 82 70 7 177 25 128 120 155 140 161 151 113 21 181 + + + ICC8051 + 114 116 19 79 5 82 70 7 177 25 128 120 155 140 161 151 113 21 181 - $PROJ_DIR$\..\Source\OSAL_simpleBLECentral.c + $PROJ_DIR$\..\..\Profiles\DevInfo\devinfoservice.c BICOMP - 52 + 105 + + + ICC8051 + 124 + + + + + BICOMP + 58 128 79 7 120 155 140 161 151 86 74 89 76 84 32 57 + + + ICC8051 + 114 116 58 128 79 7 120 155 140 161 151 86 74 89 76 84 32 57 + + + + + $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL_ClockBLE.c + + + BICOMP + 152 + + + ICC8051 + 146 + + + + + BICOMP + 128 79 7 112 70 177 179 120 155 140 161 151 194 + + + ICC8051 + 114 116 128 79 7 112 70 177 179 120 155 140 161 151 194 + + + + + $PROJ_DIR$\..\..\..\..\Components\ble\host\gatt_uuid.c + + + BICOMP + 138 + + + ICC8051 + 90 + + + + + BICOMP + 128 79 7 120 155 140 161 151 76 58 74 89 84 + + + ICC8051 + 114 116 128 79 7 120 155 140 161 151 76 58 74 89 84 + + + + + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_adc.c + + + BICOMP + 136 + + + ICC8051 + 160 + + + + + BICOMP + 19 79 5 82 70 7 177 + + + ICC8051 + 114 116 19 79 5 82 70 7 177 + + + + + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_aes.c + + + BICOMP + 109 + + + ICC8051 + 149 + + + + + BICOMP + 120 155 140 128 79 7 161 151 81 69 5 82 70 177 + + + ICC8051 + 114 116 120 155 140 128 79 7 161 151 81 69 5 82 70 177 + + + + + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_sleep.c + + + BICOMP + 168 + + + ICC8051 + 96 + + + + + BICOMP + 79 70 7 177 5 82 179 2 12 120 155 140 128 161 151 167 207 10 21 197 58 186 189 + + + ICC8051 + 114 116 79 70 7 177 5 82 179 2 12 120 155 140 128 161 151 167 207 10 21 197 58 186 189 + + + + + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_startup.c + + + BICOMP + 173 + + + ICC8051 + 166 + + + + + BICOMP + 5 82 70 7 79 177 + + + ICC8051 + 114 116 5 82 70 7 79 177 + + + + + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_lcd.c + + + BICOMP + 147 ICC8051 @@ -303,115 +1084,150 @@ BICOMP - 162 7 27 90 68 110 21 51 19 118 153 161 39 157 97 105 113 106 149 31 33 82 83 76 152 150 160 130 134 151 167 128 127 101 + 79 26 5 82 70 7 177 120 155 140 128 161 151 112 179 21 154 99 + + + ICC8051 + 114 116 79 26 5 82 70 7 177 120 155 140 128 161 151 112 179 21 154 99 - $PROJ_DIR$\..\Source\simpleBLECentral.c + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_timer.c BICOMP - 89 + 171 ICC8051 - 87 + 131 + + + + + ICC8051 + 114 116 + + + + + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_flash.c + + + BICOMP + 156 + + + ICC8051 + 143 BICOMP - 161 68 162 110 7 27 90 21 51 137 126 149 31 109 103 113 106 102 99 151 167 152 153 157 97 130 128 127 150 160 134 133 101 159 105 100 + 82 70 7 79 177 69 5 25 + + + ICC8051 + 114 116 82 70 7 79 177 69 5 25 - $PROJ_DIR$\..\..\..\..\Components\hal\common\hal_drivers.c + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_key.c BICOMP - 26 + 145 ICC8051 - 10 - - - - - $PROJ_DIR$\..\Source\simpleBLEPeripheral.c - - - BICOMP - 20 - - - ICC8051 - 74 + 125 BICOMP - 161 68 162 110 7 27 90 21 51 137 126 149 31 109 112 113 106 103 102 99 151 167 152 157 153 97 130 128 123 133 136 134 150 160 116 100 159 105 + 70 7 79 177 10 19 5 82 12 120 155 140 128 161 151 + + + ICC8051 + 114 116 70 7 79 177 10 19 5 82 12 120 155 140 128 161 151 - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_adc.c + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_dma.c BICOMP - 30 + 134 ICC8051 - 44 + 213 - - - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_crc.c - + BICOMP - 36 + 69 5 82 70 7 79 177 180 ICC8051 - 77 + 114 116 69 5 82 70 7 79 177 180 - - - - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_aes.c - - - BICOMP - 34 - - - ICC8051 - 25 - - + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_led.c BICOMP - 18 + 170 ICC8051 - 65 + 208 + + + BICOMP + 70 7 79 177 10 2 5 82 120 155 140 128 161 151 + + + ICC8051 + 114 116 70 7 79 177 10 2 5 82 120 155 140 128 161 151 + + - $PROJ_DIR$\..\Source\SimpleBLEPeripheral_Main.c + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_crc.c + + + BICOMP + 176 + + + ICC8051 + 139 + + + + + BICOMP + 5 82 70 7 79 177 83 + + + ICC8051 + 114 116 5 82 70 7 79 177 83 + + + + + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_uart.c BICOMP @@ -419,270 +1235,102 @@ ICC8051 - 54 + 121 - - - $PROJ_DIR$\..\..\Profiles\Roles\gapbondmgr.c - + BICOMP - 92 + 82 70 7 79 177 10 180 5 211 212 140 21 69 ICC8051 - 17 + 114 116 82 70 7 79 177 10 180 5 211 212 140 21 69 - + $PROJ_DIR$\..\..\Profiles\SimpleProfile\simpleGATTprofile.c BICOMP - 75 + 144 ICC8051 - 69 + 119 - - - $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL_Timers.c - + BICOMP - 50 + 58 128 79 7 120 155 140 161 151 86 74 89 76 84 32 59 88 60 94 26 5 82 70 177 27 ICC8051 - 81 + 114 116 58 128 79 7 120 155 140 161 151 86 74 89 76 84 32 59 88 60 94 26 5 82 70 177 27 - - - - $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL_ClockBLE.c - - - BICOMP - 35 - - - ICC8051 - 67 - - - - - $PROJ_DIR$\..\..\..\..\Components\osal\mcu\cc2540\osal_snv.c - - - BICOMP - 57 - - - ICC8051 - 16 - - + $PROJ_DIR$\..\..\common\cc2540\OnBoard.c BICOMP - 15 + 132 ICC8051 - 66 + 141 - - - $PROJ_DIR$\..\..\..\..\Components\ble\host\gatt_uuid.c - + BICOMP - 24 + 58 128 79 7 112 70 177 179 120 155 140 161 151 2 5 82 12 ICC8051 - 49 + 114 116 58 128 79 7 112 70 177 179 120 155 140 161 151 2 5 82 12 - + - $PROJ_DIR$\..\..\..\..\Components\osal\common\osal_cbtimer.c + $PROJ_DIR$\CC2541\Exe\SimpleBLEPeripheral.d51 - BICOMP - 5 - - - ICC8051 - 72 + XLINK + 232 233 + + + XLINK + 30 42 48 133 124 97 159 90 160 149 139 213 137 143 125 165 208 96 166 131 121 184 228 225 230 219 218 216 231 187 203 163 141 118 122 202 146 95 93 209 164 162 148 201 183 130 195 110 119 29 + + - $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL_Memory.c + [ROOT_NODE] - BICOMP - 13 - - - ICC8051 - 22 - - - - - $PROJ_DIR$\..\..\Profiles\Roles\peripheral.c - - - BICOMP - 59 - - - ICC8051 - 73 - - - - - $PROJ_DIR$\..\..\Profiles\DevInfo\devinfoservice.c - - - BICOMP - 41 - - - ICC8051 - 71 - - - - - $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL_PwrMgr.c - - - BICOMP - 37 - - - ICC8051 - 48 - - - - - $PROJ_DIR$\..\..\Profiles\Roles\gap.c - - - BICOMP - 56 - - - ICC8051 - 58 - - - - - $PROJ_DIR$\..\..\Profiles\Roles\central.c - - - BICOMP - 11 - - - ICC8051 - 42 - - - - - $PROJ_DIR$\..\..\common\npi\npi_np\npi.c - - - BICOMP - 84 - - - ICC8051 - 29 - - - - - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_startup.c - - - BICOMP - 9 - - - ICC8051 - 45 - - - - - $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL.c - - - BICOMP - 14 - - - ICC8051 - 53 - - - - - $PROJ_DIR$\..\..\..\..\Components\osal\common\osal_bufmgr.c - - - BICOMP - 61 - - - ICC8051 - 85 - - - - - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_timer.c - - - BICOMP - 23 - - - ICC8051 - 12 - - - - - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_uart.c - - - BICOMP - 32 - - - ICC8051 - 80 + XLINK + 174 232 233 + + $PROJ_DIR$\..\..\Profiles\OAD\oad_target.c + ICC8051 + + + $PROJ_DIR$\..\..\Profiles\Roles\peripheralBroadcaster.c + ICC8051 + + + $PROJ_DIR$\..\..\Profiles\Keys\simplekeys.c + ICC8051 + CC2541-OAD-Encrypted-ImgA @@ -719,290 +1367,194 @@ CC2541DK-MINI Keyfob - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_flash.c - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_lcd.c - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_sleep.c - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_key.c - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_dma.c - $PROJ_DIR$\..\..\..\..\Components\osal\include\OSAL.h - $PROJ_DIR$\..\..\..\..\Components\osal\include\OSAL_Tasks.h - $PROJ_DIR$\..\..\..\..\Components\osal\include\OSAL_Memory.h - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\osal_bufmgr.r51 - $TOOLKIT_DIR$\inc\clib\limits.h - $TOOLKIT_DIR$\inc\ioCC2541.h - $PROJ_DIR$\..\..\..\..\Components\ble\hci\hci_data.h - $PROJ_DIR$\CC2541DK-MINI Keyfob\Exe\SimpleBLEPeripheral.d51 - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_sleep.pbi - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\gapbondmgr.pbi - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\devinfoservice.r51 - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_uart.r51 - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_key.pbi - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_flash.pbi - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\OSAL.pbi - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\npi.pbi - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_aes.r51 - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_uart.pbi - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\OSAL_Timers.r51 - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_crc.pbi - $PROJ_DIR$\..\..\..\..\Components\ble\hci\hci_tl.h - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_led.pbi - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\OSAL_SimpleBLEPeripheral.r51 - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\simpleGATTprofile.pbi - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_startup.pbi - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_lcd.pbi - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\osal_cbtimer.r51 - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\gatt_uuid.pbi - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_drivers.r51 - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\peripheral.r51 - $PROJ_DIR$\..\..\..\..\Components\ble\controller\include\ll_math.h - $PROJ_DIR$\..\..\..\..\Components\osal\include\osal_snv.h - $PROJ_DIR$\..\..\..\..\Components\ble\controller\include\ll_sleep.h - $PROJ_DIR$\..\..\..\..\Components\osal\include\OSAL_Timers.h - $PROJ_DIR$\..\..\..\..\Components\ble\controller\include\ll_timer2.h - $PROJ_DIR$\..\..\..\..\Components\osal\include\comdef.h - $PROJ_DIR$\..\..\..\..\Components\osal\include\osal_cbtimer.h - $PROJ_DIR$\..\..\..\..\Components\osal\include\osal_bufmgr.h - $PROJ_DIR$\..\..\..\..\Components\ble\hci\hci_event.h - $PROJ_DIR$\..\..\..\..\Components\osal\include\OSAL_Clock.h - $TOOLKIT_DIR$\inc\clib\string.h - $TOOLKIT_DIR$\inc\clib\sysmac.h - $PROJ_DIR$\..\Source\OSAL_SimpleBLEPeripheral.c - $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_assert.h - $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_lcd.h - $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_flash.h - $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_key.h $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_led.h - $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_timer.h - $PROJ_DIR$\..\..\..\..\Components\hal\common\hal_drivers.c - $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_uart.h - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_board_cfg.h - $PROJ_DIR$\..\Source\simpleBLEPeripheral.c - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_adc.c - $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_sleep.h - $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_defs.h - $PROJ_DIR$\..\..\..\..\Components\services\saddr\saddr.h - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_crc.c - $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_adc.h - $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_board.h - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_aes.c - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_led.c $PROJ_DIR$\..\Source\simpleBLEPeripheral.h - $PROJ_DIR$\..\Source\SimpleBLEPeripheral_Main.c + $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_board.h + $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_defs.h + $PROJ_DIR$\..\..\..\..\Components\hal\common\hal_drivers.c $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_drivers.h - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\OSAL_Timers.pbi - $PROJ_DIR$\..\..\common\cc2540\ti_51ew_cc2540b.xcl - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_key.r51 - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_lcd.r51 - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\OSAL_ClockBLE.r51 - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\gap.pbi - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\peripheral.pbi - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\osal_bufmgr.pbi - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\SimpleBLEPeripheral_Main.r51 - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_startup.r51 - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\npi.r51 - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\osal_snv.pbi - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\OSAL_PwrMgr.pbi - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_adc.pbi - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_adc.r51 - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_dma.r51 - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\simpleBLEPeripheral.pbi - $PROJ_DIR$\CC2541DK-MINI Keyfob\List\SimpleBLEPeripheral.map - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_flash.r51 - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\SimpleBLEPeripheral_Main.pbi - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\simplekeys.pbi - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\OSAL_SimpleBLEPeripheral.pbi - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\simpleBLEPeripheral.r51 - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\gatt_uuid.r51 + $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_key.h + $PROJ_DIR$\..\Source\OSAL_SimpleBLEPeripheral.c + $PROJ_DIR$\..\Source\SimpleBLEPeripheral_Main.c + $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_adc.h + $PROJ_DIR$\..\Source\simpleBLEPeripheral.c + $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_assert.h + $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_flash.h + $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_lcd.h $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\OSAL_PwrMgr.r51 - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\OSAL_Memory.r51 - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\OSAL_Memory.pbi + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\osal_bufmgr.pbi + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\OSAL_ClockBLE.r51 + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\OSAL_PwrMgr.pbi + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\OSAL_Timers.r51 + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_uart.r51 + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_aes.r51 $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\gap.r51 - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\simpleGATTprofile.r51 - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_led.r51 + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\OSAL_SimpleBLEPeripheral.pbi + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_adc.r51 + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\OSAL_Timers.pbi + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\OSAL.pbi $PROJ_DIR$\..\..\Libraries\CC2541DB\bin\CC2541_BLE_peri.lib - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_dma.pbi - $PROJ_DIR$\CC2541DK-MINI Keyfob\Exe\SimpleBLEPeripheral.hex + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_startup.r51 + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\simpleGATTprofile.r51 + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_dma.r51 + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_crc.pbi + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\OSAL_Memory.r51 + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\gap.pbi + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\npi.pbi + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\simpleGATTprofile.pbi + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_sleep.pbi + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\osal_cbtimer.r51 + $PROJ_DIR$\CC2541DK-MINI Keyfob\List\SimpleBLEPeripheral.map + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\OSAL_Memory.pbi + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_lcd.r51 + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\gapbondmgr.pbi + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_lcd.pbi + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\SimpleBLEPeripheral_Main.r51 + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_drivers.r51 + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_adc.pbi + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\OSAL_ClockBLE.pbi + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\peripheral.pbi + $PROJ_DIR$\CC2541DK-MINI Keyfob\Exe\SimpleBLEPeripheral.d51 + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\simpleBLEPeripheral.r51 + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\SimpleBLEPeripheral_Main.pbi + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\osal_snv.pbi $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\OnBoard.r51 - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\OnBoard.pbi - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_sleep.r51 + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_dma.pbi + $TOOLKIT_DIR$\lib\clib\cl-pli-blxd-1e16x01.r51 + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_aes.pbi + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\npi.r51 + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_led.r51 + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_key.r51 $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\OSAL.r51 + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\osal_snv.r51 + $PROJ_DIR$\CC2541DK-MINI Keyfob\Exe\SimpleBLEPeripheral.hex + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_sleep.r51 + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_crc.r51 + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_timer.r51 + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\simplekeys.r51 + $PROJ_DIR$\..\..\common\cc2540\ti_51ew_cc2540b.xcl + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\gatt_uuid.r51 + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\osal_cbtimer.pbi + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_flash.r51 + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_timer.pbi + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\simplekeys.pbi + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\simpleBLEPeripheral.pbi + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\OnBoard.pbi + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_drivers.pbi $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\gapbondmgr.r51 $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\devinfoservice.pbi - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_timer.pbi - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\simplekeys.r51 - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_drivers.pbi - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\OSAL_ClockBLE.pbi - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_crc.r51 - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\osal_cbtimer.pbi - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_timer.r51 - $TOOLKIT_DIR$\lib\clib\cl-pli-blxd-1e16x01.r51 - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\osal_snv.r51 - $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_aes.pbi $PROJ_DIR$\..\..\Profiles\Roles\gapbondmgr.c - $PROJ_DIR$\..\..\Profiles\SimpleProfile\simpleGATTprofile.c - $PROJ_DIR$\buildConfig.cfg - $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL_Timers.c - $PROJ_DIR$\..\..\Profiles\DevInfo\devinfoservice.h - $PROJ_DIR$\..\..\Profiles\Keys\simplekeys.c - $PROJ_DIR$\..\..\Profiles\Keys\simplekeys.h - $PROJ_DIR$\..\..\common\cc2540\OnBoard.h $PROJ_DIR$\..\..\Include\gattservapp.h - $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL_ClockBLE.c + $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL_Timers.c $PROJ_DIR$\..\..\Include\gapgattserver.h - $PROJ_DIR$\..\..\..\..\Components\osal\mcu\cc2540\osal_snv.c - $PROJ_DIR$\..\..\Profiles\SimpleProfile\simpleGATTprofile.h - $PROJ_DIR$\..\..\config\buildComponents.cfg - $PROJ_DIR$\..\..\Profiles\Roles\gapbondmgr.h - $PROJ_DIR$\..\..\common\cc2540\OnBoard.c - $PROJ_DIR$\..\..\Profiles\Roles\peripheral.h - $PROJ_DIR$\..\..\..\..\Components\osal\include\OSAL_PwrMgr.h - $PROJ_DIR$\..\..\..\..\Components\ble\host\gatt_uuid.c - $PROJ_DIR$\..\..\..\..\Components\osal\common\osal_cbtimer.c - $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL_Memory.c $PROJ_DIR$\..\..\Profiles\Roles\peripheral.c - $PROJ_DIR$\..\..\Profiles\DevInfo\devinfoservice.c - $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL_PwrMgr.c + $PROJ_DIR$\..\..\..\..\Components\osal\common\osal_bufmgr.c + $PROJ_DIR$\..\..\Profiles\Roles\peripheral.h + $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL.c + $PROJ_DIR$\..\..\common\npi\npi_np\npi.h $PROJ_DIR$\..\..\Profiles\Roles\gap.c - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_mcu.h - $PROJ_DIR$\..\..\..\..\Components\ble\include\gap.h - $PROJ_DIR$\..\..\..\..\Components\ble\include\gatt.h - $PROJ_DIR$\..\..\..\..\Components\ble\include\l2cap.h $PROJ_DIR$\..\..\..\..\Components\ble\controller\include\ll.h - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_crc.h $PROJ_DIR$\..\..\Libraries\Common\bin\CC254x_BLE_HCI_TL_None.lib $PROJ_DIR$\..\..\common\npi\npi_np\npi.c - $PROJ_DIR$\..\..\..\..\Components\ble\include\hci.h - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_startup.c - $PROJ_DIR$\..\..\common\npi\npi_np\npi.h - $PROJ_DIR$\..\..\..\..\Components\ble\include\sm.h + $PROJ_DIR$\..\..\..\..\Components\osal\common\osal_cbtimer.c + $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL_Memory.c + $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL_PwrMgr.c + $PROJ_DIR$\..\..\..\..\Components\osal\mcu\cc2540\osal_snv.c + $PROJ_DIR$\..\..\Profiles\DevInfo\devinfoservice.c + $PROJ_DIR$\..\..\Profiles\DevInfo\devinfoservice.h $PROJ_DIR$\..\..\..\..\Components\ble\include\bcomdef.h - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_types.h - $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL.c - $PROJ_DIR$\..\..\..\..\Components\ble\include\gatt_uuid.h - $PROJ_DIR$\..\..\..\..\Components\ble\host\linkdb.h - $PROJ_DIR$\..\..\..\..\Components\osal\common\osal_bufmgr.c - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_dma.h + $PROJ_DIR$\..\..\Profiles\Roles\gapbondmgr.h + $PROJ_DIR$\..\..\..\..\Components\ble\include\sm.h + $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL_ClockBLE.c + $PROJ_DIR$\..\..\..\..\Components\ble\host\gatt_uuid.c + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_adc.c + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_aes.c + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_sleep.c + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_startup.c + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_lcd.c $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_timer.c - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_aes.h + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_dma.h + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_mcu.h + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_flash.c + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_key.c + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_dma.c $PROJ_DIR$\..\..\..\..\Components\ble\include\att.h + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_led.c + $PROJ_DIR$\..\..\..\..\Components\ble\include\gatt.h + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_crc.c + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_types.h $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_uart.c + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_aes.h + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_board_cfg.h + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_crc.h + $PROJ_DIR$\..\..\..\..\Components\ble\include\gatt_uuid.h + $PROJ_DIR$\..\..\..\..\Components\ble\include\hci.h + $PROJ_DIR$\..\..\..\..\Components\ble\host\linkdb.h + $PROJ_DIR$\..\..\..\..\Components\ble\include\gap.h + $PROJ_DIR$\..\..\..\..\Components\ble\include\l2cap.h + $PROJ_DIR$\..\..\Profiles\SimpleProfile\simpleGATTprofile.h + $PROJ_DIR$\..\..\Profiles\Keys\simplekeys.c + $PROJ_DIR$\..\..\Profiles\SimpleProfile\simpleGATTprofile.c + $PROJ_DIR$\..\..\Profiles\Keys\simplekeys.h + $PROJ_DIR$\..\..\common\cc2540\OnBoard.c + $PROJ_DIR$\..\..\common\cc2540\OnBoard.h + $PROJ_DIR$\..\..\..\..\Components\osal\include\osal_snv.h + $PROJ_DIR$\..\..\config\buildComponents.cfg + $PROJ_DIR$\..\..\..\..\Components\ble\hci\hci_tl.h + $PROJ_DIR$\buildConfig.cfg + $PROJ_DIR$\..\..\..\..\Components\ble\hci\hci_data.h + $PROJ_DIR$\..\..\..\..\Components\osal\include\OSAL.h + $PROJ_DIR$\..\..\..\..\Components\osal\include\osal_bufmgr.h + $PROJ_DIR$\..\..\..\..\Components\osal\include\comdef.h + $PROJ_DIR$\..\..\..\..\Components\osal\include\osal_cbTimer.h + $TOOLKIT_DIR$\inc\clib\sysmac.h + $PROJ_DIR$\..\..\..\..\Components\osal\include\OSAL_Timers.h + $TOOLKIT_DIR$\inc\clib\limits.h + $PROJ_DIR$\..\..\..\..\Components\osal\include\OSAL_Memory.h + $PROJ_DIR$\..\..\..\..\Components\osal\include\OSAL_Tasks.h + $TOOLKIT_DIR$\inc\ioCC2541.h + $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_sleep.h + $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_uart.h + $PROJ_DIR$\..\..\..\..\Components\services\saddr\saddr.h + $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_timer.h + $PROJ_DIR$\..\..\..\..\Components\ble\controller\include\ll_timer2.h + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\gatt_uuid.pbi + $PROJ_DIR$\..\..\..\..\Components\ble\controller\include\ll_math.h + $PROJ_DIR$\..\..\..\..\Components\osal\include\OSAL_Clock.h + $PROJ_DIR$\..\..\..\..\Components\ble\controller\include\ll_sleep.h + $PROJ_DIR$\..\..\..\..\Components\ble\hci\hci_event.h + $PROJ_DIR$\..\..\..\..\Components\osal\include\OSAL_PwrMgr.h + $TOOLKIT_DIR$\inc\clib\string.h + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_flash.pbi + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_key.pbi + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\peripheral.r51 + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_led.pbi + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\devinfoservice.r51 + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\osal_bufmgr.r51 + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_uart.pbi + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\hal_startup.pbi + $PROJ_DIR$\CC2541DK-MINI Keyfob\Obj\OSAL_SimpleBLEPeripheral.r51 - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_flash.c + $PROJ_DIR$\..\..\..\..\Components\hal\common\hal_drivers.c BICOMP - 18 - - - ICC8051 - 88 - - - - - ICC8051 - 132 121 56 144 60 157 10 162 64 50 - - - - - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_lcd.c - - - BICOMP - 30 - - - ICC8051 73 - - ICC8051 - 132 121 157 49 64 56 144 60 10 5 9 46 40 7 38 126 59 48 + 43 - - - - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_sleep.c - + + BICOMP - 13 + 9 115 2 118 107 3 145 117 106 5 6 13 0 146 149 147 136 142 140 138 143 141 156 ICC8051 - 105 - - - - - ICC8051 - 132 121 157 144 60 10 64 56 59 52 51 5 9 46 40 7 38 6 136 69 48 37 156 39 35 - - - - - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_key.c - - - BICOMP - 17 - - - ICC8051 - 72 - - - - - ICC8051 - 132 121 144 60 157 10 69 63 64 56 51 5 9 46 40 7 38 - - - - - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_dma.c - - - BICOMP - 101 - - - ICC8051 - 85 - - - - - ICC8051 - 132 121 162 64 56 144 60 157 10 55 - - - - - [ROOT_NODE] - - - XLINK - 87 102 12 - - - - - $PROJ_DIR$\CC2541DK-MINI Keyfob\Exe\SimpleBLEPeripheral.d51 - - - XLINK - 87 102 - - - - - XLINK - 71 100 150 106 74 95 94 27 23 103 78 15 97 107 93 84 21 113 85 33 88 72 73 99 105 79 115 16 80 8 31 117 34 92 98 110 116 + 132 134 9 115 2 118 107 3 145 117 106 5 6 13 0 146 149 147 136 142 140 138 143 141 156 @@ -1011,147 +1563,21 @@ BICOMP - 91 + 22 ICC8051 - 27 + 166 BICOMP - 157 5 9 46 40 60 7 38 6 69 148 156 25 152 48 55 64 56 144 10 11 42 43 41 147 145 155 129 133 146 165 127 135 67 + 115 136 142 140 138 3 143 141 144 5 86 95 133 121 11 147 2 118 107 145 135 137 155 139 124 123 97 79 96 113 111 77 82 1 ICC8051 - 132 121 157 5 9 46 40 60 7 38 6 69 148 156 25 152 48 55 64 56 144 10 11 42 43 41 147 145 155 129 133 146 165 127 135 67 - - - - - $PROJ_DIR$\..\..\..\..\Components\hal\common\hal_drivers.c - - - BICOMP - 111 - - - ICC8051 - 33 - - - - - BICOMP - 63 157 64 56 144 60 10 164 162 69 51 49 52 59 53 55 5 9 46 40 7 38 136 - - - ICC8051 - 132 121 63 157 64 56 144 60 10 164 162 69 51 49 52 59 53 55 5 9 46 40 7 38 136 - - - - - $PROJ_DIR$\..\Source\simpleBLEPeripheral.c - - - BICOMP - 86 - - - ICC8051 - 92 - - - - - BICOMP - 156 40 157 60 5 9 46 7 38 136 126 144 10 59 63 64 56 52 51 49 146 165 147 152 148 48 129 127 123 131 125 135 133 145 155 67 - - - ICC8051 - 132 121 156 40 157 60 5 9 46 7 38 136 126 144 10 59 63 64 56 52 51 49 146 165 147 152 148 48 129 127 123 131 125 135 133 145 155 67 - - - - - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_adc.c - - - BICOMP - 83 - - - ICC8051 - 84 - - - - - BICOMP - 63 157 64 56 144 60 10 - - - ICC8051 - 132 121 63 157 64 56 144 60 10 - - - - - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_crc.c - - - BICOMP - 24 - - - ICC8051 - 113 - - - - - ICC8051 - 132 121 64 56 144 60 157 10 149 - - - - - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_aes.c - - - BICOMP - 118 - - - ICC8051 - 21 - - - - - ICC8051 - 132 121 5 9 46 40 157 60 7 38 164 162 64 56 144 10 - - - - - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_led.c - - - BICOMP - 26 - - - ICC8051 - 99 - - - - - ICC8051 - 132 121 144 60 157 10 69 52 64 56 5 9 46 40 7 38 + 132 134 115 136 142 140 138 3 143 141 144 5 86 95 133 121 11 147 2 118 107 145 135 137 155 139 124 123 97 79 96 113 111 77 82 1 @@ -1160,21 +1586,59 @@ BICOMP - 89 + 49 ICC8051 - 78 + 42 BICOMP - 157 51 64 56 144 60 10 53 69 52 5 9 46 40 7 38 6 136 36 126 59 + 115 6 2 118 107 3 145 149 5 0 136 142 140 138 143 141 144 156 131 130 146 ICC8051 - 132 121 157 51 64 56 144 60 10 53 69 52 5 9 46 40 7 38 6 136 36 126 59 + 132 134 115 6 2 118 107 3 145 149 5 0 136 142 140 138 143 141 144 156 131 130 146 + + + + + $PROJ_DIR$\..\Source\simpleBLEPeripheral.c + + + BICOMP + 71 + + + ICC8051 + 48 + + + + + BICOMP + 95 138 115 3 136 142 140 143 141 156 130 107 145 146 9 2 118 0 6 13 113 111 124 121 86 11 79 77 94 125 128 82 96 123 97 1 + + + ICC8051 + 132 134 95 138 115 3 136 142 140 143 141 156 130 107 145 146 9 2 118 0 6 13 113 111 124 121 86 11 79 77 94 125 128 82 96 123 97 1 + + + + + $PROJ_DIR$\CC2541DK-MINI Keyfob\Exe\SimpleBLEPeripheral.d51 + + + XLINK + 37 60 + + + + + XLINK + 65 26 87 58 16 31 14 166 18 51 42 162 21 74 66 23 20 62 29 43 68 57 39 56 61 27 63 19 55 163 36 59 160 48 28 64 53 @@ -1183,83 +1647,7 @@ BICOMP - 14 - - - ICC8051 - 107 - - - - - ICC8051 - 132 121 156 40 157 60 5 9 46 7 38 36 145 155 160 146 165 147 159 152 148 48 127 129 133 - - - - - $PROJ_DIR$\..\..\Profiles\SimpleProfile\simpleGATTprofile.c - - - BICOMP - 28 - - - ICC8051 - 98 - - - - - ICC8051 - 132 121 156 40 157 60 5 9 46 7 38 160 165 147 146 159 127 133 145 155 131 - - - - - $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL_Timers.c - - - BICOMP - 70 - - - ICC8051 - 23 - - - - - ICC8051 - 132 121 40 157 60 126 144 10 59 5 9 46 7 38 53 64 56 - - - - - $PROJ_DIR$\..\..\Profiles\Keys\simplekeys.c - - - BICOMP - 90 - - - ICC8051 - 110 - - - - - ICC8051 - 132 121 156 40 157 60 5 9 46 7 38 160 165 147 146 159 127 133 145 155 125 - - - - - $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL_ClockBLE.c - - - BICOMP - 112 + 40 ICC8051 @@ -1269,50 +1657,88 @@ ICC8051 - 132 121 40 157 60 126 144 10 59 5 9 46 7 38 44 + 132 134 95 138 115 3 136 142 140 143 141 131 123 97 122 113 111 124 120 121 86 11 77 79 96 - $PROJ_DIR$\..\..\..\..\Components\osal\mcu\cc2540\osal_snv.c + $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL_Timers.c BICOMP - 81 + 24 ICC8051 - 117 + 18 ICC8051 - 132 121 63 157 64 56 144 60 10 50 40 5 9 46 7 38 36 48 61 + 132 134 138 115 3 130 107 145 146 136 142 140 143 141 149 2 118 - $PROJ_DIR$\..\..\common\cc2540\OnBoard.c + $PROJ_DIR$\..\..\Profiles\Roles\peripheral.c BICOMP - 104 + 46 ICC8051 - 103 + 160 ICC8051 - 132 121 156 40 157 60 126 144 10 59 5 9 46 7 38 52 64 56 51 + 132 134 95 138 115 3 136 142 140 143 141 133 121 86 11 147 2 118 107 145 135 137 155 124 123 97 122 111 113 131 82 96 - $PROJ_DIR$\..\..\..\..\Components\ble\host\gatt_uuid.c + $PROJ_DIR$\..\..\..\..\Components\osal\common\osal_bufmgr.c + + + BICOMP + 15 + + + ICC8051 + 163 + + + + + ICC8051 + 132 134 136 142 140 138 115 3 143 141 130 107 145 146 137 + + + + + $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL.c + + + BICOMP + 25 + + + ICC8051 + 58 + + + + + ICC8051 + 132 134 157 140 138 115 3 2 118 107 145 136 142 143 141 144 156 153 130 146 5 + + + + + $PROJ_DIR$\..\..\Profiles\Roles\gap.c BICOMP @@ -1320,13 +1746,32 @@ ICC8051 - 93 + 21 ICC8051 - 132 121 40 157 60 5 9 46 7 38 146 156 165 147 159 + 132 134 95 138 115 3 123 136 142 140 143 141 97 + + + + + $PROJ_DIR$\..\..\common\npi\npi_np\npi.c + + + BICOMP + 33 + + + ICC8051 + 55 + + + + + ICC8051 + 132 134 115 2 118 107 3 145 84 147 @@ -1335,7 +1780,26 @@ BICOMP - 114 + 67 + + + ICC8051 + 36 + + + + + ICC8051 + 132 134 136 142 140 138 115 3 143 141 144 139 + + + + + $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL_Memory.c + + + BICOMP + 38 ICC8051 @@ -1345,64 +1809,7 @@ ICC8051 - 132 121 5 9 46 40 157 60 7 38 6 41 - - - - - $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL_Memory.c - - - BICOMP - 96 - - - ICC8051 - 95 - - - - - ICC8051 - 132 121 40 157 60 5 9 46 7 38 126 144 10 59 48 - - - - - $PROJ_DIR$\..\..\Profiles\Roles\peripheral.c - - - BICOMP - 76 - - - ICC8051 - 34 - - - - - ICC8051 - 132 121 156 40 157 60 5 9 46 7 38 25 152 148 48 55 64 56 144 10 11 42 43 147 145 155 160 165 146 36 135 133 - - - - - $PROJ_DIR$\..\..\Profiles\DevInfo\devinfoservice.c - - - BICOMP - 108 - - - ICC8051 - 15 - - - - - ICC8051 - 132 121 156 40 157 60 5 9 46 7 38 160 165 147 146 159 127 123 + 132 134 138 115 3 136 142 140 143 141 130 107 145 146 11 @@ -1411,22 +1818,41 @@ BICOMP - 82 + 17 ICC8051 - 94 + 14 ICC8051 - 132 121 40 157 60 126 144 10 59 5 9 46 7 38 6 136 + 132 134 138 115 3 130 107 145 146 136 142 140 143 141 144 156 - $PROJ_DIR$\..\..\Profiles\Roles\gap.c + $PROJ_DIR$\..\..\..\..\Components\osal\mcu\cc2540\osal_snv.c + + + BICOMP + 50 + + + ICC8051 + 59 + + + + + ICC8051 + 132 134 9 115 2 118 107 3 145 12 138 136 142 140 143 141 131 11 148 + + + + + $PROJ_DIR$\..\..\Profiles\DevInfo\devinfoservice.c BICOMP @@ -1434,117 +1860,22 @@ ICC8051 - 97 + 162 ICC8051 - 132 121 156 40 157 60 145 5 9 46 7 38 155 + 132 134 95 138 115 3 136 142 140 143 141 122 111 124 113 120 77 94 - $PROJ_DIR$\..\..\common\npi\npi_np\npi.c + $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL_ClockBLE.c BICOMP - 20 - - - ICC8051 - 80 - - - - - ICC8051 - 132 121 157 64 56 144 60 10 154 55 - - - - - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_startup.c - - - BICOMP - 29 - - - ICC8051 - 79 - - - - - ICC8051 - 132 121 64 56 144 60 157 10 - - - - - $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL.c - - - BICOMP - 19 - - - ICC8051 - 106 - - - - - ICC8051 - 132 121 45 46 40 157 60 64 56 144 10 5 9 7 38 6 136 44 126 59 69 - - - - - $PROJ_DIR$\..\..\..\..\Components\osal\common\osal_bufmgr.c - - - BICOMP - 77 - - - ICC8051 - 8 - - - - - ICC8051 - 132 121 5 9 46 40 157 60 7 38 126 144 10 59 42 - - - - - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_timer.c - - - BICOMP - 109 - - - ICC8051 - 115 - - - - - ICC8051 - 132 121 - - - - - $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_uart.c - - - BICOMP - 22 + 45 ICC8051 @@ -1554,10 +1885,327 @@ ICC8051 - 132 121 56 144 60 157 10 69 55 64 5 9 46 40 7 38 136 + 132 134 138 115 3 130 107 145 146 136 142 140 143 141 153 + + $PROJ_DIR$\..\..\..\..\Components\ble\host\gatt_uuid.c + + + BICOMP + 151 + + + ICC8051 + 66 + + + + + ICC8051 + 132 134 138 115 3 136 142 140 143 141 113 95 111 124 120 + + + + + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_adc.c + + + BICOMP + 44 + + + ICC8051 + 23 + + + + + BICOMP + 9 115 2 118 107 3 145 + + + ICC8051 + 132 134 9 115 2 118 107 3 145 + + + + + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_aes.c + + + BICOMP + 54 + + + ICC8051 + 20 + + + + + ICC8051 + 132 134 136 142 140 138 115 3 143 141 117 106 2 118 107 145 + + + + + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_sleep.c + + + BICOMP + 35 + + + ICC8051 + 61 + + + + + ICC8051 + 132 134 115 107 3 145 2 118 146 0 6 136 142 140 138 143 141 144 156 5 11 154 95 150 152 + + + + + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_startup.c + + + BICOMP + 165 + + + ICC8051 + 27 + + + + + ICC8051 + 132 134 2 118 107 3 115 145 + + + + + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_lcd.c + + + BICOMP + 41 + + + ICC8051 + 39 + + + + + ICC8051 + 132 134 115 13 2 118 107 3 145 136 142 140 138 143 141 130 146 11 + + + + + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_timer.c + + + BICOMP + 69 + + + ICC8051 + 63 + + + + + ICC8051 + 132 134 + + + + + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_flash.c + + + BICOMP + 158 + + + ICC8051 + 68 + + + + + ICC8051 + 132 134 118 107 3 115 145 106 2 12 + + + + + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_key.c + + + BICOMP + 159 + + + ICC8051 + 57 + + + + + ICC8051 + 132 134 107 3 115 145 5 9 2 118 6 136 142 140 138 143 141 + + + + + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_dma.c + + + BICOMP + 52 + + + ICC8051 + 29 + + + + + ICC8051 + 132 134 106 2 118 107 3 115 145 147 + + + + + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_led.c + + + BICOMP + 161 + + + ICC8051 + 56 + + + + + ICC8051 + 132 134 107 3 115 145 5 0 2 118 136 142 140 138 143 141 + + + + + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_crc.c + + + BICOMP + 30 + + + ICC8051 + 62 + + + + + ICC8051 + 132 134 2 118 107 3 115 145 119 + + + + + $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_uart.c + + + BICOMP + 164 + + + ICC8051 + 19 + + + + + ICC8051 + 132 134 118 107 3 115 145 5 147 2 136 142 140 138 143 141 156 + + + + + $PROJ_DIR$\..\..\Profiles\Keys\simplekeys.c + + + BICOMP + 70 + + + ICC8051 + 64 + + + + + ICC8051 + 132 134 95 138 115 3 136 142 140 143 141 122 111 124 113 120 77 96 123 97 128 + + + + + $PROJ_DIR$\..\..\Profiles\SimpleProfile\simpleGATTprofile.c + + + BICOMP + 34 + + + ICC8051 + 28 + + + + + ICC8051 + 132 134 95 138 115 3 136 142 140 143 141 122 111 124 113 120 77 96 123 97 125 + + + + + $PROJ_DIR$\..\..\common\cc2540\OnBoard.c + + + BICOMP + 72 + + + ICC8051 + 51 + + + + + ICC8051 + 132 134 95 138 115 3 130 107 145 146 136 142 140 143 141 0 2 118 6 + + + + + [ROOT_NODE] + + + XLINK + 37 60 47 + + + [MULTI_TOOL] XLINK diff --git a/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/CC2541DB/SimpleBLEPeripheral.ewp b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/CC2541DB/SimpleBLEPeripheral.ewp index 4a591a8..71d5455 100644 --- a/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/CC2541DB/SimpleBLEPeripheral.ewp +++ b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/CC2541DB/SimpleBLEPeripheral.ewp @@ -1407,6 +1407,8 @@ HAL_LED=TRUE HAL_UART=TRUE xLCD_TO_UART + BOARD_51 + NO_FS APP + + $PROJ_DIR$\..\Source\Irext\src\ir_ac_apply.c + + + $PROJ_DIR$\..\Source\Irext\src\ir_ac_binary_parse.c + + + $PROJ_DIR$\..\Source\Irext\src\ir_ac_build_frame.c + + + $PROJ_DIR$\..\Source\Irext\src\ir_ac_control.c + + + $PROJ_DIR$\..\Source\Irext\src\ir_ac_parse_forbidden_info.c + + + $PROJ_DIR$\..\Source\Irext\src\ir_ac_parse_frame_info.c + + + $PROJ_DIR$\..\Source\Irext\src\ir_ac_parse_parameter.c + + + $PROJ_DIR$\..\Source\Irext\src\ir_decode.c + + + $PROJ_DIR$\..\Source\Irext\src\ir_tv_control.c + + + $PROJ_DIR$\..\Source\Irext\src\ir_utils.c + $PROJ_DIR$\..\Source\OSAL_simpleBLECentral.c diff --git a/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/CC2541DB/settings/SimpleBLEPeripheral.wsdt b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/CC2541DB/settings/SimpleBLEPeripheral.wsdt index 5404f54..6077595 100644 --- a/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/CC2541DB/settings/SimpleBLEPeripheral.wsdt +++ b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/CC2541DB/settings/SimpleBLEPeripheral.wsdt @@ -19,7 +19,7 @@ - 20103536969 + 2090849369 @@ -37,7 +37,7 @@ Workspace - SimpleBLEPeripheralSimpleBLEPeripheral/APPSimpleBLEPeripheral/LIBSimpleBLEPeripheral/PROFILES + SimpleBLEPeripheralSimpleBLEPeripheral/APPSimpleBLEPeripheral/INCLUDESimpleBLEPeripheral/PROFILES @@ -63,14 +63,14 @@ - TextEditor$WS_DIR$\..\Source\simpleBLEPeripheral.c00000000TextEditor$WS_DIR$\..\Source\SimpleBLEPeripheral_Main.c0000058382938291TextEditor$WS_DIR$\..\Source\simpleBLE.c000000000100000010000001 + TextEditor$WS_DIR$\..\Source\simpleBLEPeripheral.c00000000TextEditor$WS_DIR$\..\Source\SimpleBLEPeripheral_Main.c000005838293829TextEditor$WS_DIR$\..\Source\simpleBLE.c00000000TextEditor$WS_DIR$\..\..\Profiles\SimpleProfile\simpleGATTprofile.c00000392952295230100000010000001 - iaridepm.enu1-2-2705343-2-2267253139063251491179688702783-2-22561922-2-219242581002083256461139063251491 + iaridepm.enu1-2-2648343-2-2267253139063251241179688645482-2-23141922-2-219243161002083313803139063251241 diff --git a/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/CC2541DB/settings/SimpleBLEPeripheral.wspos b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/CC2541DB/settings/SimpleBLEPeripheral.wspos index 1c30b86..3d2a2ab 100644 --- a/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/CC2541DB/settings/SimpleBLEPeripheral.wspos +++ b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/CC2541DB/settings/SimpleBLEPeripheral.wspos @@ -1,2 +1,2 @@ [MainWindow] -WindowPlacement=_ 120 75 1502 944 3 +WindowPlacement=_ 1 1 1365 736 3 diff --git a/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_ac_apply.h b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_ac_apply.h new file mode 100644 index 0000000..a9dc4d2 --- /dev/null +++ b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_ac_apply.h @@ -0,0 +1,43 @@ +/************************************************************************************** +Filename: ir_ac_apply.h +Revised: Date: 2016-10-12 +Revision: Revision: 1.0 + +Description: This file provides methods for AC IR applying functionalities + +Revision log: +* 2016-10-12: created by strawmanbobi +**************************************************************************************/ + +#ifndef _IRDA_APPLY_H_ +#define _IRDA_APPLY_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif + +#include "ir_decode.h" + +#define MIN_TAG_LENGTH_TYPE_1 4 +#define MIN_TAG_LENGTH_TYPE_2 6 + +INT8 apply_power(t_remote_ac_status ac_status, UINT8 function_code); + +INT8 apply_mode(t_remote_ac_status ac_status, UINT8 function_code); + +INT8 apply_wind_speed(t_remote_ac_status ac_status, UINT8 function_code); + +INT8 apply_swing(t_remote_ac_status ac_status, UINT8 function_code); + +INT8 apply_temperature(t_remote_ac_status ac_status, UINT8 function_code); + +INT8 apply_function(struct ac_protocol *protocol, UINT8 function); + +INT8 apply_checksum(struct ac_protocol *protocol); + +#ifdef __cplusplus +} +#endif + +#endif //_IRDA_APPLY_H_ \ No newline at end of file diff --git a/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_ac_binary_parse.h b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_ac_binary_parse.h new file mode 100644 index 0000000..921437a --- /dev/null +++ b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_ac_binary_parse.h @@ -0,0 +1,35 @@ +/************************************************************************************** +Filename: ir_ac_binary_parse.h +Revised: Date: 2017-01-03 +Revision: Revision: 1.0 + +Description: This file provides methods for AC binary parse + +Revision log: +* 2017-01-03: created by strawmanbobi +**************************************************************************************/ + +#ifndef IRDA_DECODER_IR_AC_BINARY_PARSE_H +#define IRDA_DECODER_IR_AC_BINARY_PARSE_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +#include "ir_defs.h" + +extern INT8 binary_parse_offset(); + +extern INT8 binary_parse_len(); + +extern void binary_tags_info(); + +extern INT8 binary_parse_data(); + +#ifdef __cplusplus +} +#endif + + +#endif //IRDA_DECODER_IR_AC_BINARY_PARSE_H diff --git a/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_ac_build_frame.h b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_ac_build_frame.h new file mode 100644 index 0000000..8def3c8 --- /dev/null +++ b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_ac_build_frame.h @@ -0,0 +1,28 @@ +/************************************************************************************** +Filename: ir_utils.c +Revised: Date: 2016-10-26 +Revision: Revision: 1.0 + +Description: This file provides generic utils for IR frame build + +Revision log: +* 2016-10-01: created by strawmanbobi +**************************************************************************************/ + +#ifndef _IRDA_IRFRAME_H_ +#define _IRDA_IRFRAME_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif + +#include "ir_defs.h" + +extern UINT16 create_ir_frame(); + +#ifdef __cplusplus +} +#endif + +#endif // _IRDA_IRFRAME_H_ \ No newline at end of file diff --git a/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_ac_control.h b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_ac_control.h new file mode 100644 index 0000000..6eeee04 --- /dev/null +++ b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_ac_control.h @@ -0,0 +1,439 @@ +/************************************************************************************** +Filename: ir_ac_control.h +Revised: Date: 2016-12-31 +Revision: Revision: 1.0 + +Description: This file provides methods for AC IR control + +Revision log: +* 2016-10-12: created by strawmanbobi +**************************************************************************************/ +#ifndef IRDA_DECODER_IR_AC_CONTROL_H +#define IRDA_DECODER_IR_AC_CONTROL_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +#include "ir_defs.h" + + +#define TAG_COUNT_FOR_PROTOCOL 29 + +#define TAG_INVALID 0xffff + +#define MAX_DELAYCODE_NUM 16 +#define MAX_BITNUM 16 + +#define AC_PARAMETER_TYPE_1 0 +#define AC_PARAMETER_TYPE_2 1 + +typedef enum +{ + AC_POWER_ON = 0, + AC_POWER_OFF, + AC_POWER_MAX +} t_ac_power; + +typedef enum +{ + AC_TEMP_16 = 0, + AC_TEMP_17, + AC_TEMP_18, + AC_TEMP_19, + AC_TEMP_20, + AC_TEMP_21, + AC_TEMP_22, + AC_TEMP_23, + AC_TEMP_24, + AC_TEMP_25, + AC_TEMP_26, + AC_TEMP_27, + AC_TEMP_28, + AC_TEMP_29, + AC_TEMP_30, + AC_TEMP_MAX +} t_ac_temperature; + +typedef enum +{ + AC_MODE_COOL = 0, + AC_MODE_HEAT, + AC_MODE_AUTO, + AC_MODE_FAN, + AC_MODE_DRY, + AC_MODE_MAX +} t_ac_mode; + +typedef enum +{ + AC_FUNCTION_POWER = 1, + AC_FUNCTION_MODE, + AC_FUNCTION_TEMPERATURE_UP, + AC_FUNCTION_TEMPERATURE_DOWN, + AC_FUNCTION_WIND_SPEED, + AC_FUNCTION_WIND_SWING, + AC_FUNCTION_WIND_FIX, + AC_FUNCTION_MAX, +} t_ac_function; + +typedef enum +{ + AC_WS_AUTO = 0, + AC_WS_LOW, + AC_WS_MEDIUM, + AC_WS_HIGH, + AC_WS_MAX +} t_ac_wind_speed; + +typedef enum +{ + AC_SWING_ON = 0, + AC_SWING_OFF, + AC_SWING_MAX +} t_ac_swing; + +typedef enum +{ + SWING_TYPE_SWING_ONLY = 0, + SWING_TYPE_NORMAL, + SWING_TYPE_NOT_SPECIFIED, + SWING_TYPE_MAX +} swing_type; + +typedef enum +{ + TEMP_TYPE_DYNAMIC = 0, + TEMP_TYPE_STATIC, + TEMP_TYPE_MAX, +} t_temp_type; + +// enumeration for application polymorphism +typedef enum +{ + AC_APPLY_POWER = 0, + AC_APPLY_MODE, + AC_APPLY_TEMPERATURE_UP, + AC_APPLY_TEMPERATURE_DOWN, + AC_APPLY_WIND_SPEED, + AC_APPLY_WIND_SWING, + AC_APPLY_WIND_FIX, + AC_APPLY_MAX +} t_ac_apply; + +typedef struct _ac_hex +{ + UINT8 len; + UINT8 *data; +} t_ac_hex; + +typedef struct _ac_level +{ + UINT16 low; + UINT16 high; +} t_ac_level; + +typedef struct _ac_bootcode +{ + UINT16 len; + UINT16 data[16]; +} t_ac_bootcode; + +typedef struct _ac_delaycode +{ + INT16 pos; + UINT16 time[8]; + UINT16 time_cnt; +} t_ac_delaycode; + +/* + * the array of tag_100X application data + * seg_len : length for each segment + * byte_pos : the position of update byte + * byte_value : the value to be updated to position + */ +typedef struct _tag_comp_type_1 +{ + UINT8 seg_len; + UINT8 *segment; +} t_tag_comp; + +typedef struct _tag_swing_info +{ + swing_type type; + UINT8 mode_count; + UINT8 dir_index; +} t_swing_info; + +typedef struct _tag_power_1 +{ + UINT8 len; + t_tag_comp comp_data[AC_POWER_MAX]; +} t_power_1; + +typedef struct _tag_temp_1 +{ + UINT8 len; + UINT8 type; + t_tag_comp comp_data[AC_TEMP_MAX]; +} t_temp_1; + +typedef struct tag_mode_1 +{ + UINT8 len; + t_tag_comp comp_data[AC_MODE_MAX]; +} t_mode_1; + +typedef struct tag_speed_1 +{ + UINT8 len; + t_tag_comp comp_data[AC_WS_MAX]; +} t_speed_1; + +typedef struct tag_swing_1 +{ + UINT8 len; + UINT16 count; + t_tag_comp *comp_data; +} t_swing_1; + +typedef struct tag_temp_2 +{ + UINT8 len; + UINT8 type; + t_tag_comp comp_data[AC_TEMP_MAX]; +} t_temp_2; + +typedef struct tag_mode_2 +{ + UINT8 len; + t_tag_comp comp_data[AC_MODE_MAX]; +} t_mode_2; + +typedef struct tag_speed_2 +{ + UINT8 len; + t_tag_comp comp_data[AC_WS_MAX]; +} t_speed_2; + +typedef struct tag_swing_2 +{ + UINT8 len; + UINT16 count; + t_tag_comp *comp_data; +} t_swing_2; + +#if defined SUPPORT_HORIZONTAL_SWING +typedef struct tag_horiswing_1 +{ + UINT16 len; + t_tag_comp comp_data[AC_HORI_SWING_MAX]; +} hori_swing_1; +#endif + +typedef struct _tag_checksum_data +{ + UINT8 len; + UINT8 type; + UINT8 start_byte_pos; + UINT8 end_byte_pos; + UINT8 checksum_byte_pos; + UINT8 checksum_plus; + UINT8 *spec_pos; +} t_tag_checksum_data; + +typedef struct tag_checksum +{ + UINT8 len; + UINT16 count; + t_tag_checksum_data *checksum_data; +} t_checksum; + +typedef struct tag_function_1 +{ + UINT8 len; + t_tag_comp comp_data[AC_FUNCTION_MAX - 1]; +} t_function_1; + +typedef struct tag_function_2 +{ + UINT8 len; + t_tag_comp comp_data[AC_FUNCTION_MAX - 1]; +} t_function_2; + +typedef struct tag_solo_code +{ + UINT8 len; + UINT8 solo_func_count; + UINT8 solo_function_codes[AC_FUNCTION_MAX - 1]; +} t_solo_code; + +typedef struct _ac_bitnum +{ + INT16 pos; + UINT16 bits; +} t_ac_bit_num; + +typedef enum +{ + N_COOL = 0, + N_HEAT, + N_AUTO, + N_FAN, + N_DRY, + N_MODE_MAX, +} t_ac_n_mode; + +typedef enum +{ + CHECKSUM_TYPE_BYTE = 1, + CHECKSUM_TYPE_BYTE_INVERSE, + CHECKSUM_TYPE_HALF_BYTE, + CHECKSUM_TYPE_HALF_BYTE_INVERSE, + CHECKSUM_TYPE_SPEC_HALF_BYTE, + CHECKSUM_TYPE_SPEC_HALF_BYTE_INVERSE, + CHECKSUM_TYPE_SPEC_HALF_BYTE_ONE_BYTE, + CHECKSUM_TYPE_SPEC_HALF_BYTE_INVERSE_ONE_BYTE, + CHECKSUM_TYPE_MAX, +} t_checksum_type; + +typedef struct _ac_n_mode_info +{ + UINT8 enable; + UINT8 all_speed; + UINT8 all_temp; + UINT8 temp[AC_TEMP_MAX]; + UINT8 temp_cnt; + UINT8 speed[AC_WS_MAX]; + UINT8 speed_cnt; +} t_ac_n_mode_info; + +typedef struct ac_protocol +{ + UINT8 endian; + // t_ac_hex default_code; + t_ac_hex default_code; + t_ac_level zero; + t_ac_level one; + t_ac_bootcode boot_code; + t_ac_delaycode dc[MAX_DELAYCODE_NUM]; + t_power_1 power1; + t_temp_1 temp1; + t_mode_1 mode1; + t_speed_1 speed1; + t_swing_1 swing1; + t_checksum checksum; + + t_function_1 function1; + t_function_2 function2; + + t_temp_2 temp2; + t_mode_2 mode2; + t_speed_2 speed2; + t_swing_2 swing2; + + t_swing_info si; + t_solo_code sc; + + UINT8 swing_status; + + BOOL change_wind_direction; + + UINT16 dc_cnt; + t_ac_bit_num bit_num[MAX_BITNUM]; + UINT16 bit_num_cnt; + UINT16 repeat_times; + t_ac_n_mode_info n_mode[N_MODE_MAX]; + UINT16 code_cnt; + UINT8 last_bit; + UINT16 *time; + UINT8 solo_function_mark; + + UINT16 frame_length; +} t_ac_protocol; + +typedef struct tag_head +{ + UINT16 tag; + UINT16 len; + unsigned short offset; + UINT8 *p_data; +} t_tag_head; + +struct ir_bin_buffer +{ + UINT8 *data; + UINT16 len; + UINT16 offset; +}; + +typedef struct REMOTE_AC_STATUS +{ + t_ac_power ac_power; + t_ac_temperature ac_temp; + t_ac_mode ac_mode; + t_ac_swing ac_wind_dir; + t_ac_wind_speed ac_wind_speed; + UINT8 ac_display; + UINT8 ac_sleep; + UINT8 ac_timer; +} t_remote_ac_status; + +// function polymorphism +typedef INT8 (*lp_apply_ac_parameter)(t_remote_ac_status ac_status, UINT8 function_code); + +#define TAG_AC_BOOT_CODE 1 +#define TAG_AC_ZERO 2 +#define TAG_AC_ONE 3 +#define TAG_AC_DELAY_CODE 4 +#define TAG_AC_FRAME_LENGTH 5 +#define TAG_AC_ENDIAN 6 +#define TAG_AC_LAST_BIT 7 + +#define TAG_AC_POWER_1 21 +#define TAG_AC_DEFAULT_CODE 22 +#define TAG_AC_TEMP_1 23 +#define TAG_AC_MODE_1 24 +#define TAG_AC_SPEED_1 25 +#define TAG_AC_SWING_1 26 +#define TAG_AC_CHECKSUM_TYPE 27 +#define TAG_AC_SOLO_FUNCTION 28 +#define TAG_AC_FUNCTION_1 29 +#define TAG_AC_TEMP_2 30 +#define TAG_AC_MODE_2 31 +#define TAG_AC_SPEED_2 32 +#define TAG_AC_SWING_2 33 +#define TAG_AC_FUNCTION_2 34 + +#define TAG_AC_BAN_FUNCTION_IN_COOL_MODE 41 +#define TAG_AC_BAN_FUNCTION_IN_HEAT_MODE 42 +#define TAG_AC_BAN_FUNCTION_IN_AUTO_MODE 43 +#define TAG_AC_BAN_FUNCTION_IN_FAN_MODE 44 +#define TAG_AC_BAN_FUNCTION_IN_DRY_MODE 45 +#define TAG_AC_SWING_INFO 46 +#define TAG_AC_REPEAT_TIMES 47 +#define TAG_AC_BIT_NUM 48 + + +// definition about size + +#define PROTOCOL_SIZE (sizeof(t_ac_protocol)) + +/* exported variables */ +extern UINT8 *ir_hex_code; +extern UINT8 ir_hex_len; +extern t_ac_protocol *context; + + +extern INT8 ir_ac_lib_parse(); + +extern INT8 free_ac_context(); + +extern BOOL is_solo_function(UINT8 function_code); + +#ifdef __cplusplus +} +#endif + +#endif //IRDA_DECODER_IR_AC_CONTROL_H diff --git a/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_ac_parse_forbidden_info.h b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_ac_parse_forbidden_info.h new file mode 100644 index 0000000..8f0f5b1 --- /dev/null +++ b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_ac_parse_forbidden_info.h @@ -0,0 +1,29 @@ +/************************************************************************************** +Filename: ir_parse_forbidden_info.h +Revised: Date: 2016-10-05 +Revision: Revision: 1.0 + +Description: This file provides algorithms for forbidden area of AC code + +Revision log: +* 2016-10-05: created by strawmanbobi +**************************************************************************************/ + +#ifndef _IRDA_PARSE_PARSE_H_ +#define _IRDA_PARSE_PARSE_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif + +#include "ir_decode.h" + +extern INT8 parse_nmode(struct tag_head *tag, t_ac_n_mode index); + +#ifdef __cplusplus +} +#endif + +#endif // _IRDA_PARSE_PARSE_H_ + diff --git a/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_ac_parse_frame_info.h b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_ac_parse_frame_info.h new file mode 100644 index 0000000..899f499 --- /dev/null +++ b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_ac_parse_frame_info.h @@ -0,0 +1,44 @@ +/************************************************************************************** +Filename: ir_parse_frame_parameter.h +Revised: Date: 2016-10-11 +Revision: Revision: 1.0 + +Description: This file provides algorithms for IR decode for AC frame parameters + +Revision log: +* 2016-10-11: created by strawmanbobi +**************************************************************************************/ + +#ifndef _IRDA_PARSE_FRAME_PARAMETER_H_ +#define _IRDA_PARSE_FRAME_PARAMETER_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif + +#include "ir_decode.h" + +extern INT8 parse_boot_code(struct tag_head *tag); + +extern INT8 parse_zero(struct tag_head *tag); + +extern INT8 parse_one(struct tag_head *tag); + +extern INT8 parse_delay_code(struct tag_head *tag); + +extern INT8 parse_frame_len(struct tag_head *tag, UINT16 len); + +extern INT8 parse_endian(struct tag_head *tag); + +extern INT8 parse_lastbit(struct tag_head *tag); + +extern INT8 parse_repeat_times(struct tag_head *tag); + +extern INT8 parse_bit_num(struct tag_head *tag); + +#ifdef __cplusplus +} +#endif + +#endif // _IRDA_PARSE_FRAME_PARAMETER_H_ \ No newline at end of file diff --git a/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_ac_parse_parameter.h b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_ac_parse_parameter.h new file mode 100644 index 0000000..6d53e89 --- /dev/null +++ b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_ac_parse_parameter.h @@ -0,0 +1,58 @@ +/************************************************************************************** +Filename: ir_parse_ac_parameter.h +Revised: Date: 2016-10-12 +Revision: Revision: 1.0 + +Description: This file provides algorithms for IR decode for AC functionality parameters + +Revision log: +* 2016-10-12: created by strawmanbobi +**************************************************************************************/ + +#ifndef _IRDA_PARSE_AC_PARAMETER_H_ +#define _IRDA_PARSE_AC_PARAMETER_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif + +#include "ir_decode.h" + +extern INT8 parse_common_ac_parameter(t_tag_head *tag, t_tag_comp *comp_data, UINT8 with_end, UINT8 type); + +extern INT8 parse_default_code(struct tag_head *tag, t_ac_hex *default_code); + +extern INT8 parse_power_1(struct tag_head *tag, t_power_1 *power1); + +extern INT8 parse_temp_1(struct tag_head *tag, t_temp_1 *temp1); + +extern INT8 parse_mode_1(struct tag_head *tag, t_mode_1 *mode1); + +extern INT8 parse_speed_1(struct tag_head *tag, t_speed_1 *speed1); + +extern INT8 parse_swing_1(struct tag_head *tag, t_swing_1 *swing1, UINT16 swing_count); + +extern INT8 parse_checksum(struct tag_head *tag, t_checksum *checksum); + +extern INT8 parse_function_1_tag29(struct tag_head *tag, t_function_1 *function1); + +extern INT8 parse_temp_2(struct tag_head *tag, t_temp_2 *temp2); + +extern INT8 parse_mode_2(struct tag_head *tag, t_mode_2 *mode2); + +extern INT8 parse_speed_2(struct tag_head *tag, t_speed_2 *speed2); + +extern INT8 parse_swing_2(struct tag_head *tag, t_swing_2 *swing2, UINT16 swing_count); + +extern INT8 parse_function_2_tag34(struct tag_head *tag, t_function_2 *function2); + +extern INT8 parse_swing_info(struct tag_head *tag, t_swing_info *si); + +extern INT8 parse_solo_code(struct tag_head *tag, t_solo_code *sc); + +#ifdef __cplusplus +} +#endif + +#endif // _IRDA_PARSE_AC_PARAMETER_H_ \ No newline at end of file diff --git a/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_decode.h b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_decode.h new file mode 100644 index 0000000..b2fff07 --- /dev/null +++ b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_decode.h @@ -0,0 +1,160 @@ +/************************************************************************************** +Filename: ir_decode.h +Revised: Date: 2016-10-01 +Revision: Revision: 1.0 + +Description: This file provides algorithms for IR decode + +Revision log: +* 2016-10-01: created by strawmanbobi +**************************************************************************************/ + +#ifndef _IRDA_DECODE_H_ +#define _IRDA_DECODE_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif + +#include +#include "ir_defs.h" +#include "ir_ac_control.h" +#include "ir_tv_control.h" + +#define IR_DECODE_FAILED (-1) +#define IR_DECODE_SUCCEEDED (0) + +#define IR_CATEGORY_AC 1 +#define IR_CATEGORY_TV 2 + +#define IR_TYPE_STATUS 0 +#define IR_TYPE_COMMANDS 1 + +#define SUB_CATEGORY_QUATERNARY 0 +#define SUB_CATEGORY_HEXADECIMAL 1 + +// exported functions +/** + * function ir_file_open + * + * description: open IR binary code from file + * + * parameters: category (in) - category ID get from indexing API + * sub_category (in) - subcategory ID get from indexing API + * file_name (in) - file name of IR binary + * + * returns: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED + * + */ +extern INT8 ir_file_open(const UINT8 category, const UINT8 sub_category, const char* file_name); + +/** + * function ir_binary_open + * + * description: open IR binary code from buffer + * + * parameters: category (in) - category ID get from indexing API + * sub_category (in) - subcategory ID get from indexing API + * binary (in) - pointer to binary buffer + * binary_length (in) - binary buffer size + * + * returns: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED + */ +extern INT8 ir_binary_open(const UINT8 category, const UINT8 sub_category, UINT8* binary, UINT16 binary_length); + +/** + * function ir_decode + * + * description: decode IR binary into INT16 array which indicates the IR levels + * + * parameters: key_code (in) - the code of pressed key + * user_data (out) - output decoded data in INT16 array format + * ac_status(in) - pointer to AC status (optional) + * change_wind_direction (in) - if control changes wind direction for AC (for AC only) + * + * returns: length of decoded data (0 indicates decode failure) + */ +extern UINT16 ir_decode(UINT8 key_code, UINT16* user_data, t_remote_ac_status* ac_status, BOOL change_wind_direction); + +/** + * function ir_close + * + * description: close IR binary code + * + * parameters: N/A + * + * returns: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED + */ +extern INT8 ir_close(); + +/** + * function get_temperature_range + * + * description: get the supported temperature range [min, max] for the opened AC IR binary + * + * parameters: ac_mode (in) specify in which AC mode the application need to get temperature info + * temp_min (out) the min temperature supported in a specified AC mode + * temp_max (out) the max temperature supported in a specified AC mode + * + * returns: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED + */ +extern INT8 get_temperature_range(UINT8 ac_mode, INT8 *temp_min, INT8 *temp_max); + +/** + * function get_supported_mode + * + * description: get supported mode for the opened AC IR binary + * + * parameters: supported_mode (out) mode supported by the remote in lower 5 bits + * + * returns: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED + */ +extern INT8 get_supported_mode(UINT8 *supported_mode); + +/** + * function get_supported_wind_speed + * + * description: get supported wind speed levels for the opened AC IR binary in certain mode + * + * parameters: ac_mode (in) specify in which AC mode the application need to get wind speed info + * supported_wind_speed (out) wind speed supported by the remote in lower 4 bits + * + * returns: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED + */ +extern INT8 get_supported_wind_speed(UINT8 ac_mode, UINT8 *supported_wind_speed); + +/** + * function get_supported_swing + * + * description: get supported swing functions for the opened AC IR binary in certain mode + * + * parameters: ac_mode (in) specify in which AC mode the application need to get swing info + * supported_swing (out) swing supported by the remote in lower 2 bits + * + * returns: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED + */ +extern INT8 get_supported_swing(UINT8 ac_mode, UINT8 *supported_swing); + +/** + * function get_supported_wind_direction + * + * description: get supported wind directions for the opened AC IR binary in certain mode + * + * parameters: supported_wind_direction (out) swing supported by the remote in lower 2 bits + * + * returns: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED + */ +extern INT8 get_supported_wind_direction(UINT8 *supported_wind_direction); + + +// private extern function +#if (defined BOARD_PC || defined BOARD_PC_DLL) +extern void ir_lib_free_inner_buffer(); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // _IRDA_DECODE_H_ diff --git a/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_defs.h b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_defs.h new file mode 100644 index 0000000..7b60e53 --- /dev/null +++ b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_defs.h @@ -0,0 +1,63 @@ +/************************************************************************************** +Filename: ir_defs.h +Revised: Date: 2016-10-26 +Revision: Revision: 1.0 + +Description: This file provides algorithms for IR decode + +Revision log: +* 2016-10-01: created by strawmanbobi +**************************************************************************************/ + +#ifndef PARSE_IR_DEFS_H +#define PARSE_IR_DEFS_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +#if defined BOARD_ANDROID +#include +#define LOG_TAG "ir_decode" +#endif + +#if defined BOARD_CC26XX +#include "OSAL.h" +#endif + +#define TRUE 1 +#define FALSE 0 + +typedef unsigned char UINT8; +typedef signed char INT8; +typedef unsigned short UINT16; +typedef signed short INT16; +typedef signed int INT; +typedef unsigned int UINT; +typedef int BOOL; + +void noprint(const char *fmt, ...); + +#if !defined BOARD_CC26XX +#define ir_malloc(A) malloc(A) +#define ir_free(A) free(A) +#else +#define ir_malloc(A) ICall_malloc(A) +#define ir_free(A) ICall_free(A) +#endif + +#define ir_memcpy(A, B, C) memcpy(A, B, C) +#define ir_memset(A, B, C) memset(A, B, C) +#define ir_strlen(A) strlen(A) +#if (defined BOARD_PC) && (!defined BOARD_PC_JNI) +#define ir_printf printf +#else +#define ir_printf noprint +#endif +#define USER_DATA_SIZE 1636 + +#ifdef __cplusplus +} +#endif +#endif //PARSE_IR_DEFS_H diff --git a/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_tv_control.h b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_tv_control.h new file mode 100644 index 0000000..9e86741 --- /dev/null +++ b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_tv_control.h @@ -0,0 +1,215 @@ +/************************************************************************************** +Filename: ir_lib.h +Revised: Date: 2016-02-23 +Revision: Revision: 1.0 + +Description: This file provides algorithms for IR decode (compressed command type) + +Revision log: +* 2016-10-21: created by strawmanbobi +**************************************************************************************/ + +#ifndef _IRDA_LIB_H_ +#define _IRDA_LIB_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif + +#include "ir_defs.h" + +#define STB_CHANNEL_OFFSET 14 + +#define IRDA_FLAG_NORMAL 0 +#define IRDA_FLAG_INVERSE 1 + +#define IRDA_LEVEL_LOW 0 +#define IRDA_LEVEL_HIGH 1 + +#define IRDA_LSB 0 +#define IRDA_MSB 1 + +enum +{ + IRDA_DECODE_1_BIT = 0, + IRDA_DECODE_2_BITS, + IRDA_DECODE_4_BITS, +}; + +/* + * global type definitions + */ +typedef enum ir_flags +{ + IRDA_BOOT = 0, + IRDA_STOP, + IRDA_SEP, + IRDA_ONE, + IRDA_ZERO, + IRDA_FLIP, + IRDA_TWO, + IRDA_THREE = 7, + IRDA_FOUR, + IRDA_FIVE, + IRDA_SIX, + IRDA_SEVEN, + IRDA_EIGHT, + IRDA_NINE, + IRDA_A, + IRDA_B, + IRDA_C, + IRDA_D, + IRDA_E, + IRDA_F, + IRDA_MAX = 20, +} t_ir_flags; + +typedef struct ir_data +{ + UINT8 bits; + UINT8 lsb; + UINT8 mode; + UINT8 index; +} t_ir_data; + +#if !defined BOARD_51 +#pragma pack(1) +#endif +typedef struct ir_cycles +{ + UINT8 flag; + UINT16 mask; + UINT16 space; +} t_ir_cycles; + +#if !defined BOARD_51 +#pragma pack() +#endif + +typedef enum tv_key_value +{ + TV_POWER = 0, + TV_MUTE, + TV_UP, + TV_DOWN, + TV_LEFT, + TV_RIGHT, + TV_OK, + TV_VOL_UP, + TV_VOL_DOWN, + TV_BACK, + TV_INPUT, + TV_MENU, + TV_HOME, + TV_SET, + TV_0, + TV_1, + TV_2, + TV_3, + TV_4, + TV_5, + TV_6, + TV_7, + TV_8, + TV_9, + TV_KEY_MAX, +} t_tv_key_value; + + +typedef enum stb_key_value +{ + STB_POWER = 0, + STB_MUTE, + STB_UP, + STB_DOWN, + STB_LEFT, + STB_RIGHT, + STB_OK, + STB_VOL_UP, + STB_VOL_DOWN, + STB_BACK, + STB_INPUT, + STB_MENU, + STB_PAGE_UP, + STB_PAGE_DOWN, + STB_0, + STB_1, + STB_2, + STB_3, + STB_4, + STB_5, + STB_6, + STB_7, + STB_8, + STB_9, + STB_KEY_MAX, +} t_stb_key_value; + +typedef enum nw_key_value +{ + NW_POWER = 0, + NW_UP, + NW_DOWN, + NW_LEFT, + NW_RIGHT, + NW_OK, + NW_VOL_UP, + NW_VOL_DOWN, + NW_BACK, + NW_MENU, + NW_HOME, + NW_0, + NW_1, + NW_2, + NW_3, + NW_4, + NW_5, + NW_6, + NW_7, + NW_8, + NW_9, + NW_KEY_MAX, +} t_nw_key_value; + +typedef enum cm_key_value +{ + CM_POWER = 0, + CM_UP, + CM_DOWN, + CM_LEFT, + CM_RIGHT, + CM_OK, + CM_VOL_UP, + CM_VOL_DOWN, + CM_FUNC_1, + CM_FUNC_2, + CM_FUNC_3, + CM_BACK, + CM_HOME, + CM_MENU, + CM_MODE, + CM_KEY_MAX, +} t_cm_key_value; + +typedef struct ir_data_tv +{ + char magic[4]; + UINT8 per_keycode_bytes; +} t_ir_data_tv; + + +extern INT8 tv_lib_open(UINT8 *binary, UINT16 binary_length); + +extern BOOL tv_lib_parse(UINT8 encode_type); + +extern UINT16 tv_lib_control(UINT8 key, UINT16 *user_data); + +extern UINT8 tv_lib_close(); + +#ifdef __cplusplus +} +#endif + +#endif /* _IRDA_LIB_H_ */ + diff --git a/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_utils.h b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_utils.h new file mode 100644 index 0000000..667bdf1 --- /dev/null +++ b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/include/ir_utils.h @@ -0,0 +1,36 @@ +/************************************************************************************** +Filename: ir_utils.c +Revised: Date: 2016-10-26 +Revision: Revision: 1.0 + +Description: This file provides generic utils for IRDA algorithms + +Revision log: +* 2016-10-01: created by strawmanbobi +**************************************************************************************/ + +#ifndef _IRDA_UTILS_H_ +#define _IRDA_UTILS_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif + +#include "ir_defs.h" +#include "ir_decode.h" + +#include + +extern void string_to_hex(UINT8 *p, t_ac_hex *pac_hex); + +extern void string_to_hex_common(UINT8 *p, UINT8 *hex_data, UINT16 len); + +extern BOOL is_in(const UINT8 *array, UINT8 value, UINT8 len); + +extern void hex_byte_to_double_char(char *dest, UINT8 length, UINT8 src); + +#ifdef __cplusplus +} +#endif +#endif // _IRDA_UTILS_H_ \ No newline at end of file diff --git a/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_ac_apply.c b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_ac_apply.c new file mode 100644 index 0000000..905ddc8 --- /dev/null +++ b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_ac_apply.c @@ -0,0 +1,772 @@ +/************************************************************************************** +Filename: ir_ac_apply.c +Revised: Date: 2016-10-12 +Revision: Revision: 1.0 + +Description: This file provides methods for AC IR applying functionalities + +Revision log: +* 2016-10-12: created by strawmanbobi +**************************************************************************************/ + +#include "../include/ir_utils.h" +#include "../include/ir_ac_apply.h" + + +static INT8 apply_ac_power(struct ac_protocol *protocol, UINT8 power_status); + +static INT8 apply_ac_mode(struct ac_protocol *protocol, UINT8 mode_status); + +static INT8 apply_ac_temperature(struct ac_protocol *protocol, UINT8 temp_diff); + +static INT8 apply_ac_wind_speed(struct ac_protocol *protocol, UINT8 wind_speed); + +static INT8 apply_ac_swing(struct ac_protocol *protocol, UINT8 swing_mode); + +static UINT8 has_function(struct ac_protocol *protocol, UINT8 function); + + +INT8 apply_ac_parameter_type_1(UINT8 *dc_data, t_tag_comp *comp_data, UINT8 current_seg, UINT8 is_temp) +{ + if (0 != (comp_data->seg_len & 0x01)) + { + return IR_DECODE_FAILED; + } + + if (1 == is_temp) + { + dc_data[comp_data->segment[current_seg]] += comp_data->segment[current_seg + 1]; + } + else + { + dc_data[comp_data->segment[current_seg]] = comp_data->segment[current_seg + 1]; + } + + return IR_DECODE_SUCCEEDED; +} + +INT8 apply_ac_parameter_type_2(UINT8 *dc_data, t_tag_comp *comp_data, UINT8 current_seg, UINT8 is_temp) +{ + UINT8 start_bit = 0; + UINT8 end_bit = 0; + UINT8 cover_byte_pos_hi = 0; + UINT8 cover_byte_pos_lo = 0; + UINT8 value; + UINT8 move_bit = 0; + + if (0 != (comp_data->seg_len % 3)) + { + return IR_DECODE_FAILED; + } + + start_bit = comp_data->segment[current_seg]; + end_bit = comp_data->segment[current_seg + 1]; + cover_byte_pos_hi = start_bit >> 3; + cover_byte_pos_lo = (UINT8) (end_bit - 1) >> 3; + if (cover_byte_pos_hi == cover_byte_pos_lo) + { + // cover_byte_pos_hi or cover_bytes_pos_lo is target byte to be applied with AC parameter + // try get raw value of byte to be applied + UINT8 raw_value = comp_data->segment[current_seg + 2]; + UINT8 int_start_bit = start_bit - (cover_byte_pos_hi << 3); + UINT8 int_end_bit = end_bit - (cover_byte_pos_lo << 3); + UINT8 bit_range = end_bit - start_bit; + UINT8 mask = (UINT8) ((0xFF << (8 - int_start_bit)) | (0xFF >> int_end_bit)); + UINT8 origin = dc_data[cover_byte_pos_lo]; + + if (TRUE == is_temp) + { + move_bit = (UINT8) (8 - int_end_bit); + value = (origin & mask) | (((((origin & ~mask) >> move_bit) + raw_value) << move_bit) & ~mask); + } + else + { + value = (origin & mask) | ((raw_value << (8 - int_start_bit - bit_range)) & ~mask); + } + dc_data[cover_byte_pos_lo] = value; + } + else + { + UINT8 origin_hi = 0; + UINT8 origin_lo = 0; + UINT8 mask_hi = 0; + UINT8 mask_lo = 0; + UINT8 raw_value = 0; + UINT8 int_start_bit = 0; + UINT8 int_end_bit = 0; + + if (cover_byte_pos_hi > cover_byte_pos_lo) + { + return IR_DECODE_FAILED; + } + // calculate the bit scope + UINT8 bit_range = end_bit - start_bit; + + raw_value = comp_data->segment[current_seg + 2]; + origin_hi = dc_data[cover_byte_pos_hi]; + origin_lo = dc_data[cover_byte_pos_lo]; + + int_start_bit = start_bit - (cover_byte_pos_hi << 3); + int_end_bit = end_bit - (cover_byte_pos_lo << 3); + + mask_hi = (UINT8) 0xFF << (8 - int_start_bit); + mask_lo = (UINT8) 0xFF >> int_end_bit; + + value = ((origin_hi & ~mask_hi) << int_end_bit) | ((origin_lo & ~mask_lo) >> (8 - int_end_bit)); + + if (TRUE == is_temp) + { + raw_value += value; + } + + dc_data[cover_byte_pos_hi] = (UINT8) ((origin_hi & mask_hi) | + (((0xFF >> (8 - bit_range)) & raw_value) >> int_end_bit)); + + dc_data[cover_byte_pos_lo] = (UINT8) ((origin_lo & mask_lo) | + (((0xFF >> (8 - bit_range)) & raw_value) << (8 - int_end_bit))); + } + + return IR_DECODE_SUCCEEDED; +} + +static INT8 apply_ac_power(struct ac_protocol *protocol, UINT8 power_status) +{ + UINT16 i = 0; + if (0 == protocol->power1.len) + { + return IR_DECODE_SUCCEEDED; + } + + if (0 == protocol->power1.comp_data[power_status].seg_len) + { + // force to apply power in any cases + return IR_DECODE_SUCCEEDED; + } + for (i = 0; i < protocol->power1.comp_data[power_status].seg_len; i += 2) + { + apply_ac_parameter_type_1(ir_hex_code, &(protocol->power1.comp_data[power_status]), (UINT8) i, FALSE); + } + return IR_DECODE_SUCCEEDED; +} + +static INT8 apply_ac_mode(struct ac_protocol *protocol, UINT8 mode_status) +{ + UINT16 i = 0; + + if (0 == protocol->mode1.len) + { + goto try_applying_mode2; + } + + if (0 == protocol->mode1.comp_data[mode_status].seg_len) + { + return IR_DECODE_FAILED; + } + + for (i = 0; i < protocol->mode1.comp_data[mode_status].seg_len; i += 2) + { + apply_ac_parameter_type_1(ir_hex_code, &(protocol->mode1.comp_data[mode_status]), (UINT8) i, FALSE); + } + + // get return here since wind mode 1 is already applied + return IR_DECODE_SUCCEEDED; + + try_applying_mode2: + if (0 == protocol->mode2.len) + { + return IR_DECODE_SUCCEEDED; + } + + if (0 == protocol->mode2.comp_data[mode_status].seg_len) + { + return IR_DECODE_FAILED; + } + + for (i = 0; i < protocol->mode2.comp_data[mode_status].seg_len; i += 3) + { + apply_ac_parameter_type_2(ir_hex_code, + &(protocol->mode2.comp_data[mode_status]), + (UINT8) i, FALSE); + } + return IR_DECODE_SUCCEEDED; +} + +static INT8 apply_ac_wind_speed(struct ac_protocol *protocol, UINT8 wind_speed) +{ + UINT16 i = 0; + + if (0 == protocol->speed1.len) + { + goto try_applying_wind_speed2; + } + + if (0 == protocol->speed1.comp_data[wind_speed].seg_len) + { + return IR_DECODE_FAILED; + } + + for (i = 0; i < protocol->speed1.comp_data[wind_speed].seg_len; i += 2) + { + apply_ac_parameter_type_1(ir_hex_code, &(protocol->speed1.comp_data[wind_speed]), (UINT8) i, FALSE); + } + + // get return here since wind speed 1 is already applied + return IR_DECODE_SUCCEEDED; + + try_applying_wind_speed2: + if (0 == protocol->speed2.len) + { + return IR_DECODE_SUCCEEDED; + } + + if (0 == protocol->speed2.comp_data[wind_speed].seg_len) + { + return IR_DECODE_FAILED; + } + + for (i = 0; i < protocol->speed2.comp_data[wind_speed].seg_len; i += 3) + { + apply_ac_parameter_type_2(ir_hex_code, + &(protocol->speed2.comp_data[wind_speed]), + (UINT8) i, FALSE); + } + return IR_DECODE_SUCCEEDED; +} + +static INT8 apply_ac_temperature(struct ac_protocol *protocol, UINT8 temp_diff) +{ + UINT16 i = 0; + + if (0 == protocol->temp1.len) + { + goto try_applying_temp2; + } + + if (0 == protocol->temp1.comp_data[temp_diff].seg_len) + { + return IR_DECODE_FAILED; + } + + for (i = 0; i < protocol->temp1.comp_data[temp_diff].seg_len; i += 2) + { + if (TEMP_TYPE_DYNAMIC == protocol->temp1.type) + { + apply_ac_parameter_type_1(ir_hex_code, &(protocol->temp1.comp_data[temp_diff]), (UINT8) i, TRUE); + } + else if (TEMP_TYPE_STATIC == protocol->temp1.type) + { + apply_ac_parameter_type_1(ir_hex_code, &(protocol->temp1.comp_data[temp_diff]), (UINT8) i, FALSE); + } + } + + // get return here since temperature 1 is already applied + return IR_DECODE_SUCCEEDED; + + try_applying_temp2: + if (0 == protocol->temp2.len) + { + return IR_DECODE_SUCCEEDED; + } + + if (0 == protocol->temp2.comp_data[temp_diff].seg_len) + { + return IR_DECODE_FAILED; + } + + for (i = 0; i < protocol->temp2.comp_data[temp_diff].seg_len; i += 3) + { + if (0 != protocol->temp2.comp_data[temp_diff].seg_len) + { + if (TEMP_TYPE_DYNAMIC == protocol->temp2.type) + { + apply_ac_parameter_type_2(ir_hex_code, &(protocol->temp2.comp_data[temp_diff]), (UINT8) i, TRUE); + } + else if (TEMP_TYPE_STATIC == protocol->temp2.type) + { + apply_ac_parameter_type_2(ir_hex_code, &(protocol->temp2.comp_data[temp_diff]), (UINT8) i, FALSE); + } + } + } + return IR_DECODE_SUCCEEDED; +} + +static INT8 apply_ac_swing(struct ac_protocol *protocol, UINT8 swing_mode) +{ + UINT16 i = 0; + + if (0 == protocol->swing1.len) + { + goto try_applying_swing2; + } + + if (swing_mode >= protocol->swing1.count) + { + return IR_DECODE_FAILED; + } + + if (0 == protocol->swing1.comp_data[swing_mode].seg_len) + { + // swing does not have any empty data segment + return IR_DECODE_FAILED; + } + + for (i = 0; i < protocol->swing1.comp_data[swing_mode].seg_len; i += 2) + { + apply_ac_parameter_type_1(ir_hex_code, &(protocol->swing1.comp_data[swing_mode]), (UINT8) i, FALSE); + } + + // get return here since temperature 1 is already applied + return IR_DECODE_SUCCEEDED; + + try_applying_swing2: + if (0 == protocol->swing2.len) + { + return IR_DECODE_SUCCEEDED; + } + + if (swing_mode >= protocol->swing2.count) + { + return IR_DECODE_FAILED; + } + + if (0 == protocol->swing2.comp_data[swing_mode].seg_len) + { + // swing does not have any empty data segment + return IR_DECODE_FAILED; + } + + for (i = 0; i < protocol->swing2.comp_data[swing_mode].seg_len; i += 3) + { + apply_ac_parameter_type_2(ir_hex_code, + &(protocol->swing2.comp_data[swing_mode]), + (UINT8) i, FALSE); + } + return IR_DECODE_SUCCEEDED; +} + +static INT8 apply_checksum_byte(UINT8 *ac_code, t_tag_checksum_data cs, BOOL inverse) +{ + UINT16 i = 0; + UINT8 checksum = 0x00; + + if (cs.len < 3) + { + return IR_DECODE_SUCCEEDED; + } + + for (i = cs.start_byte_pos; i < cs.end_byte_pos; i++) + { + checksum += ac_code[i]; + } + + checksum += cs.checksum_plus; + + if (TRUE == inverse) + { + checksum = ~checksum; + } + + // apply checksum + ac_code[cs.checksum_byte_pos] = checksum; + + return IR_DECODE_SUCCEEDED; +} + +static INT8 apply_checksum_halfbyte(UINT8 *ac_code, t_tag_checksum_data cs, BOOL inverse) +{ + UINT16 i = 0; + UINT8 checksum = 0x00; + + if (cs.len < 3) + { + return IR_DECODE_SUCCEEDED; + } + + for (i = cs.start_byte_pos; i < cs.end_byte_pos; i++) + { + checksum += (ac_code[i] >> 4) + (ac_code[i] & 0x0F); + } + + checksum += cs.checksum_plus; + + if (TRUE == inverse) + { + checksum = ~checksum; + } + + // apply checksum + ac_code[cs.checksum_byte_pos] = checksum; + + return IR_DECODE_SUCCEEDED; +} + +static INT8 apply_checksum_spec_byte(UINT8 *ac_code, t_tag_checksum_data cs, BOOL inverse) +{ + UINT16 i = 0; + UINT8 apply_byte_pos = 0; + UINT8 checksum = 0x00; + +#if 1 + if (cs.len < 4) + { + return IR_DECODE_SUCCEEDED; + } +#endif + + for (i = 0; i < cs.len - 3; i++) + { + UINT8 pos = cs.spec_pos[i]; + UINT8 byte_pos = pos >> 1; + + if (0 == (pos & 0x01)) + { + checksum += ac_code[byte_pos] >> 4; + } + else + { + checksum += ac_code[byte_pos] & 0x0F; + } + } + + checksum += cs.checksum_plus; + + if (TRUE == inverse) + { + checksum = ~checksum; + } + + // apply checksum, for specific-half-byte checksum, the byte pos actually indicates the half-byte pos + apply_byte_pos = cs.checksum_byte_pos >> 1; + if (0 == (cs.checksum_byte_pos & 0x01)) + { + // save low bits and add checksum as high bits + ac_code[apply_byte_pos] = (UINT8) ((ac_code[apply_byte_pos] & 0x0F) | (checksum << 4)); + } + else + { + // save high bits and add checksum as low bits + ac_code[apply_byte_pos] = (UINT8) ((ac_code[apply_byte_pos] & 0xF0) | (checksum & 0x0F)); + } + + return IR_DECODE_SUCCEEDED; +} + +static INT8 apply_checksum_spec_byte_onebyte(UINT8 *ac_code, t_tag_checksum_data cs, BOOL inverse) +{ + UINT16 i = 0; + UINT8 apply_byte_pos = 0; + UINT8 checksum = 0x00; + +#if 1 + if (cs.len < 4) + { + return IR_DECODE_SUCCEEDED; + } +#endif + + for (i = 0; i < cs.len - 3; i++) + { + UINT8 pos = cs.spec_pos[i]; + UINT8 byte_pos = pos >> 1; + + if (0 == (pos & 0x01)) + { + checksum += ac_code[byte_pos] >> 4; + } + else + { + checksum += ac_code[byte_pos] & 0x0F; + } + } + + checksum += cs.checksum_plus; + + if (TRUE == inverse) + { + checksum = ~checksum; + } + + // apply checksum, for specific-half-byte checksum, the byte pos actually indicates the half-byte pos + apply_byte_pos = cs.checksum_byte_pos >> 1; + ac_code[apply_byte_pos] = checksum; + + return IR_DECODE_SUCCEEDED; +} + +static UINT8 has_function(struct ac_protocol *protocol, UINT8 function) +{ + if (0 != protocol->function1.len) + { + if (0 != protocol->function1.comp_data[function - 1].seg_len) + { + return TRUE; + } + } + + if (0 != protocol->function2.len) + { + if (0 != protocol->function2.comp_data[function - 1].seg_len) + { + return TRUE; + } + } + + return FALSE; +} + +INT8 apply_function(struct ac_protocol *protocol, UINT8 function) +{ + UINT16 i = 0; + + // function index starts from 1 (AC_FUNCTION_POWER), do -1 operation at first + if (0 == protocol->function1.len) + { + goto try_applying_function2; + } + + if (0 == protocol->function1.comp_data[function - 1].seg_len) + { + // force to apply function in any case + return IR_DECODE_SUCCEEDED; + } + + for (i = 0; i < protocol->function1.comp_data[function - 1].seg_len; i += 2) + { + apply_ac_parameter_type_1(ir_hex_code, &(protocol->function1.comp_data[function - 1]), (UINT8) i, FALSE); + } + + // get return here since function 1 is already applied + return IR_DECODE_SUCCEEDED; + + try_applying_function2: + if (0 == protocol->function2.len) + { + return IR_DECODE_SUCCEEDED; + } + + if (0 == protocol->function2.comp_data[function - 1].seg_len) + { + return IR_DECODE_SUCCEEDED; + } + + for (i = 0; i < protocol->function2.comp_data[function - 1].seg_len; i += 3) + { + apply_ac_parameter_type_2(ir_hex_code, + &(protocol->function2.comp_data[function - 1]), + (UINT8) i, FALSE); + } + return IR_DECODE_SUCCEEDED; +} + +INT8 apply_checksum(struct ac_protocol *protocol) +{ + UINT8 i = 0; + + if (0 == protocol->checksum.len) + { + return IR_DECODE_SUCCEEDED; + } + + for (i = 0; i < protocol->checksum.count; i++) + { + switch (protocol->checksum.checksum_data[i].type) + { + case CHECKSUM_TYPE_BYTE: + apply_checksum_byte(ir_hex_code, protocol->checksum.checksum_data[i], FALSE); + break; + case CHECKSUM_TYPE_BYTE_INVERSE: + apply_checksum_byte(ir_hex_code, protocol->checksum.checksum_data[i], TRUE); + break; + case CHECKSUM_TYPE_HALF_BYTE: + apply_checksum_halfbyte(ir_hex_code, protocol->checksum.checksum_data[i], FALSE); + break; + case CHECKSUM_TYPE_HALF_BYTE_INVERSE: + apply_checksum_halfbyte(ir_hex_code, protocol->checksum.checksum_data[i], TRUE); + break; + case CHECKSUM_TYPE_SPEC_HALF_BYTE: + apply_checksum_spec_byte(ir_hex_code, protocol->checksum.checksum_data[i], FALSE); + break; + case CHECKSUM_TYPE_SPEC_HALF_BYTE_INVERSE: + apply_checksum_spec_byte(ir_hex_code, protocol->checksum.checksum_data[i], TRUE); + break; + case CHECKSUM_TYPE_SPEC_HALF_BYTE_ONE_BYTE: + apply_checksum_spec_byte_onebyte(ir_hex_code, protocol->checksum.checksum_data[i], FALSE); + break; + case CHECKSUM_TYPE_SPEC_HALF_BYTE_INVERSE_ONE_BYTE: + apply_checksum_spec_byte_onebyte(ir_hex_code, protocol->checksum.checksum_data[i], TRUE); + break; + default: + break; + } + } + + return IR_DECODE_SUCCEEDED; +} + +INT8 apply_power(t_remote_ac_status ac_status, UINT8 function_code) +{ + apply_ac_power(context, ac_status.ac_power); + return IR_DECODE_SUCCEEDED; +} + +INT8 apply_mode(t_remote_ac_status ac_status, UINT8 function_code) +{ + if (IR_DECODE_FAILED == apply_ac_mode(context, ac_status.ac_mode)) + { + // do not implement this mechanism since mode, temperature, wind + // speed would have unspecified function + //if(FALSE == has_function(context, AC_FUNCTION_MODE)) + { + return IR_DECODE_FAILED; + } + } + + return IR_DECODE_SUCCEEDED; +} + +INT8 apply_wind_speed(t_remote_ac_status ac_status, UINT8 function_code) +{ + if (FALSE == context->n_mode[ac_status.ac_mode].all_speed) + { + // if this level is not in black list + if (!is_in(context->n_mode[ac_status.ac_mode].speed, + ac_status.ac_wind_speed, + context->n_mode[ac_status.ac_mode].speed_cnt)) + { + if (IR_DECODE_FAILED == apply_ac_wind_speed(context, ac_status.ac_wind_speed) && + function_code == AC_FUNCTION_WIND_SPEED) + { + // do not implement this mechanism since mode, temperature, wind + // speed would have unspecified function + //if(FALSE == has_function(context, AC_FUNCTION_WIND_SPEED)) + { + return IR_DECODE_FAILED; + } + } + } + else + { + // if this level is in black list, do not send IR wave if user want to apply this function + if (function_code == AC_FUNCTION_WIND_SPEED) + { + // do not implement this mechanism since mode, temperature, wind + // speed would have unspecified function + //if(FALSE == has_function(context, AC_FUNCTION_WIND_SPEED)) + { + return IR_DECODE_FAILED; + } + } + } + } + else + { + // if this level is in black list, do not send IR wave if user want to apply this function + if (function_code == AC_FUNCTION_WIND_SPEED) + { + // do not implement this mechanism since mode, temperature, wind + // speed would have unspecified function + //if(FALSE == has_function(context, AC_FUNCTION_WIND_SPEED)) + { + return IR_DECODE_FAILED; + } + } + } + return IR_DECODE_SUCCEEDED; +} + +INT8 apply_swing(t_remote_ac_status ac_status, UINT8 function_code) +{ + if (function_code == AC_FUNCTION_WIND_FIX) + { + // adjust fixed wind direction according to current status + if (context->si.type == SWING_TYPE_NORMAL && context->si.mode_count > 1) + { + if (TRUE == context->change_wind_direction) + { + context->si.dir_index++; + } + + if (context->si.dir_index == context->si.mode_count) + { + // reset dir index + context->si.dir_index = 1; + } + context->swing_status = context->si.dir_index; + } + } + else if (function_code == AC_FUNCTION_WIND_SWING) + { + context->swing_status = 0; + } + else + { + // do nothing + } + + if (IR_DECODE_FAILED == apply_ac_swing(context, context->swing_status)) + { + if (function_code == AC_FUNCTION_WIND_SWING && FALSE == has_function(context, AC_FUNCTION_WIND_SWING)) + { + return IR_DECODE_FAILED; + } + else if (function_code == AC_FUNCTION_WIND_FIX && FALSE == has_function(context, AC_FUNCTION_WIND_FIX)) + { + return IR_DECODE_FAILED; + } + } + return IR_DECODE_SUCCEEDED; +} + +INT8 apply_temperature(t_remote_ac_status ac_status, UINT8 function_code) +{ + if (FALSE == context->n_mode[ac_status.ac_mode].all_temp) + { + if (!is_in(context->n_mode[ac_status.ac_mode].temp, + ac_status.ac_temp, + context->n_mode[ac_status.ac_mode].temp_cnt)) + { + if (IR_DECODE_FAILED == apply_ac_temperature(context, ac_status.ac_temp)) + { + if (function_code == AC_FUNCTION_TEMPERATURE_UP + /*&& FALSE == has_function(context, AC_FUNCTION_TEMPERATURE_UP)*/) + { + return IR_DECODE_FAILED; + } + else if (function_code == AC_FUNCTION_TEMPERATURE_DOWN + /*&& FALSE == has_function(context, AC_FUNCTION_TEMPERATURE_DOWN)*/) + { + return IR_DECODE_FAILED; + } + } + } + else + { + // if this level is in black list, do not send IR wave if user want to apply this function + if (function_code == AC_FUNCTION_TEMPERATURE_UP + /*&& FALSE == has_function(context, AC_FUNCTION_TEMPERATURE_UP)*/) + { + return IR_DECODE_FAILED; + } + else if (function_code == AC_FUNCTION_TEMPERATURE_DOWN + /*&& FALSE == has_function(context, AC_FUNCTION_TEMPERATURE_DOWN)*/) + { + return IR_DECODE_FAILED; + } + } + } + else + { + // if this level is in black list, do not send IR wave if user want to apply this function + if (function_code == AC_FUNCTION_TEMPERATURE_UP + /*&& FALSE == has_function(context, AC_FUNCTION_TEMPERATURE_UP)*/) + { + return IR_DECODE_FAILED; + } + else if (function_code == AC_FUNCTION_TEMPERATURE_DOWN + /*&& FALSE == has_function(context, AC_FUNCTION_TEMPERATURE_DOWN)*/) + { + return IR_DECODE_FAILED; + } + } + return IR_DECODE_SUCCEEDED; +} \ No newline at end of file diff --git a/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_ac_binary_parse.c b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_ac_binary_parse.c new file mode 100644 index 0000000..747a8b8 --- /dev/null +++ b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_ac_binary_parse.c @@ -0,0 +1,121 @@ +/************************************************************************************** +Filename: ir_ac_binary_parse.c +Revised: Date: 2017-01-03 +Revision: Revision: 1.0 + +Description: This file provides methods for AC binary parse + +Revision log: +* 2017-01-03: created by strawmanbobi +**************************************************************************************/ + +#include + +#include "../include/ir_ac_binary_parse.h" +#include "../include/ir_decode.h" + +UINT16 tag_head_offset = 0; + +extern struct ir_bin_buffer *p_ir_buffer; +extern struct tag_head *tags; + +UINT8 tag_count = 0; +const UINT16 tag_index[TAG_COUNT_FOR_PROTOCOL] = +{ + 1, 2, 3, 4, 5, 6, 7, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 41, 42, 43, 44, 45, 46, 47, 48 +}; + +INT8 binary_parse_offset() +{ + int i = 0; + UINT16 *phead = (UINT16 *) &p_ir_buffer->data[1]; + + tag_count = p_ir_buffer->data[0]; + if (TAG_COUNT_FOR_PROTOCOL != tag_count) + { + return IR_DECODE_FAILED; + } + + tag_head_offset = (UINT16) ((tag_count << 1) + 1); + + tags = (t_tag_head *) ir_malloc(tag_count * sizeof(t_tag_head)); + if (NULL == tags) + { + return IR_DECODE_FAILED; + } + + for (i = 0; i < tag_count; i++) + { + tags[i].tag = tag_index[i]; + tags[i].offset = *(phead + i); + + if (tags[i].offset == TAG_INVALID) + { + tags[i].len = 0; + } + } + return IR_DECODE_SUCCEEDED; +} + +INT8 binary_parse_len() +{ + UINT16 i = 0, j = 0; + for (i = 0; i < (tag_count - 1); i++) + { + if (tags[i].offset == TAG_INVALID) + { + continue; + } + + for (j = (UINT16) (i + 1); j < tag_count; j++) + { + if (tags[j].offset != TAG_INVALID) + { + break; + } + } + if (j < tag_count) + { + tags[i].len = tags[j].offset - tags[i].offset; + } + else + { + tags[i].len = p_ir_buffer->len - tags[i].offset - tag_head_offset; + return IR_DECODE_SUCCEEDED; + } + } + if (tags[tag_count - 1].offset != TAG_INVALID) + { + tags[tag_count - 1].len = p_ir_buffer->len - tag_head_offset - tags[tag_count - 1].offset; + } + + return IR_DECODE_SUCCEEDED; +} + +void binary_tags_info() +{ +#if defined BOARD_PC + UINT16 i = 0; + for (i = 0; i < tag_count; i++) + { + if (tags[i].len == 0) + { + continue; + } + ir_printf("tag(%d).len = %d\n", tags[i].tag, tags[i].len); + } +#endif +} + +INT8 binary_parse_data() +{ + UINT16 i = 0; + for (i = 0; i < tag_count; i++) + { + tags[i].p_data = p_ir_buffer->data + tags[i].offset + tag_head_offset; + } + + return IR_DECODE_SUCCEEDED; +} \ No newline at end of file diff --git a/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_ac_build_frame.c b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_ac_build_frame.c new file mode 100644 index 0000000..f3f767d --- /dev/null +++ b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_ac_build_frame.c @@ -0,0 +1,145 @@ +/************************************************************************************** +Filename: ir_irframe.c +Revised: Date: 2016-10-01 +Revision: Revision: 1.0 + +Description: This file provides algorithms for IR frame build + +Revision log: +* 2016-10-01: created by strawmanbobi +**************************************************************************************/ + +#include "../include/ir_ac_build_frame.h" +#include "../include/ir_decode.h" + +extern t_ac_protocol *context; + + +//return bit number per byte,default value is 8 +UINT8 bits_per_byte(UINT8 index) +{ + UINT8 i = 0; + UINT8 size = 0; + + if (context->bit_num_cnt == 0) + return 8; //defaut value + + if (context->bit_num_cnt >= MAX_BITNUM) + size = MAX_BITNUM; + else + size = (UINT8) context->bit_num_cnt; + + for (i = 0; i < size; i++) + { + if (context->bit_num[i].pos == index) + return (UINT8) context->bit_num[i].bits; + if (context->bit_num[i].pos > index) + return 8; + } + return 8; +} + +UINT16 add_delaycode(UINT8 index) +{ + UINT8 i = 0, j = 0; + UINT8 size = 0; + UINT8 tail_delaycode = 0; + UINT16 tail_pos = 0; + + if (context->dc_cnt != 0) + { + size = (UINT8) context->dc_cnt; + + for (i = 0; i < size; i++) + { + if (context->dc[i].pos == index) + { + for (j = 0; j < context->dc[i].time_cnt; j++) + { + context->time[context->code_cnt++] = context->dc[i].time[j]; + } + } + else if (context->dc[i].pos == -1) + { + tail_delaycode = 1; + tail_pos = i; + } + } + } + + if ((context->last_bit == 0) && (index == (ir_hex_len - 1))) + { + context->time[context->code_cnt++] = context->one.low; //high + } + + if (context->dc_cnt != 0) + { + if ((index == (ir_hex_len - 1)) && (tail_delaycode == 1)) + { + for (i = 0; i < context->dc[tail_pos].time_cnt; i++) + { + context->time[context->code_cnt++] = context->dc[tail_pos].time[i]; + } + } + } + + return context->dc[i].time_cnt; +} + +UINT16 create_ir_frame() +{ + UINT16 i = 0, j = 0; + UINT8 bitnum = 0; + UINT8 *irdata = ir_hex_code; + UINT8 mask = 1; + UINT16 framelen = 0; + + context->code_cnt = 0; + + // boot code + for (i = 0; i < context->boot_code.len; i++) + { + context->time[context->code_cnt++] = context->boot_code.data[i]; + } + //code_cnt += context->boot_code.len; + + for (i = 0; i < ir_hex_len; i++) + { + bitnum = bits_per_byte((UINT8) i); + for (j = 0; j < bitnum; j++) + { + if (context->endian == 0) + mask = (UINT8) ((1 << (bitnum - 1)) >> j); + else + mask = (UINT8) (1 << j); + + if (irdata[i] & mask) + { + //ir_printf("%d,%d,", context->one.low, context->one.high); + context->time[context->code_cnt++] = context->one.low; + context->time[context->code_cnt++] = context->one.high; + } + else + { + //ir_printf("%d,%d,", context->zero.low, context->zero.high); + context->time[context->code_cnt++] = context->zero.low; + context->time[context->code_cnt++] = context->zero.high; + } + } + add_delaycode((UINT8) i); + } + + framelen = context->code_cnt; + + for (i = 0; i < (context->repeat_times - 1); i++) + { + for (j = 0; j < framelen; j++) + { + context->time[context->code_cnt++] = context->time[j]; + } + } + + return context->code_cnt; +} + + diff --git a/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_ac_control.c b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_ac_control.c new file mode 100644 index 0000000..2bd8219 --- /dev/null +++ b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_ac_control.c @@ -0,0 +1,548 @@ +/************************************************************************************** +Filename: ir_ac_control.c +Revised: Date: 2017-01-02 +Revision: Revision: 1.0 + +Description: This file provides methods for AC IR control + +Revision log: +* 2016-10-12: created by strawmanbobi +**************************************************************************************/ + +#include +#include +#include + +#include "../include/ir_ac_control.h" +#include "../include/ir_ac_binary_parse.h" +#include "../include/ir_decode.h" +#include "../include/ir_ac_parse_parameter.h" +#include "../include/ir_ac_parse_forbidden_info.h" +#include "../include/ir_ac_parse_frame_info.h" +#include "../include/ir_utils.h" + + +extern struct tag_head *tags; +extern UINT8 tag_count; + +static INT8 ir_context_init(); + + +static INT8 ir_context_init() +{ + ir_memset(context, 0, sizeof(t_ac_protocol)); + return IR_DECODE_SUCCEEDED; +} + + +INT8 ir_ac_lib_parse() +{ + UINT8 i = 0; + // suggest not to call init function here for de-couple purpose + ir_context_init(); + + if (IR_DECODE_FAILED == binary_parse_offset()) + { + return IR_DECODE_FAILED; + } + + if (IR_DECODE_FAILED == binary_parse_len()) + { + return IR_DECODE_FAILED; + } + + if (IR_DECODE_FAILED == binary_parse_data()) + { + return IR_DECODE_FAILED; + } + + binary_tags_info(); + + context->endian = 0; + context->last_bit = 0; + context->repeat_times = 1; + + for (i = 0; i < N_MODE_MAX; i++) + { + context->n_mode[i].enable = TRUE; + context->n_mode[i].all_speed = FALSE; + context->n_mode[i].all_temp = FALSE; + ir_memset(context->n_mode[i].speed, 0x00, AC_WS_MAX); + context->n_mode[i].speed_cnt = 0; + ir_memset(context->n_mode[i].temp, 0x00, AC_TEMP_MAX); + context->n_mode[i].temp_cnt = 0; + } + + // parse TAG 46 in first priority + for (i = 0; i < tag_count; i++) + { + if (tags[i].tag == TAG_AC_SWING_INFO) + { + if (tags[i].len != 0) + { + parse_swing_info(&tags[i], &(context->si)); + } + else + { + context->si.type = SWING_TYPE_NORMAL; + context->si.mode_count = 2; + } + context->si.dir_index = 0; + } + } + + for (i = 0; i < tag_count; i++) + { + if (tags[i].len == 0) + { + continue; + } + // then parse TAG 26 or 33 + if (context->si.type == SWING_TYPE_NORMAL) + { + UINT16 swing_space_size = 0; + if (tags[i].tag == TAG_AC_SWING_1) + { + context->swing1.count = context->si.mode_count; + context->swing1.len = (UINT8) tags[i].len >> 1; + swing_space_size = sizeof(t_tag_comp) * context->si.mode_count; + context->swing1.comp_data = (t_tag_comp *) ir_malloc(swing_space_size); + if (NULL == context->swing1.comp_data) + { + return IR_DECODE_FAILED; + } + + ir_memset(context->swing1.comp_data, 0x00, swing_space_size); + if (IR_DECODE_FAILED == parse_common_ac_parameter(&tags[i], + context->swing1.comp_data, + context->si.mode_count, + AC_PARAMETER_TYPE_1)) + { + return IR_DECODE_FAILED; + } + } + else if (tags[i].tag == TAG_AC_SWING_2) + { + context->swing2.count = context->si.mode_count; + context->swing2.len = (UINT8) tags[i].len >> 1; + swing_space_size = sizeof(t_tag_comp) * context->si.mode_count; + context->swing2.comp_data = (t_tag_comp *) ir_malloc(swing_space_size); + if (NULL == context->swing2.comp_data) + { + return IR_DECODE_FAILED; + } + ir_memset(context->swing2.comp_data, 0x00, swing_space_size); + if (IR_DECODE_FAILED == parse_common_ac_parameter(&tags[i], + context->swing2.comp_data, + context->si.mode_count, + AC_PARAMETER_TYPE_2)) + { + return IR_DECODE_FAILED; + } + } + } + + if (tags[i].tag == TAG_AC_DEFAULT_CODE) // default code TAG + { + context->default_code.data = (UINT8 *) ir_malloc(((size_t) tags[i].len - 2) >> 1); + if (NULL == context->default_code.data) + { + return IR_DECODE_FAILED; + } + if (IR_DECODE_FAILED == parse_default_code(&tags[i], &(context->default_code))) + { + return IR_DECODE_FAILED; + } + } + else if (tags[i].tag == TAG_AC_POWER_1) // power tag + { + context->power1.len = (UINT8) tags[i].len >> 1; + if (IR_DECODE_FAILED == parse_common_ac_parameter(&tags[i], + context->power1.comp_data, + AC_POWER_MAX, + AC_PARAMETER_TYPE_1)) + { + return IR_DECODE_FAILED; + } + } + else if (tags[i].tag == TAG_AC_TEMP_1) // temperature tag type 1 + { + if (IR_DECODE_FAILED == parse_temp_1(&tags[i], &(context->temp1))) + { + return IR_DECODE_FAILED; + } + } + else if (tags[i].tag == TAG_AC_MODE_1) // mode tag + { + context->mode1.len = (UINT8) tags[i].len >> 1; + if (IR_DECODE_FAILED == parse_common_ac_parameter(&tags[i], + context->mode1.comp_data, + AC_MODE_MAX, + AC_PARAMETER_TYPE_1)) + { + return IR_DECODE_FAILED; + } + } + else if (tags[i].tag == TAG_AC_SPEED_1) // wind speed tag + { + context->speed1.len = (UINT8) tags[i].len >> 1; + if (IR_DECODE_FAILED == parse_common_ac_parameter(&tags[i], + context->speed1.comp_data, + AC_WS_MAX, + AC_PARAMETER_TYPE_1)) + { + return IR_DECODE_FAILED; + } + } + else if (tags[i].tag == TAG_AC_CHECKSUM_TYPE) + { + if (IR_DECODE_FAILED == parse_checksum(&tags[i], &(context->checksum))) + { + return IR_DECODE_FAILED; + } + } + else if (tags[i].tag == TAG_AC_MODE_2) + { + context->mode2.len = (UINT8) tags[i].len >> 1; + if (IR_DECODE_FAILED == + parse_common_ac_parameter(&tags[i], + context->mode2.comp_data, AC_MODE_MAX, AC_PARAMETER_TYPE_1)) + { + return IR_DECODE_FAILED; + } + } + else if (tags[i].tag == TAG_AC_SPEED_2) + { + context->speed2.len = (UINT8) tags[i].len >> 1; + if (IR_DECODE_FAILED == + parse_common_ac_parameter(&tags[i], + context->speed2.comp_data, AC_WS_MAX, AC_PARAMETER_TYPE_1)) + { + return IR_DECODE_FAILED; + } + } + else if (tags[i].tag == TAG_AC_TEMP_2) + { + if (IR_DECODE_FAILED == parse_temp_2(&tags[i], &(context->temp2))) + { + return IR_DECODE_FAILED; + } + } + else if (tags[i].tag == TAG_AC_SOLO_FUNCTION) + { + if (IR_DECODE_FAILED == parse_solo_code(&tags[i], &(context->sc))) + { + return IR_DECODE_FAILED; + } + context->solo_function_mark = 1; + } + else if (tags[i].tag == TAG_AC_FUNCTION_1) + { + if (IR_DECODE_FAILED == parse_function_1_tag29(&tags[i], &(context->function1))) + { + ir_printf("\nfunction code parse error\n"); + return IR_DECODE_FAILED; + } + } + else if (tags[i].tag == TAG_AC_FUNCTION_2) + { + if (IR_DECODE_FAILED == parse_function_2_tag34(&tags[i], &(context->function2))) + { + return IR_DECODE_FAILED; + } + } + else if (tags[i].tag == TAG_AC_FRAME_LENGTH) + { + if (IR_DECODE_FAILED == parse_frame_len(&tags[i], tags[i].len)) + { + return IR_DECODE_FAILED; + } + } + else if (tags[i].tag == TAG_AC_ZERO) + { + if (IR_DECODE_FAILED == parse_zero(&tags[i])) + { + return IR_DECODE_FAILED; + } + } + else if (tags[i].tag == TAG_AC_ONE) + { + if (IR_DECODE_FAILED == parse_one(&tags[i])) + { + return IR_DECODE_FAILED; + } + } + else if (tags[i].tag == TAG_AC_BOOT_CODE) + { + if (IR_DECODE_FAILED == parse_boot_code(&tags[i])) + { + return IR_DECODE_FAILED; + } + } + else if (tags[i].tag == TAG_AC_REPEAT_TIMES) + { + if (IR_DECODE_FAILED == parse_repeat_times(&tags[i])) + { + return IR_DECODE_FAILED; + } + } + else if (tags[i].tag == TAG_AC_BIT_NUM) + { + if (IR_DECODE_FAILED == parse_bit_num(&tags[i])) + { + return IR_DECODE_FAILED; + } + } + else if (tags[i].tag == TAG_AC_ENDIAN) + { + if (IR_DECODE_FAILED == parse_endian(&tags[i])) + { + return IR_DECODE_FAILED; + } + } + else if (tags[i].tag == TAG_AC_BAN_FUNCTION_IN_COOL_MODE) + { + if (IR_DECODE_FAILED == parse_nmode(&tags[i], N_COOL)) + { + return IR_DECODE_FAILED; + } + } + else if (tags[i].tag == TAG_AC_BAN_FUNCTION_IN_HEAT_MODE) + { + if (IR_DECODE_FAILED == parse_nmode(&tags[i], N_HEAT)) + { + return IR_DECODE_FAILED; + } + } + else if (tags[i].tag == TAG_AC_BAN_FUNCTION_IN_AUTO_MODE) + { + if (IR_DECODE_FAILED == parse_nmode(&tags[i], N_AUTO)) + { + return IR_DECODE_FAILED; + } + } + else if (tags[i].tag == TAG_AC_BAN_FUNCTION_IN_FAN_MODE) + { + if (IR_DECODE_FAILED == parse_nmode(&tags[i], N_FAN)) + { + return IR_DECODE_FAILED; + } + } + else if (tags[i].tag == TAG_AC_BAN_FUNCTION_IN_DRY_MODE) + { + if (IR_DECODE_FAILED == parse_nmode(&tags[i], N_DRY)) + { + return IR_DECODE_FAILED; + } + } + } + + for (i = 0; i < tag_count; i++) + { + if (tags[i].len == 0) + { + continue; + } + if (tags[i].tag == TAG_AC_DELAY_CODE) + { + if (IR_DECODE_FAILED == parse_delay_code(&tags[i])) + { + return IR_DECODE_FAILED; + } + } + if (tags[i].tag == TAG_AC_LAST_BIT) + { + if (IR_DECODE_FAILED == parse_lastbit(&tags[i])) + { + return IR_DECODE_FAILED; + } + } + } + + if (NULL != tags) + { + ir_free(tags); + tags = NULL; + } + + ir_hex_code = (UINT8 *) ir_malloc(context->default_code.len); + if (NULL == ir_hex_code) + { + // warning: this AC bin contains no default code + return IR_DECODE_FAILED; + } + + ir_hex_len = context->default_code.len; + ir_memset(ir_hex_code, 0x00, ir_hex_len); + + // pre-calculate solo function status after parse phase + if (1 == context->solo_function_mark) + { + context->solo_function_mark = 0x00; + // bit order from right to left : power, mode, temp+, temp-, wind_speed, swing, fix + for (i = AC_FUNCTION_POWER; i < AC_FUNCTION_MAX; i++) + { + if (is_in(context->sc.solo_function_codes, i, context->sc.solo_func_count)) + { + context->solo_function_mark |= (1 << (i - 1)); + } + } + } + + // it is strongly recommended that we free p_ir_buffer + // or make global buffer shared in extreme memory case + /* in case of running with test - begin */ +#if (defined BOARD_PC || defined BOARD_PC_DLL) + ir_lib_free_inner_buffer(); + ir_printf("AC parse done\n"); +#endif + /* in case of running with test - end */ + + return IR_DECODE_SUCCEEDED; +} + + +INT8 free_ac_context() +{ + UINT16 i = 0; + + if (ir_hex_code != NULL) + { + ir_free(ir_hex_code); + ir_hex_code = NULL; + } + ir_hex_len = 0; + + if (context->default_code.data != NULL) + { + ir_free(context->default_code.data); + context->default_code.data = NULL; + context->default_code.len = 0; + } + + for (i = 0; i < AC_POWER_MAX; i++) + { + if (context->power1.comp_data[i].segment != NULL) + { + ir_free(context->power1.comp_data[i].segment); + context->power1.comp_data[i].segment = NULL; + context->power1.comp_data[i].seg_len = 0; + } + } + + for (i = 0; i < AC_TEMP_MAX; i++) + { + if (context->temp1.comp_data[i].segment != NULL) + { + ir_free(context->temp1.comp_data[i].segment); + context->temp1.comp_data[i].segment = NULL; + context->temp1.comp_data[i].seg_len = 0; + } + if (context->temp2.comp_data[i].segment != NULL) + { + ir_free(context->temp2.comp_data[i].segment); + context->temp2.comp_data[i].segment = NULL; + context->temp2.comp_data[i].seg_len = 0; + } + } + + for (i = 0; i < AC_MODE_MAX; i++) + { + if (context->mode1.comp_data[i].segment != NULL) + { + ir_free(context->mode1.comp_data[i].segment); + context->mode1.comp_data[i].segment = NULL; + context->mode1.comp_data[i].seg_len = 0; + } + if (context->mode2.comp_data[i].segment != NULL) + { + ir_free(context->mode2.comp_data[i].segment); + context->mode2.comp_data[i].segment = NULL; + context->mode2.comp_data[i].seg_len = 0; + } + } + for (i = 0; i < AC_WS_MAX; i++) + { + if (context->speed1.comp_data[i].segment != NULL) + { + ir_free(context->speed1.comp_data[i].segment); + context->speed1.comp_data[i].segment = NULL; + context->speed1.comp_data[i].seg_len = 0; + } + if (context->speed2.comp_data[i].segment != NULL) + { + ir_free(context->speed2.comp_data[i].segment); + context->speed2.comp_data[i].segment = NULL; + context->speed2.comp_data[i].seg_len = 0; + } + } + + for (i = 0; i < context->si.mode_count; i++) + { + if (context->swing1.comp_data != NULL && + context->swing1.comp_data[i].segment != NULL) + { + ir_free(context->swing1.comp_data[i].segment); + context->swing1.comp_data[i].segment = NULL; + context->swing1.comp_data[i].seg_len = 0; + } + if (context->swing2.comp_data != NULL && + context->swing2.comp_data[i].segment != NULL) + { + ir_free(context->swing2.comp_data[i].segment); + context->swing2.comp_data[i].segment = NULL; + context->swing2.comp_data[i].seg_len = 0; + } + } + + for (i = 0; i < AC_FUNCTION_MAX - 1; i++) + { + if (context->function1.comp_data[i].segment != NULL) + { + ir_free(context->function1.comp_data[i].segment); + context->function1.comp_data[i].segment = NULL; + context->function1.comp_data[i].seg_len = 0; + } + if (context->function2.comp_data[i].segment != NULL) + { + ir_free(context->function2.comp_data[i].segment); + context->function2.comp_data[i].segment = NULL; + context->function2.comp_data[i].seg_len = 0; + } + } + + // free composite data for swing1 and swing 2 + if (context->swing1.comp_data != NULL) + { + ir_free(context->swing1.comp_data); + context->swing1.comp_data = NULL; + } + if (context->swing2.comp_data != NULL) + { + ir_free(context->swing2.comp_data); + context->swing2.comp_data = NULL; + } + + for (i = 0; i < context->checksum.count; i++) + { + if (context->checksum.checksum_data != NULL && + context->checksum.checksum_data[i].spec_pos != NULL) + { + ir_free(context->checksum.checksum_data[i].spec_pos); + context->checksum.checksum_data[i].len = 0; + context->checksum.checksum_data[i].spec_pos = NULL; + } + } + if (context->checksum.checksum_data != NULL) + { + ir_free(context->checksum.checksum_data); + context->checksum.checksum_data = NULL; + } + + return IR_DECODE_SUCCEEDED; +} + +BOOL is_solo_function(UINT8 function_code) +{ + return (((context->solo_function_mark >> (function_code - 1)) & 0x01) == 0x01) ? TRUE : FALSE; +} diff --git a/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_ac_parse_forbidden_info.c b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_ac_parse_forbidden_info.c new file mode 100644 index 0000000..0ea1c47 --- /dev/null +++ b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_ac_parse_forbidden_info.c @@ -0,0 +1,143 @@ +/************************************************************************************** +Filename: ir_parse_forbidden_info.c +Revised: Date: 2016-10-05 +Revision: Revision: 1.0 + +Description: This file provides algorithms for forbidden area of AC code + +Revision log: +* 2016-10-05: created by strawmanbobi +**************************************************************************************/ + +#include +#include +#include + +#include "../include/ir_decode.h" +#include "../include/ir_ac_parse_forbidden_info.h" + + +extern t_ac_protocol *context; + + +INT8 parse_nmode_data_speed(char *pdata, t_ac_n_mode seq) +{ + char buf[16] = {0}; + char *p = pdata; + UINT16 pos = 0; + UINT16 cnt = 0, index = 0; + + while (index <= ir_strlen(pdata)) + { + while ((index != ir_strlen(pdata)) && (*(p++) != ',')) + { + index++; + } + ir_memcpy(buf, pdata + pos, index - pos); + pos = (UINT16) (index + 1); + index = pos; + context->n_mode[seq].speed[cnt++] = (UINT8) atoi(buf); + context->n_mode[seq].speed_cnt = (UINT8) cnt; + ir_memset(buf, 0, 16); + } + + return IR_DECODE_SUCCEEDED; +} + +INT8 parse_nmode_data_temp(char *pdata, t_ac_n_mode seq) +{ + + char buf[16] = {0}; + char *p = pdata; + UINT16 pos = 0; + UINT16 cnt = 0, index = 0; + + while (index <= ir_strlen(pdata)) + { + while ((index != ir_strlen(pdata)) && (*(p++) != ',')) + { + index++; + } + ir_memcpy(buf, pdata + pos, index - pos); + pos = (UINT16) (index + 1); + index = pos; + context->n_mode[seq].temp[cnt++] = (UINT8) (atoi(buf) - 16); + context->n_mode[seq].temp_cnt = (UINT8) cnt; + ir_memset(buf, 0, 16); + } + return IR_DECODE_SUCCEEDED; +} + +INT8 parse_nmode_pos(char *buf, t_ac_n_mode index) +{ + UINT16 i = 0; + char data[64] = {0}; + // char start[8] = {0}; + if (ir_strlen(buf) == 1) + { + if (buf[0] == 'S' || buf[0] == 's') + { + context->n_mode[index].all_speed = 1; + } + else if (buf[0] == 'T' || buf[0] == 't') + { + context->n_mode[index].all_temp = 1; + } + return IR_DECODE_SUCCEEDED; + } + + for (i = 0; i < ir_strlen(buf); i++) + { + if (buf[i] == '&') + { + ir_memcpy(data, buf + i + 1, ir_strlen(buf) - i - 1); + break; + } + } + if (buf[0] == 'S') + { + parse_nmode_data_speed(data, index); + } + else + { + parse_nmode_data_temp(data, index); + } + + return IR_DECODE_SUCCEEDED; +} + +INT8 parse_nmode(struct tag_head *tag, t_ac_n_mode index) +{ + UINT16 i = 0; + UINT16 preindex = 0; + + char buf[64] = {0}; + + if (tag->p_data[0] == 'N' && tag->p_data[1] == 'A') + { + // ban this function directly + context->n_mode[index].enable = 0; + return IR_DECODE_SUCCEEDED; + } + else + { + context->n_mode[index].enable = 1; + } + + preindex = 0; + for (i = 0; i < tag->len; i++) + { + if (tag->p_data[i] == '|') + { + ir_memcpy(buf, tag->p_data + preindex, i - preindex); + preindex = (UINT16) (i + 1); + parse_nmode_pos(buf, index); + ir_memset(buf, 0, 64); + } + + } + ir_memcpy(buf, tag->p_data + preindex, i - preindex); + parse_nmode_pos(buf, index); + ir_memset(buf, 0, 64); + return IR_DECODE_SUCCEEDED; +} diff --git a/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_ac_parse_frame_info.c b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_ac_parse_frame_info.c new file mode 100644 index 0000000..b96bca1 --- /dev/null +++ b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_ac_parse_frame_info.c @@ -0,0 +1,329 @@ +/************************************************************************************** +Filename: ir_parse_frame_parameter.c +Revised: Date: 2016-10-11 +Revision: Revision: 1.0 + +Description: This file provides algorithms for IR decode for AC frame parameters + +Revision log: +* 2016-10-11: created by strawmanbobi +**************************************************************************************/ + +#include +#include +#include + +#include "../include/ir_utils.h" +#include "../include/ir_ac_parse_frame_info.h" + + +INT8 parse_boot_code(struct tag_head *tag) +{ + UINT8 buf[16] = {0}; + UINT8 *p = NULL; + UINT16 pos = 0; + UINT16 cnt = 0, index = 0; + + if (NULL == tag) + { + return IR_DECODE_FAILED; + } + p = tag->p_data; + + if (NULL == p) + { + return IR_DECODE_FAILED; + } + + while (index <= tag->len) + { + while ((index != (tag->len)) && (*(p++) != ',')) + { + index++; + } + ir_memcpy(buf, tag->p_data + pos, index - pos); + pos = (UINT16) (index + 1); + index = pos; + context->boot_code.data[cnt++] = (UINT16) (atoi((char *) buf)); + ir_memset(buf, 0, 16); + } + context->boot_code.len = cnt; + return IR_DECODE_SUCCEEDED; +} + +INT8 parse_zero(struct tag_head *tag) +{ + UINT8 low[16] = {0}; + UINT8 high[16] = {0}; + UINT16 index = 0; + UINT8 *p = NULL; + + if (NULL == tag) + { + return IR_DECODE_FAILED; + } + p = tag->p_data; + + if (NULL == p) + { + return IR_DECODE_FAILED; + } + + while (*(p++) != ',') + { + index++; + } + + ir_memcpy(low, tag->p_data, index); + ir_memcpy(high, tag->p_data + index + 1, (size_t) (tag->len - index - 1)); + + context->zero.low = (UINT16) (atoi((char *) low)); + context->zero.high = (UINT16) (atoi((char *) high)); + return IR_DECODE_SUCCEEDED; +} + +INT8 parse_one(struct tag_head *tag) +{ + UINT8 low[16] = {0}; + UINT8 high[16] = {0}; + UINT16 index = 0; + UINT8 *p = NULL; + + if (NULL == tag) + { + return IR_DECODE_FAILED; + } + p = tag->p_data; + + if (NULL == p) + { + return IR_DECODE_FAILED; + } + + while (*(p++) != ',') + { + index++; + } + ir_memcpy(low, tag->p_data, index); + ir_memcpy(high, tag->p_data + index + 1, (size_t) (tag->len - index - 1)); + + context->one.low = (UINT16) (atoi((char *) low)); + context->one.high = (UINT16) (atoi((char *) high)); + + return IR_DECODE_SUCCEEDED; +} + +INT8 parse_delay_code_data(UINT8 *pdata) +{ + UINT8 buf[16] = {0}; + UINT8 *p = NULL; + UINT16 pos = 0; + UINT16 cnt = 0, index = 0; + + if (NULL == pdata) + { + return IR_DECODE_FAILED; + } + p = pdata; + + while (index <= ir_strlen((char *) pdata)) + { + while ((index != ir_strlen((char *) pdata)) && (*(p++) != ',')) + { + index++; + } + ir_memcpy(buf, pdata + pos, index - pos); + pos = (UINT16) (index + 1); + index = pos; + context->dc[context->dc_cnt].time[cnt++] = (UINT16) (atoi((char *) buf)); + context->dc[context->dc_cnt].time_cnt = cnt; + ir_memset(buf, 0, 16); + } + + return IR_DECODE_SUCCEEDED; +} + +INT8 parse_delay_code_pos(UINT8 *buf) +{ + UINT16 i = 0; + UINT8 data[64] = {0}, start[8] = {0}; + + if (NULL == buf) + { + return IR_DECODE_FAILED; + } + + for (i = 0; i < ir_strlen((char *) buf); i++) + { + if (buf[i] == '&') + { + ir_memcpy(start, buf, i); + ir_memcpy(data, buf + i + 1, ir_strlen((char *) buf) - i - 1); + break; + } + } + parse_delay_code_data(data); + context->dc[context->dc_cnt].pos = (UINT16) (atoi((char *) start)); + + context->dc_cnt++; + return IR_DECODE_SUCCEEDED; +} + +INT8 parse_delay_code(struct tag_head *tag) +{ + UINT8 buf[64] = {0}; + UINT16 i = 0; + UINT16 preindex = 0; + preindex = 0; + + if (NULL == tag) + { + return IR_DECODE_FAILED; + } + + for (i = 0; i < tag->len; i++) + { + if (tag->p_data[i] == '|') + { + ir_memcpy(buf, tag->p_data + preindex, i - preindex); + preindex = (UINT16) (i + 1); + parse_delay_code_pos(buf); + ir_memset(buf, 0, 64); + } + + } + ir_memcpy(buf, tag->p_data + preindex, i - preindex); + parse_delay_code_pos(buf); + ir_memset(buf, 0, 64); + + return IR_DECODE_SUCCEEDED; +} + +INT8 parse_frame_len(struct tag_head *tag, UINT16 len) +{ + UINT8 *temp = NULL; + + if (NULL == tag) + { + return IR_DECODE_FAILED; + } + + temp = (UINT8 *) ir_malloc(len + 1); + + if (NULL == temp) + { + return IR_DECODE_FAILED; + } + + ir_memset(temp, 0x00, len + 1); + + ir_memcpy(temp, tag->p_data, len); + temp[len] = '\0'; + + context->frame_length = (UINT16) (atoi((char *) temp)); + + ir_free(temp); + return IR_DECODE_SUCCEEDED; +} + +INT8 parse_endian(struct tag_head *tag) +{ + UINT8 buf[8] = {0}; + + if (NULL == tag) + { + return IR_DECODE_FAILED; + } + ir_memcpy(buf, tag->p_data, tag->len); + context->endian = (UINT8) (atoi((char *) buf)); + return IR_DECODE_SUCCEEDED; +} + +INT8 parse_lastbit(struct tag_head *tag) +{ + UINT8 buf[8] = {0}; + + if (NULL == tag) + { + return IR_DECODE_FAILED; + } + ir_memcpy(buf, tag->p_data, tag->len); + context->last_bit = (UINT8) (atoi((char *) buf)); + return IR_DECODE_SUCCEEDED; +} + +INT8 parse_repeat_times(struct tag_head *tag) +{ + char asc_code[8] = {0}; + if (NULL == tag) + { + return IR_DECODE_FAILED; + } + + ir_memcpy(asc_code, tag->p_data, tag->len); + + context->repeat_times = (UINT16) (atoi((char *) asc_code)); + + return IR_DECODE_SUCCEEDED; +} + +INT8 parse_delay_code_tag48_pos(UINT8 *buf) +{ + UINT16 i = 0; + UINT8 data[64] = {0}, start[8] = {0}; + + if (NULL == buf) + { + return IR_DECODE_FAILED; + } + + for (i = 0; i < ir_strlen((char *) buf); i++) + { + if (buf[i] == '&') + { + ir_memcpy(start, buf, i); + ir_memcpy(data, buf + i + 1, ir_strlen((char *) buf) - i - 1); + break; + } + } + + context->bit_num[context->bit_num_cnt].pos = (UINT16) (atoi((char *) start)); + context->bit_num[context->bit_num_cnt].bits = (UINT16) (atoi((char *) data)); + context->bit_num_cnt++; + return IR_DECODE_SUCCEEDED; +} + +INT8 parse_bit_num(struct tag_head *tag) +{ + UINT16 i = 0; + UINT16 preindex = 0; + UINT8 buf[64] = {0}; + + if (NULL == tag) + { + return IR_DECODE_FAILED; + } + + preindex = 0; + for (i = 0; i < tag->len; i++) + { + if (tag->p_data[i] == '|') + { + ir_memcpy(buf, tag->p_data + preindex, i - preindex); + preindex = (UINT16) (i + 1); + parse_delay_code_tag48_pos(buf); + ir_memset(buf, 0, 64); + } + + } + ir_memcpy(buf, tag->p_data + preindex, i - preindex); + parse_delay_code_tag48_pos(buf); + ir_memset(buf, 0, 64); + + for (i = 0; i < context->bit_num_cnt; i++) + { + if (context->bit_num[i].pos == -1) + context->bit_num[i].pos = (UINT16) (context->default_code.len - 1); //convert -1 to last data pos + } + return IR_DECODE_SUCCEEDED; +} diff --git a/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_ac_parse_parameter.c b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_ac_parse_parameter.c new file mode 100644 index 0000000..6dc072a --- /dev/null +++ b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_ac_parse_parameter.c @@ -0,0 +1,1190 @@ +/************************************************************************************** +Filename: ir_parse_ac_parameter.c +Revised: Date: 2016-10-12 +Revision: Revision: 1.0 + +Description: This file provides algorithms for IR decode for AC functionality parameters + +Revision log: +* 2016-10-12: created by strawmanbobi +**************************************************************************************/ + +#include +#include +#include + +#include "../include/ir_utils.h" +#include "../include/ir_ac_parse_parameter.h" + + +INT8 parse_comp_data_type_1(UINT8 *data, UINT16 *trav_offset, t_tag_comp *comp) +{ + UINT8 seg_len = data[*trav_offset]; + (*trav_offset)++; + + if (0 == seg_len) + { + // do alloc memory to this power segment and return SUCCESS + comp->seg_len = 0; + comp->segment = NULL; + return IR_DECODE_SUCCEEDED; + } + + comp->seg_len = seg_len; + comp->segment = (UINT8 *) ir_malloc(seg_len); + if (NULL == comp->segment) + { + return IR_DECODE_FAILED; + } + + ir_memcpy(comp->segment, &data[*trav_offset], seg_len); + *trav_offset += seg_len; + + return IR_DECODE_SUCCEEDED; +} + +INT8 parse_comp_data_type_2(UINT8 *data, UINT16 *trav_offset, t_tag_comp *comp) +{ + UINT8 seg_len = data[*trav_offset]; + (*trav_offset)++; + + if (0 == seg_len) + { + // do alloc memory to this temp segment and return SUCCESS + comp->seg_len = 0; + comp->segment = NULL; + return IR_DECODE_SUCCEEDED; + } + + comp->seg_len = seg_len; + comp->segment = (UINT8 *) ir_malloc(seg_len); + if (NULL == comp->segment) + { + return IR_DECODE_FAILED; + } + + ir_memcpy(comp->segment, &data[*trav_offset], seg_len); + *trav_offset += seg_len; + + return IR_DECODE_SUCCEEDED; +} + +INT8 parse_common_ac_parameter(t_tag_head *tag, t_tag_comp *comp_data, UINT8 with_end, UINT8 type) +{ + UINT16 hex_len = 0; + UINT16 trav_offset = 0; + UINT16 seg_index = 0; + UINT8 *hex_data = NULL; + + if (NULL == tag) + { + return IR_DECODE_FAILED; + } + + if (NULL == comp_data) + { + return IR_DECODE_FAILED; + } + + hex_len = tag->len >> 1; + hex_data = (UINT8 *) ir_malloc(hex_len); + if (NULL == hex_data) + { + return IR_DECODE_FAILED; + } + + string_to_hex_common(tag->p_data, hex_data, hex_len); + + // parse hex data to AC data structure + //*comp_len = hex_len; + + if (AC_PARAMETER_TYPE_1 == type) + { + for (seg_index = 0; seg_index < with_end; seg_index++) + { + if (IR_DECODE_FAILED == parse_comp_data_type_1(hex_data, &trav_offset, &comp_data[seg_index])) + { + ir_free(hex_data); + return IR_DECODE_FAILED; + } + + if (trav_offset >= hex_len) + { + break; + } + } + } + else + { + for (seg_index = 0; seg_index < with_end; seg_index++) + { + if (IR_DECODE_FAILED == parse_comp_data_type_2(hex_data, &trav_offset, &comp_data[seg_index])) + { + ir_free(hex_data); + return IR_DECODE_FAILED; + } + + if (trav_offset >= hex_len) + { + break; + } + } + } + + ir_free(hex_data); + + return IR_DECODE_SUCCEEDED; +} + +INT8 parse_default_code(struct tag_head *tag, t_ac_hex *default_code) +{ + if (NULL == tag) + { + return IR_DECODE_FAILED; + } + + string_to_hex(tag->p_data, default_code); + + return IR_DECODE_SUCCEEDED; +} + +INT8 parse_power_1(struct tag_head *tag, t_power_1 *power1) +{ + UINT16 hex_len = 0; + UINT16 trav_offset = 0; + UINT16 seg_index = 0; + UINT8 *hex_data = NULL; + + if (NULL == tag) + { + return IR_DECODE_FAILED; + } + + if (NULL == power1) + { + return IR_DECODE_FAILED; + } + + hex_len = tag->len >> 1; + hex_data = (UINT8 *) ir_malloc(hex_len); + + if (NULL == hex_data) + { + return IR_DECODE_FAILED; + } + + string_to_hex_common(tag->p_data, hex_data, hex_len); + + // parse hex data to power1 data structure + power1->len = (UINT8) hex_len; + + for (seg_index = AC_POWER_ON; seg_index < AC_POWER_MAX; seg_index++) + { + if (IR_DECODE_FAILED == parse_comp_data_type_1(hex_data, &trav_offset, &power1->comp_data[seg_index])) + { + ir_free(hex_data); + return IR_DECODE_FAILED; + } + + // prevent from buffer over flowing + if (trav_offset >= hex_len) + { + break; + } + } + + ir_free(hex_data); + + return IR_DECODE_SUCCEEDED; +} + +INT8 parse_temp_1(struct tag_head *tag, t_temp_1 *temp1) +{ + UINT16 hex_len = 0; + UINT16 i = 0; + UINT16 trav_offset = 0; + UINT16 seg_index = 0; + UINT8 *hex_data = NULL; + + if (NULL == tag) + { + return IR_DECODE_FAILED; + } + + hex_len = tag->len >> 1; + hex_data = (UINT8 *) ir_malloc(hex_len); + + if (NULL == hex_data) + { + return IR_DECODE_FAILED; + } + + string_to_hex_common(tag->p_data, hex_data, hex_len); + + // parse hex data according to length + if (hex_data[0] == hex_len - 1) + { + // dynamic temperature tag + temp1->type = TEMP_TYPE_DYNAMIC; + temp1->len = (UINT8) hex_len; + UINT8 seg_len = hex_data[0]; + + for (seg_index = AC_TEMP_16; seg_index < AC_TEMP_MAX; seg_index++) + { + // 020210 indicates set the 02nd byte to [default] +10, +11, +12, +... + temp1->comp_data[seg_index].seg_len = seg_len; + temp1->comp_data[seg_index].segment = (UINT8 *) ir_malloc(seg_len); + if (NULL == temp1->comp_data[seg_index].segment) + { + ir_free(hex_data); + return IR_DECODE_FAILED; + } + + for (i = 1; i < seg_len; i += 2) + { + temp1->comp_data[seg_index].segment[i - 1] = hex_data[i]; + + // get the default value of temperature + temp1->comp_data[seg_index].segment[i] = (UINT8) (hex_data[i + 1] * seg_index); + } + } + } + else + { + // static temperature tag + temp1->len = (UINT8) hex_len; + temp1->type = TEMP_TYPE_STATIC; + for (seg_index = AC_TEMP_16; seg_index < AC_TEMP_MAX; seg_index++) + { + if (IR_DECODE_FAILED == parse_comp_data_type_1(hex_data, &trav_offset, &temp1->comp_data[seg_index])) + { + ir_free(hex_data); + return IR_DECODE_FAILED; + } + + if (trav_offset >= hex_len) + { + break; + } + } + } + ir_free(hex_data); + + return IR_DECODE_SUCCEEDED; +} + +INT8 parse_mode_1(struct tag_head *tag, t_mode_1 *mode1) +{ + UINT16 hex_len = 0; + UINT16 trav_offset = 0; + UINT16 seg_index = 0; + UINT8 *hex_data = NULL; + + if (NULL == tag) + { + return IR_DECODE_FAILED; + } + + hex_len = tag->len >> 1; + hex_data = (UINT8 *) ir_malloc(hex_len); + + if (NULL == hex_data) + { + return IR_DECODE_FAILED; + } + + string_to_hex_common(tag->p_data, hex_data, hex_len); + + // parse hex data to mode1 data structure + mode1->len = (UINT8) hex_len; + + for (seg_index = AC_MODE_COOL; seg_index < AC_MODE_MAX; seg_index++) + { + if (IR_DECODE_FAILED == parse_comp_data_type_1(hex_data, &trav_offset, &mode1->comp_data[seg_index])) + { + ir_free(hex_data); + return IR_DECODE_FAILED; + } + + if (trav_offset >= hex_len) + { + break; + } + } + + ir_free(hex_data); + + return IR_DECODE_SUCCEEDED; +} + +INT8 parse_speed_1(struct tag_head *tag, t_speed_1 *speed1) +{ + UINT16 hex_len = 0; + UINT16 trav_offset = 0; + UINT16 seg_index = 0; + UINT8 *hex_data = NULL; + + if (NULL == tag) + { + return IR_DECODE_FAILED; + } + + hex_len = tag->len >> 1; + hex_data = (UINT8 *) ir_malloc(hex_len); + + if (NULL == hex_data) + { + return IR_DECODE_FAILED; + } + + string_to_hex_common(tag->p_data, hex_data, hex_len); + + // parse hex data to speed1 data structure + speed1->len = (UINT8) hex_len; + + for (seg_index = AC_WS_AUTO; seg_index < AC_WS_MAX; seg_index++) + { + if (IR_DECODE_FAILED == parse_comp_data_type_1(hex_data, &trav_offset, &speed1->comp_data[seg_index])) + { + ir_free(hex_data); + return IR_DECODE_FAILED; + } + + if (trav_offset >= hex_len) + { + break; + } + } + + ir_free(hex_data); + + return IR_DECODE_SUCCEEDED; +} + +INT8 parse_swing_1(struct tag_head *tag, t_swing_1 *swing1, UINT16 swing_count) +{ + UINT16 hex_len = 0; + UINT16 trav_offset = 0; + UINT16 seg_index = 0; + UINT8 *hex_data = NULL; + + if (NULL == tag) + { + return IR_DECODE_FAILED; + } + + hex_len = tag->len >> 1; + hex_data = (UINT8 *) ir_malloc(hex_len); + + if (NULL == hex_data) + { + return IR_DECODE_FAILED; + } + + string_to_hex_common(tag->p_data, hex_data, hex_len); + + // parse hex data to swing1 data structure + swing1->count = swing_count; + swing1->len = (UINT8) hex_len; + swing1->comp_data = (t_tag_comp *) ir_malloc(sizeof(t_tag_comp) * swing_count); + if (NULL == swing1->comp_data) + { + ir_free(hex_data); + return IR_DECODE_FAILED; + } + + for (seg_index = 0; seg_index < swing_count; seg_index++) + { + if (IR_DECODE_FAILED == parse_comp_data_type_1(hex_data, &trav_offset, &swing1->comp_data[seg_index])) + { + ir_free(hex_data); + return IR_DECODE_FAILED; + } + + if (trav_offset >= hex_len) + { + break; + } + } + + ir_free(hex_data); + + return IR_DECODE_SUCCEEDED; +} + +INT8 parse_checksum_byte_typed(UINT8 *csdata, t_tag_checksum_data *checksum, UINT16 len) +{ + checksum->start_byte_pos = csdata[2]; + checksum->end_byte_pos = csdata[3]; + checksum->checksum_byte_pos = csdata[4]; + + if (len > 5) + { + checksum->checksum_plus = csdata[5]; + } + else + { + checksum->checksum_plus = 0; + } + checksum->spec_pos = NULL; + + return IR_DECODE_SUCCEEDED; +} + +INT8 parse_checksum_half_byte_typed(UINT8 *csdata, t_tag_checksum_data *checksum, UINT16 len) +{ + checksum->start_byte_pos = csdata[2]; + checksum->end_byte_pos = csdata[3]; + checksum->checksum_byte_pos = csdata[4]; + + if (len > 5) + { + checksum->checksum_plus = csdata[5]; + } + else + { + checksum->checksum_plus = 0; + } + checksum->spec_pos = NULL; + return IR_DECODE_SUCCEEDED; +} + +INT8 parse_checksum_spec_half_byte_typed(UINT8 *csdata, t_tag_checksum_data *checksum, UINT16 len) +{ + /* + * note: + * for the type of specified half byte checksum algorithm, + * the checksum byte positions are in unit of HALF BYTE, rather than in unit of BYTE + * as well as the specified half byte positions (spec_pos). + * Thus the specified half byte checksum only affects 4 bits of a position + * of half byte specified by check_sum_byte_pos property. + */ + UINT16 spec_pos_size = (UINT16) (len - 4); + + checksum->checksum_byte_pos = csdata[2]; + checksum->checksum_plus = csdata[3]; + checksum->start_byte_pos = 0; + checksum->end_byte_pos = 0; + checksum->spec_pos = (UINT8 *) ir_malloc(spec_pos_size); + if (NULL == checksum->spec_pos) + { + return IR_DECODE_FAILED; + } + ir_memcpy(checksum->spec_pos, &csdata[4], spec_pos_size); + + return IR_DECODE_SUCCEEDED; +} + +INT8 parse_checksum_malloc(struct tag_head *tag, t_checksum *checksum) +{ + UINT8 i = 0; + UINT8 cnt = 0; + + for (i = 0; i < tag->len; i++) + { + if (tag->p_data[i] == '|') + { + cnt++; + } + } + + checksum->len = (UINT8) ((tag->len - cnt) >> 1); + checksum->count = (UINT16) (cnt + 1); + checksum->checksum_data = (t_tag_checksum_data *) ir_malloc(sizeof(t_tag_checksum_data) * checksum->count); + + if (NULL == checksum->checksum_data) + { + return IR_DECODE_FAILED; + } + ir_memset(checksum->checksum_data, 0x00, sizeof(t_tag_checksum_data) * checksum->count); + + return IR_DECODE_SUCCEEDED; +} + +INT8 parse_checksum_data(UINT8 *buf, t_tag_checksum_data *checksum, UINT8 length) +{ + UINT8 *hex_data = NULL; + UINT16 hex_len = 0; + + if (NULL == buf) + { + return IR_DECODE_FAILED; + } + + if (NULL == checksum) + { + return IR_DECODE_FAILED; + } + + hex_len = length; + hex_data = (UINT8 *) ir_malloc(hex_len); + + if (NULL == hex_data) + { + return IR_DECODE_FAILED; + } + + string_to_hex_common(buf, hex_data, hex_len); + + if (length != hex_data[0] + 1) + { + ir_free(hex_data); + return IR_DECODE_FAILED; + } + + checksum->len = hex_data[0]; + checksum->type = hex_data[1]; + switch (checksum->type) + { + case CHECKSUM_TYPE_BYTE: + case CHECKSUM_TYPE_BYTE_INVERSE: + if (IR_DECODE_FAILED == parse_checksum_byte_typed(hex_data, checksum, hex_len)) + { + ir_free(hex_data); + return IR_DECODE_FAILED; + } + break; + case CHECKSUM_TYPE_HALF_BYTE: + case CHECKSUM_TYPE_HALF_BYTE_INVERSE: + if (IR_DECODE_FAILED == parse_checksum_half_byte_typed(hex_data, checksum, hex_len)) + { + ir_free(hex_data); + return IR_DECODE_FAILED; + } + break; + case CHECKSUM_TYPE_SPEC_HALF_BYTE: + case CHECKSUM_TYPE_SPEC_HALF_BYTE_INVERSE: + case CHECKSUM_TYPE_SPEC_HALF_BYTE_ONE_BYTE: + case CHECKSUM_TYPE_SPEC_HALF_BYTE_INVERSE_ONE_BYTE: + if (IR_DECODE_FAILED == parse_checksum_spec_half_byte_typed(hex_data, checksum, hex_len)) + { + ir_free(hex_data); + return IR_DECODE_FAILED; + } + break; + default: + ir_free(hex_data); + return IR_DECODE_FAILED; + } + + ir_free(hex_data); + return IR_DECODE_SUCCEEDED; +} + +INT8 parse_checksum(struct tag_head *tag, t_checksum *checksum) +{ + UINT8 i = 0; + UINT8 num = 0; + UINT16 preindex = 0; + + if (NULL == tag) + { + return IR_DECODE_FAILED; + } + + if (NULL == checksum) + { + return IR_DECODE_FAILED; + } + + if (IR_DECODE_FAILED == parse_checksum_malloc(tag, checksum)) + { + return IR_DECODE_FAILED; + } + + for (i = 0; i < tag->len; i++) + { + if (tag->p_data[i] == '|') + { + if (IR_DECODE_FAILED == parse_checksum_data(tag->p_data + preindex, + checksum->checksum_data + num, + (UINT8) (i - preindex) >> 1)) + { + return IR_DECODE_FAILED; + } + preindex = (UINT16) (i + 1); + num++; + } + } + + if (IR_DECODE_FAILED == parse_checksum_data(tag->p_data + preindex, + checksum->checksum_data + num, + (UINT8) (i - preindex) >> 1)) + { + return IR_DECODE_FAILED; + } + + return IR_DECODE_SUCCEEDED; +} + +INT8 parse_function_1(UINT8 *data, UINT16 *trav_offset, t_tag_comp *mode_seg) +{ + UINT8 seg_len = 0; + BOOL valid_function_id = TRUE; + + if (NULL == data) + { + return IR_DECODE_FAILED; + } + + if (NULL == trav_offset) + { + return IR_DECODE_FAILED; + } + + if (NULL == mode_seg) + { + return IR_DECODE_FAILED; + } + + seg_len = data[*trav_offset]; + (*trav_offset)++; + + // function id starts from 1 (POWER) + UINT8 function_id = (UINT8) (data[*trav_offset] - 1); + + if (function_id > AC_FUNCTION_MAX - 1) + { + // ignore unsupported function ID + ir_printf("\nunsupported function id : %d\n", function_id); + valid_function_id = FALSE; + } + + (*trav_offset)++; + + if (0 == seg_len) + { + // do alloc memory to this mode segment and return SUCCESS + if (TRUE == valid_function_id) + { + mode_seg[function_id].seg_len = 0; + + if (NULL != mode_seg[function_id].segment) + { + ir_free(mode_seg[function_id].segment); + mode_seg[function_id].segment = NULL; + } + } + + return IR_DECODE_SUCCEEDED; + } + + if (TRUE == valid_function_id) + { + mode_seg[function_id].seg_len = (UINT8) (seg_len - 1); + mode_seg[function_id].segment = (UINT8 *) ir_malloc((size_t) (seg_len - 1)); + if (NULL == mode_seg[function_id].segment) + { + return IR_DECODE_FAILED; + } + ir_memcpy(mode_seg[function_id].segment, &data[*trav_offset], (size_t) (seg_len - 1)); + } + *trav_offset += seg_len - 1; + + return function_id; +} + +INT8 parse_function_1_tag29(struct tag_head *tag, t_function_1 *function1) +{ + UINT16 hex_len = 0; + UINT16 trav_offset = 0; + UINT16 seg_index = 0; + UINT8 *hex_data = NULL; + + if (NULL == tag) + { + return IR_DECODE_FAILED; + } + + if (NULL == function1) + { + return IR_DECODE_FAILED; + } + + hex_len = tag->len >> 1; + hex_data = (UINT8 *) ir_malloc(hex_len); + + if (NULL == hex_data) + { + return IR_DECODE_FAILED; + } + + string_to_hex_common(tag->p_data, hex_data, hex_len); + + // parse hex data to mode1 data structure + function1->len = (UINT8) hex_len; + + // seg_index in TAG only refers to functional count + for (seg_index = AC_FUNCTION_POWER; seg_index < AC_FUNCTION_MAX; seg_index++) + { + INT8 fid = parse_function_1(hex_data, &trav_offset, &function1->comp_data[0]); + + /** WARNING: for strict mode only **/ + /** + if (fid > AC_FUNCTION_MAX - 1) + { + irda_free(hex_data); + hex_data = NULL; + return IR_DECODE_FAILED; + } + **/ + + if (trav_offset >= hex_len) + { + break; + } + } + + ir_free(hex_data); + + return IR_DECODE_SUCCEEDED; +} + +INT8 parse_temp_2(struct tag_head *tag, t_temp_2 *temp2) +{ + UINT16 hex_len = 0; + UINT16 i = 0; + UINT16 trav_offset = 0; + UINT16 seg_index = 0; + UINT8 *hex_data = NULL; + + if (NULL == tag) + { + return IR_DECODE_FAILED; + } + + if (NULL == temp2) + { + return IR_DECODE_FAILED; + } + + hex_len = tag->len >> 1; + hex_data = (UINT8 *) ir_malloc(hex_len); + + if (NULL == hex_data) + { + return IR_DECODE_FAILED; + } + + string_to_hex_common(tag->p_data, hex_data, hex_len); + + // parse hex data according to length + if (hex_data[0] == hex_len - 1) + { + // dynamic temperature tag + temp2->type = TEMP_TYPE_DYNAMIC; + temp2->len = (UINT8) hex_len; + UINT8 seg_len = hex_data[0]; + + for (seg_index = AC_TEMP_16; seg_index < AC_TEMP_MAX; seg_index++) + { + // 020210 indicates set the 02nd byte to [default] +10, +11, +12, +... + temp2->comp_data[seg_index].seg_len = seg_len; + temp2->comp_data[seg_index].segment = (UINT8 *) ir_malloc(seg_len); + if (NULL == temp2->comp_data[seg_index].segment) + { + ir_free(hex_data); + return IR_DECODE_FAILED; + } + for (i = 2; i < seg_len; i += 3) + { + temp2->comp_data[seg_index].segment[i - 2] = hex_data[i - 1]; + temp2->comp_data[seg_index].segment[i - 1] = hex_data[i]; + + // for this second type (TAG 30) temperature update, apply the change in run time. + temp2->comp_data[seg_index].segment[i] = (UINT8) (hex_data[i + 1] * seg_index); + } + } + } + else + { + // static temperature tag + temp2->len = (UINT8) hex_len; + temp2->type = TEMP_TYPE_STATIC; + for (seg_index = AC_TEMP_16; seg_index < AC_TEMP_MAX; seg_index++) + { + if (IR_DECODE_FAILED == parse_comp_data_type_2(hex_data, &trav_offset, &temp2->comp_data[seg_index])) + { + ir_free(hex_data); + return IR_DECODE_FAILED; + } + + if (trav_offset >= hex_len) + { + break; + } + } + } + ir_free(hex_data); + + return IR_DECODE_SUCCEEDED; +} + +INT8 parse_mode_2(struct tag_head *tag, t_mode_2 *mode2) +{ + UINT16 hex_len = 0; + UINT16 trav_offset = 0; + UINT16 seg_index = 0; + UINT8 *hex_data = NULL; + + if (NULL == tag) + { + return IR_DECODE_FAILED; + } + + if (NULL == mode2) + { + return IR_DECODE_FAILED; + } + + hex_len = tag->len >> 1; + hex_data = (UINT8 *) ir_malloc(hex_len); + + if (NULL == hex_data) + { + return IR_DECODE_FAILED; + } + + string_to_hex_common(tag->p_data, hex_data, hex_len); + + // parse hex data to mode1 data structure + mode2->len = (UINT8) hex_len; + + for (seg_index = AC_MODE_COOL; seg_index < AC_MODE_MAX; seg_index++) + { + if (IR_DECODE_FAILED == parse_comp_data_type_2(hex_data, &trav_offset, &mode2->comp_data[seg_index])) + { + ir_free(hex_data); + return IR_DECODE_FAILED; + } + + if (trav_offset >= hex_len) + { + break; + } + } + + ir_free(hex_data); + + return IR_DECODE_SUCCEEDED; +} + +INT8 parse_speed_2(struct tag_head *tag, t_speed_2 *speed2) +{ + UINT16 hex_len = 0; + UINT16 trav_offset = 0; + UINT16 seg_index = 0; + UINT8 *hex_data = NULL; + + if (NULL == tag) + { + return IR_DECODE_FAILED; + } + + if (NULL == speed2) + { + return IR_DECODE_FAILED; + } + + hex_len = tag->len >> 1; + hex_data = (UINT8 *) ir_malloc(hex_len); + + if (NULL == hex_data) + { + return IR_DECODE_FAILED; + } + + string_to_hex_common(tag->p_data, hex_data, hex_len); + + // parse hex data to speed1 data structure + speed2->len = (UINT8) hex_len; + + for (seg_index = AC_WS_AUTO; seg_index < AC_WS_MAX; seg_index++) + { + if (IR_DECODE_FAILED == parse_comp_data_type_2(hex_data, &trav_offset, &speed2->comp_data[seg_index])) + { + ir_free(hex_data); + return IR_DECODE_FAILED; + } + + if (trav_offset >= hex_len) + { + break; + } + } + + ir_free(hex_data); + + return IR_DECODE_SUCCEEDED; +} + +INT8 parse_swing_2(struct tag_head *tag, t_swing_2 *swing2, UINT16 swing_count) +{ + UINT16 hex_len = 0; + UINT16 trav_offset = 0; + UINT16 seg_index = 0; + UINT8 *hex_data = NULL; + + if (NULL == tag) + { + return IR_DECODE_FAILED; + } + + if (NULL == swing2) + { + return IR_DECODE_FAILED; + } + + hex_len = tag->len >> 1; + hex_data = (UINT8 *) ir_malloc(hex_len); + + if (NULL == hex_data) + { + return IR_DECODE_FAILED; + } + + string_to_hex_common(tag->p_data, hex_data, hex_len); + + // parse hex data to swing2 data structure + swing2->count = swing_count; + swing2->len = (UINT8) hex_len; + swing2->comp_data = (t_tag_comp *) ir_malloc(sizeof(t_tag_comp) * swing_count); + if (NULL == swing2->comp_data) + { + ir_free(hex_data); + return IR_DECODE_FAILED; + } + + for (seg_index = 0; seg_index < swing_count; seg_index++) + { + if (IR_DECODE_FAILED == parse_comp_data_type_2(hex_data, &trav_offset, &swing2->comp_data[seg_index])) + { + ir_free(hex_data); + return IR_DECODE_FAILED; + } + + if (trav_offset >= hex_len) + { + break; + } + } + + ir_free(hex_data); + + return IR_DECODE_SUCCEEDED; +} + +INT8 parse_function_2(UINT8 *data, UINT16 *trav_offset, t_tag_comp *mode_seg) +{ + UINT8 seg_len = 0; + BOOL valid_function_id = TRUE; + + if (NULL == data) + { + return IR_DECODE_FAILED; + } + + if (NULL == trav_offset) + { + return IR_DECODE_FAILED; + } + + if (NULL == mode_seg) + { + return IR_DECODE_FAILED; + } + + seg_len = data[*trav_offset]; + (*trav_offset)++; + + // function id starts from 1 (POWER) + UINT8 function_id = (UINT8) (data[*trav_offset] - 1); + if (function_id > AC_FUNCTION_MAX - 1) + { + // ignore unsupported function ID + ir_printf("\nunsupported function id : %d\n", function_id); + valid_function_id = FALSE; + } + + (*trav_offset)++; + + if (0 == seg_len) + { + if (TRUE == valid_function_id) + { + // do alloc memory to this mode segment and return SUCCESS + mode_seg[function_id].seg_len = 0; + + if (NULL != mode_seg[function_id].segment) + { + ir_free(mode_seg[function_id].segment); + mode_seg[function_id].segment = NULL; + } + } + + return IR_DECODE_SUCCEEDED; + } + + if (TRUE == valid_function_id) + { + mode_seg[function_id].seg_len = (UINT8) (seg_len - 1); + mode_seg[function_id].segment = (UINT8 *) ir_malloc((size_t) (seg_len - 1)); + + if (NULL == mode_seg[function_id].segment) + { + return IR_DECODE_FAILED; + } + + ir_memcpy(mode_seg[function_id].segment, &data[*trav_offset], (size_t) (seg_len - 1)); + } + *trav_offset += seg_len - 1; + + return function_id; +} + +INT8 parse_function_2_tag34(struct tag_head *tag, t_function_2 *function2) +{ + UINT16 hex_len = 0; + UINT16 trav_offset = 0; + UINT16 seg_index = 0; + UINT8 *hex_data = NULL; + + if (NULL == tag) + { + return IR_DECODE_FAILED; + } + + if (NULL == function2) + { + return IR_DECODE_FAILED; + } + + hex_len = tag->len >> 1; + hex_data = (UINT8 *) ir_malloc(hex_len); + + if (NULL == hex_data) + { + return IR_DECODE_FAILED; + } + + string_to_hex_common(tag->p_data, hex_data, hex_len); + + // parse hex data to mode1 data structure + function2->len = (UINT8) hex_len; + + // seg_index in TAG only refers to functional count + for (seg_index = AC_FUNCTION_POWER; seg_index < AC_FUNCTION_MAX; seg_index++) + { + INT8 fid = parse_function_2(hex_data, &trav_offset, &function2->comp_data[0]); + + /** WARNING: for strict mode only **/ + /** + if (fid > AC_FUNCTION_MAX - 1) + { + irda_free(hex_data); + hex_data = NULL; + return IR_DECODE_FAILED; + } + **/ + + if (trav_offset >= hex_len) + { + break; + } + } + + ir_free(hex_data); + + return IR_DECODE_SUCCEEDED; +} + +INT8 parse_swing_info(struct tag_head *tag, t_swing_info *si) +{ + if (NULL == tag) + { + return IR_DECODE_FAILED; + } + + if (NULL == si) + { + return IR_DECODE_FAILED; + } + /* + * 0 or 1 only - indicates swing info + */ + if (1 == tag->len) + { + if ('0' == tag->p_data[0]) + { + // to identify if there is only 1 status in TAG 26 OR 33 + si->type = SWING_TYPE_NOT_SPECIFIED; + si->mode_count = 0; + } + else if ('1' == tag->p_data[0]) + { + si->type = SWING_TYPE_SWING_ONLY; + si->mode_count = 1; + } + else + { + return IR_DECODE_FAILED; + } + return IR_DECODE_SUCCEEDED; + } + + /* + * length greater than 1 indicates both auto-swing and some swing angles are supported + */ + // count how many swing types are there + si->type = SWING_TYPE_NORMAL; + si->mode_count = (UINT8) ((tag->len + 1) >> 1); + + return IR_DECODE_SUCCEEDED; +} + +INT8 parse_solo_code(struct tag_head *tag, t_solo_code *sc) +{ + UINT16 hex_len = 0; + UINT8 *hex_data = NULL; + UINT8 i = 0; + + if (NULL == tag) + { + return IR_DECODE_FAILED; + } + + if (NULL == sc) + { + return IR_DECODE_FAILED; + } + + hex_len = tag->len >> 1; + + if (hex_len > AC_FUNCTION_MAX) + { + ir_printf("\nsolo function code exceeded!!\n"); + return IR_DECODE_FAILED; + } + + hex_data = (UINT8 *) ir_malloc(hex_len); + + if (NULL == hex_data) + { + return IR_DECODE_FAILED; + } + string_to_hex_common(tag->p_data, hex_data, hex_len); + + // parse hex data to mode1 data structure + sc->len = (UINT8) hex_len; + sc->solo_func_count = (UINT8) (hex_len - 1); + + // per each function takes just 1 byte of length + sc->solo_func_count = hex_data[0]; + for (i = 1; i < hex_len; i++) + { + sc->solo_function_codes[i - 1] = hex_data[i]; + } + + ir_free(hex_data); + return IR_DECODE_SUCCEEDED; +} \ No newline at end of file diff --git a/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_decode.c b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_decode.c new file mode 100644 index 0000000..f2b8cdd --- /dev/null +++ b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_decode.c @@ -0,0 +1,640 @@ +/************************************************************************************** +Filename: ir_decode.c +Revised: Date: 2016-10-01 +Revision: Revision: 1.0 + +Description: This file provides algorithms for IR decode (status type) + +Revision log: +* 2016-10-01: created by strawmanbobi +**************************************************************************************/ + +#include +#include + +#include + +#include "../include/ir_decode.h" +#include "../include/ir_utils.h" +#include "../include/ir_ac_build_frame.h" +#include "../include/ir_ac_apply.h" + +struct ir_bin_buffer binary_file; +struct ir_bin_buffer *p_ir_buffer = &binary_file; +struct tag_head *tags; + + +UINT8 *ir_hex_code = NULL; +UINT8 ir_hex_len = 0; + +UINT8 byteArray[PROTOCOL_SIZE] = {0}; + +size_t binary_length = 0; +UINT8 *binary_content = NULL; + +UINT8 ir_binary_type = IR_TYPE_STATUS; +UINT8 ir_hexadecimal = SUB_CATEGORY_QUATERNARY; + +t_ac_protocol *context = (t_ac_protocol *) byteArray; + +lp_apply_ac_parameter apply_table[AC_APPLY_MAX] = +{ + apply_power, + apply_mode, + apply_temperature, + apply_temperature, + apply_wind_speed, + apply_swing, + apply_swing +}; + +// static functions declarations +static INT8 ir_ac_file_open(const char *file_name); +static INT8 ir_ac_lib_open(UINT8 *binary, UINT16 binary_length); +static UINT16 ir_ac_lib_control(t_remote_ac_status ac_status, UINT16 *user_data, UINT8 function_code, + BOOL change_wind_direction); +static INT8 ir_ac_lib_close(); +static INT8 ir_tv_file_open(const char *file_name); +static INT8 ir_tv_lib_open(UINT8 *binary, UINT16 binary_length); +static INT8 ir_tv_lib_parse(UINT8 ir_hex_encode); +static UINT16 ir_tv_lib_control(UINT8 key, UINT16 *l_user_data); +static INT8 ir_tv_lib_close(); + + +void noprint(const char *fmt, ...) +{ + return; +} + +// pubic function definitions + +INT8 ir_file_open(const UINT8 category, const UINT8 sub_category, const char* file_name) +{ + INT8 ret = IR_DECODE_SUCCEEDED; + if (category == IR_CATEGORY_AC) + { + ir_binary_type = IR_TYPE_STATUS; + ret = ir_ac_file_open(file_name); + if (IR_DECODE_SUCCEEDED == ret) + { + return ir_ac_lib_parse(); + } + else + { + return ret; + } + } + else + { + ir_binary_type = IR_TYPE_COMMANDS; + if (1 == sub_category) + { + ir_hexadecimal = SUB_CATEGORY_QUATERNARY; + } + else if (2 == sub_category) + { + ir_hexadecimal = SUB_CATEGORY_HEXADECIMAL; + } + else + { + return IR_DECODE_FAILED; + } + + ret = ir_tv_file_open(file_name); + if (IR_DECODE_SUCCEEDED == ret) + { + return ir_tv_lib_parse(ir_hexadecimal); + } + else + { + return ret; + } + } +} + + +INT8 ir_binary_open(const UINT8 category, const UINT8 sub_category, UINT8* binary, UINT16 binary_length) +{ + INT8 ret = IR_DECODE_SUCCEEDED; + + if (category == IR_CATEGORY_AC) + { + ir_binary_type = IR_TYPE_STATUS; + ret = ir_ac_lib_open(binary, binary_length); + if (IR_DECODE_SUCCEEDED == ret) + { + return ir_ac_lib_parse(); + } + else + { + return ret; + } + } + else + { + ir_binary_type = IR_TYPE_COMMANDS; + if (1 == sub_category) + { + ir_hexadecimal = SUB_CATEGORY_QUATERNARY; + } + else if (2 == sub_category) + { + ir_hexadecimal = SUB_CATEGORY_HEXADECIMAL; + } + else + { + return IR_DECODE_FAILED; + } + + ret = ir_tv_lib_open(binary, binary_length); + if (IR_DECODE_SUCCEEDED == ret) + { + return ir_tv_lib_parse(ir_hexadecimal); + } + else + { + return ret; + } + } +} + + +UINT16 ir_decode(UINT8 key_code, UINT16* user_data, t_remote_ac_status* ac_status, BOOL change_wind_direction) +{ + if (IR_TYPE_COMMANDS == ir_binary_type) + { + return ir_tv_lib_control(key_code, user_data); + } + else + { + if (NULL == ac_status) + { + return 0; + } + return ir_ac_lib_control(*ac_status, user_data, key_code, change_wind_direction); + } +} + + +INT8 ir_close() +{ + if (IR_TYPE_COMMANDS == ir_binary_type) + { + return ir_tv_lib_close(); + } + else + { + return ir_ac_lib_close(); + } +} + + +#if (defined BOARD_PC || defined BOARD_PC_DLL) +void ir_lib_free_inner_buffer(); +#endif + + +// static function definitions + +//////// AC Begin //////// +static INT8 ir_ac_file_open(const char *file_name) +{ +#if !defined NO_FS + size_t ret = 0; +#if !defined WIN32 + FILE *stream = fopen(file_name, "rb"); +#else + FILE *stream; + fopen_s(&stream, file_name, "rb"); +#endif + if (NULL == stream) + { + ir_printf("\nfile open failed\n"); + return IR_DECODE_FAILED; + } + + fseek(stream, 0, SEEK_END); + binary_length = (size_t) ftell(stream); + binary_content = (UINT8 *) ir_malloc(binary_length); + + if (NULL == binary_content) + { + ir_printf("\nfailed to alloc memory for binary\n"); + fclose(stream); + return IR_DECODE_FAILED; + } + + fseek(stream, 0, SEEK_SET); + ret = fread(binary_content, binary_length, 1, stream); + + if (ret <= 0) + { + fclose(stream); + ir_free(binary_content); + binary_length = 0; + return IR_DECODE_FAILED; + } + + fclose(stream); + + if (IR_DECODE_FAILED == ir_ac_lib_open(binary_content, (UINT16) binary_length)) + { + ir_free(binary_content); + binary_length = 0; + return IR_DECODE_FAILED; + } +#endif + return IR_DECODE_SUCCEEDED; +} + +static INT8 ir_ac_lib_open(UINT8 *binary, UINT16 binary_length) +{ + // it is recommended that the parameter binary pointing to + // a global memory block in embedded platform environment + p_ir_buffer->data = binary; + p_ir_buffer->len = binary_length; + p_ir_buffer->offset = 0; + return IR_DECODE_SUCCEEDED; +} + +static UINT16 ir_ac_lib_control(t_remote_ac_status ac_status, UINT16 *user_data, UINT8 function_code, + BOOL change_wind_direction) +{ + UINT16 time_length = 0; + +#if defined BOARD_PC + UINT8 i = 0; +#endif + + if (0 == context->default_code.len) + { + ir_printf("\ndefault code is empty\n"); + return 0; + } + + // pre-set change wind direction flag here + context->change_wind_direction = change_wind_direction; + + context->time = user_data; + + // generate temp buffer for frame calculation + ir_memcpy(ir_hex_code, context->default_code.data, context->default_code.len); + +#if defined USE_APPLY_TABLE + if(ac_status.ac_power != AC_POWER_OFF) + { + for (i = AC_APPLY_POWER; i < AC_APPLY_MAX; i++) + { + apply_table[i](context, parameter_array[i]); + } + } +#else + if (ac_status.ac_power == AC_POWER_OFF) + { + // otherwise, power should always be applied + apply_power(ac_status, function_code); + } + else + { + // check the mode as the first priority, despite any other status + if (TRUE == context->n_mode[ac_status.ac_mode].enable) + { + if (is_solo_function(function_code)) + { + // this key press function needs to send solo code + apply_table[function_code - 1](ac_status, function_code); + } + else + { + if (!is_solo_function(AC_FUNCTION_POWER)) + { + apply_power(ac_status, function_code); + } + + if (!is_solo_function(AC_FUNCTION_MODE)) + { + if (IR_DECODE_FAILED == apply_mode(ac_status, function_code)) + { + return 0; + } + } + + if (!is_solo_function(AC_FUNCTION_WIND_SPEED)) + { + if (IR_DECODE_FAILED == apply_wind_speed(ac_status, function_code)) + { + return 0; + } + } + + if (!is_solo_function(AC_FUNCTION_WIND_SWING) && + !is_solo_function(AC_FUNCTION_WIND_FIX)) + { + if (IR_DECODE_FAILED == apply_swing(ac_status, function_code)) + { + return 0; + } + } + + if (!is_solo_function(AC_FUNCTION_TEMPERATURE_UP) && + !is_solo_function(AC_FUNCTION_TEMPERATURE_DOWN)) + { + if (IR_DECODE_FAILED == apply_temperature(ac_status, function_code)) + { + return 0; + } + } + } + } + else + { + return 0; + } + } +#endif + apply_function(context, function_code); + // checksum should always be applied + apply_checksum(context); + + time_length = create_ir_frame(); + +#if (defined BOARD_PC) +#if (defined BOARD_PC_JNI) + ir_printf("code count = %d\n", context->code_cnt); +#else + for (i = 0; i < context->code_cnt; i++) + { + ir_printf("%d,", context->time[i]); + } +#endif + ir_printf("\n"); +#endif + + return time_length; +} + +static INT8 ir_ac_lib_close() +{ + // free context + if (NULL != tags) + { + ir_free(tags); + tags = NULL; + } + free_ac_context(); + + return IR_DECODE_SUCCEEDED; +} + +// utils +INT8 get_temperature_range(UINT8 ac_mode, INT8 *temp_min, INT8 *temp_max) +{ + UINT8 i = 0; + + if (ac_mode >= AC_MODE_MAX) + { + return IR_DECODE_FAILED; + } + if (NULL == temp_min || NULL == temp_max) + { + return IR_DECODE_FAILED; + } + + if (1 == context->n_mode[ac_mode].all_temp) + { + *temp_min = *temp_max = -1; + return IR_DECODE_SUCCEEDED; + } + + *temp_min = -1; + *temp_max = -1; + for (i = 0; i < AC_TEMP_MAX; i++) + { + if (is_in(context->n_mode[ac_mode].temp, i, context->n_mode[ac_mode].temp_cnt) || + (context->temp1.len != 0 && 0 == context->temp1.comp_data[i].seg_len) || + (context->temp2.len != 0 && 0 == context->temp2.comp_data[i].seg_len)) + { + continue; + } + if (-1 == *temp_min) + { + *temp_min = i; + } + if (-1 == *temp_max || i > *temp_max) + { + *temp_max = i; + } + } + return IR_DECODE_SUCCEEDED; +} + +INT8 get_supported_mode(UINT8 *supported_mode) +{ + UINT8 i = 0; + if (NULL == supported_mode) + { + return IR_DECODE_FAILED; + } + *supported_mode = 0x1F; + + for (i = 0; i < AC_MODE_MAX; i++) + { + if (0 == context->n_mode[i].enable || + (context->mode1.len != 0 && 0 == context->mode1.comp_data[i].seg_len) || + (context->mode2.len != 0 && 0 == context->mode2.comp_data[i].seg_len)) + { + *supported_mode &= ~(1 << i); + } + } + + return IR_DECODE_SUCCEEDED; +} + +INT8 get_supported_wind_speed(UINT8 ac_mode, UINT8 *supported_wind_speed) +{ + UINT8 i = 0; + if (ac_mode >= AC_MODE_MAX) + { + return IR_DECODE_FAILED; + } + + if (NULL == supported_wind_speed) + { + return IR_DECODE_FAILED; + } + + if (1 == context->n_mode[ac_mode].all_speed) + { + *supported_wind_speed = 0; + return IR_DECODE_SUCCEEDED; + } + + *supported_wind_speed = 0x0F; + + for (i = 0; i < AC_WS_MAX; i++) + { + if (is_in(context->n_mode[ac_mode].speed, i, context->n_mode[ac_mode].speed_cnt) || + (context->speed1.len != 0 && 0 == context->speed1.comp_data[i].seg_len) || + (context->speed2.len != 0 && 0 == context->speed2.comp_data[i].seg_len)) + { + *supported_wind_speed &= ~(1 << i); + } + } + + return IR_DECODE_SUCCEEDED; +} + +INT8 get_supported_swing(UINT8 ac_mode, UINT8 *supported_swing) +{ + if (ac_mode >= AC_MODE_MAX) + { + return IR_DECODE_FAILED; + } + + if (NULL == supported_swing) + { + return IR_DECODE_FAILED; + } + + if (context->si.type == SWING_TYPE_NORMAL) + { + *supported_swing = 0x03; + } + else if (context->si.type == SWING_TYPE_SWING_ONLY) + { + *supported_swing = 0x02; + } + else if (context->si.type == SWING_TYPE_NOT_SPECIFIED) + { + *supported_swing = 0x00; + } + else + { + *supported_swing = 0x01; + } + return IR_DECODE_SUCCEEDED; +} + +INT8 get_supported_wind_direction(UINT8 *supported_wind_direction) +{ + if (NULL != context) + { + *supported_wind_direction = (UINT8) (context->si.mode_count - 1); + return IR_DECODE_SUCCEEDED; + } + else + { + return IR_DECODE_FAILED; + } +} + +//////// AC End //////// + +//////// TV Begin //////// +static INT8 ir_tv_file_open(const char *file_name) +{ +#if !defined NO_FS + size_t ret = 0; + +#if !defined WIN32 + FILE *stream = fopen(file_name, "rb"); +#else + FILE *stream; + fopen_s(&stream, file_name, "rb"); +#endif + + if (stream == NULL) + { + ir_printf("\nfile open failed\n"); + return IR_DECODE_FAILED; + } + + fseek(stream, 0, SEEK_END); + binary_length = (size_t) ftell(stream); + + binary_content = (UINT8 *) ir_malloc(binary_length); + if (NULL == binary_content) + { + ir_printf("\nfailed to alloc memory for binary\n"); + fclose(stream); + return IR_DECODE_FAILED; + } + + fseek(stream, 0, SEEK_SET); + ret = fread(binary_content, binary_length, 1, stream); + if (ret <= 0) + { + fclose(stream); + ir_free(binary_content); + binary_length = 0; + return IR_DECODE_FAILED; + } + + fclose(stream); + + if (IR_DECODE_FAILED == ir_tv_lib_open(binary_content, (UINT16) binary_length)) + { + ir_free(binary_content); + binary_length = 0; + return IR_DECODE_FAILED; + } +#endif + return IR_DECODE_SUCCEEDED; +} + +static INT8 ir_tv_lib_open(UINT8 *binary, UINT16 binary_length) +{ + return tv_lib_open(binary, binary_length); +} + +static INT8 ir_tv_lib_parse(UINT8 ir_hex_encode) +{ + if (FALSE == tv_lib_parse(ir_hex_encode)) + { + ir_printf("parse irda binary failed\n"); + return IR_DECODE_FAILED; + } + return IR_DECODE_SUCCEEDED; +} + +static UINT16 ir_tv_lib_control(UINT8 key, UINT16 *l_user_data) +{ +#if defined BOARD_PC + UINT16 print_index = 0; +#endif + UINT16 ir_code_length = 0; + memset(l_user_data, 0x00, USER_DATA_SIZE); + ir_code_length = tv_lib_control(key, l_user_data); + +#if defined BOARD_PC + // have some debug + ir_printf("length of IR code = %d\n", ir_code_length); + for (print_index = 0; print_index < ir_code_length; print_index++) + { + ir_printf("%d ", l_user_data[print_index]); + } +#endif + + return ir_code_length; +} + +static INT8 ir_tv_lib_close() +{ +#if (defined BOARD_PC || defined BOARD_PC_DLL) + ir_lib_free_inner_buffer(); +#endif + return IR_DECODE_SUCCEEDED; +} +//////// TV End //////// + + +#if (defined BOARD_PC || defined BOARD_PC_DLL) +void ir_lib_free_inner_buffer() +{ + if (NULL != binary_content) + { + ir_free(binary_content); + binary_content = NULL; + } +} +#endif \ No newline at end of file diff --git a/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_tv_control.c b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_tv_control.c new file mode 100644 index 0000000..78cb9b9 --- /dev/null +++ b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_tv_control.c @@ -0,0 +1,448 @@ +/************************************************************************************** +Filename: ir_lib.c +Revised: Date: 2016-10-21 +Revision: Revision: 1.0 + +Description: This file provides algorithms for IR decode (compressed command type) + +Revision log: +* 2016-10-21: created by strawmanbobi +**************************************************************************************/ + +#include + +#include "../include/ir_defs.h" +#include "../include/ir_decode.h" +#include "../include/ir_tv_control.h" + + +struct buffer +{ + UINT8 *data; + UINT16 len; + UINT16 offset; +} ir_file; + + +static struct buffer *pbuffer = &ir_file; + +static UINT8 *prot_cycles_num = NULL; +static t_ir_cycles *prot_cycles_data[IRDA_MAX]; +static UINT8 prot_items_cnt = 0; +static t_ir_data *prot_items_data = NULL; +static t_ir_data_tv *remote_p; +static UINT8 *remote_pdata = NULL; + +static UINT16 time_index = 0; +static UINT8 ir_level = IRDA_LEVEL_LOW; +static UINT8 ir_toggle_bit = FALSE; +static UINT8 ir_decode_flag = IRDA_DECODE_1_BIT; +static UINT8 cycles_num_size = 0; + + +static BOOL get_ir_protocol(UINT8 encode_type); + +static BOOL get_ir_keymap(void); + +static void print_ir_time(t_ir_data *data, UINT8 key_index, UINT16 *ir_time); + +static void process_decode_number(UINT8 keycode, t_ir_data *data, UINT8 valid_bits, UINT16 *ir_time); + +static void convert_to_ir_time(UINT8 value, UINT16 *ir_time); + +static void replace_with(t_ir_cycles *pcycles_num, UINT16 *ir_time); + + +INT8 tv_lib_open(UINT8 *binary, UINT16 binary_length) +{ + // load binary to buffer + pbuffer->data = binary; + pbuffer->len = binary_length; + pbuffer->offset = 0; + return IR_DECODE_SUCCEEDED; +} + +BOOL tv_lib_parse(UINT8 encode_type) +{ + if (FALSE == get_ir_protocol(encode_type)) + { + return FALSE; + } + + return get_ir_keymap(); +} + +UINT16 tv_lib_control(UINT8 key, UINT16 *user_data) +{ + UINT16 i = 0; + + time_index = 0; + ir_level = IRDA_LEVEL_LOW; + + for (i = 0; i < prot_items_cnt; i++) + { + print_ir_time(&prot_items_data[i], key, user_data); + } + + // next flip + if (2 == prot_cycles_num[IRDA_FLIP]) + { + ir_toggle_bit = (ir_toggle_bit == FALSE) ? TRUE : FALSE; + } + + return time_index; +} + + +static BOOL get_ir_protocol(UINT8 encode_type) +{ + UINT8 i = 0; + UINT8 name_size = 20; + UINT8 *prot_cycles = NULL; + UINT8 cycles_sum = 0; + + if (pbuffer->data == NULL) + { + return FALSE; + } + + pbuffer->offset = 0; + + /* t_ac_protocol name */ + pbuffer->offset += name_size; + + /* cycles number */ + prot_cycles_num = pbuffer->data + pbuffer->offset; + + if (encode_type == 0) + { + cycles_num_size = 8; /* "BOOT", "STOP", "SEP", "ONE", "ZERO", "FLIP", "TWO", "THREE" */ + if (prot_cycles_num[IRDA_TWO] == 0 && prot_cycles_num[IRDA_THREE] == 0) + { + ir_decode_flag = IRDA_DECODE_1_BIT; + } + else + { + ir_decode_flag = IRDA_DECODE_2_BITS; + } + } + else if (encode_type == 1) + { + cycles_num_size = IRDA_MAX; + ir_decode_flag = IRDA_DECODE_4_BITS; + } + else + { + return FALSE; + } + pbuffer->offset += cycles_num_size; + + /* cycles data */ + prot_cycles = pbuffer->data + pbuffer->offset; + for (i = 0; i < cycles_num_size; i++) + { + if (0 != prot_cycles_num[i]) + { + prot_cycles_data[i] = (t_ir_cycles *) (&prot_cycles[sizeof(t_ir_cycles) * cycles_sum]); + } + else + { + prot_cycles_data[i] = NULL; + } + cycles_sum += prot_cycles_num[i]; + } + pbuffer->offset += sizeof(t_ir_cycles) * cycles_sum; + + /* items count */ + prot_items_cnt = pbuffer->data[pbuffer->offset]; + pbuffer->offset += sizeof(UINT8); + + /* items data */ + prot_items_data = (t_ir_data *) (pbuffer->data + pbuffer->offset); + pbuffer->offset += prot_items_cnt * sizeof(t_ir_data); + + ir_toggle_bit = FALSE; + + return TRUE; +} + +static BOOL get_ir_keymap(void) +{ + remote_p = (t_ir_data_tv *) (pbuffer->data + pbuffer->offset); + pbuffer->offset += sizeof(t_ir_data_tv); + + if (strncmp(remote_p->magic, "irda", 4) == 0) + { + remote_pdata = pbuffer->data + pbuffer->offset; + return TRUE; + } + + return FALSE; +} + +static void print_ir_time(t_ir_data *data, UINT8 key_index, UINT16 *ir_time) +{ + UINT8 i = 0; + UINT8 cycles_num = 0; + t_ir_cycles *pcycles = NULL; + UINT8 key_code = 0; + + if (NULL == data || NULL == ir_time) + { + ir_printf("data or ir_time is null\n"); + return; + } + + pcycles = prot_cycles_data[data->index]; + key_code = remote_pdata[remote_p->per_keycode_bytes * key_index + data->index - 1]; + + if (prot_cycles_num[IRDA_ONE] != 1 || prot_cycles_num[IRDA_ZERO] != 1) + { + ir_printf("logical 1 or 0 is invalid\n"); + return; + } + + if (time_index >= USER_DATA_SIZE) + { + ir_printf("time index exceeded\n"); + return; + } + + if (data->bits == 1) + { + if (pcycles == NULL) + { + ir_printf("pcycles is null\n"); + return; + } + + cycles_num = prot_cycles_num[data->index]; + if (cycles_num > 5) + { + ir_printf("cycles number exceeded\n"); + return; + } + + for (i = cycles_num; i > 0; i--) + { + if (cycles_num == 2 && data->index == IRDA_FLIP) + { + if (ir_toggle_bit == TRUE) + { + pcycles += 1; + } + } + + if (pcycles->mask && pcycles->space) + { + if (pcycles->flag == IRDA_FLAG_NORMAL) + { + if (ir_level == IRDA_LEVEL_HIGH && time_index != 0) + { + time_index--; + ir_time[time_index++] += pcycles->mask; + } + else if (ir_level == IRDA_LEVEL_LOW) + { + ir_time[time_index++] = pcycles->mask; + } + ir_time[time_index++] = pcycles->space; + ir_level = IRDA_LEVEL_LOW; + } + else if (pcycles->flag == IRDA_FLAG_INVERSE) + { + if (ir_level == IRDA_LEVEL_LOW && time_index != 0) + { + time_index--; + ir_time[time_index++] += pcycles->space; + } + else if (ir_level == IRDA_LEVEL_HIGH) + { + ir_time[time_index++] = pcycles->space; + } + ir_time[time_index++] = pcycles->mask; + ir_level = IRDA_LEVEL_HIGH; + } + } + else if (0 == pcycles->mask && 0 != pcycles->space) + { + if (ir_level == IRDA_LEVEL_LOW && time_index != 0) + { + time_index--; + ir_time[time_index++] += pcycles->space; + } + else if (ir_level == IRDA_LEVEL_HIGH) + { + ir_time[time_index++] = pcycles->space; + } + ir_level = IRDA_LEVEL_LOW; + } + else if (0 == pcycles->space && 0 != pcycles->mask) + { + if (ir_level == IRDA_LEVEL_HIGH && time_index != 0) + { + time_index--; + ir_time[time_index++] += pcycles->mask; + } + else if (ir_level == IRDA_LEVEL_LOW) + { + ir_time[time_index++] = pcycles->mask; + } + ir_level = IRDA_LEVEL_HIGH; + } + else + { + // do nothing + } + + if (cycles_num == 2 && data->index == IRDA_FLIP) + { + break; + } + pcycles++; + } + } + else + { + // mode: inverse + if (data->mode == 1) + key_code = ~key_code; + + if (ir_decode_flag == IRDA_DECODE_1_BIT) + { + // for binary formatted code + process_decode_number(key_code, data, 1, ir_time); + } + else if (ir_decode_flag == IRDA_DECODE_2_BITS) + { + // for quanternary formatted code + process_decode_number(key_code, data, 2, ir_time); + } + else if (ir_decode_flag == IRDA_DECODE_4_BITS) + { + // for hexadecimal formatted code + process_decode_number(key_code, data, 4, ir_time); + } + } +} + +static void process_decode_number(UINT8 keycode, t_ir_data *data, UINT8 valid_bits, UINT16 *ir_time) +{ + UINT8 i = 0; + UINT8 value = 0; + UINT8 bit_num = data->bits / valid_bits; + UINT8 valid_value = 0; + + valid_value = (UINT8) ((valid_bits == 1) ? 1 : (valid_bits * valid_bits - 1)); + + if (data->lsb == IRDA_LSB) + { + for (i = 0; i < bit_num; i++) + { + value = (keycode >> (valid_bits * i)) & valid_value; + convert_to_ir_time(value, ir_time); + } + } + else if (data->lsb == IRDA_MSB) + { + for (i = 0; i < bit_num; i++) + { + value = (keycode >> (data->bits - valid_bits * (i + 1))) & valid_value; + convert_to_ir_time(value, ir_time); + } + } +} + +static void convert_to_ir_time(UINT8 value, UINT16 *ir_time) +{ + switch (value) + { + case 0: + replace_with(prot_cycles_data[IRDA_ZERO], ir_time); + break; + case 1: + replace_with(prot_cycles_data[IRDA_ONE], ir_time); + break; + case 2: + replace_with(prot_cycles_data[IRDA_TWO], ir_time); + break; + case 3: + replace_with(prot_cycles_data[IRDA_THREE], ir_time); + break; + case 4: + replace_with(prot_cycles_data[IRDA_FOUR], ir_time); + break; + case 5: + replace_with(prot_cycles_data[IRDA_FIVE], ir_time); + break; + case 6: + replace_with(prot_cycles_data[IRDA_SIX], ir_time); + break; + case 7: + replace_with(prot_cycles_data[IRDA_SEVEN], ir_time); + break; + case 8: + replace_with(prot_cycles_data[IRDA_EIGHT], ir_time); + break; + case 9: + replace_with(prot_cycles_data[IRDA_NINE], ir_time); + break; + case 0x0A: + replace_with(prot_cycles_data[IRDA_A], ir_time); + break; + case 0x0B: + replace_with(prot_cycles_data[IRDA_B], ir_time); + break; + case 0x0C: + replace_with(prot_cycles_data[IRDA_C], ir_time); + break; + case 0x0D: + replace_with(prot_cycles_data[IRDA_D], ir_time); + break; + case 0x0E: + replace_with(prot_cycles_data[IRDA_E], ir_time); + break; + case 0x0F: + replace_with(prot_cycles_data[IRDA_F], ir_time); + break; + default: + break; + } +} + +static void replace_with(t_ir_cycles *pcycles_num, UINT16 *ir_time) +{ + if (NULL == pcycles_num || NULL == ir_time) + { + return; + } + + if (pcycles_num->flag == IRDA_FLAG_NORMAL) + { + if (ir_level == IRDA_LEVEL_HIGH && time_index != 0) + { + time_index--; + ir_time[time_index++] += pcycles_num->mask; + } + else if (ir_level == IRDA_LEVEL_LOW) + { + ir_time[time_index++] = pcycles_num->mask; + } + ir_time[time_index++] = pcycles_num->space; + ir_level = IRDA_LEVEL_LOW; + } + else if (pcycles_num->flag == IRDA_FLAG_INVERSE) + { + if (ir_level == IRDA_LEVEL_LOW && time_index != 0) + { + time_index--; + ir_time[time_index++] += pcycles_num->space; + } + else if (ir_level == IRDA_LEVEL_HIGH) + { + ir_time[time_index++] = pcycles_num->space; + } + ir_time[time_index++] = pcycles_num->mask; + ir_level = IRDA_LEVEL_HIGH; + } +} \ No newline at end of file diff --git a/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_utils.c b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_utils.c new file mode 100644 index 0000000..6867df7 --- /dev/null +++ b/cc25xx-example/ti/BLE-CC254x/Projects/ble/SimpleBLEPeripheral-IREXT/Source/Irext/src/ir_utils.c @@ -0,0 +1,98 @@ +/************************************************************************************** +Filename: ir_utils.c +Revised: Date: 2016-10-26 +Revision: Revision: 1.0 + +Description: This file provides generic utils for IRDA algorithms + +Revision log: +* 2016-10-01: created by strawmanbobi +**************************************************************************************/ + +#include "../include/ir_utils.h" + +UINT8 char_to_hex(char chr) +{ + UINT8 value = 0; + if (chr >= '0' && chr <= '9') + value = (UINT8) (chr - '0'); + if (chr >= 'a' && chr <= 'f') + value = (UINT8) (chr - 'a' + 10); + if (chr >= 'A' && chr <= 'F') + value = (UINT8) (chr - 'A' + 10); + return value; +} + +UINT8 chars_to_hex(const UINT8 *p) +{ + return (char_to_hex(*p) << 4) + char_to_hex(*(p + 1)); +} + +void string_to_hex_common(UINT8 *p, UINT8 *hex_data, UINT16 len) +{ + // in condition of hex_code is already assigned + UINT16 i = 0; + + for (i = 0; i < len; i++) + { + hex_data[i] = chars_to_hex(p); + p = p + 2; + } +} + +void string_to_hex(UINT8 *p, t_ac_hex *pac_hex) +{ + UINT8 i = 0; + + pac_hex->len = chars_to_hex(p); + p = p + 2; + for (i = 0; i < pac_hex->len; i++) + { + pac_hex->data[i] = chars_to_hex(p); + p = p + 2; + } +} + +char hex_half_byte_to_single_char(UINT8 length, UINT8 half_byte) +{ + if (1 != length || half_byte >= 16) + { + return '0'; + } + if (half_byte >= 10 && half_byte < 16) + { + return (char) (half_byte - 10 + 0x41); + } + else + { + return (char) (half_byte + 0x30); + } +} + +void hex_byte_to_double_char(char *dest, UINT8 length, UINT8 src) +{ + UINT8 hi_num = 0; + UINT8 lo_num = 0; + if (NULL == dest || 2 != length) + { + return; + } + hi_num = (UINT8) ((src >> 4) & 0x0F); + lo_num = (UINT8) (src & 0x0F); + + dest[0] = hex_half_byte_to_single_char(1, hi_num); + dest[1] = hex_half_byte_to_single_char(1, lo_num); +} + +BOOL is_in(const UINT8 *array, UINT8 value, UINT8 len) +{ + UINT16 i = 0; + for (i = 0; i < len; i++) + { + if (array[i] == value) + { + return TRUE; + } + } + return FALSE; +} \ No newline at end of file diff --git a/cc26xx-example/ti/BLE-CC264x/ble_cc26xx/Projects/ble/SimpleBLEPeripheral-IREXT/CC26xx/Source/Application/Irext/src/ir_ac_parse_parameter.c b/cc26xx-example/ti/BLE-CC264x/ble_cc26xx/Projects/ble/SimpleBLEPeripheral-IREXT/CC26xx/Source/Application/Irext/src/ir_ac_parse_parameter.c index 70137bd..6dc072a 100644 --- a/cc26xx-example/ti/BLE-CC264x/ble_cc26xx/Projects/ble/SimpleBLEPeripheral-IREXT/CC26xx/Source/Application/Irext/src/ir_ac_parse_parameter.c +++ b/cc26xx-example/ti/BLE-CC264x/ble_cc26xx/Projects/ble/SimpleBLEPeripheral-IREXT/CC26xx/Source/Application/Irext/src/ir_ac_parse_parameter.c @@ -138,14 +138,11 @@ INT8 parse_common_ac_parameter(t_tag_head *tag, t_tag_comp *comp_data, UINT8 wit INT8 parse_default_code(struct tag_head *tag, t_ac_hex *default_code) { - UINT16 byteLen = 0; - if (NULL == tag) { return IR_DECODE_FAILED; } - byteLen = tag->len >> 1; string_to_hex(tag->p_data, default_code); return IR_DECODE_SUCCEEDED;