-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
137 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#ifndef SURFACE_H | ||
#define SURFACE_H | ||
|
||
enum SurfaceKeyType { SURFACE_PAD, SURFACE_CTRL }; | ||
|
||
/** | ||
* @brief index_to_surface_key_type Convert an index to a SurfaceKeyType | ||
* @param index The index to convert | ||
* @return The SurfaceKeyType | ||
*/ | ||
enum SurfaceKeyType index_to_surface_key_type(unsigned char index); | ||
|
||
#endif // SURFACE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include "surface.h" | ||
|
||
enum SurfaceKeyType index_to_surface_key_type(unsigned char index) { | ||
if (index >= 90) { | ||
return SURFACE_CTRL; | ||
} | ||
if (index <= 10) { | ||
return SURFACE_CTRL; | ||
} | ||
if (index % 10 == 9) { | ||
return SURFACE_CTRL; | ||
} | ||
if (index % 10 == 1) { | ||
return SURFACE_CTRL; | ||
} | ||
|
||
return SURFACE_PAD; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#include "app.h" | ||
|
||
void hal_plot_led(u8 type, u8 index, u8 red, u8 green, u8 blue) | ||
{ | ||
} | ||
|
||
void hal_read_led(u8 type, u8 index, u8 *red, u8 *green, u8 *blue) | ||
{ | ||
} | ||
|
||
void hal_send_midi(u8 port, u8 status, u8 d1, u8 d2) | ||
{ | ||
} | ||
|
||
void hal_send_sysex(u8 port, const u8* data, u16 length) | ||
{ | ||
} | ||
|
||
void hal_read_flash(u32 offset, u8 *data, u32 length) | ||
{ | ||
} | ||
|
||
void hal_write_flash(u32 offset,const u8 *data, u32 length) | ||
{ | ||
} | ||
|
||
static u16 raw_ADC[64]; | ||
|
||
void sim_app_init() | ||
{ | ||
app_init(raw_ADC); | ||
} | ||
|
||
void sim_app_surface_event(u8 type, u8 index, u8 value) | ||
{ | ||
app_surface_event(type, index, value); | ||
} | ||
|
||
void sim_app_midi_event(u8 port, u8 status, u8 d1, u8 d2) | ||
{ | ||
app_midi_event(port, status, d1, d2); | ||
} | ||
|
||
void sim_app_timer_event() | ||
{ | ||
app_timer_event(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include <stdarg.h> | ||
#include <stddef.h> | ||
#include <setjmp.h> | ||
#include <stdint.h> | ||
#include <cmocka.h> | ||
#include "surface.h" | ||
|
||
/* A test case that does nothing and succeeds. */ | ||
static void test_index_to_surface_key_type(void **state) { | ||
(void) state; /* unused */ | ||
|
||
assert_int_equal(index_to_surface_key_type(95), SURFACE_CTRL); | ||
assert_int_equal(index_to_surface_key_type(5), SURFACE_CTRL); | ||
assert_int_equal(index_to_surface_key_type(29), SURFACE_CTRL); | ||
assert_int_equal(index_to_surface_key_type(21), SURFACE_CTRL); | ||
assert_int_equal(index_to_surface_key_type(15), SURFACE_PAD); | ||
assert_int_equal(index_to_surface_key_type(36), SURFACE_PAD); | ||
assert_int_equal(index_to_surface_key_type(48), SURFACE_PAD); | ||
} | ||
|
||
int main(void) { | ||
const struct CMUnitTest tests[] = { | ||
cmocka_unit_test(test_index_to_surface_key_type), | ||
}; | ||
|
||
return cmocka_run_group_tests(tests, NULL, NULL); | ||
} | ||
|
This file was deleted.
Oops, something went wrong.