Subversion Repositories HomeAutomation

Rev

Rev 1930 | Rev 2065 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 1930 Rev 2013
Line 1042... Line 1042...
1042
 
1042
 
1043
    /* No dimming */
1043
    /* No dimming */
1044
    *len = 131;
1044
    *len = 131;
1045
    uint8_t dimming = 0;
1045
    uint8_t dimming = 0;
1046
   
1046
   
1047
    /* If most significant bit i set, then dimming should be sent */
1047
    /* If most significant bit is set, then dimming should be sent */
1048
    if (tempshift&(1<<64))
1048
//  if (tempshift&(1ULL<<63))
1049
    {
1049
//  {
1050
        /* Dimming */
1050
        /* Dimming */
1051
        *len = 147;
1051
//      *len = 147;
1052
        dimming=1;
1052
//      dimming=1;
1053
    }
1053
//  }
1054
   
1054
   
1055
    for (uint8_t i = 2; i < 131; i+=4)
1055
    for (uint8_t i = 2; i < 131; i+=4)
1056
    {
1056
    {
1057
        buf[i] = IR_NEXA2_HIGH;
1057
        buf[i] = IR_NEXA2_HIGH;
1058
        buf[i+2] = IR_NEXA2_HIGH;
1058
        buf[i+2] = IR_NEXA2_HIGH;
Line 1074... Line 1074...
1074
   
1074
   
1075
    proto->modfreq=IR_NEXA2_F_MOD;
1075
    proto->modfreq=IR_NEXA2_F_MOD;
1076
    proto->timeout=IR_NEXA2_START1/1000;
1076
    proto->timeout=IR_NEXA2_START1/1000;
1077
    proto->repeats=IR_NEXA2_REPS;
1077
    proto->repeats=IR_NEXA2_REPS;
1078
    return IR_OK;
1078
    return IR_OK;
1079
}
1079
}
1080
 
1080
 
1081
 
1081
 
1082
#if (IR_PROTOCOLS_USE_NEXA1)
1082
#if (IR_PROTOCOLS_USE_NEXA1)
1083
/**
1083
/**
1084
 * Test data on NEXA protocol
1084
 * Test data on NEXA protocol
1085
 * http://www.elektronikforumet.com/wiki/index.php/RF_Protokoll_-_Nexa/Proove_(%C3%A4ldre,_ej_sj%C3%A4lvl%C3%A4rande)
1085
 * http://www.elektronikforumet.com/wiki/index.php/RF_Protokoll_-_Nexa/Proove_(%C3%A4ldre,_ej_sj%C3%A4lvl%C3%A4rande)
1086
 *
1086
 *
Line 1093... Line 1093...
1093
 * @return
1093
 * @return
1094
 *      IR_OK if data parsed successfully, one of several errormessages if not
1094
 *      IR_OK if data parsed successfully, one of several errormessages if not
1095
 */
1095
 */
1096
int8_t parseNexa1(const uint16_t *buf, uint8_t len, Ir_Protocol_Data_t *proto) {
1096
int8_t parseNexa1(const uint16_t *buf, uint8_t len, Ir_Protocol_Data_t *proto) {
1097
    /* parse buf[], max is len */
1097
    /* parse buf[], max is len */
1098
 
-
 
1099
//gpio_set_pin(EXP_H);
-
 
1100
 
1098
 
1101
    /* check if we have correct amount of data */
1099
    /* check if we have correct amount of data */
1102
    if (len != 50) {
1100
    if (len != 50) {
1103
        return IR_NOT_CORRECT_DATA;
1101
        return IR_NOT_CORRECT_DATA;
1104
    }
1102
    }
Line 1117... Line 1115...
1117
            (buf[i+2] > IR_NEXA1_SHORT - IR_NEXA1_SHORT/IR_NEXA1_TOL_DIV && buf[i+2] < IR_NEXA1_SHORT + IR_NEXA1_SHORT/IR_NEXA1_TOL_DIV) &&
1115
            (buf[i+2] > IR_NEXA1_SHORT - IR_NEXA1_SHORT/IR_NEXA1_TOL_DIV && buf[i+2] < IR_NEXA1_SHORT + IR_NEXA1_SHORT/IR_NEXA1_TOL_DIV) &&
1118
            (buf[i+3] > IR_NEXA1_LONG - IR_NEXA1_LONG/IR_NEXA1_TOL_DIV && buf[i+3] < IR_NEXA1_LONG + IR_NEXA1_LONG/IR_NEXA1_TOL_DIV))
1116
            (buf[i+3] > IR_NEXA1_LONG - IR_NEXA1_LONG/IR_NEXA1_TOL_DIV && buf[i+3] < IR_NEXA1_LONG + IR_NEXA1_LONG/IR_NEXA1_TOL_DIV))
1119
        {
1117
        {
1120
            /* write a one */
1118
            /* write a one */
1121
            rawbitsTemp |= (1UL)<<(bitCounter++);
1119
            rawbitsTemp |= (1UL)<<(bitCounter++);
1122
        }
1120
        }
1123
        /* Check if 'X' bit */
1121
        /* Check if 'X' bit */
1124
        else if (
1122
        else if (
1125
            (buf[i+0] > IR_NEXA1_SHORT - IR_NEXA1_SHORT/IR_NEXA1_TOL_DIV && buf[i+0] < IR_NEXA1_SHORT + IR_NEXA1_SHORT/IR_NEXA1_TOL_DIV) &&
1123
            (buf[i+0] > IR_NEXA1_SHORT - IR_NEXA1_SHORT/IR_NEXA1_TOL_DIV && buf[i+0] < IR_NEXA1_SHORT + IR_NEXA1_SHORT/IR_NEXA1_TOL_DIV) &&
1126
            (buf[i+1] > IR_NEXA1_LONG - IR_NEXA1_LONG/IR_NEXA1_TOL_DIV && buf[i+1] < IR_NEXA1_LONG + IR_NEXA1_LONG/IR_NEXA1_TOL_DIV) &&
1124
            (buf[i+1] > IR_NEXA1_LONG - IR_NEXA1_LONG/IR_NEXA1_TOL_DIV && buf[i+1] < IR_NEXA1_LONG + IR_NEXA1_LONG/IR_NEXA1_TOL_DIV) &&
1127
            (buf[i+2] > IR_NEXA1_LONG - IR_NEXA1_LONG/IR_NEXA1_TOL_DIV && buf[i+2] < IR_NEXA1_LONG + IR_NEXA1_LONG/IR_NEXA1_TOL_DIV) &&
1125
            (buf[i+2] > IR_NEXA1_LONG - IR_NEXA1_LONG/IR_NEXA1_TOL_DIV && buf[i+2] < IR_NEXA1_LONG + IR_NEXA1_LONG/IR_NEXA1_TOL_DIV) &&
1128
            (buf[i+3] > IR_NEXA1_SHORT - IR_NEXA1_SHORT/IR_NEXA1_TOL_DIV && buf[i+3] < IR_NEXA1_SHORT + IR_NEXA1_SHORT/IR_NEXA1_TOL_DIV))
1126
            (buf[i+3] > IR_NEXA1_SHORT - IR_NEXA1_SHORT/IR_NEXA1_TOL_DIV && buf[i+3] < IR_NEXA1_SHORT + IR_NEXA1_SHORT/IR_NEXA1_TOL_DIV))
1129
        {
1127
        {
1130
            /* do nothing, a zero is already in rawbits */
1128
            /* do nothing, a zero is already in rawbits */
1131
            bitCounter++;
1129
            bitCounter++;
1132
        }
1130
        }
-
 
1131
    }
-
 
1132
 
-
 
1133
    if (rawbitsTemp==0)
-
 
1134
    {
-
 
1135
        /* Bogus RF data */
-
 
1136
        return IR_NOT_CORRECT_DATA;
1133
    }
1137
    }
1134
   
1138
   
1135
    proto->protocol=IR_PROTO_NEXA1;
1139
    proto->protocol=IR_PROTO_NEXA1;
1136
    proto->timeout=IR_NEXA1_TIMEOUT;
1140
    proto->timeout=IR_NEXA1_TIMEOUT;
1137
    proto->data=rawbitsTemp;
1141
    proto->data=rawbitsTemp;