changeset 291:a72feaed133a

PWT buzzer driver: conditionalize on TARGET_HAS_BUZZER Here we add a new target config preprocessor symbol TARGET_HAS_BUZZER, currently defined for c11x and c139; later we also expect to have it on for FC Venus, and in FC Magnetite we are going to turn it on for target dsample, just for the sake of completeness and philosophical correctness.
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 26 Mar 2022 19:31:18 +0000
parents 0e5ccb343284
children 0f688d07b068
files src/cs/drivers/drv_app/buzzer/pwt.c targets/c11x.h targets/c139.h
diffstat 3 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/cs/drivers/drv_app/buzzer/pwt.c	Sat Mar 26 18:23:50 2022 +0000
+++ b/src/cs/drivers/drv_app/buzzer/pwt.c	Sat Mar 26 19:31:18 2022 +0000
@@ -5,6 +5,7 @@
 
 #include "main/sys_types.h"
 #include "pwt.h"
+#include "fc-target.h"
 
 #define	ASIC_CONF_REG	(*(volatile SYS_UWORD16 *) 0xFFFEF008)
 #define	PWT_MODE_MASK	0x0020
@@ -18,25 +19,33 @@
 
 void PWT_block_on(void)
 {
+#ifdef TARGET_HAS_BUZZER
 	ASIC_CONF_REG |= PWT_MODE_MASK;
 	PWT_GCR_REG = 0x01;
+#endif
 }
 
 void PWT_block_off(void)
 {
+#ifdef TARGET_HAS_BUZZER
 	ASIC_CONF_REG &= ~PWT_MODE_MASK;
 	PWT_GCR_REG = 0;
+#endif
 }
 
 void PWT_play_tone(SYS_UWORD8 note, SYS_UWORD8 volume)
 {
+#ifdef TARGET_HAS_BUZZER
 	PWT_FRC_REG = note;
 	PWT_VCR_REG = (volume << 1) | 1;
 	PWT_tone_is_on = 1;
+#endif
 }
 
 void PWT_stop_tone(void)
 {
+#ifdef TARGET_HAS_BUZZER
 	PWT_VCR_REG = 0;
 	PWT_tone_is_on = 0;
+#endif
 }
--- a/targets/c11x.h	Sat Mar 26 18:23:50 2022 +0000
+++ b/targets/c11x.h	Sat Mar 26 19:31:18 2022 +0000
@@ -4,3 +4,4 @@
 #define	USE_TSPACT2_FOR_TXLOW	0
 #define	GPIO1_SPEAKER_CTRL	0
 #define	UARTFAX_CLASSIC_DTR_DCD	0
+#define	TARGET_HAS_BUZZER	1
--- a/targets/c139.h	Sat Mar 26 18:23:50 2022 +0000
+++ b/targets/c139.h	Sat Mar 26 19:31:18 2022 +0000
@@ -4,3 +4,4 @@
 #define	USE_TSPACT2_FOR_TXLOW	1
 #define	GPIO1_SPEAKER_CTRL	0
 #define	UARTFAX_CLASSIC_DTR_DCD	0
+#define	TARGET_HAS_BUZZER	1