A C library to control a device via UART that responds to an AT command set (like an RN-42)
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
arduino
atcommander
lpc17xx
script
tests
.gitignore
.gitmodules
.travis.yml
CHANGELOG.mkd
LICENSE
Makefile
README.mkd
runtests.sh

README.mkd

AT Commander

The AT Commander is a C library (with an optional C++ wrapper) for controller an embedded module that uses an AT command set.

Supported AT Platforms

  • Roving Networks
    • RN-41
    • RN-42
  • Digi
    • XBee

Firmware

There are examples in this repository for a few platforms that you can flash to set the baud rate of an attached RN-42:

  • Arduino / chipKIT
  • LPC17xx

C API Example

For a full working example on the Arduion platform, see the arduino directory.

A brief example:

AtCommanderConfig config;
config.platform = AT_PLATFORM_RN42;
config.write_function = write_byte
config.read_function = read_byte
config.delay_function = delay;

// Set the baud to 115200, if it's not already correct
bool baud_set = at_commander_set_baud(&config, 115200);

char device_id[20];
at_commander_get_device_id(&config, device_id, sizeof(device_id));

// Send an arbitrary "get" request:
AtCommand my_get_command = {
    request_format: "GB",
    expected_response: NULL,
    error_response: "ERR"
};

char response[25];
at_commander_get(config, &my_get_command, response, sizeof(response));

// Send an arbitrary "set" command, with arguments
AtCommand my_set_command = {
    request_format: "SR,%s",
    expected_response: "AOK",
    error_response: "ERR"
};

at_commander_set(config, &my_set_command, "Z");

C++ API Example

TODO, might look like this:

AtCommander commander(AT_PLATFORM_RN42, Serial.write, Serial.read, delay);
commander.setBaud(115200);

Testing

The library includes a test suite that uses the check C unit test library.

$ script/bootstrap.sh
$ make test

Authors

Chris Peplin cpeplin@ford.com

License

Copyright (c) 2013 Ford Motor Company

Licensed under the BSD license.