📄 ezlink_modem_main.h
字号:
/*
** ============================================================================
**
** FILE
** Id: EZLink_Modem_Main.h, v2.0
**
** DESCRIPTION
** Header file
**
** COPYRIGHT
** Copyright 2006 Integration Associates Inc. All rights reserved.
**
** LIMITED USE LICENSE.
** By using this software, the user agrees to the terms of the
** following license. If the user does not agree to these terms,
** then this software should be returned within 30 days and a full
** refund of the purchase price or license fee will provided.
** Integration Associates hereby grants a license to the user on the
** following terms and conditions: The user may use, copy, modify,
** revise, translate, abridge, condense, expand, collect, compile,
** link, recast, distribute, transform or adapt this software solely
** in connection with the development of products incorporating
** integrated circuits sold by Integration Associates. Any other use
** for any other purpose is expressly prohibited with the prior written
** consent of Integration Associates.
**
** Any copy or modification made must satisfy the following conditions:
**
** 1. Both the copyright notice and this permission notice appear in all copies of the software,
** derivative works or modified versions, and any portions thereof, and that both notices
** appear in supporting documentation.
**
** 2. All copies of the software shall contain the following acknowledgement: "Portions of this
** software are used under license from Integration Associates Inc. and are copyrighted."
**
** 3 Neither the name of Integration Associates Inc. nor any of its subsidiaries may be used
** to endorse or promote products derived from this software without specific prior written
** permission.
**
** THIS SOFTWARE IS PROVIDED BY "AS IS" AND ALL WARRANTIES OF ANY KIND, INCLUDING THE IMPLIED
** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR USE, ARE EXPRESSLY DISCLAIMED. THE DEVELOPER
** SHALL NOT BE LIABLE FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
** THIS SOFTWARE MAY NOT BE USED IN PRODUCTS INTENDED FOR USE IN IMPLANTATION OR OTHER DIRECT
** LIFE SUPPORT APPLICATIONS WHERE MALFUNCTION MAY RESULT IN THE DIRECT PHYSICAL HARM OR INJURY
** TO PERSONS. ALL SUCH IS USE IS EXPRESSLY PROHIBITED.
**
** ============================================================================
*/
//==============================================================
// TYPE definitions
//==============================================================
typedef struct //bit definitions for a byte
{
unsigned int bit0 : 1;
unsigned int bit1 : 1;
unsigned int bit2 : 1;
unsigned int bit3 : 1;
unsigned int bit4 : 1;
unsigned int bit5 : 1;
unsigned int bit6 : 1;
unsigned int bit7 : 1;
} reg;
typedef union //union to help access to the bits of a byte
{
reg testreg;
int8 adat;
}reg_union;
//==============================================================
// Constant definitions:
//==============================================================
#ifdef IA4421
#define SPI_SDI PIN_B3 // MISO
#define SPI_SDO PIN_A2 // MOSI
#define SPI_SCK PIN_B5 // SPI clock, output
#define NSEL PIN_B4 // chip select, active low output
#define NFFS PIN_B1 // rx fifo select, active low output
#define FFIT PIN_B0
#define NIRQ PIN_B2 // IA4421 IRQ, active low input
#define NRES PIN_E3 // reset from IA4420, active low input
#define VDI PIN_A1
#define ARSSI PIN_A0
// Application I/O definitions:
#define TLED PIN_C5
#define RLED PIN_C4
#define LT PIN_E3 // Linktest button, active low input
#define NCMD PIN_C3 // Command mode, active low input
#endif
// Application constants:
#define PAYLOAD_LEN 40 // TX (RX) payload size
#define PACKET_LEN PAYLOAD_LEN + 4 // TX (RX) packet size ([AAAA]AA2DD4 + PL + payload)
#define TXBUF_LEN PACKET_LEN + 2 // TX buffer size (TX packet + 2 bytes dummy)
#define CIRCBUF_LEN 16
#define RF_DEV 90 // deviation used
//==============================================================
// RF specific definitions
//==============================================================
#ifdef BAND_434
#ifdef BAND_868 | BAND_915
#error Error: only one frequency band can be selected!
#endif
#define FW_VERSION "2.3 434MHz"
//define radio parameters
#define FREQ_Band 0x0010 //434MHz
#define FREQ_start 1332
#define FREQ_step 132
#define FREQ_maxid 3
#define MAX_FREQ "3"
#define BAND_SELECTED
#endif
#ifdef BAND_868
#ifdef BAND_434 | BAND_915
#error Error: only one frequency band can be selected!
#endif
#define FW_VERSION "2.3 868MHz"
//define radio parameters
#define FREQ_Band 0x0020 //868MHz
#define FREQ_start 710
#define FREQ_step 90
#define FREQ_maxid 13
#define MAX_FREQ "13"
#define BAND_SELECTED
#endif
#ifdef BAND_915
#ifdef BAND_434 | BAND_868
#error Error: only one frequency band can be selected!
#endif
#define FW_VERSION "2.3 915MHz"
//define radio parameters
#define FREQ_Band 0x0030 //915MHz
#define FREQ_start 112
#define FREQ_step 64
#define FREQ_maxid 59
#define MAX_FREQ "59"
#define BAND_SELECTED
#endif
#ifndef BAND_SELECTED
#error: Error: frequency band is not selected!
#endif
//==============================================================
// EEprom addresses
//==============================================================
#define EE_rf_ch 100
#define EE_rf_dr 101 // long
#define EE_rf_pwr 103
#define EE_rf_dev 104
//==============================================================
// Global variables:
//==============================================================
// IA4420 IT flags:
int8 ffit_rgit; // IT bit0
int8 por;
int8 ffof_rgur;
int8 wkup;
int8 ext;
int8 lbd; // IT bit5
// rf input/output buffers:
int8 RxPacket[PAYLOAD_LEN]; // Receive data puffer (payload only)
int8 RxPacketPtr; // Next byte to send
int8 RxPacketLen; // Tx packet size
int8 TxPacket[TXBUF_LEN]; // Transmit data puffer
int8 TxPacketPtr; // Next byte to send
// IA4420 SPI commands:
int16 Configuration_cmd;
int16 Frequency_cmd;
int16 Power_management_cmd;
int16 Receiver_control_cmd;
int16 Transmitter_control_cmd;
int16 Txreg_write_cmd;
int16 FIFO_cmd;
int16 Data_filter_cmd;
int16 Data_rate_cmd;
int16 AFC_cmd;
// RS232 comm.:
int8 CircBuf[CIRCBUF_LEN]; // RS232 circular input buffer
int8 i_ptr;
int8 o_ptr; // buffer write/read pointers
int8 BufChar; // Nr of unprocessed characters
// others:
int8 swit_10ms;
int8 rs232_timer;
int8 rs232_timeout;
int8 rs232_EOP;
int8 opmode;
//==============================================================
// Function declarations
//==============================================================
int16 set_frq(int8 ch);
int16 set_tx(int8 dev, int8 pwr);
int16 set_dr(int16 dr);
void send_cmd(int16 spicmd);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -