Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: NerfUS_cmake_add_library_from_mbed NerfUS NerfUSGameCoordinator
Revision 0:e67c78f2b4f4, committed 2017-02-16
- Comitter:
- Maxime Dupuis
- Date:
- Thu Feb 16 11:42:32 2017 -0500
- Child:
- 1:001a600870d9
- Commit message:
- Initial commit
Add a BlinkerInterface from which different hardware implementations
could be made (e.g. for the LPC1768)
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CMakeLists.txt Thu Feb 16 11:42:32 2017 -0500 @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.5) + +project(hardware_interface_lpc1768) + +include_directories(include) + +file(GLOB SOURCES "source/*.cpp") +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/include/BlinkerInterface.hpp Thu Feb 16 11:42:32 2017 -0500
@@ -0,0 +1,4 @@
+class BlinkerInterface
+{
+ virtual void blink() = 0;
+};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/include/MbedBlinker.hpp Thu Feb 16 11:42:32 2017 -0500
@@ -0,0 +1,12 @@
+#include "BlinkerInterface.hpp"
+#include "mbed.h"
+
+class MbedBlinker : public BlinkerInterface
+{
+ public:
+ MbedBlinker(DigitalOut led);
+ virtual void blink();
+
+ private:
+ DigitalOut led;
+};
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/source/MbedBlinker.cpp Thu Feb 16 11:42:32 2017 -0500
@@ -0,0 +1,14 @@
+#include "MbedBlinker.hpp"
+
+MbedBlinker::MbedBlinker(DigitalOut led) :
+ led(led)
+{
+}
+
+void MbedBlinker::blink()
+{
+ led = 1;
+ wait(0.5);
+ led = 0;
+ wait(0.5);
+}