⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mcu_reg_init_def.h

📁 2.4G无线音箱的接收程序,采用ATMEGA8单片机和STS公司的无线模块完成
💻 H
字号:
/******************************************************************************
*
* Purpose:      Micro controller Dependend defines
*
* Creator:      Rob Lansbergen
*
* Version:		$Revision: 19 $
*
* File Name:	$Workfile: MCU_Reg_Init_Def.h $
*
* Author:		Rob Lansbergen
*
* Check in:		$Author: Chong.cheeleong $
*
* The information is provided 揳s is?without any express or implied warranty  
* of any kind, * including warranties of merchantability, noninfringement of   
* intellectual property, or fitness for any particular purpose. In no event sha
* Wireless Sound Solutions and/or its affiliate companies, or its suppliers be 
* liable for any damages whatsoever arising out of the use of or inability to  
* use the information or the materials. Wireless Sound Solutions, its affiliate
* companies, and its suppliers further do not warrant the accuracy or          
* completeness of information, text, graphics, or other items contained within 
* materials. Wireless Sound Solutions, Inc., may make changes to materials, or 
* the products described within, at any time, without notice.                  
* ?007 Wireless Sound Solutions. All rights reserved. Wireless Sound Solutions
* STS and STS-wireless are trademarks of Wireless Sound Solutions.        
******************************************************************************/

#ifdef MCU_ATMEGA128
	#include <iom128.h>
#else /* 128 */
	#include <iom8.h>
#endif
#ifndef MCU_FUNC_H
#define MCU_FUNC_H


/*
** Public function prototypes
** --------------------------
*/
void MCU_init (void);
void Wait_For_mSec(int Milisec);

/*******************************************************************************************/
#ifdef PCB_PNP80_UNIVERSAL_TRX

  	#define I2C_PORT	    PORTC
	#define I2C_DDR	        DDRC
	#define I2C_PIN		    PINC
	#define SCL_PIN         0x20 /* PC5 */
	#define SDA_PIN         0x10 /* PC4 */

	#ifdef Target_CU		//Central Unit (CU) TX
		/* Disable button and all software behind it by defining a 1 instead of the port input */
	#define CONNECT_SW			(PIND & 0x10) /* PD4 */
	#define ERASE_CON_CODE_SW	(PIND & 0x10) /* PD4 */
	#define SYNC_LED_ON 		PORTD = PORTD | 0x04;  /* PD2 */
	#define SYNC_LED_OFF		PORTD = PORTD & ~0x04;
	#define SET_RFLEDS(mask)	PORTD = (PORTD & ~0x04) | ((mask) & 0x04); /* Link LED */							  
	#define RESET_DARR(en)		(PORTC = (PORTC & ~0x01) | ((en & 1) * 0x01)) /* PC0 */
	#define CODEC_RESET(en) 	(PORTC = (PORTC & ~0x02) | ((en & 1) * 0x02)) /* PC1 */ 		
	#define MU_CU_SW			(PIND & 0x40)	/* PD6 */

	#else
		/* Disable button and all software behind it by defining a 1 instead of the port input */
	#define CONNECT_SW			(PIND & 0x10) /* PD4 */
	#define ERASE_CON_CODE_SW	(PIND & 0x10) /* PD4 */
//#define SYNC_LED_ON 		PORTD = PORTD | 0x20;  /* PD5 */
//#define SYNC_LED_OFF		PORTD = PORTD | 0x20;  /* PD5 */
//#define SET_RFLEDS(mask)	PORTD = (PORTD & ~0x20) | ((mask) & 0x20); /* Link LED */							  
	#define SYNC_LED_ON 		PORTC = PORTC | 0x04;  /* PC2 */
	#define SYNC_LED_OFF		PORTC = PORTC & ~0x04;
	#define SET_RFLEDS(mask)	PORTC = (PORTC & ~0x04) | ((mask) & 0x04); /* Link LED */							  
	#define RESET_DARR(en)		(PORTC = (PORTC & ~0x01) | ((en & 1) * 0x01)) /* PC0 */
	#define CODEC_RESET(en) 	(PORTC = (PORTC & ~0x02) | ((en & 1) * 0x02)) /* PC1 */ 		
	//#define MU_CU_SW			(PIND & 0x04)	/* PD3 */
	#define MU_CU_SW			(PIND & 0x40)	/* PD6 */

	#define pd5_mute_ctrl(en)	(PORTD = (PORTD & ~0x20) | ((en & 1) * 0x20)) /* PD5 */
	#endif

	#define CHECK_INTERRUPT_PIN 	((PIND & 0x02) == 00) /* PD1 */
	#define FLIP_ABCD_SW			MU_CU_SW			//Allan 0723		


	#define AUX3_ON
	#define AUX3_OFF
	#define AUX4_ON
	#define AUX4_OFF
    #define DATA_LED_ON       //SYNC_LED_ON
    #define DATA_LED_OFF      //SYNC_LED_OFF
	



    #define GPIO1
    #define GPIO2
    #define GPIO3
    #define GPIO4

//	#define SNIFF_SW			1
    //#define FLIP_ABCD_SW        PLAY_PAUSE_STOP_SW 			//      
    
//    #define ERASE_CON_CODE_SW   1
	#define VOL_Close_Open_SW			(PINB & 0x04) /* PB2 Actived:0*/

	#define VOL_UP_SW			1//(PIND & 0x80) /* PD7 Actived:0*/
	#define VOL_DOWN_SW			1//(PIND & 0x20) /* PD5 Actived:0*/
	//#define VOL_DOWN_SW 		(PIND & 0x01) /* PD5 Actived:0*/
    #define PLAY_PAUSE_STOP_SW	1//(PINB & 0x02) /* PB1 Actived:0*/
    #define PREV_SW				1//(PINB & 0x04) /* PB2 Actived:0*/
    #define NEXT_SW				1//(PINB & 0x01) /* PB0 Actived:0*/
	/* GUI Programs EEPROM with Power settings address 508 and 509 */
		
#endif /* end PCB_PNP80_UNIVERSAL_TRX */

/*******************************************************************************************
*	ConfigByte 1:
*		Bit 0-4	: Application selection 
*		Bit 5 	: 1 = MU, 0 = CU
*		Bit 6	: 1 = Use Continuous RX TX
*		Bit 7	: 1 = Use MU CU Swap
*
*	ConfigByte 2:
*		Bit 0-3	: Stream Enable
*		Bit 4	: 1 = Auto Snooze enable auto powerdown when no audio is detected
*		Bit 5   : Reserved (Production) (should always be zero)
*		Bit 6   : 1 = Use SPDIF as Audio Interface | 0 = I2S
*		Bit 7   : 1 = Use Nack Report
*
*	ConfigByte 3:
*		Bit 0	: 1 = Use Own WLAN Detection
*		Bit 1-6	: free
*       Bit 7   : 1 = Auto Config
*/


#endif   /* MCU_FUNC_INTERN_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -