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

📄 config.h

📁 ENC28J60 System HTTP
💻 H
字号:
#ifndef _CONFIG_H_
#define _CONFIG_H_
#include "build.h"

/////////////////////////////// PASSWORD SETUP ////////////////////////////////////////////
#define HTTPD_ADMIN_AUTH_LOGIN "admin"
#define HTTPD_ADMIN_AUTH_PASS  "1eth1"

/////////////////////////////// NETWORK SETUP ////////////////////////////////////////////

//IP address of _this_ server:
#define NIC_IP_ADDRESS             IP(192,168,10,21)

//Netmask of _this_ network:
#define NIC_IP_NETMASK             IP(255,255,255,0)

//IP address of default gateway:
#define NIC_GATEWAY_IP_ADDRESS     IP(192,168,10,1)


//NTP Server ip: 64.142.28.65
#define NTP_SERVER_IP_ADDRESS      IP(64,142,28,65)

//nic ethernet address. i picked an address that is free for experimental/private use (really?)
//see the last line: http://standards.ieee.org/regauth/oui/oui.txt
//-> AC-DE-48-xx-xx-xx
#define NIC_MAC0 0xAC
#define NIC_MAC1 0xDE
#define NIC_MAC2 0x48
#define NIC_MAC3 0xAA
#define NIC_MAC4 0xBB
#define NIC_MAC5 0xCC


/////////////////////////////// PIN SETUP ////////////////////////////////////////////
//-> io/dataflash
#define DATAFLASH_PIN_CS  6
#define DATAFLASH_PIN_RST 5
#define DATAFLASH_PORT    PORTC
#define DATAFLASH_DDR     DDRC

//-> io/softuart
#define SOFTUART_PORT PORTC
#define SOFTUART_DDR  DDRC
#define SOFTUART_TXPIN 2

//-> enc28j60
#define ENC28J60_PORT	  PORTB
#define ENC28J60_DDR	  DDRB
#define ENC28J60_PIN_CS	4
#define ENC28J60_PIN_RESET	3

//-> status led
#define LED_PORT PORTC
#define LED_DDR   DDRC
#define LED_PIN      3

//-> mca25
#define MCA25_RESET_PORT     PORTD
#define MCA25_RESET_PORT_DIR DDRD
#define MCA25_RESET_PIN      6

//-> mpf10
#define MPF10_ENABLE_PORT PORTD
#define MPF10_ENABLE_DDR   DDRD
#define MPF10_ENABLE_PIN      7

//-> servo (use timer output OCR2!)
#define SERVO_PORT        PORTD
#define SERVO_DDR          DDRD
#define SERVO_PIN             7

//-> lm75
//#define LM75_DEVICE_ID 0x9E
#define LM75_DEVICE_ID 0x90

/////////////////////////////// HELPERS ////////////////////////////////////////////
//DO NOT CHANGE ANYTHING BELOW!

//convert config ip to long:
#define IP(a3,a2,a1,a0) ((((unsigned long)(a3))<<24)|(((unsigned long)(a2))<<16)|(((unsigned long)(a1))<<8)|(unsigned long)(a0))

/*#define NIC_IP_ADDRESS \
				(((uint32_t)NIC_IP_ADDRESS_0)<<24 | \
				((uint32_t)NIC_IP_ADDRESS_1)<<16 | \
				((uint32_t)NIC_IP_ADDRESS_2)<< 8 | \
				((uint32_t)NIC_IP_ADDRESS_3))

#define NIC_IP_NETMASK \
				(((uint32_t)NIC_IP_NETMASK_0)<<24 | \
				((uint32_t)NIC_IP_NETMASK_1)<<16 | \
				((uint32_t)NIC_IP_NETMASK_2)<< 8 | \
				((uint32_t)NIC_IP_NETMASK_3))


#define NIC_GATEWAY_IP_ADDRESS \
				(((uint32_t)NIC_GATEWAY_IP_ADDRESS_0)<<24 | \
				((uint32_t)NIC_GATEWAY_IP_ADDRESS_1)<<16 | \
				((uint32_t)NIC_GATEWAY_IP_ADDRESS_2)<< 8 | \
				((uint32_t)NIC_GATEWAY_IP_ADDRESS_3))

#define NTP_SERVER_IP_ADDRESS \
				(((uint32_t)NTP_SERVER_IP_ADDRESS_0)<<24 | \
				((uint32_t)NTP_SERVER_IP_ADDRESS_1)<<16 | \
				((uint32_t)NTP_SERVER_IP_ADDRESS_2)<< 8 | \
				((uint32_t)NTP_SERVER_IP_ADDRESS_3))
*/

#define sbi(reg,bit)    reg |= (1<<(bit));
#define cbi(reg,bit)    reg &= ~(1<<(bit));
#define MIN(a,b)        ((a<b)?(a):(b))

#define lo8(x) ((x   )&0xFF)
#define hi8(x) (((x)>>8)&0xFF)


#ifndef F_CPU
	#define F_CPU F_OSC
#endif


#endif

⌨️ 快捷键说明

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