From dad65c96eeb8e8cd8e4e1df896163448f4f859c6 Mon Sep 17 00:00:00 2001 From: Dave Hodder Date: Thu, 8 Nov 2018 10:42:06 +0000 Subject: updated macOS simulator to implement flash & ADC APIs --- tools/osx/simulator-osx.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/osx/simulator-osx.c b/tools/osx/simulator-osx.c index 7298042..a1c446b 100644 --- a/tools/osx/simulator-osx.c +++ b/tools/osx/simulator-osx.c @@ -50,6 +50,10 @@ static MIDIEndpointRef g_inVirtualEndpoint = 0; static const float TIMER_INTERVAL_S = 0.001; //s +static const u16 g_ADC[PAD_COUNT]; + +static u8 g_Flash[USER_AREA_SIZE]; + // ____________________________________________________________________________ // // Simulator "hal". This lets you exercise your device code without having to upload @@ -95,6 +99,15 @@ void hal_send_sysex(u8 port, const u8* data, u16 length) // as above, or just dump to console? } +void hal_read_flash(u32 offset, u8 *data, u32 length) +{ + memcpy(data, g_Flash+offset, length); +} +void hal_write_flash(u32 offset,const u8 *data, u32 length) +{ + memcpy(g_Flash+offset, data, length); +} + ////////////////////////////////////////////////////////////////////////// static void processPacket(const unsigned char *data, int length) { @@ -335,9 +348,13 @@ int main(int argc, char * argv[]) // no Launchpad Pro connected return -3; } + + // clear dummy flash & ADC + memset(g_Flash, 0, USER_AREA_SIZE); + memset(g_ADC, 0, sizeof(g_ADC)); // now start things up - app_init(); + app_init(g_ADC); // start a timer loop CFRunLoopSourceContext source_context; @@ -354,4 +371,4 @@ int main(int argc, char * argv[]) CFRunLoopRun(); return EXIT_SUCCESS; -} \ No newline at end of file +} -- cgit v1.2.1