Files
wordclock/code/main/hal/inc/ISerialBus.h
T
Matthias Mitscherlich a0d13f08c1 Started with a blank main file
- Added GPIO handling
- Added a logger class with additional static debug log handling

Tested, functional
2024-03-11 15:45:48 +01:00

104 lines
3.5 KiB
C++

// --------------------------------------------------------------------------------------------------------------------
/// \file ISerialBus.h
/// \brief File description
// --------------------------------------------------------------------------------------------------------------------
//
// vbchaos software design
//
// --------------------------------------------------------------------------------------------------------------------
/// $Revision: $
/// $Author: $
/// $Date: $
// (c) 2023 vbchaos
// --------------------------------------------------------------------------------------------------------------------
#ifndef MAIN_HAL_INC_ISERIALBUS_H_
#define MAIN_HAL_INC_ISERIALBUS_H_
/**
* ISerialBus implementation
* \defgroup ISerialBus
* \brief {group_description}
* \addtogroup {Layer}
*
* Detailed description
* @{
*/
// --------------------------------------------------------------------------------------------------------------------
// Include files
// --------------------------------------------------------------------------------------------------------------------
// CompilerIncludes
// All include files that are provided by the compiler directly
#include <stdint.h>
// ProjectIncludes
// All include files that are provided by the project
#include "FunctionStatus.h"
// --------------------------------------------------------------------------------------------------------------------
// Constant and macro definitions
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Type definitions.
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Function declarations
// --------------------------------------------------------------------------------------------------------------------
template<typename T>
class ISerialBus
{
// -----------------------------------------------------------------------------------------------------------------
// Public Section
// -----------------------------------------------------------------------------------------------------------------
public:
// Virtual Class Destructor (required for absolute virtual classes)
virtual ~ISerialBus() {}
FunctionStatus open() {status = OPEN; return FUNCTION_STATUS_OK;}
FunctionStatus close() {status = CLOSED; return FUNCTION_STATUS_OK;}
virtual FunctionStatus read(T* buffer, uint32_t length, uint32_t* actualLength) = 0;
virtual FunctionStatus write(T* buffer, uint32_t length) = 0;
// -----------------------------------------------------------------------------------------------------------------
// Protected Section
// -----------------------------------------------------------------------------------------------------------------
protected:
typedef enum
{
CLOSED = 0,
OPEN
} Status_t;
// The current open/close status of the interface
Status_t status;
// -----------------------------------------------------------------------------------------------------------------
// Private Section
// -----------------------------------------------------------------------------------------------------------------
private:
};
/** @} */
#endif /* MAIN_HAL_INC_ISERIALBUS_H_ */