Пример #1
0
void fs20_send(uint8_t fht, uint16_t housecode, uint8_t address, uint8_t command, uint8_t command2)
{
    for (uint8_t i = 0; i < 3; i++) 
    {
        fs20_send_sync();

        /* magic constant 6 from fs20 protocol definition, 0x0c from fht protocol definition... */
        uint8_t sum = fht ? 0x0C : 0x06; 

        fs20_send_byte(HI8(housecode));
        sum += HI8(housecode);
        fs20_send_byte(LO8(housecode));
        sum += LO8(housecode);
        fs20_send_byte(address);
        sum += address;
        fs20_send_byte(command);
        sum += command;

        if ( command & 0x20 )
        {
            fs20_send_byte(command2);
            sum += command2;
        }

        fs20_send_byte(sum);

        fs20_send_zero();

        _delay_loop_2(FS20_DELAY_CMD);
    }
}
Пример #2
0
void fs20_send(uint16_t housecode, uint8_t address, uint8_t command)
{

    for (uint8_t i = 0; i < 3; i++) {
        fs20_send_sync();

        uint8_t sum = 6; /* magic constant 6 from fs20 protocol definition... */

        fs20_send_byte(HI8(housecode));
        sum += HI8(housecode);
        fs20_send_byte(LO8(housecode));
        sum += LO8(housecode);
        fs20_send_byte(address);
        sum += address;
        fs20_send_byte(command);
        sum += command;
        fs20_send_byte(sum);

        fs20_send_zero();

        _delay_loop_2(FS20_DELAY_CMD);
    }

}