A few more style fixes.
Got rid of some trailing whitespace.
Removed one (1) instance of "not universally accepted language."
Disabled copy and assign ctors in Pin class.
diff --git a/bbb_cape/src/bbb/byte_reader.h b/bbb_cape/src/bbb/byte_reader.h
index 16e364c..952433d 100644
--- a/bbb_cape/src/bbb/byte_reader.h
+++ b/bbb_cape/src/bbb/byte_reader.h
@@ -8,11 +8,11 @@
namespace bbb {
class ByteReader {
- public:
+public:
// We have 64-bit ints in some of our data.
typedef char __attribute__((aligned(8))) AlignedChar;
- // Implemented by subclasses to provide a data source
+ // Implemented by subclasses to provide a data source
// for these algorithms.
// Returns the number of bytes read, -1 if there is an error in errno, or -2
// if reading takes longer than timeout.
@@ -20,6 +20,6 @@
const ::aos::time::Time &timeout_time) = 0;
};
-} // namespace bbb
+} // namespace bbb
-#endif // BBB_BYTE_READER_H_
+#endif // BBB_BYTE_READER_H_
diff --git a/bbb_cape/src/bbb/gpios.cc b/bbb_cape/src/bbb/gpios.cc
index 4f9dce3..8594ba4 100644
--- a/bbb_cape/src/bbb/gpios.cc
+++ b/bbb_cape/src/bbb/gpios.cc
@@ -7,6 +7,8 @@
namespace bbb {
+Pin::Pin() {}
+
Pin::~Pin() {
// Unexport the pin.
if ((handle_ = fopen("/sys/class/gpio/unexport", "ab")) == NULL) {
diff --git a/bbb_cape/src/bbb/gpios.h b/bbb_cape/src/bbb/gpios.h
index ba5da00..4925f1b 100644
--- a/bbb_cape/src/bbb/gpios.h
+++ b/bbb_cape/src/bbb/gpios.h
@@ -3,6 +3,8 @@
#include <stdio.h>
+#include "aos/common/macros.h"
+
// As it turns out, controlling the BBB's GPIO pins
// from C++ is kind of a pain. The purpose of this
// code is to provide a simple wrapper that masks
@@ -20,6 +22,10 @@
// Not strictly necessary for this to be virtual,
// but it's a good idea.
virtual ~Pin();
+ // When you don't define this and use the
+ // DISALLOW_COPY_AND_ASSIGN macro, the compiler
+ // doesn't seem to create a default one.
+ Pin();
protected:
// Set the pin direction.
@@ -33,6 +39,8 @@
FILE *handle_ = NULL;
int kernel_pin_ = -1;
+
+ DISALLOW_COPY_AND_ASSIGN(Pin);
};
} // namespace bbb
diff --git a/bbb_cape/src/bbb/gpo.cc b/bbb_cape/src/bbb/gpo.cc
index 29c5ee6..959b132 100644
--- a/bbb_cape/src/bbb/gpo.cc
+++ b/bbb_cape/src/bbb/gpo.cc
@@ -8,8 +8,8 @@
Gpo::Gpo(int bank, int pin) {
// All the failures here are fatal, seeing as
- // if we can't initialize the pin, we're probably
- // screwed anyway.
+ // failure to initialize the pin would at best
+ // severely cripple the calling process.
if (!InitPin(bank, pin)) {
LOG(FATAL, "Failed to export the pin.\n");
}
diff --git a/bbb_cape/src/bbb/gpo.h b/bbb_cape/src/bbb/gpo.h
index 701e214..596daf5 100644
--- a/bbb_cape/src/bbb/gpo.h
+++ b/bbb_cape/src/bbb/gpo.h
@@ -14,6 +14,7 @@
// If the argument is true, is sets it high.
// Otherwise, it sets it low.
bool Set(const bool high);
+
};
} // namespace bbb
diff --git a/bbb_cape/src/bbb/uart_reader_main.cc b/bbb_cape/src/bbb/uart_reader_main.cc
index 1c9ed31..f8aefbd 100644
--- a/bbb_cape/src/bbb/uart_reader_main.cc
+++ b/bbb_cape/src/bbb/uart_reader_main.cc
@@ -12,8 +12,8 @@
int main() {
::aos::Init();
- ::bbb::Gpo reset_pin = bbb::Gpo(1, 6);
-
+ ::bbb::Gpo reset_pin(1, 6);
+
::bbb::UartReader reader(750000);
::bbb::PacketFinder receiver(&reader, DATA_STRUCT_SEND_SIZE - 4);
diff --git a/bbb_cape/src/flasher/0001-fixed-the-page-by-page-erase-logic.patch b/bbb_cape/src/flasher/0001-fixed-the-page-by-page-erase-logic.patch
index c119655..57fc87e 100644
--- a/bbb_cape/src/flasher/0001-fixed-the-page-by-page-erase-logic.patch
+++ b/bbb_cape/src/flasher/0001-fixed-the-page-by-page-erase-logic.patch
@@ -16,7 +16,7 @@
@@ -430,14 +430,14 @@ char stm32_erase_memory(const stm32_t *stm, uint8_t spage, uint8_t pages) {
uint8_t pg_byte;
uint8_t cs = 0;
-
+
- pg_byte = pages >> 8;
- stm32_send_byte(stm, pg_byte); // Number of pages to be erased, two bytes, MSB first
+ pg_byte = (pages - 1) >> 8;
@@ -26,12 +26,12 @@
+ pg_byte = (pages - 1) & 0xFF;
stm32_send_byte(stm, pg_byte);
cs ^= pg_byte;
-
+
- for (pg_num = 0; pg_num <= pages; pg_num++) {
+ for (pg_num = spage; pg_num < spage + pages; pg_num++) {
pg_byte = pg_num >> 8;
cs ^= pg_byte;
stm32_send_byte(stm, pg_byte);
---
+--
1.7.10.4