From 2565f4857ea9cdebdbba483e35a07d012aa3afce Mon Sep 17 00:00:00 2001 From: root Date: Sat, 20 Aug 2016 23:04:40 +0100 Subject: first working version --- app/dialstr.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 app/dialstr.c (limited to 'app/dialstr.c') diff --git a/app/dialstr.c b/app/dialstr.c new file mode 100644 index 0000000..f75a8e4 --- /dev/null +++ b/app/dialstr.c @@ -0,0 +1,49 @@ +#include "project.h" +#define DIGIT_TIMEOUT 4000 + +static char dialstr[32]="ATDT"; +static unsigned dialstr_ptr=4; +static int dialstr_timeout; + +void dialstr_clear(void) +{ +dialstr_ptr=4; +dialstr[dialstr_ptr]=';'; +dialstr[dialstr_ptr+1]=0; +} + + +void dialstr_digit(int digit) +{ +if (!dialstr_timeout) dialstr_clear(); +if (dialstr_ptr>=(sizeof(dialstr)-2)) return; + +dialstr[dialstr_ptr]='0'+digit; +dialstr_ptr++; +dialstr[dialstr_ptr]=';'; +dialstr[dialstr_ptr+1]=0; + +dialstr_timeout=DIGIT_TIMEOUT; +printf("Dialstr is now %s\r\n",dialstr+4); + +} + +void dialstr_dial(void) +{ +printf("Dialing %s\r\n",dialstr+4); +modem_send(dialstr); +} + +void dialstr_tick(void) +{ +if (!dialstr_timeout) return; +dialstr_timeout--; +if (dialstr_timeout) return; + +if (!hook) + dialstr_dial(); + +} + + + -- cgit v1.2.3