Subversion Repositories Code-Repo

Compare Revisions

Ignore whitespace Rev 113 → Rev 114

/Classwork/ECE4534 - Embedded Systems/PIC 26J11/buffer.c
1,5 → 1,6
#include "buffer.h"
#include "maindefs.h"
#include "pwm.h"
 
#pragma udata buffer
unsigned char buffer[BUFFER_SIZE];
17,6 → 18,7
char buffer_insert_one(unsigned char c) {
if (BUFFER_SIZE - buffer_data->stored_length == 0) {
DBG_PRINT_BUFFER("Buffer: (ERROR) Not enough free space for insert\r\n");
pwm_LED_on(); // Turn on LED to indicate full buffer
return -1;
}
 
39,6 → 41,7
// Make sure we have enough space to store message
if (length > BUFFER_SIZE - buffer_data->stored_length) {
DBG_PRINT_BUFFER("Buffer: (ERROR) Not enough free space for insert\r\n");
pwm_LED_on(); // Turn on LED to indicate full buffer
return -1;
}
 
63,6 → 66,7
// Make sure requested data is less than size of stored data
if (length > buffer_data->stored_length) {
DBG_PRINT_BUFFER("Buffer: (ERROR) Read length exceedes stored length\r\n");
pwm_LED_on(); // Turn on LED to indicate full buffer
return -1;
}