Skip to content

at parser: improvements#27

Merged
kaspar030 merged 2 commits intokaspar030:add_at_parserfrom
OTAkeys:pr/add_at_parser
Jul 14, 2017
Merged

at parser: improvements#27
kaspar030 merged 2 commits intokaspar030:add_at_parserfrom
OTAkeys:pr/add_at_parser

Conversation

@vincent-d
Copy link
Copy Markdown

Hi @kaspar030

I worked a bit with your at command parser and I have some improvements to propose.

The EOL character can be configured with a macro.

I've also added a function to send a command and wait for a prompt and another to send raw bytes.

Copy link
Copy Markdown
Owner

@kaspar030 kaspar030 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor comments

}

if (at_expect_bytes(dev, "\r\n", 2, timeout)) {
if (at_expect_bytes(dev, AT_END_OF_LINE "\r\n", sizeof(AT_END_OF_LINE) + 1, timeout)) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both macro and literal?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you send AT<CR>, the modem answer AT<CR> (echo) then <CR><LF>OK. I guess this work like that for every modem...maybe this could be configurable as well, not sure if needed though.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, I see.


#ifndef AT_END_OF_LINE
/** End of line character to send after the AT command */
#define AT_END_OF_LINE "\r"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does sizeof(<string-constant>) return its length?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does. :)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes ;)

@kaspar030
Copy link
Copy Markdown
Owner

Thanks for tackling this!

@kaspar030
Copy link
Copy Markdown
Owner

BTW, if you're using this to control a modem, maybe take a look at https://github.com/kaspar030/RIOT/tree/add_gsm_driver. I'm using that branch for a customer. It's sim8xx support hasn't been tested in a while, but MC60 works quite well.

@vincent-d
Copy link
Copy Markdown
Author

Looks interesting! We use a u-blox, but this could be adapted.

Do you plan to merge that upstream?

@kaspar030
Copy link
Copy Markdown
Owner

Do you plan to merge that upstream?

yes! I'll be back from holidays in august, will PR then.

@kaspar030 kaspar030 merged commit 9bcc58c into kaspar030:add_at_parser Jul 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants