summaryrefslogtreecommitdiffstats
path: root/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src
diff options
context:
space:
mode:
Diffstat (limited to 'tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src')
-rwxr-xr-xtinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/bar.c1
-rwxr-xr-xtinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/bar.h14
-rwxr-xr-xtinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/custom_types.h6
-rwxr-xr-xtinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/display.c7
-rwxr-xr-xtinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/display.h16
-rwxr-xr-xtinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/event_processor.c93
-rwxr-xr-xtinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/event_processor.h11
-rwxr-xr-xtinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/foo.c16
-rwxr-xr-xtinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/foo.h8
-rwxr-xr-xtinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/subfolder/zzz.c1
-rwxr-xr-xtinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/subfolder/zzz.h6
11 files changed, 179 insertions, 0 deletions
diff --git a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/bar.c b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/bar.c
new file mode 100755
index 00000000..6a403234
--- /dev/null
+++ b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/bar.c
@@ -0,0 +1 @@
+#include "bar.h"
diff --git a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/bar.h b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/bar.h
new file mode 100755
index 00000000..febc5865
--- /dev/null
+++ b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/bar.h
@@ -0,0 +1,14 @@
+#ifndef bar_H
+#define bar_H
+
+#include "custom_types.h"
+
+void bar_turn_on(void);
+void bar_print_message(const char * message);
+void bar_print_message_formatted(const char * format, ...);
+void bar_numbers(int one, int two, char three);
+void bar_const_test(const char * a, char * const b, const int c);
+custom_t bar_needs_custom_type(void);
+const char * bar_return_const_ptr(int one);
+
+#endif // bar_H
diff --git a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/custom_types.h b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/custom_types.h
new file mode 100755
index 00000000..b426b32c
--- /dev/null
+++ b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/custom_types.h
@@ -0,0 +1,6 @@
+#ifndef custom_types_H
+#define custom_types_H
+
+typedef int custom_t;
+
+#endif
diff --git a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/display.c b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/display.c
new file mode 100755
index 00000000..2f03449b
--- /dev/null
+++ b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/display.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+#include "display.h"
+
+void display_turnOffStatusLed(void)
+{
+ printf("Display: Status LED off");
+} \ No newline at end of file
diff --git a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/display.h b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/display.h
new file mode 100755
index 00000000..def29960
--- /dev/null
+++ b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/display.h
@@ -0,0 +1,16 @@
+#include <stdbool.h>
+
+void display_turnOffStatusLed(void);
+void display_turnOnStatusLed(void);
+void display_setVolume(int level);
+void display_setModeToMinimum(void);
+void display_setModeToMaximum(void);
+void display_setModeToAverage(void);
+bool display_isError(void);
+void display_powerDown(void);
+void display_updateData(int data, void(*updateCompleteCallback)(void));
+
+/*
+ The entry is returned (up to `length` bytes) in the provided `entry` buffer.
+*/
+void display_getKeyboardEntry(char * entry, int length);
diff --git a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/event_processor.c b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/event_processor.c
new file mode 100755
index 00000000..916a9236
--- /dev/null
+++ b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/event_processor.c
@@ -0,0 +1,93 @@
+/*
+ This module implements some business logic to test.
+
+ Signal events by calling the functions on the module.
+*/
+
+#include <stdio.h>
+#include <string.h>
+#include "event_processor.h"
+#include "display.h"
+
+void event_deviceReset(void)
+{
+ //printf ("Device reset\n");
+ display_turnOffStatusLed();
+}
+
+void event_volumeKnobMaxed(void)
+{
+ display_setVolume(11);
+}
+
+void event_powerReadingUpdate(int powerReading)
+{
+ if (powerReading >= 5)
+ {
+ display_turnOnStatusLed();
+ }
+}
+
+void event_modeSelectButtonPressed(void)
+{
+ static int mode = 0;
+
+ if (mode == 0)
+ {
+ display_setModeToMinimum();
+ mode++;
+ }
+ else if (mode == 1)
+ {
+ display_setModeToMaximum();
+ mode++;
+ }
+ else if (mode == 2)
+ {
+ display_setModeToAverage();
+ mode++;
+ }
+ else
+ {
+ mode = 0;
+ }
+}
+
+void event_devicePoweredOn(void)
+{
+ if (display_isError())
+ {
+ display_powerDown();
+ }
+}
+
+void event_keyboardCheckTimerExpired(void)
+{
+ char userEntry[100];
+
+ display_getKeyboardEntry(userEntry, 100);
+
+ if (strcmp(userEntry, "sleep") == 0)
+ {
+ display_powerDown();
+ }
+}
+
+static bool event_lastComplete = false;
+
+/* Function called when the display update is complete. */
+static void displayUpdateComplete(void)
+{
+ event_lastComplete = true;
+}
+
+void event_newDataAvailable(int data)
+{
+ event_lastComplete = false;
+ display_updateData(data, displayUpdateComplete);
+}
+
+bool eventProcessor_isLastEventComplete(void)
+{
+ return event_lastComplete;
+}
diff --git a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/event_processor.h b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/event_processor.h
new file mode 100755
index 00000000..a79e68c5
--- /dev/null
+++ b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/event_processor.h
@@ -0,0 +1,11 @@
+#include <stdbool.h>
+
+void event_deviceReset(void);
+void event_volumeKnobMaxed(void);
+void event_powerReadingUpdate(int powerReading);
+void event_modeSelectButtonPressed(void);
+void event_devicePoweredOn(void);
+void event_keyboardCheckTimerExpired(void);
+void event_newDataAvailable(int data);
+
+bool eventProcessor_isLastEventComplete(void);
diff --git a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/foo.c b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/foo.c
new file mode 100755
index 00000000..c05b1154
--- /dev/null
+++ b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/foo.c
@@ -0,0 +1,16 @@
+#include "foo.h"
+#include "bar.h"
+#include "subfolder/zzz.h"
+
+void foo_turn_on(void) {
+ bar_turn_on();
+ zzz_sleep(1, "sleepy");
+}
+
+void foo_print_message(const char * message) {
+ bar_print_message(message);
+}
+
+void foo_print_special_message(void) {
+ bar_print_message_formatted("The numbers are %d, %d and %d", 1, 2, 3);
+}
diff --git a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/foo.h b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/foo.h
new file mode 100755
index 00000000..3fea6994
--- /dev/null
+++ b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/foo.h
@@ -0,0 +1,8 @@
+#ifndef foo_H
+#define foo_H
+
+void foo_turn_on(void);
+void foo_print_message(const char * message);
+void foo_print_special_message(void);
+
+#endif // foo_H
diff --git a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/subfolder/zzz.c b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/subfolder/zzz.c
new file mode 100755
index 00000000..85f370e1
--- /dev/null
+++ b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/subfolder/zzz.c
@@ -0,0 +1 @@
+#include "zzz.h"
diff --git a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/subfolder/zzz.h b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/subfolder/zzz.h
new file mode 100755
index 00000000..32c52940
--- /dev/null
+++ b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/subfolder/zzz.h
@@ -0,0 +1,6 @@
+#ifndef zzz_H
+#define zzz_H
+
+int zzz_sleep(int time, char * name);
+
+#endif // zzz_H