Microchip® Advanced Software Framework

at45dbx_hal_spi.h File Reference

Connection of the AT45DBX DataFlash to SPI interface driver.

This file manages the connection of the AT45dbx DataFlash driver to an SPI service (could be spi master service or usart in spi mode). The SPI service selection depends on AT45DBX_USES_SPI_MASTER_SERVICE or AT45DBX_USES_USART_SPI_SERVICE in conf_at45dbx.h

Copyright (c) 2010-2018 Microchip Technology Inc. and its subsidiaries.

#include "conf_at45dbx.h"

Macros

#define AT45DBX_CS_ID(slot, unused)   { .id = AT45DBX_CS##slot},
 
#define AT45DBX_DESELECT(slot, unused)
 
#define AT45DBX_SELECT(slot, unused)
 

Functions to connect the DataFlash driver with the SPI Multiple-Sector Access Functions

#define at45dbx_drv_device   ATPASTE2(driver, _device)
 
#define at45dbx_drv_setup_device   ATPASTE2(driver, _setup_device)
 
#define at45dbx_drv_select_device   ATPASTE2(driver, _select_device)
 
#define at45dbx_drv_deselect_device   ATPASTE2(driver, _deselect_device)
 
#define at45dbx_drv_write_packet   ATPASTE2(driver, _write_packet)
 
#define at45dbx_drv_read_packet   ATPASTE2(driver, _read_packet)
 
#define AT45DBX_CS0   AT45DBX_CS
 
static struct at45dbx_drv_device at45dbx_devices []
 
void at45dbx_spi_init (void)
 Initialize SPI external resource for AT45dbx DataFlash driver. More...
 
void at45dbx_spi_select_device (uint8_t mem_id)
 Select one external DataFlash component. More...
 
void at45dbx_spi_deselect_device (uint8_t mem_id)
 Unselect one external DataFlash component. More...
 
void at45dbx_spi_write_byte (uint8_t data)
 Send one byte to the DataFlash. More...
 
void at45dbx_spi_read_byte (uint8_t *data)
 Get one byte (read) from the DataFlash. More...
 
void at45dbx_spi_read_packet (void const *data, size_t len)
 Receive a sequence of bytes from a DataFlash. More...
 
void at45dbx_spi_write_packet (void const *data, size_t len)
 Send a sequence of bytes to a DataFlash from. More...
 

#define AT45DBX_CS0   AT45DBX_CS
#define AT45DBX_CS_ID (   slot,
  unused 
)    { .id = AT45DBX_CS##slot},
#define AT45DBX_DESELECT (   slot,
  unused 
)
Value:
case slot:\
at45dbx_drv_deselect_device(AT45DBX_SPI_MODULE, &at45dbx_devices[slot]); \
break;
static struct at45dbx_drv_device at45dbx_devices[]
Definition: at45dbx_hal_spi.h:83
#define at45dbx_drv_deselect_device
Definition: at45dbx_hal_spi.h:77

Referenced by at45dbx_spi_deselect_device().

#define at45dbx_drv_deselect_device   ATPASTE2(driver, _deselect_device)
#define at45dbx_drv_device   ATPASTE2(driver, _device)
#define at45dbx_drv_read_packet   ATPASTE2(driver, _read_packet)
#define at45dbx_drv_select_device   ATPASTE2(driver, _select_device)
#define at45dbx_drv_setup_device   ATPASTE2(driver, _setup_device)
#define at45dbx_drv_write_packet   ATPASTE2(driver, _write_packet)
#define AT45DBX_SELECT (   slot,
  unused 
)
Value:
case slot:\
at45dbx_drv_setup_device(AT45DBX_SPI_MODULE, &at45dbx_devices[slot],\
SPI_MODE_0, AT45DBX_SPI_MASTER_SPEED, 0);\
at45dbx_drv_select_device(AT45DBX_SPI_MODULE, &at45dbx_devices[slot]); \
break;
static struct at45dbx_drv_device at45dbx_devices[]
Definition: at45dbx_hal_spi.h:83
#define at45dbx_drv_select_device
Definition: at45dbx_hal_spi.h:76
#define SPI_MODE_0
SPI mode 0.
Definition: sam_spi/spi_master.h:96
#define at45dbx_drv_setup_device
Definition: at45dbx_hal_spi.h:75

Referenced by at45dbx_spi_select_device().

struct at45dbx_drv_device at45dbx_devices[]
static
Initial value:
= {
#define AT45DBX_CS_ID(slot, unused)
}