Project

General

Profile

Revision 1543

Added by Brad Neuman over 14 years ago

Added a bunch of debug prints to the library

View differences:

serial.c
108 108
int xbee_init() {
109 109

  
110 110
  if(xbee_initd) {
111
    DRAGONFLY_DEBUG_PRINT("ERROR: xbee already init'd\r\n");
111 112
    return ERROR_INIT_ALREADY_INITD;
112 113
  }
113 114

  
......
170 171
 **/
171 172
int xbee_putc(char c) {
172 173

  
173
  if(!xbee_initd)
174
  if(!xbee_initd) {
175
    DRAGONFLY_DEBUG_PRINT("ERROR: xbee not init'd\r\n"); 
174 176
    return ERROR_LIBRARY_NOT_INITD;
177
  }
175 178

  
176 179
  // Wait until buffer is clear for sending
177 180
  loop_until_bit_is_set(UCSR1A, UDRE1);
......
190 193
int usb_puts(char *s) {
191 194
  char *t = s;
192 195

  
193
  if(!usb_initd)
196
  if(!usb_initd) {
197
    DRAGONFLY_DEBUG_PRINT("ERROR: xbee not init'd\r\n"); 
194 198
    return ERROR_LIBRARY_NOT_INITD;
199
  }
195 200

  
196 201
  while (*t != 0) {
197 202
    usb_putc(*t);
......
210 215
int usb_puts_P (PGM_P s) {
211 216
    char buf;
212 217

  
213
    if(!usb_initd)
218
    if(!usb_initd) {
219
      DRAGONFLY_DEBUG_PRINT("ERROR: xbee not init'd\r\n"); 
214 220
      return ERROR_LIBRARY_NOT_INITD;
221
    }
215 222
	
216 223
    while (memcpy_P (&buf, s, sizeof (char)), buf!=0) {
217 224
        usb_putc (buf);
......
256 263
 **/
257 264
int xbee_getc(void) {
258 265

  
259
  if(!usb_initd)
266
  if(!usb_initd) {
267
    DRAGONFLY_DEBUG_PRINT("ERROR: xbee not init'd\r\n"); 
260 268
    return -1;
269
  }
261 270

  
262 271
  // Wait for the receive buffer to be filled
263 272
  loop_until_bit_is_set(UCSR1A, RXC1);
......
307 316
 * @see xbee_init, xbee_getc
308 317
 **/
309 318
int xbee_getc_nb(char *c) {
310
  if(!xbee_initd)
319
  if(!xbee_initd) {
320
    DRAGONFLY_DEBUG_PRINT("ERROR: xbee not init'd\r\n"); 
311 321
    return ERROR_LIBRARY_NOT_INITD;
322
  }
312 323

  
313 324
  // check if the receive buffer is filled
314 325
  if (UCSR1A & _BV(RXC1)) {

Also available in: Unified diff