summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2015-12-25 23:25:43 -0800
committerKeith Packard <keithp@keithp.com>2015-12-25 23:30:33 -0800
commitaffad27df6c2f38f0398175d96c073a85039ebe5 (patch)
tree758561619425ee2c06c9bc9433c2fbf72b815791
parent0fd370af8bc8842000415c4d182d84b4bf6f90fa (diff)
altos: Hacks to test PWM output on EasyMegaeasymega-pwm-hacks
This uses the companion port chip select pins, which happen to be connected to tim4. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--src/easymega-v1.0/Makefile2
-rw-r--r--src/easymega-v1.0/ao_easymega.c4
-rw-r--r--src/easymega-v1.0/ao_pins.h18
3 files changed, 21 insertions, 3 deletions
diff --git a/src/easymega-v1.0/Makefile b/src/easymega-v1.0/Makefile
index c3b360b4..99a52db9 100644
--- a/src/easymega-v1.0/Makefile
+++ b/src/easymega-v1.0/Makefile
@@ -100,8 +100,8 @@ ALTOS_SRC = \
ao_sample.c \
ao_kalman.c \
ao_flight.c \
- ao_companion.c \
ao_pyro.c \
+ ao_pwm_stm.c \
$(MATH_SRC) \
$(PROFILE) \
$(SAMPLE_PROFILE) \
diff --git a/src/easymega-v1.0/ao_easymega.c b/src/easymega-v1.0/ao_easymega.c
index e217c33c..db3a58b0 100644
--- a/src/easymega-v1.0/ao_easymega.c
+++ b/src/easymega-v1.0/ao_easymega.c
@@ -24,6 +24,7 @@
#include <ao_companion.h>
#include <ao_profile.h>
#include <ao_eeprom.h>
+#include <ao_pwm.h>
#if HAS_SAMPLE_PROFILE
#include <ao_sample_profile.h>
#endif
@@ -79,7 +80,8 @@ main(void)
ao_usb_init();
ao_igniter_init();
- ao_companion_init();
+// ao_companion_init();
+ ao_pwm_init();
ao_pyro_init();
ao_config_init();
diff --git a/src/easymega-v1.0/ao_pins.h b/src/easymega-v1.0/ao_pins.h
index a5e55638..f8f9cf18 100644
--- a/src/easymega-v1.0/ao_pins.h
+++ b/src/easymega-v1.0/ao_pins.h
@@ -78,7 +78,7 @@
#define HAS_RADIO 0
#define HAS_TELEMETRY 0
#define HAS_APRS 0
-#define HAS_COMPANION 1
+#define HAS_COMPANION 0
#define HAS_SPI_1 1
#define SPI_1_PA5_PA6_PA7 1 /* Barometer */
@@ -353,4 +353,20 @@ struct ao_adc {
#define AO_PROFILE 0
#endif
+/*
+ * PWM output
+ */
+
+#define NUM_PWM 2
+#define PWM_MAX 1023
+#define AO_PWM_TIMER stm_tim4
+#define AO_PWM_TIMER_ENABLE STM_RCC_APB1ENR_TIM4EN
+#define AO_PWM_TIMER_SCALE 1
+
+#define AO_PWM_0_GPIO (&stm_gpiob)
+#define AO_PWM_0_PIN 6
+
+#define AO_PWM_1_GPIO (&stm_gpiob)
+#define AO_PWM_1_PIN 7
+
#endif /* _AO_PINS_H_ */