Subversion Repositories HomeAutomation

Rev

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

Rev 624 Rev 625
Line 48... Line 48...
48
    // Set up callback for CAN reception, this is optional if only sending is required.
48
    // Set up callback for CAN reception, this is optional if only sending is required.
49
    BIOS_CanCallback = &can_receive;
49
    BIOS_CanCallback = &can_receive;
50
    // Send CAN_NMT_APP_START
50
    // Send CAN_NMT_APP_START
51
    BIOS_CanSend(&txMsg);
51
    BIOS_CanSend(&txMsg);
52
   
52
   
53
    Callerid_Init();
53
    DTMFin_Init();
54
 
54
 
55
    uint8_t rxbuffer[MAX_TONES];
55
    uint8_t rxbuffer[MAX_TONES];
56
    uint8_t state=0;
56
    uint8_t state=0;
57
    uint8_t rxlen=0;
57
    uint8_t rxlen=0;
58
 
58
 
59
    while (1) {
59
    while (1) {
60
       
60
       
61
        if (state == STATE_IDLE) {
61
        if (state == STATE_IDLE) {
62
            Callerid_Start(rxbuffer);
62
            DTMFin_Start(rxbuffer);
63
            state = STATE_START_WAIT;
63
            state = STATE_START_WAIT;
64
        } else if (state == STATE_START_WAIT) {
64
        } else if (state == STATE_START_WAIT) {
65
            state = STATE_WAIT;
65
            state = STATE_WAIT;
66
        } else if (state == STATE_WAIT) {
66
        } else if (state == STATE_WAIT) {
67
            uint8_t retval = Callerid_Poll(&rxlen);
67
            uint8_t retval = DTMFin_Poll(&rxlen);
68
            if (retval == RET_FINISHED) {
68
            if (retval == RET_FINISHED) {
69
                state = STATE_STOP;
69
                state = STATE_STOP;
70
            } else if (retval == RET_OVERFLOW) {
70
            } else if (retval == RET_OVERFLOW) {
71
                state = STATE_IDLE;
71
                state = STATE_IDLE;
72
            }
72
            }