summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Fiore <mfiore@multitech.com>2015-11-09 13:10:24 -0600
committerMike Fiore <mfiore@multitech.com>2015-11-09 13:10:24 -0600
commit6cbc41d13e8acb1aca1a2f462e072f5d32a31752 (patch)
tree0d55fac7774bcea0b3de14ae51876c2839b71dab
parent9fcf1e3dc4e36e590de24a3f1742bb7b42c5141b (diff)
downloadmtdot-box-evb-factory-firmware-6cbc41d13e8acb1aca1a2f462e072f5d32a31752.tar.gz
mtdot-box-evb-factory-firmware-6cbc41d13e8acb1aca1a2f462e072f5d32a31752.tar.bz2
mtdot-box-evb-factory-firmware-6cbc41d13e8acb1aca1a2f462e072f5d32a31752.zip
display logo and product information on startup, add version.sh to generate version header
-rw-r--r--main.cpp58
-rwxr-xr-xversion.sh10
2 files changed, 68 insertions, 0 deletions
diff --git a/main.cpp b/main.cpp
new file mode 100644
index 0000000..8a4c54a
--- /dev/null
+++ b/main.cpp
@@ -0,0 +1,58 @@
+#include "mbed.h"
+#include "rtos.h"
+
+#include "font_6x8.h"
+#include "MultiTech_Logo.h"
+
+#include "DOGS102.h"
+#include "ISL29011.h"
+#include "MMA845x.h"
+#include "MPL3115A2.h"
+#include "NCP5623B.h"
+#include "GPSPARSER.h"
+
+#include "mDot.h"
+#include "MTSLog.h"
+#include "version.h"
+
+// product and version information
+static const std::string product_name = "MTDOT-BOX/EVB";
+static const std::string program_name = "Factory Firmware";
+static const std::string program_version = MTDOT_BOX_VERSION;
+
+// LCD and backlight controllers
+SPI lcd_spi(SPI1_MOSI, SPI1_MISO, SPI1_SCK);
+I2C backlight_i2c(I2C_SDA, I2C_SCL);
+DigitalOut lcd_spi_cs(SPI1_CS, 1);
+DigitalOut lcd_cd(XBEE_ON_SLEEP, 1);
+DOGS102* lcd;
+NCP5623B* lcd_backlight;
+
+// Serial debug port
+Serial debug(USBTX, USBRX);
+
+int main() {
+ debug.baud(115200);
+ MTSLog::setLogLevel(MTSLog::TRACE_LEVEL);
+
+ lcd = new DOGS102(lcd_spi, lcd_spi_cs, lcd_cd);
+ lcd_backlight = new NCP5623B(backlight_i2c);
+
+ logInfo("starting...");
+
+ lcd->startUpdate();
+ lcd->writeBitmap(0, 0, MultiTech_Logo);
+ lcd->writeText(0, 3, font_6x8, product_name.c_str(), product_name.size());
+ lcd->writeText(0, 4, font_6x8, program_name.c_str(), program_name.size());
+ lcd->writeText(0, 5, font_6x8, program_version.c_str(), program_version.size());
+ lcd->endUpdate();
+
+ logInfo("on screen");
+
+ while (true) {
+ logInfo("in loop");
+ osDelay(5000);
+ }
+
+ return 0;
+}
diff --git a/version.sh b/version.sh
new file mode 100755
index 0000000..a1c79f9
--- /dev/null
+++ b/version.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+VERSION=`git describe --tags`
+BRANCH=$(git branch | grep '^*' | sed 's/^\* //')
+
+if [[ $BRANCH != "master" ]] && [[ $BRANCH != "(no branch)" ]]; then
+ VERSION="$VERSION-$BRANCH"
+fi
+
+echo -e "#ifndef __VERSION_H__\r\n#define __VERSION_H__\r\n\r\n#define MTDOT_BOX_VERSION \"$VERSION\"\r\n\r\n#endif" > version.h