📄 hal_ccxx00db.h
字号:
/*******************************************************************************************************
*******************************************************************************************************
* The Chipcon Hardware Abstraction Library is a collection of functions, macros and constants, which *
* can be used to ease access to the hardware on the CCxx00 and the target microcontroller. *
* *
* This file contains all definitions that are specific for the CCxx00DB development platform. *
*******************************************************************************************************
* Compiler: AVR-GCC *
* Target platform: CCxx00DB *
* Author: WangChaoyan
*******************************************************************************************************
* Revision history: *
*
*******************************************************************************************************/
#ifndef _HAL_CCxx00DB_H_
#define _HAL_CCxx00DB_H_
/*******************************************************************************************************
*******************************************************************************************************
************************** AVR I/O PORTS **************************
*******************************************************************************************************
*******************************************************************************************************/
//-------------------------------------------------------------------------------------------------------
// Port B
#define CSN 0 // PB.0 - Output: SPI Chip Select (CS_N)
#define SCK 1 // PB.1 - Output: SPI Serial Clock (SCLK)
#define MOSI 2 // PB.2 - Output: SPI Master out - slave in (MOSI)
#define MISO 3 // PB.3 - Input: SPI Master in - slave out (MISO)
#define PB4_NC 4 // PB.4 - NC; test,output; 24-Sep
#define PB5_NC 5 // PB.5 - NC
#define PB_INIT do {DDRB = BM(MOSI) | BM(SCK) | BM(CSN);PORTB =0x3F;} while(0)
//-------------------------------------------------------------------------------------------------------
// Port C
#define PC0_NC 0 // PC.0 - :
#define PC1_NC 1 // PC.1 - ;
#define PC2_NC 2 // PC.2 - NC:
#define PC3_NC 3 // PC.5 - NC
#define PC4_NC 4 // PC.4 - NC:
#define PC5_NC 5 // PC.5 - NC:
#define PC_INIT do {DDRC = 0; PORTC=0x3F;} while(0)
//-------------------------------------------------------------------------------------------------------
// Port D
#define PD0_NC 0 // PD.0 - Input: INT0,
#define PD1_NC 1 // PD.1 - Input : INT1,
#define UART1_RXD 2 // PD.2 - Input: UART1 RXD
#define UART1_TXD 3 // PD.3 - Output: UART1 TXD
#define PD4_NC 4 // PD.4 - NC
#define PD5_NC 5 // PD.5 - NC
#define PD6_NC 6 // PD.6 - NC;
#define LED_RDY 7 // PD.7 - Output: LED_RDY
#define PD_INIT do {DDRD =( BM(UART1_TXD))|(BM(LED_RDY)) ; PORTD = 0x7F;} while(0)
//-------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------
// Port setup macros
// Port initialization
#define PORT_INIT() \
do { \
PB_INIT; \
PC_INIT; \
PD_INIT; \
} while (0)
// Enables/disables the SPI interface
#define SPI_ENABLE() (PORTB &= ~BM(CSN))
#define SPI_DISABLE() (PORTB |= BM(CSN))
//-------------------------------------------------------------------------------------------------------
/*******************************************************************************************************
*******************************************************************************************************
************************** LEDS **************************
*******************************************************************************************************
*******************************************************************************************************/
//-------------------------------------------------------------------------------------------------------
//define ready_led
#define SET_LED_RDY() (PORTD |= BM(LED_RDY))
#define CLR_LED_RDY() (PORTD &= 0x7F)
#define TOGGLE_LED_RDY() (PORTD ^= BM(LED_RDY))
//end test
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -