Skip to content

Commit

Permalink
Replace type 'byte_t' (defined as 'unsigned char') by 'char' to fix an
Browse files Browse the repository at this point in the history
error that consisted in that the program does not properly copy the bytes
from the UART receive buffer to the 'hostcom' buffer.
  • Loading branch information
Jonan CM committed Oct 2, 2013
1 parent 98906c5 commit c9929ea
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 12 deletions.
6 changes: 3 additions & 3 deletions datastruc/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
* Type definition for a linear buffer.
*/
typedef struct {
byte_t data[BUFFER_SIZE];
int size;
int used;
char data[BUFFER_SIZE];
int size;
int used;
} buffer_t;

/**
Expand Down
2 changes: 1 addition & 1 deletion gpcore/hostcom.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void __attribute__((__interrupt__)) _U2RXInterrupt(void)
IFS1bits.U2RXIF = 0;
}

int hostcom_read_cmd(byte_t buf[], int size, bool_t *full)
int hostcom_read_cmd(char buf[], int size, bool_t *full)
{
int copied;
int i, j;
Expand Down
2 changes: 1 addition & 1 deletion gpcore/hostcom.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void __attribute__((__interrupt__)) _U2RXInterrupt(void);
*
* @returns Amount of bytes copied.
*/
int hostcom_read_cmd(byte_t buf[], int size, bool_t *full);
int hostcom_read_cmd(char buf[], int size, bool_t *full);

int hostcom_send(const char * const data, const int size);

Expand Down
4 changes: 2 additions & 2 deletions gpcore/shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ typedef union {
* Buffer where received commands are stored for the parser to read them.
*/
#define CMD_BUF_SIZE 128
byte_t cmd_buf[CMD_BUF_SIZE];
char cmd_buf[CMD_BUF_SIZE];

/**
* Position in the command buffer where the lexical analyzer is parsing.
Expand All @@ -66,7 +66,7 @@ token_value_t token_value;
*/
bool_t interactive;

byte_t cmd_name[2];
char cmd_name[2];
typedef struct {
bool_t present; // whether the parameter has been specified or not
token_type_t type; // type of the parameter
Expand Down
5 changes: 0 additions & 5 deletions types.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#ifndef TYPES_H
#define TYPES_H

#ifndef _BYTE_T
#define _BYTE_T
typedef unsigned char byte_t;
#endif

#ifndef _BOOL_T
#define _BOOL_T
typedef unsigned char bool_t;
Expand Down

0 comments on commit c9929ea

Please sign in to comment.