blob: e71a59f7b8622e81a906f792c386972751a5bd77 [file] [log] [blame]
Brian Silverman04fac622014-01-26 18:32:15 -08001#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
11namespace bbb {
12
13// Manages the connection to the cape (including GPIOs, running the bootloader,
14// setting up the serial connection, etc).
15class 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 Silvermanfac5c292014-02-17 15:26:57 -080032 Gpo reset_, custom_bootloader_, bootloader_;
Brian Silverman04fac622014-01-26 18:32:15 -080033
34 DISALLOW_COPY_AND_ASSIGN(CapeManager);
35};
36
37} // namespace bbb
38
39#endif // BBB_CAPE_SRC_BBB_CAPE_MANAGER_H_