ASCII Serial Com
Serial communication library between computers, microcontrollers, FPGAs, etc. Uses only ASCII. Not the most efficient protocol, but meant to be easy to read
Loading...
Searching...
No Matches
asc_exception.h
Go to the documentation of this file.
1#ifndef ASC_EXCEPTION_H
2#define ASC_EXCEPTION_H
3
4/** \file */
5
6//#define CEXCEPTION_T uint8_t
7//#define CEXCEPTION_NONE 0xFF
8
9#ifdef linux
10#define CEXCEPTION_NO_CATCH_HANDLER(id) \
11 fprintf(stderr, "Uncaught exception: %" PRIu8, id); \
12 exit(1);
13#endif
14
15#ifdef __AVR
16#define CEXCEPTION_NONE (0x5A5A)
17#endif
18
19#include "externals/CException.h"
20
21/** \brief Exception type to be used with CException
22 *
23 * These exception types can be used with Throw() and Catch()
24 *
25 */
27 ASC_ERROR_UNKOWN = 0,
28 ASC_ERROR_NO_ERROR = 1,
29 // ASC
30 ASC_ERROR_DATA_TOO_LONG = 0x10,
31 ASC_ERROR_CHECKSUM_PROBLEM = 0x11, // problem computing checksum
32 ASC_ERROR_INVALID_FRAME = 0x12,
33 ASC_ERROR_INVALID_FRAME_PERIOD = 0x13, // relating to no '.' or misplaced '.'
34 ASC_ERROR_NOT_HEX_CHAR = 0x14,
35 ASC_ERROR_COMMAND_NOT_IMPLEMENTED = 0x15,
36 ASC_ERROR_UNEXPECTED_COMMAND = 0x16,
37 ASC_ERROR_DATA_TOO_SHORT = 0x17,
38 // Register block
39 ASC_ERROR_REG_BLOCK_NULL = 0x20,
40 ASC_ERROR_REGNUM_OOB = 0x21, // reg number too large
41 ASC_ERROR_REGVAL_LEN = 0x22, // reg value the wrong number of bytes
42 // circular_buffer
43 ASC_ERROR_CB_OOB = 0x30, // Circular buffer index >= size
44 ASC_ERROR_CB_POP_EMPTY = 0x31,
45 ASC_ERROR_CB_BAD_CAPACITY = 0x32, // capacity not a power of 2
46 // I/O
47 ASC_ERROR_FILE_READ = 0x40,
48 ASC_ERROR_FILE_WRITE = 0x41,
49};
50
51#endif
asc_exception
Exception type to be used with CException.