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

📄 msp430-fw-console.c

📁 老外用DDSAD9854和MSP430做的一个收音机的源程序.
💻 C
字号:
//===================================================================
//
//  MSP430F149 based direct digital conversion
//  software defined radio receiver
//
//  (C) 2005 Jan Florian Wagner OH2GHR, jwagner@cc.hut.fi
//  http://users.tkk.fi/~jwagner/electr/dc-rx/
//
//  Firmware Version 1.03
//
//  Licence: free as per GNU GPL
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//  
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//  
//  For further details see the included GPL.TXT 
//  or go to http://www.gnu.org/copyleft/gpl.html  
//
//===================================================================
//
//  User keyboard and PC serial control commands.
//  The keyboard scan codes are decoded for Finnish/Swedish keyboards,
//  other keyboards may or may not decode correctly.
//
//  Command syntax:
//  HELP              list of commands (without the debug commands)
//  INFO              progam version info
//  FREQ mmkkkhhh     set the frequency
//  STEP n[nn][k]     set frequency step size, e.g. STEP 15k
//  WHEEL {+|-}nn     turn the wheel, e.g. WHEEL +15
//  BAND n[n][m]      switch to start of freq band, e.g. BAND 20m
//  ...
//  Debug commands: DUMP DDS
//

#define ECHO_PCCONS     // define to send result of command over serial port
#define ECHO_PC_TO_LCD  // define to show PC commands on the LCD

// debug flags, comment out when not needed
//#define DEBUG_KBDCONS             // (currently unused)
//#define DEBUG_KBDCONS_SCANCODES   // define to dump keyboard scancodes to PC

#include "MSP430-fw-stdincludes.h"

// local funcs
unsigned char  parseCmdString (unsigned char cmdBuf[]);
unsigned char  strSemiComp (char *str1, char *str2);

// buffers
volatile unsigned char  pcCmdBuf[MAX_CMD_LEN+1];
volatile unsigned char  pcCmdBufPos;
volatile char           pcCmdEOL;

volatile unsigned char  kbdCmdBuf[MAX_CMD_LEN+1];
volatile unsigned char  kbdCmdBufPos;
volatile char           kbdFlags;
#define  FLAG_X   BIT0     // 1=special char follows
#define  FLAG_KR  BIT1     // 1=key release event/char follows
#define  FLAG_EOL BIT2     // 1=got full cmd line (after ENTER)

// ACK/NACK responses send back over the serial port
const char* PC_OK    = "OK";
const char* PC_NACK  = "NACK";

// -- scan code to ascii and internal keydef tables
//
// extended chars, internal codes used in this prog
//  0x00 none    0x01 left alt  0x02 left shift  0x03 left ctrl  0x04 enter
//  0x05 backspc 0x06 esc       0x07 num lock    0x08 scoll lock 0x09 end
//  0x0a arr lft 0x0b home      0x0c insert      0x0d arr down   0x0e arr right
//  0x0f arr up  0x10 num '0'   ... 0x19 num'9'  0x1a down       0x1b up
#define ScancodeLUT_START 0x15
const unsigned char ScancodeLUT[] = {  // table starts at 0x15 !! and the keyboard is FINNISH/SWEDISH...
   'q', '1',  0, 0, 0, 'z', 's', 'a', 'w', '2', 0,  // 0x15 - 0x1F
   0, 'c', 'x', 'd', 'e', '4', '3', 0, 0, ' ', 'v', 'f', 't', 'r', '5', 0, // 0x20-0x2F
   0, 'n', 'b', 'h', 'g', 'y', '6', 0, 0, 0, 'm', 'j', 'u', '7', '8', 0, // 0x30-0x3F
   0, ',', 'k', 'i', 'o', '0', '9', 0, 0, '.', '-', 'l', '

⌨️ 快捷键说明

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