예제 #1
0
파일: fs20.c 프로젝트: AnDann/ethersex
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
파일: fs20.c 프로젝트: HansBaechle/ethersex
void fs20_send_bit(uint8_t bit)
{

    if (bit > 0)
        fs20_send_one();
    else
        fs20_send_zero();

}
예제 #3
0
파일: fs20.c 프로젝트: HansBaechle/ethersex
void fs20_send_sync(void)
{

    for (uint8_t i = 0; i < 12; i++)
        fs20_send_zero();

    fs20_send_one();

}
예제 #4
0
파일: fs20.c 프로젝트: HansBaechle/ethersex
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);
    }

}