diff options
Diffstat (limited to 'software/rda1846dongle/rda1846.c')
-rw-r--r-- | software/rda1846dongle/rda1846.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/software/rda1846dongle/rda1846.c b/software/rda1846dongle/rda1846.c index 9f8f356..3b89f2a 100644 --- a/software/rda1846dongle/rda1846.c +++ b/software/rda1846dongle/rda1846.c @@ -142,8 +142,8 @@ void rda1846_reg_init(void) // rda1846_write_register(RDA1846_REG_TX_VOICE, RDA1846_TX_VOICE_TONE2); // rda1846_write_register(RDA1846_REG_DTMF_T2, 6689); -// rda1846_write_register(RDA1846_REG_DTMF_CTL, RDA1846_DTMF_DUAL | RDA1846_DTMF_EN); -// rda1846_write_register(RDA1846_REG_INT, RDA1846_INT_DTMF_IDLE); + rda1846_write_register(RDA1846_REG_DTMF_CTL, RDA1846_DTMF_DUAL | RDA1846_DTMF_EN); + rda1846_write_register(RDA1846_REG_INT, RDA1846_INT_DTMF_IDLE); rda1846_gpio_default(); } @@ -299,17 +299,23 @@ uint16_t rda1846_get_flags(void) return data & 0x1687; } -uint8_t rda1846_get_dtmf(uint8_t* idx1, uint8_t* idx2, uint8_t* code) +uint16_t rda1846_get_dtmf(uint8_t* idx1, uint8_t* idx2, uint8_t* code, uint8_t* valid) { uint16_t data; if(rda1846_read_register(RDA1846_REG_DTMF_OUT, &data)) - return 1; + return 0xFFFF; - if(idx1) *idx1 = (uint8_t)((data & 0x0380)>>7); - if(idx2) *idx2 = (uint8_t)((data & 0x0070)>>4); + if(idx1) *idx1 = (uint8_t)((data & 0x0700)>>8); + if(idx2) *idx2 = (uint8_t)((data & 0x00E0)>>5); if(code) *code = (uint8_t)(data & 0x000F); + if(valid) *valid = data & 0x0010 ? 0 : 1; - return 0; + return data; +} + +void rda1846_clear_int(void) +{ + rda1846_write_register(0x00, 0x1846); } int32_t rda1846_get_freq_kHz(void) |