debug.c
来自「at51系列单片机编程源码」· C语言 代码 · 共 51 行
C
51 行
/* ---------------------------------------------------------------------------- * debug.c * this module contains debugging functions * * Copyright 2003/2004 * * 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. * ----------------------------------------------------------------------------*/#ifdef DEBUG#include <stdio.h>#include <unistd.h>#include "isp-at89.h"#define dbg_index_max 150unsigned int dbg_index;char dbg_reset[dbg_index_max];char dbg_miso[dbg_index_max];char dbg_mosi[dbg_index_max];char dbg_sck[dbg_index_max];voiddebug_resetbuffer(){ int i; dbg_index = 0; for (i=0; i < dbg_index_max; i++) { dbg_miso[i] = dbg_mosi[i] = dbg_sck[i] = dbg_reset[i] = 0; }}voiddebug_adddata(unsigned char data, unsigned char status){ dbg_reset[dbg_index] = (data & RESET) ? '-' : '_'; dbg_sck[dbg_index] = (data & SCK) ? '-' : '_'; dbg_mosi[dbg_index] = (data & MOSI) ? '-' : '_'; dbg_miso[dbg_index] = ((status >> MISO_BIT) && 1) ? '-' : '_'; dbg_index++; dbg_miso[dbg_index] = dbg_mosi[dbg_index] = dbg_sck[dbg_index] = dbg_reset[dbg_index]= 0;}voiddebug_printbuffer(int result){ printf("\nRESET: _%s_\nSCK : _%s_\nMOSI : _%s_\nMISO : _%s_ %06x\n\n", dbg_reset, dbg_sck, dbg_mosi, dbg_miso, result);}#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?