summaryrefslogtreecommitdiffstats
path: root/apps/plugins/fft/fft.c
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-10-08 09:47:40 -0400
committerSolomon Peachy <pizza@shaftnet.org>2020-10-11 16:37:17 -0400
commit2a471e288c16b91a7186a60b3fb84dd55a494c7a (patch)
tree3e746212c5fa69b59f61d19b6e29d11aa8a5e31b /apps/plugins/fft/fft.c
parent5efaa9ef8073bb216e3dcdbb4476f2fa7c672b76 (diff)
downloadrockbox-2a471e288c16b91a7186a60b3fb84dd55a494c7a.tar.gz
rockbox-2a471e288c16b91a7186a60b3fb84dd55a494c7a.tar.bz2
rockbox-2a471e288c16b91a7186a60b3fb84dd55a494c7a.zip
New port: AIGO EROS Q / EROS K
The Q and K have a slightly different case, but the hardware under the shell is completely identical. These models are rebadged versions: * Hifiwalker H2 (== Q) * AGPTek H3 (== K) * Surfans F20 (== K) Other notes: * Significant improvements in the shared Hiby-platform launcher/loader * SD card can theoretically be hot-swapped now * Support external USB mass storage! * Some consolidation of Hiby-platform targets * Some consolidation of plugin keymaps Todo/known issues: * Keymaps need to be gone over properly * Convert to HAVE_SCROLLWHEEL? Change-Id: I5a8a4f22c38a5b69392ca7c0a8ad8c4e07d9523c
Diffstat (limited to 'apps/plugins/fft/fft.c')
-rw-r--r--apps/plugins/fft/fft.c39
1 files changed, 15 insertions, 24 deletions
diff --git a/apps/plugins/fft/fft.c b/apps/plugins/fft/fft.c
index eeb6611488..4719446475 100644
--- a/apps/plugins/fft/fft.c
+++ b/apps/plugins/fft/fft.c
@@ -334,16 +334,7 @@ GREY_INFO_STRUCT
# define FFT_AMP_SCALE BUTTON_PLAY
# define FFT_QUIT BUTTON_POWER
-#elif (CONFIG_KEYPAD == XDUOO_X3II_PAD)
-# define FFT_PREV_GRAPH BUTTON_PREV
-# define FFT_NEXT_GRAPH BUTTON_NEXT
-# define FFT_ORIENTATION BUTTON_HOME
-# define FFT_FREQ_SCALE BUTTON_OPTION
-# define FFT_WINDOW (BUTTON_HOME|BUTTON_POWER)
-# define FFT_AMP_SCALE BUTTON_PLAY
-# define FFT_QUIT BUTTON_POWER
-
-#elif (CONFIG_KEYPAD == XDUOO_X20_PAD)
+#elif (CONFIG_KEYPAD == XDUOO_X3II_PAD) || (CONFIG_KEYPAD == XDUOO_X20_PAD)
# define FFT_PREV_GRAPH BUTTON_PREV
# define FFT_NEXT_GRAPH BUTTON_NEXT
# define FFT_ORIENTATION BUTTON_HOME
@@ -361,7 +352,7 @@ GREY_INFO_STRUCT
# define FFT_AMP_SCALE BUTTON_PLAY
# define FFT_QUIT BUTTON_POWER
-#elif (CONFIG_KEYPAD == IHIFI_770_PAD)
+#elif (CONFIG_KEYPAD == IHIFI_770_PAD) || (CONFIG_KEYPAD == IHIFI_800_PAD)
# define FFT_PREV_GRAPH BUTTON_PREV
# define FFT_NEXT_GRAPH BUTTON_NEXT
# define FFT_ORIENTATION BUTTON_HOME
@@ -370,13 +361,13 @@ GREY_INFO_STRUCT
# define FFT_AMP_SCALE BUTTON_PLAY
# define FFT_QUIT BUTTON_POWER
-#elif (CONFIG_KEYPAD == IHIFI_800_PAD)
-# define FFT_PREV_GRAPH BUTTON_PREV
-# define FFT_NEXT_GRAPH BUTTON_NEXT
-# define FFT_ORIENTATION BUTTON_HOME
-# define FFT_FREQ_SCALE BUTTON_VOL_UP
-# define FFT_WINDOW BUTTON_VOL_DOWN
-# define FFT_AMP_SCALE BUTTON_PLAY
+#elif (CONFIG_KEYPAD == EROSQ_PAD)
+# define FFT_PREV_GRAPH BUTTON_SCROLL_BACK
+# define FFT_NEXT_GRAPH BUTTON_SCROLL_FWD
+# define FFT_ORIENTATION BUTTON_VOL_UP
+# define FFT_FREQ_SCALE BUTTON_VOL_DOWN
+# define FFT_WINDOW BUTTON_BACK
+# define FFT_AMP_SCALE BUTTON_MENU
# define FFT_QUIT BUTTON_POWER
#elif !defined(HAVE_TOUCHSCREEN)
@@ -530,7 +521,7 @@ static struct fft_config
int amp_scale;
int freq_scale;
int window_func;
-} fft_disk =
+} fft_disk =
{
/* Defaults */
.orientation = FFT_OR_VERT,
@@ -647,7 +638,7 @@ static void apply_window_func(enum fft_window_func mode)
/* Calculates the magnitudes from complex numbers and returns the maximum */
static unsigned calc_magnitudes(enum fft_amp_scale scale)
{
- /* A major assumption made when calculating the Q*MAX constants
+ /* A major assumption made when calculating the Q*MAX constants
* is that the maximum magnitude is 29 bits long. */
unsigned this_max = 0;
kiss_fft_cpx *this_output = output[output_head] + 1; /* skip DC */
@@ -806,7 +797,7 @@ static void draw_lines_vertical(unsigned this_max, unsigned graph_max)
{
int bins_acc = LCD_WIDTH / 2;
unsigned bins_max = 0;
-
+
for(int i = 0, x = 0; i < ARRAYLEN_PLOT; ++i)
{
unsigned bin = plot[i];
@@ -1107,7 +1098,7 @@ static inline bool fft_get_fft(void)
/* This block can introduce discontinuities in our data. Meaning, the
* FFT will not be done a continuous segment of the signal. Which can
* be bad. Or not.
- *
+ *
* Anyway, this is a demo, not a scientific tool. If you want accuracy,
* do a proper spectrum analysis.*/
@@ -1409,7 +1400,7 @@ static void fft_setting_update(unsigned which)
[FFT_OR_HORZ] = draw_bars_horizontal,
[FFT_OR_VERT] = draw_bars_vertical,
},
- [FFT_DM_SPECTROGRAM] =
+ [FFT_DM_SPECTROGRAM] =
{
[FFT_OR_HORZ] = draw_spectrogram_horizontal,
[FFT_OR_VERT] = draw_spectrogram_vertical,
@@ -1533,7 +1524,7 @@ static void fft_cleanup(void)
{
myosd_destroy();
- fft_close_fft();
+ fft_close_fft();
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cancel_cpu_boost();