BayEOSArduino Library
diagnostics.h
1 /* Arduino SPIMemory Library v.3.4.0
2  * Copyright (C) 2019 by Prajwal Bhattaram
3  * Created by Prajwal Bhattaram - 19/05/2015
4  * Modified by Prajwal Bhattaram - 02/06/2019
5  *
6  * This file is part of the Arduino SPIMemory Library. This library is for
7  * Flash and FRAM memory modules. In its current form it enables reading,
8  * writing and erasing data from and to various locations;
9  * suspending and resuming programming/erase and powering down for low power operation.
10  *
11  * This Library is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation, either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * This Library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License v3.0
22  * along with the Arduino SPIMemory Library. If not, see
23  * <http://www.gnu.org/licenses/>.
24  */
25 
26  #ifndef DIAGNOSTICS_H
27  #define DIAGNOSTICS_H
28 
29  #include "SPIMemory.h"
30  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
31  // List of Error codes //
32  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
33 
34  #define SUCCESS 0x00
35  #define CALLBEGIN 0x01
36  #define UNKNOWNCHIP 0x02
37  #define UNKNOWNCAP 0x03
38  #define CHIPBUSY 0x04
39  #define OUTOFBOUNDS 0x05
40  #define CANTENWRITE 0x06
41  #define PREVWRITTEN 0x07
42  #define LOWRAM 0x08
43  #define SYSSUSPEND 0x09
44  #define ERRORCHKFAIL 0x0A
45  #define NORESPONSE 0x0B
46  #define UNSUPPORTEDFUNC 0x0C
47  #define UNABLETO4BYTE 0x0D
48  #define UNABLETO3BYTE 0x0E
49  #define CHIPISPOWEREDDOWN 0x0F
50  #define NOSFDP 0x10
51  #define NOSFDPERASEPARAM 0x11
52  #define NOSFDPERASETIME 0x12
53  #define NOSFDPPROGRAMTIMEPARAM 0x13
54  #define NOCHIPSELECTDECLARED 0x14
55  #define UNKNOWNERROR 0xFE
56  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
57 
58  class Diagnostics {
59  public:
60  //------------------------------------ Constructor ------------------------------------//
61 
62  Diagnostics(void){};
63  ~Diagnostics(void){};
64  //------------------------------- Public functions -----------------------------------//
65  void troubleshoot(uint8_t _code, bool printoverride = false);
66 
67  uint8_t errorcode;
68  private:
69  void _printErrorCode(void);
70  void _printSupportLink(void);
71 
72  };
73 
74  extern Diagnostics diagnostics;
75 
76  #endif
Definition: diagnostics.h:58