Subversion Repositories HomeAutomation

Rev

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

Rev 2119 Rev 2143
Line 1155... Line 1155...
1155
 *      Pointer to protocol information
1155
 *      Pointer to protocol information
1156
 * @return
1156
 * @return
1157
 *      IR_OK if data expanded successfully, one of several errormessages if not
1157
 *      IR_OK if data expanded successfully, one of several errormessages if not
1158
 */
1158
 */
1159
int8_t expandNexa1(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto) {
1159
int8_t expandNexa1(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto) {
-
 
1160
    uint64_t tempshift = proto->data;
1160
   
1161
 
-
 
1162
    /* 12 data bits + 1 stop bit */
-
 
1163
    *len = 49;
-
 
1164
 
-
 
1165
    /* encode data bits */
-
 
1166
    for (uint8_t i = 0; i < 45; i += 4)
-
 
1167
    {
-
 
1168
        if (tempshift & 1) {
-
 
1169
            /* encode 0 bit */
-
 
1170
            buf[i+0] = IR_NEXA1_SHORT;
-
 
1171
            buf[i+1] = IR_NEXA1_LONG;
-
 
1172
            buf[i+2] = IR_NEXA1_SHORT;
-
 
1173
            buf[i+3] = IR_NEXA1_LONG;
-
 
1174
        } else {
-
 
1175
            /* encode X bit */
-
 
1176
            buf[i+0] = IR_NEXA1_SHORT;
-
 
1177
            buf[i+1] = IR_NEXA1_LONG;
-
 
1178
            buf[i+2] = IR_NEXA1_LONG;
-
 
1179
            buf[i+3] = IR_NEXA1_SHORT;
-
 
1180
        }
-
 
1181
        tempshift = tempshift>>1;
-
 
1182
    }
-
 
1183
 
-
 
1184
    /* encode stop/sync bit */
-
 
1185
    buf[48] = IR_NEXA1_SHORT;
-
 
1186
   
-
 
1187
    proto->modfreq = IR_NEXA1_F_MOD;
-
 
1188
    proto->timeout = IR_NEXA1_START/1000;
-
 
1189
    proto->repeats = IR_NEXA1_REPS;
1161
    return IR_NOT_CORRECT_DATA;
1190
    return IR_OK;  
1162
}
1191
}
1163
 
1192