Updates on the IODevice structure.
Display and Logger fully functional. Keypad task completed - yet to be tested git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@219 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
/// @file led.h
|
||||
/// @brief File description
|
||||
@@ -34,6 +35,7 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "platform.h"
|
||||
#include "IODevice.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
@@ -47,6 +49,7 @@
|
||||
|
||||
struct Led
|
||||
{
|
||||
struct IODevice device;
|
||||
T_PL_GPIO ledGpio;
|
||||
bool status;
|
||||
};
|
||||
@@ -56,6 +59,8 @@ struct Led
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
ErrorStatus LED_construct (struct Led* self);
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* LED_turnOn
|
||||
* Turns on the LED identified with the ID
|
||||
@@ -68,7 +73,7 @@ struct Led
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern ErrorStatus LED_turnOn(struct Led* const led);
|
||||
extern ErrorStatus LED_turnOn(struct Led* led);
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* LED_turnOff
|
||||
@@ -82,6 +87,6 @@ extern ErrorStatus LED_turnOn(struct Led* const led);
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern ErrorStatus LED_turnOff(struct Led* const led);
|
||||
extern ErrorStatus LED_turnOff(struct Led* led);
|
||||
|
||||
#endif /* LED_INC_LED_H_ */
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "semphr.h"
|
||||
|
||||
#include "platform.h"
|
||||
#include "IODevice.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
@@ -69,7 +70,7 @@ struct Spi
|
||||
SPI_TypeDef* SPI_TypeDef;
|
||||
SPI_InitTypeDef SPI_InitStruct;
|
||||
T_PL_GPIO SPI_CLK;
|
||||
T_PL_GPIO* SPI_CE;
|
||||
const T_PL_GPIO* SPI_CE;
|
||||
T_PL_GPIO SPI_MOSI;
|
||||
T_PL_GPIO SPI_MISO;
|
||||
SemaphoreHandle_t spiClaimed; //! Semaphore to protect SPI bus
|
||||
@@ -97,13 +98,6 @@ struct SpiParameters
|
||||
UBaseType_t rxQueueSize;
|
||||
};
|
||||
|
||||
struct SpiDevice
|
||||
{
|
||||
struct Spi* spi;
|
||||
struct SpiParameters* spiParameters;
|
||||
T_PL_GPIO SPI_CE;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -121,7 +115,7 @@ struct SpiDevice
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern ErrorStatus SPI_construct(struct Spi* self, struct SpiParameters* parameters);
|
||||
extern ErrorStatus SPI_construct(struct Spi* self, const struct SpiParameters* parameters);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
@@ -154,19 +148,4 @@ extern ErrorStatus SPI_destruct(struct Spi* self);
|
||||
extern ErrorStatus SPI_getDefaultParameters(struct SpiParameters* parameters);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* Spi_Write
|
||||
* Write the data in buffer to the SPI in argument self
|
||||
*
|
||||
* @param self The UART class object
|
||||
* @param buffer Message string to send
|
||||
* @parm length Message length
|
||||
*
|
||||
* @return ErrorStatus SUCCESS if writing message was successful
|
||||
* ERROR otherwise
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern ErrorStatus SPI_write (struct SpiDevice* self, const uint8_t* buffer, int length);
|
||||
#endif /* MISC_INC_SPI_H_ */
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
/// @file spiDevice.h
|
||||
/// @brief File description
|
||||
// -----------------------------------------------------------------------------
|
||||
// Micro-Key bv
|
||||
// Industrieweg 28, 9804 TG Noordhorn
|
||||
// Postbus 92, 9800 AB Zuidhorn
|
||||
// The Netherlands
|
||||
// Tel: +31 594 503020
|
||||
// Fax: +31 594 505825
|
||||
// Email: support@microkey.nl
|
||||
// Web: www.microkey.nl
|
||||
// -----------------------------------------------------------------------------
|
||||
/// $Revision$
|
||||
/// $Author$
|
||||
/// $Date$
|
||||
// (c) 2015 Micro-Key bv
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
/// @defgroup {group_name} {group_description}
|
||||
/// Description
|
||||
|
||||
/// @file spiDevice.h
|
||||
/// @ingroup {group_name}
|
||||
|
||||
#ifndef PLATFORM_INC_SPIDEVICE_H_
|
||||
#define PLATFORM_INC_SPIDEVICE_H_
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Include files
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#include "IODevice.h"
|
||||
#include "spi.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
struct SpiDevice
|
||||
{
|
||||
struct IODevice device;
|
||||
struct Spi* spi;
|
||||
struct SpiParameters parameters;
|
||||
T_PL_GPIO SPI_CE;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
extern ErrorStatus SpiDevice_construct(struct SpiDevice* self, struct Spi* spi, const struct SpiParameters* parameters, T_PL_GPIO SPI_CE);
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* Spi_Write
|
||||
* Write the data in buffer to the SPI in argument self
|
||||
*
|
||||
* @param self The UART class object
|
||||
* @param buffer Message string to send
|
||||
* @parm length Message length
|
||||
*
|
||||
* @return ErrorStatus SUCCESS if writing message was successful
|
||||
* ERROR otherwise
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern ErrorStatus SpiDevice_write (const struct SpiDevice* self, const char* buffer, int length);
|
||||
|
||||
#endif /* PLATFORM_INC_SPIDEVICE_H_ */
|
||||
Reference in New Issue
Block a user