summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Hodder <dave.hodder@focusrite.com>2018-11-08 10:42:06 +0000
committerDave Hodder <dave.hodder@focusrite.com>2018-11-08 10:42:06 +0000
commitdad65c96eeb8e8cd8e4e1df896163448f4f859c6 (patch)
tree4c6502abc07e50ebe1c7e99188da101cc2533b49
parent2e649cb9bd0f3847a0738bc258855821970ed993 (diff)
downloadlaunchpad-polymaker-dad65c96eeb8e8cd8e4e1df896163448f4f859c6.tar.gz
launchpad-polymaker-dad65c96eeb8e8cd8e4e1df896163448f4f859c6.zip
updated macOS simulator to implement flash & ADC APIs
-rw-r--r--tools/osx/simulator-osx.c21
1 files changed, 19 insertions, 2 deletions
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;
50 50
51static const float TIMER_INTERVAL_S = 0.001; //s 51static const float TIMER_INTERVAL_S = 0.001; //s
52 52
53static const u16 g_ADC[PAD_COUNT];
54
55static u8 g_Flash[USER_AREA_SIZE];
56
53// ____________________________________________________________________________ 57// ____________________________________________________________________________
54// 58//
55// Simulator "hal". This lets you exercise your device code without having to upload 59// 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)
95 // as above, or just dump to console? 99 // as above, or just dump to console?
96} 100}
97 101
102void hal_read_flash(u32 offset, u8 *data, u32 length)
103{
104 memcpy(data, g_Flash+offset, length);
105}
106void hal_write_flash(u32 offset,const u8 *data, u32 length)
107{
108 memcpy(g_Flash+offset, data, length);
109}
110
98////////////////////////////////////////////////////////////////////////// 111//////////////////////////////////////////////////////////////////////////
99static void processPacket(const unsigned char *data, int length) 112static void processPacket(const unsigned char *data, int length)
100{ 113{
@@ -335,9 +348,13 @@ int main(int argc, char * argv[])
335 // no Launchpad Pro connected 348 // no Launchpad Pro connected
336 return -3; 349 return -3;
337 } 350 }
351
352 // clear dummy flash & ADC
353 memset(g_Flash, 0, USER_AREA_SIZE);
354 memset(g_ADC, 0, sizeof(g_ADC));
338 355
339 // now start things up 356 // now start things up
340 app_init(); 357 app_init(g_ADC);
341 358
342 // start a timer loop 359 // start a timer loop
343 CFRunLoopSourceContext source_context; 360 CFRunLoopSourceContext source_context;
@@ -354,4 +371,4 @@ int main(int argc, char * argv[])
354 CFRunLoopRun(); 371 CFRunLoopRun();
355 372
356 return EXIT_SUCCESS; 373 return EXIT_SUCCESS;
357} \ No newline at end of file 374}