Extended MaximInterface
Dependents: mbed_DS28EC20_GPIO
Diff: Devices/DS9400.cpp
- Revision:
- 3:f818ea5172ed
- Parent:
- 0:f77ad7f72d04
- Child:
- 6:a8c83a2e6fa4
--- a/Devices/DS9400.cpp Mon Nov 06 17:46:41 2017 -0600 +++ b/Devices/DS9400.cpp Thu Jan 11 13:50:39 2018 -0600 @@ -34,6 +34,15 @@ namespace MaximInterface { +error_code DS9400::waitAwake() { + error_code result; + uint_least8_t data; + do { + result = uart->readByte(data); + } while (!result && data != 0xA5); + return result; +} + error_code DS9400::start() { return uart->writeByte('S'); } error_code DS9400::start(uint_least8_t address) { @@ -72,4 +81,9 @@ return result; } +error_code DS9400::configure(uint_least8_t config) { + const uint_least8_t packet[] = {'C', config}; + return uart->writeBlock(packet, sizeof(packet) / sizeof(packet[0])); +} + } // namespace MaximInterface \ No newline at end of file