aboutsummaryrefslogtreecommitdiffstats
path: root/boards/base
diff options
context:
space:
mode:
Diffstat (limited to 'boards/base')
-rw-r--r--boards/base/Mikromedia-STM32-M4-ILI9341/example/Makefile1
-rw-r--r--boards/base/Mikromedia-STM32-M4-ILI9341/example/mcuconf.h5
-rw-r--r--boards/base/Olimex-SAM7EX256-GE8/board.mk1
-rw-r--r--boards/base/Olimex-SAM7EX256-GE8/example/Makefile1
-rw-r--r--boards/base/Olimex-SAM7EX256-GE8/example/halconf.h6
-rw-r--r--boards/base/Olimex-SAM7EX256-GE8/example/mcuconf.h11
-rw-r--r--boards/base/Olimex-SAM7EX256-GE8/gaudio_play_board.h75
-rw-r--r--boards/base/Olimex-SAM7EX256-GE8/gaudio_record_board.h7
8 files changed, 100 insertions, 7 deletions
diff --git a/boards/base/Mikromedia-STM32-M4-ILI9341/example/Makefile b/boards/base/Mikromedia-STM32-M4-ILI9341/example/Makefile
index 1c314543..0ca152c6 100644
--- a/boards/base/Mikromedia-STM32-M4-ILI9341/example/Makefile
+++ b/boards/base/Mikromedia-STM32-M4-ILI9341/example/Makefile
@@ -153,6 +153,7 @@ LD = $(TRGT)gcc
CP = $(TRGT)objcopy
AS = $(TRGT)gcc -x assembler-with-cpp
OD = $(TRGT)objdump
+SZ = $(TRGT)size
HEX = $(CP) -O ihex
BIN = $(CP) -O binary
diff --git a/boards/base/Mikromedia-STM32-M4-ILI9341/example/mcuconf.h b/boards/base/Mikromedia-STM32-M4-ILI9341/example/mcuconf.h
index 64895943..c92d2970 100644
--- a/boards/base/Mikromedia-STM32-M4-ILI9341/example/mcuconf.h
+++ b/boards/base/Mikromedia-STM32-M4-ILI9341/example/mcuconf.h
@@ -29,6 +29,10 @@
*/
#define STM32F4xx_MCUCONF
+#define STM32F40_41xxx
+
+// Define this if you are using an older ChibiOS version
+//#define STM32_VOS STM32_VOS_HIGH
/*
* HAL driver system settings.
@@ -57,7 +61,6 @@
#define STM32_I2SSRC STM32_I2SSRC_CKIN
#define STM32_PLLI2SN_VALUE 192
#define STM32_PLLI2SR_VALUE 5
-#define STM32_VOS STM32_VOS_HIGH
#define STM32_PVD_ENABLE FALSE
#define STM32_PLS STM32_PLS_LEV0
#define STM32_BKPRAM_ENABLE FALSE
diff --git a/boards/base/Olimex-SAM7EX256-GE8/board.mk b/boards/base/Olimex-SAM7EX256-GE8/board.mk
index 249cfc2d..98119565 100644
--- a/boards/base/Olimex-SAM7EX256-GE8/board.mk
+++ b/boards/base/Olimex-SAM7EX256-GE8/board.mk
@@ -6,3 +6,4 @@ include $(GFXLIB)/drivers/gadc/AT91SAM7/gadc_lld.mk
include $(GFXLIB)/drivers/ginput/dial/GADC/ginput_lld.mk
include $(GFXLIB)/drivers/ginput/toggle/Pal/ginput_lld.mk
include $(GFXLIB)/drivers/gaudio/gadc/driver.mk
+include $(GFXLIB)/drivers/gaudio/pwm/driver.mk
diff --git a/boards/base/Olimex-SAM7EX256-GE8/example/Makefile b/boards/base/Olimex-SAM7EX256-GE8/example/Makefile
index b7b4da1c..e9fdde2d 100644
--- a/boards/base/Olimex-SAM7EX256-GE8/example/Makefile
+++ b/boards/base/Olimex-SAM7EX256-GE8/example/Makefile
@@ -136,6 +136,7 @@ LD = $(TRGT)gcc
CP = $(TRGT)objcopy
AS = $(TRGT)gcc -x assembler-with-cpp
OD = $(TRGT)objdump
+SZ = $(TRGT)size
HEX = $(CP) -O ihex
BIN = $(CP) -O binary
diff --git a/boards/base/Olimex-SAM7EX256-GE8/example/halconf.h b/boards/base/Olimex-SAM7EX256-GE8/example/halconf.h
index db88d41b..3b60d923 100644
--- a/boards/base/Olimex-SAM7EX256-GE8/example/halconf.h
+++ b/boards/base/Olimex-SAM7EX256-GE8/example/halconf.h
@@ -80,7 +80,7 @@
* @brief Enables the GPT subsystem.
*/
#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__)
-#define HAL_USE_GPT FALSE
+#define HAL_USE_GPT TRUE
#endif
/**
@@ -116,10 +116,6 @@
*/
#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
#define HAL_USE_PWM TRUE
-#define PWM_USE_PWM1 FALSE
-#define PWM_USE_PWM2 TRUE
-#define PWM_USE_PWM3 FALSE
-#define PWM_USE_PWM4 FALSE
#endif
/**
diff --git a/boards/base/Olimex-SAM7EX256-GE8/example/mcuconf.h b/boards/base/Olimex-SAM7EX256-GE8/example/mcuconf.h
index a9a0fea7..8acdd42d 100644
--- a/boards/base/Olimex-SAM7EX256-GE8/example/mcuconf.h
+++ b/boards/base/Olimex-SAM7EX256-GE8/example/mcuconf.h
@@ -52,6 +52,10 @@
/*
* PWM driver system settings.
*/
+#define PWM_USE_PWM1 TRUE // used by audio-out
+#define PWM_USE_PWM2 TRUE // used by back-light
+#define PWM_USE_PWM3 FALSE
+#define PWM_USE_PWM4 FALSE
/*
* SERIAL driver system settings.
@@ -69,3 +73,10 @@
#define AT91SAM7_SPI_USE_SPI1 FALSE
#define AT91SAM7_SPI0_PRIORITY (AT91C_AIC_PRIOR_HIGHEST - 1)
#define AT91SAM7_SPI1_PRIORITY (AT91C_AIC_PRIOR_HIGHEST - 1)
+
+/*
+ * GPT driver system settings.
+ */
+#define AT91_GPT_USE_TC0 FALSE // used internally by ADC driver
+#define AT91_GPT_USE_TC1 TRUE // uGFX used for audio-out
+#define AT91_GPT_USE_TC2 FALSE
diff --git a/boards/base/Olimex-SAM7EX256-GE8/gaudio_play_board.h b/boards/base/Olimex-SAM7EX256-GE8/gaudio_play_board.h
new file mode 100644
index 00000000..bbbc48c6
--- /dev/null
+++ b/boards/base/Olimex-SAM7EX256-GE8/gaudio_play_board.h
@@ -0,0 +1,75 @@
+/*
+ * This file is subject to the terms of the GFX License. If a copy of
+ * the license was not distributed with this file, you can obtain one at:
+ *
+ * http://ugfx.org/license.html
+ */
+
+#ifndef GAUDIO_PLAY_BOARD_H
+#define GAUDIO_PLAY_BOARD_H
+
+/* Our timer callback */
+static void gptcallback(GPTDriver *gptp) {
+ (void) gptp;
+ gaudio_play_pwm_timer_callbackI();
+}
+
+/* PWM configuration structure. The speaker is on PWM0/PB19 ie PWM1/PIN1 in ChibiOS speak */
+static PWMConfig pwmcfg = {
+ 1000000, /* 1 MHz PWM clock frequency. Ignored as we are using PWM_MCK_DIV_n */
+ 1024, /* PWM period is 1024 cycles (10 bits). */
+ 0,
+ {
+ {PWM_MCK_DIV_1 | PWM_OUTPUT_CENTER | PWM_OUTPUT_ACTIVE_HIGH | PWM_OUTPUT_PIN1 | PWM_DISABLEPULLUP_PIN1, 0},
+ },
+};
+
+/* Timer configuration structure. We use Timer 2 (TC1) */
+static GPTConfig gptcfg = {
+ 8192, // frequency
+ gptcallback, // callback
+ GPT_CLOCK_FREQUENCY, // clocksource
+ GPT_GATE_NONE, // clockgate
+ GPT_TRIGGER_NONE, // trigger
+};
+
+static uint16_t lastvalue;
+
+static bool gaudio_play_pwm_setup(uint32_t frequency, ArrayDataFormat format) {
+ if (format == ARRAY_DATA_10BITUNSIGNED)
+ pwmcfg.period = 1024;
+ else if (format == ARRAY_DATA_8BITUNSIGNED)
+ pwmcfg.period = 256;
+ else
+ return FALSE;
+ gptcfg.frequency = frequency;
+ return TRUE;
+}
+
+static void gaudio_play_pwm_start(void) {
+ /* Start the PWM */
+ pwmStart(&PWMD1, &pwmcfg);
+ lastvalue = pwmcfg.period>>1;
+ pwmEnableChannelI(&PWMD1, 0, lastvalue);
+
+ /* Start the timer interrupt */
+ gptStart(&GPTD2, &gptcfg);
+ gptStartContinuous(&GPTD2, 0);
+}
+
+static void gaudio_play_pwm_stop(void) {
+ /* Stop the timer interrupt */
+ gptStopTimer(&GPTD2);
+
+ /* Stop the PWM */
+ pwmStop(&PWMD1);
+}
+
+static void gaudio_play_pwm_setI(uint16_t value) {
+ if (value != lastvalue) {
+ lastvalue = value;
+ pwmEnableChannelI(&PWMD1, 0, value);
+ }
+}
+
+#endif /* GAUDIO_PLAY_BOARD_H */
diff --git a/boards/base/Olimex-SAM7EX256-GE8/gaudio_record_board.h b/boards/base/Olimex-SAM7EX256-GE8/gaudio_record_board.h
index cdea5e06..68063881 100644
--- a/boards/base/Olimex-SAM7EX256-GE8/gaudio_record_board.h
+++ b/boards/base/Olimex-SAM7EX256-GE8/gaudio_record_board.h
@@ -20,12 +20,17 @@
#define GAUDIO_RECORD_NUM_CHANNELS 1
/**
+ * @brief Whether each channel is mono or stereo
+ */
+#define GAUDIO_RECORD_CHANNEL0_IS_STEREO FALSE
+
+/**
* The list of audio channels and their uses
*/
#define GAUDIO_RECORD_MICROPHONE 0
#ifdef GAUDIO_RECORD_IMPLEMENTATION
- static uint32_t gaudin_lld_physdevs[GAUDIO_RECORD_NUM_CHANNELS] = {
+ static uint32_t gaudio_gadc_physdevs[GAUDIO_RECORD_NUM_CHANNELS] = {
GADC_PHYSDEV_MICROPHONE,
};
#endif