Skip to content

Commit

Permalink
v0.4: added FctERR module
Browse files Browse the repository at this point in the history
  • Loading branch information
SMFSW committed May 4, 2017
1 parent 2665c7d commit ea92c01
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 0 deletions.
19 changes: 19 additions & 0 deletions FctERR.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*!\file FctERR.c
** \author SMFSW
** \version v0.4
** \date 2017
** \copyright MIT (c) 2017, SMFSW
** \brief errors to SMFSW FctERR code
**/

#include "FctERR.h"


FctERR HALERRtoFCTERR(HAL_StatusTypeDef Status)
{
if (Status == HAL_OK) return ERR_OK;
else if (Status == HAL_ERROR) return ERR_FAULT;
else if (Status == HAL_BUSY) return ERR_BUSY;
else if (Status == HAL_TIMEOUT) return ERR_TIMEOUT;
else return ERR_FAULT;
}
63 changes: 63 additions & 0 deletions FctERR.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*!\file FctERR.h
** \author SMFSW
** \version v0.4
** \date 2017
** \copyright MIT (c) 2017, SMFSW
** \brief errors to SMFSW FctERR declarations
**/
/****************************************************************/
#ifndef __FCTERR_H
#define __FCTERR_H

#include "sarmfsw.h"
#include CMSIS_INC
/****************************************************************/


/*!\enum EnumFctERR
** \brief Enum of high level functions return state
**/
typedef enum __attribute__((__packed__)) EnumFctERR{
ERR_OK = 0U, //!< OK
ERR_SPEED = 1U, //!< This device does not work in the active speed mode.
ERR_RANGE = 2U, //!< Parameter out of range.
ERR_VALUE = 3U, //!< Parameter of incorrect value.
ERR_OVERFLOW = 4U, //!< Timer overflow.
ERR_MATH = 5U, //!< Overflow during evaluation.
ERR_ENABLED = 6U, //!< Device is enabled.
ERR_DISABLED = 7U, //!< Device is disabled.
ERR_BUSY = 8U, //!< Device is busy.
ERR_NOTAVAIL = 9U, //!< Requested value or method not available.
ERR_RXEMPTY = 10U, //!< No data in receiver.
ERR_TXFULL = 11U, //!< Transmitter is full.
ERR_BUSOFF = 12U, //!< Bus not available.
ERR_OVERRUN = 13U, //!< Overrun error is detected.
ERR_FRAMING = 14U, //!< Framing error is detected.
ERR_PARITY = 15U, //!< Parity error is detected.
ERR_NOISE = 16U, //!< Noise error is detected.
ERR_IDLE = 17U, //!< Idle error is detected.
ERR_FAULT = 18U, //!< Fault error is detected.
ERR_BREAK = 19U, //!< Break char is received during communication.
ERR_CRC = 20U, //!< CRC error is detected.
ERR_ARBITR = 21U, //!< A node lost arbitration. This error occurs if two nodes start transmission at the same time.
ERR_PROTECT = 22U, //!< Protection error is detected.
ERR_UNDERFLOW = 23U, //!< Underflow error is detected.
ERR_UNDERRUN = 24U, //!< Underrun error is detected.
ERR_COMMON = 25U, //!< Common error of a device.
ERR_LINSYNC = 26U, //!< LIN synchronization error is detected.
ERR_FAILED = 27U, //!< Requested functionality or process failed.
ERR_QFULL = 28U, //!< Queue is full.
ERR_CMD = 29U, //!< Command error is detected
ERR_TIMEOUT = 30U, //!< Abort on timeout error
ERR_NOTIMPLEM = 31U, //!< Function not implemented error
ERR_MEMORY = 32U, //!< Memory error
ERR_INSTANCE = 33U //!< Instance error
}FctERR;


FctERR HALERRtoFCTERR(HAL_StatusTypeDef Status);


/****************************************************************/
#endif /* __FCTERR_H */
/****************************************************************/

0 comments on commit ea92c01

Please sign in to comment.