summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Hodder <dave.hodder@focusrite.com>2018-11-21 09:56:58 +0000
committerGitHub <noreply@github.com>2018-11-21 09:56:58 +0000
commit0b819937fa8163926fab98f8948b1f0207588eb0 (patch)
tree694093598bd2378adfabf9bd0a9ae860b58d548e
parentdad65c96eeb8e8cd8e4e1df896163448f4f859c6 (diff)
parent32b77e52d0cd3f7b51fb02f7451c06ff3deb9d40 (diff)
downloadlaunchpad-polymaker-0b819937fa8163926fab98f8948b1f0207588eb0.tar.gz
launchpad-polymaker-0b819937fa8163926fab98f8948b1f0207588eb0.zip
Merge pull request #46 from dvhdr/adc-improvements
ADC improvements & new API features
-rw-r--r--Makefile6
-rw-r--r--include/app.h33
-rw-r--r--lib/launchpad_pro.abin16977058 -> 180180 bytes
-rw-r--r--src/app.c8
-rw-r--r--tools/simulator.c13
5 files changed, 47 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index 4436af4..cfb7766 100644
--- a/Makefile
+++ b/Makefile
@@ -24,15 +24,15 @@ CC = arm-none-eabi-gcc
24LD = arm-none-eabi-gcc 24LD = arm-none-eabi-gcc
25OBJCOPY = arm-none-eabi-objcopy 25OBJCOPY = arm-none-eabi-objcopy
26 26
27CFLAGS = -Os -g -Wall -I.\ 27CFLAGS = -Os -Wall -I.\
28-D_STM32F103RBT6_ -D_STM3x_ -D_STM32x_ -mthumb -mcpu=cortex-m3 \ 28-D_STM32F103RBT6_ -D_STM3x_ -D_STM32x_ -mthumb -mcpu=cortex-m3 \
29-fsigned-char -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -DHSE_VALUE=6000000UL \ 29-fsigned-char -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -DHSE_VALUE=6000000UL \
30-DCMSIS -DUSE_GLOBAL_CONFIG -g3 -ffunction-sections -std=c99 -mlittle-endian \ 30-DCMSIS -DUSE_GLOBAL_CONFIG -ffunction-sections -std=c99 -mlittle-endian \
31$(INCLUDES) -o 31$(INCLUDES) -o
32 32
33LDSCRIPT = stm32_flash.ld 33LDSCRIPT = stm32_flash.ld
34 34
35LDFLAGS += -T$(LDSCRIPT) -u _start -u _Minimum_Stack_Size -mcpu=cortex-m3 -mthumb -specs=nano.specs -specs=nosys.specs -nostdlib -Wl,-static -g3 -N -nostartfiles -Wl,--gc-sections 35LDFLAGS += -T$(LDSCRIPT) -u _start -u _Minimum_Stack_Size -mcpu=cortex-m3 -mthumb -specs=nano.specs -specs=nosys.specs -nostdlib -Wl,-static -N -nostartfiles -Wl,--gc-sections
36 36
37all: $(SYX) 37all: $(SYX)
38 38
diff --git a/include/app.h b/include/app.h
index 96801eb..6752b62 100644
--- a/include/app.h
+++ b/include/app.h
@@ -71,6 +71,19 @@
71void hal_plot_led(u8 type, u8 index, u8 red, u8 green, u8 blue); 71void hal_plot_led(u8 type, u8 index, u8 red, u8 green, u8 blue);
72 72
73/** 73/**
74 * Read the RGB value of an LED. This function is safe to call from any
75 * of the app functions below, at any time. Result is undefined if an invalid address is passed
76 * for any of the red, green or blue components.
77 *
78 * @param type - TYPEPAD to address any pad or button, TYPESETUP to address the Setup LED
79 * @param index - The index of the button, as above
80 * @param red - address to read red colour value, in [0, MAXLED].
81 * @param green - address to read green colour value, in [0, MAXLED]
82 * @param blue - address to read blue colour value, in [0, MAXLED]
83 */
84void hal_read_led(u8 type, u8 index, u8 *red, u8 *green, u8 *blue);
85
86/**
74 * Send a MIDI message to either USB port or to the DIN output. 87 * Send a MIDI message to either USB port or to the DIN output.
75 * 88 *
76 * @param port - which port to send the message to - can be USBSTANDALONE, USBMIDI or DINMIDI. 89 * @param port - which port to send the message to - can be USBSTANDALONE, USBMIDI or DINMIDI.
@@ -126,6 +139,26 @@ void hal_read_flash(u32 offset, u8 *data, u32 length);
126 */ 139 */
127void hal_write_flash(u32 offset,const u8 *data, u32 length); 140void hal_write_flash(u32 offset,const u8 *data, u32 length);
128 141
142/**
143 * Retrieve the device ID bootloader option
144 *
145 * Users can set a unique ID from 1-16 in the bootloader. This is useful
146 * for USB apps, as it helps multi-Launchpad setups behave predictably.
147 *
148 * @result the zero-based device ID [0-15] assigned to this Launchpad Pro.
149 */
150u8 hal_read_device_id();
151
152/**
153 * Retrieve the "layout text" bootloader option
154 *
155 * This setting determines whether the factory firmware will scroll text on changing
156 * layouts. This may be useful as a preference for open firmware apps as well.
157 *
158 * @result 1 to scroll text on layout changes, 0 not to.
159 */
160u8 hal_read_layout_text();
161
129// ____________________________________________________________________________ 162// ____________________________________________________________________________
130// 163//
131// Callbacks from the hardware (implemented in your app.c) 164// Callbacks from the hardware (implemented in your app.c)
diff --git a/lib/launchpad_pro.a b/lib/launchpad_pro.a
index f3af9bb..c2afa5a 100644
--- a/lib/launchpad_pro.a
+++ b/lib/launchpad_pro.a
Binary files differ
diff --git a/src/app.c b/src/app.c
index 8117a18..4ce908e 100644
--- a/src/app.c
+++ b/src/app.c
@@ -155,7 +155,6 @@ void app_timer_event()
155 hal_send_midi(USBSTANDALONE, MIDITIMINGCLOCK, 0, 0); 155 hal_send_midi(USBSTANDALONE, MIDITIMINGCLOCK, 0, 0);
156 } 156 }
157 157
158/*
159 // alternative example - show raw ADC data as LEDs 158 // alternative example - show raw ADC data as LEDs
160 for (int i=0; i < PAD_COUNT; ++i) 159 for (int i=0; i < PAD_COUNT; ++i)
161 { 160 {
@@ -173,18 +172,17 @@ void app_timer_event()
173 } 172 }
174 else if (x >= MAXLED && x < (2*MAXLED)) 173 else if (x >= MAXLED && x < (2*MAXLED))
175 { 174 {
176 r = MAXLED - x; 175 r = 2*MAXLED - x;
177 g = x - MAXLED; 176 g = x - MAXLED;
178 } 177 }
179 else 178 else
180 { 179 {
181 g = MAXLED - x; 180 g = 3*MAXLED - x;
182 b = x - MAXLED; 181 b = x - 2*MAXLED;
183 } 182 }
184 183
185 hal_plot_led(TYPEPAD, ADC_MAP[i], r, g, b); 184 hal_plot_led(TYPEPAD, ADC_MAP[i], r, g, b);
186 } 185 }
187 */
188} 186}
189 187
190//______________________________________________________________________________ 188//______________________________________________________________________________
diff --git a/tools/simulator.c b/tools/simulator.c
index 138277e..cec1ede 100644
--- a/tools/simulator.c
+++ b/tools/simulator.c
@@ -41,8 +41,11 @@
41 41
42void hal_plot_led(u8 type, u8 index, u8 red, u8 green, u8 blue) 42void hal_plot_led(u8 type, u8 index, u8 red, u8 green, u8 blue)
43{ 43{
44 // wire this up to MIDI out... 44 // wire this up to MIDI out...?
45 printf("...hal_plot_led(%d, %d, %d, %d, %d);\n", type, index, red, green, blue); 45}
46
47void hal_read_led(u8 type, u8 index, u8 *red, u8 *green, u8 *blue)
48{
46} 49}
47 50
48void hal_send_midi(u8 port, u8 status, u8 d1, u8 d2) 51void hal_send_midi(u8 port, u8 status, u8 d1, u8 d2)
@@ -59,12 +62,12 @@ void hal_send_sysex(u8 port, const u8* data, u16 length)
59 62
60void hal_read_flash(u32 offset, u8 *data, u32 length) 63void hal_read_flash(u32 offset, u8 *data, u32 length)
61{ 64{
62 printf("...hal_read_flash(%d, (data), %d);\n", offset, length); 65 printf("...hal_read_flash(%lu, (data), %lu);\n", offset, length);
63} 66}
64 67
65void hal_write_flash(u32 offset,const u8 *data, u32 length) 68void hal_write_flash(u32 offset,const u8 *data, u32 length)
66{ 69{
67 printf("...hal_write_flash(%d, (data), %d);\n", offset, length); 70 printf("...hal_write_flash(%lu, (data), %lu);\n", offset, length);
68} 71}
69 72
70// ____________________________________________________________________________ 73// ____________________________________________________________________________
@@ -123,4 +126,4 @@ int main(int argc, char * argv[])
123 sim_app_timer_event(); 126 sim_app_timer_event();
124 } 127 }
125 return 0; 128 return 0;
126} \ No newline at end of file 129}