Brian Silverman | 04fac62 | 2014-01-26 18:32:15 -0800 | [diff] [blame] | 1 | #ifndef BBB_CAPE_SRC_BBB_CAPE_MANAGER_H_ |
| 2 | #define BBB_CAPE_SRC_BBB_CAPE_MANAGER_H_ |
| 3 | |
| 4 | #include <string> |
| 5 | |
| 6 | #include "aos/common/macros.h" |
| 7 | |
| 8 | #include "bbb/gpo.h" |
| 9 | #include "bbb/uart_reader.h" |
| 10 | |
| 11 | namespace bbb { |
| 12 | |
| 13 | // Manages the connection to the cape (including GPIOs, running the bootloader, |
| 14 | // setting up the serial connection, etc). |
| 15 | class CapeManager { |
| 16 | public: |
| 17 | CapeManager(); |
| 18 | |
| 19 | // Downloads a .hex file using the custom bootloader. |
| 20 | void DownloadHex(const ::std::string &filename); |
| 21 | |
| 22 | // Resets the cape. |
| 23 | void Reset() { DoReset(false); } |
| 24 | |
| 25 | UartReader *uart() { return &uart_; } |
| 26 | |
| 27 | private: |
| 28 | void DoReset(bool bootloader); |
| 29 | |
| 30 | UartReader uart_; |
| 31 | |
Brian Silverman | fac5c29 | 2014-02-17 15:26:57 -0800 | [diff] [blame] | 32 | Gpo reset_, custom_bootloader_, bootloader_; |
Brian Silverman | 04fac62 | 2014-01-26 18:32:15 -0800 | [diff] [blame] | 33 | |
| 34 | DISALLOW_COPY_AND_ASSIGN(CapeManager); |
| 35 | }; |
| 36 | |
| 37 | } // namespace bbb |
| 38 | |
| 39 | #endif // BBB_CAPE_SRC_BBB_CAPE_MANAGER_H_ |