aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/can/global.h20
-rw-r--r--include/can/mcp2515.h36
-rw-r--r--include/can/software.h9
-rw-r--r--include/spi.h10
-rw-r--r--include/usart.h10
-rw-r--r--include/usi_spi.h66
6 files changed, 13 insertions, 138 deletions
diff --git a/include/can/global.h b/include/can/global.h
deleted file mode 100644
index 5d88fe6..0000000
--- a/include/can/global.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <stdint.h>
-
-#ifndef _IOE_CAN_GLOBAL_
-#define _IOE_CAN_GLOBAL_
-
-typedef struct {
- uint16_t id;
- uint8_t length;
- uint8_t data[8];
-} CanFrame;
-
-typedef struct {
- CanFrame **buffer;
- void *udata;
-} Can;
-
-
-void can_send(Can *can, CanFrame *frame);
-
-#endif /* _IOE_CAN_GLOBAL_ */
diff --git a/include/can/mcp2515.h b/include/can/mcp2515.h
deleted file mode 100644
index 59376f7..0000000
--- a/include/can/mcp2515.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#include <avr/io.h>
-#include <avr/interrupt.h>
-#include <stdint.h>
-
-#include "spi.h"
-#include "global.h"
-
-#ifndef _IOE_CAN_MCP2515_H_
-#define _IOE_CAN_MCP2515_H_
-#ifdef CONFIG_IOE_CAN_MCP2515
-#ifndef CONFIG_IOE_SPI
-#error "Please define CONFIG_IOE_SPI. MCP2515 requires SPI."
-#endif
-
-// TODO registers
-#define CAN_MCP2515_CANCTL
-// TODO buffers
-
-typedef struct {
- uint8_t group, mask;
-} CanMcp2515;
-
-int8_t can_mcp2515_init(CanMcp2515 * can, uint8_t group, uint8_t mask);
-
-void can_mcp2515_reset(CanMcp2515 * can);
-uint8_t can_mcp2515_read(CanMcp2515 * can, uint8_t address);
-uint8_t can_mcp2515_readrx(CanMcp2515 * can, uint8_t buffer);
-void can_mcp2515_write(CanMcp2515 * can, uint8_t address, uint8_t data);
-void can_mcp2515_loadrx(CanMcp2515 * can, uint8_t buffer, uint8_t data);
-uint8_t can_mcp2515_rdstat(CanMcp2515 * can);
-uint8_t can_mcp2515_rxstat(CanMcp2515 * can);
-void can_mcp2515_bitmod(CanMcp2515 * can, uint8_t address, uint8_t mask,
- uint8_t data);
-
-#endif /* CONFIG_IOE_CAN_MCP2515 */
-#endif /* _IOE_CAN_MCP2515_H_ */
diff --git a/include/can/software.h b/include/can/software.h
deleted file mode 100644
index b443e42..0000000
--- a/include/can/software.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <avr/io.h>
-#include <util/delay.h>
-#include <stdint.h>
-
-#ifndef _IOE_CAN_SOFTWARE_H_
-#define _IOE_CAN_SOFTWARE_H_
-
-
-#endif /* _IOE_CAN_SOFTWARE_H_ */
diff --git a/include/spi.h b/include/spi.h
index 8d51eb9..bdfce25 100644
--- a/include/spi.h
+++ b/include/spi.h
@@ -9,6 +9,11 @@
#define _IOE_SPI_H_
#ifdef CONFIG_SPI
+/*! \brief Modes definition for spi_init
+ *
+ * This enum is used by spi_init to define if SPI should be initialized as master
+ * or slave.
+ */
enum spiMode {
SPI_MODE_MASTER,
SPI_MODE_SLAVE
@@ -17,6 +22,10 @@ enum spiMode {
volatile extern int8_t _spi_busy;
volatile extern Mutex spi_mutex;
+/*! \brief Initializes SPI interface.
+ *
+ * \param mode Specify mode of SPI interface
+ */
static inline void spi_init(enum spiMode mode) {
_spi_busy = 0;
if (mode == SPI_MODE_MASTER) {
@@ -59,7 +68,6 @@ static inline void spi_expose(uint8_t data) {
SPDR = data;
}
-// Null terminated array
extern void (*spi_receive)(uint8_t data);
#endif /* CONFIG_SPI */
diff --git a/include/usart.h b/include/usart.h
index 3ba5382..a3f585a 100644
--- a/include/usart.h
+++ b/include/usart.h
@@ -17,12 +17,10 @@
#define USART_DATAOVERRUN _BV(DOR0)
#define USART_PARITYERROR _BV(UPE0)
-#if CONFIG_USART_INBUFFER_SIZE > 0
-#define _USART_INBUFFER
+#ifdef CONFIG_USART_INPUT_BUFFER
volatile IOEBUFFER(uint8_t, _ioe_usart_inbuffer, CONFIG_USART_INBUFFER_SIZE);
#endif
-#if CONFIG_USART_OUTBUFFER_SIZE > 0
-#define _USART_OUTBUFFER
+#ifdef CONFIG_USART_OUTPUT_BUFFER
volatile IOEBUFFER(uint8_t, _ioe_usart_outbuffer, CONFIG_USART_OUTBUFFER_SIZE);
#endif
@@ -46,10 +44,10 @@ static inline uint8_t usart_queryerror(void) {
static inline int8_t usart_busy(void) {
return _usart_busy;
}
-#ifdef _USART_INBUFFER
+#ifdef CONFIG_USART_INPUT_BUFFER
uint8_t usart_inbuffered(void);
#endif
-#ifdef _USART_OUTBUFFER
+#ifdef CONFIG_USART_OUTPUT_BUFFER
uint8_t usart_outbuffered(void);
#endif
#if (defined CONFIG_USART_INFILE) || (defined CONFIG_USART_OUTFILE)
diff --git a/include/usi_spi.h b/include/usi_spi.h
deleted file mode 100644
index 18534ab..0000000
--- a/include/usi_spi.h
+++ /dev/null
@@ -1,66 +0,0 @@
-#include <avr/io.h>
-#include <avr/interrupt.h>
-#include <stdint.h>
-
-#include "mcu/mcu_def.h"
-
-#ifndef _IOE_USI_SPI_H_
-#define _IOE_USI_SPI_H_
-
-#ifndef MCUSUPPORT_USI
-#error "No USI interface is known on your mcu."
-#endif
-
-enum usiSpiMode {
- // Device is initialized as master
- USI_SPI_MODE_MASTER,
- // Device is initialized as slave
- USI_SPI_MODE_SLAVE,
-};
-
-/*
- * Initialize SPI on USI device
- *
- * Parameters:
- * mode - Specify mode of SPI interface
- */
-void usi_spi_init(enum usiSpiMode mode);
-/*
- * Returns NULL when device is not busy.
- * When device is busy return values in non-zero.
- */
-int8_t usi_spi_busy(void);
-/*
- * Blocks processor until device is not busy.
- */
-void usi_spi_join(void);
-/*
- * Swap bytes with slave over SPI.
- * This function blocks execution until device isn't busy.
- * WARNING: Invoke this only when interface is initialized in MASTER mode.
- */
-uint8_t usi_spi_send(uint8_t data);
-/*
- * Swaps byte with slave over SPI.
- * This function isn't checking if device is busy, but it's not blocking execution.
- * WARNING: Invoke this only when interface is initialized in MASTER mode.
- */
-uint8_t usi_spi_transfer(uint8_t data);
-/*
- * Expose data for next master request.
- * Please don't use this when device is busy.
- * Best place to call this is usi_spi_retrieve().
- * WARNING: Invoke this only when interface is initialized in SLAVE mode.
- */
-void usi_spi_expose(uint8_t data);
-
-/*
- * This function must be defined by user.
- * This function is called every time transfer is finished.
- * And until return from this function interrupts are disabled.
- * WARNING: Please define this function in your code.
- */
-void usi_spi_receive(uint8_t data);
-
-
-#endif /* _IOE_USI_SPI_H_ */