Contiki-Inga 3.x
|
Macros | |
#define | MSPI_BUS_MANAGER 1 |
#define | MSPI_MODE_0 (0x00) |
#define | MSPI_MODE_1 (0x02) |
#define | MSPI_MODE_2 (0x01) |
#define | MSPI_MODE_3 (0x03) |
#define | MSPI_BAUD_MAX (0x00) |
#define | MSPI_BAUD_2MBPS (0x01) |
#define | MSPI_BAUD_1MBPS (0x03) |
Functions | |
void | mspi_init (uint8_t cs, uint8_t mode, uint16_t baud) |
Initialize the selected USART in the MSPI mode. More... | |
void | mspi_chip_select (uint8_t cs) |
This function enables the chip select by setting the needed I/O pins (BCD-Code) More... | |
void | mspi_chip_release (uint8_t cs) |
This function disables the chip select. More... | |
uint8_t | mspi_transceive (uint8_t data) |
This function can be use either to transmit or receive data via spi. More... | |
void | mspi_deinit (void) |
This function will set all MSPI registers to their default values. | |
void | mspi_mgr_add (uint8_t cs, uint8_t mode, uint16_t baud) |
This function add a device to the SPI device table and calculates the specific checksum. More... | |
void | mspi_mgr_change_mode (spi_dev new_config) |
This function changes the SPI configuration. More... | |
There are a lot of possibilities to realize a Serial Peripheral Interface (SPI) with the ATmega1284p, but the hardware SPI is used by the transceiver chip AT86rf230. In combination with contiki it is not possible to build up an SPI Bus with this hardware SPI. A software SPI would be a solution, but the ATmega1284p provides another opportunity. The MSPI (Maser SPI) is an alternative function of the USART. There are two independent hardware USART, so it is possible to use one for the default debug RS232 interface, while the other one is free to be used as an MSPI. The only difference between an normal SPI and the MSPI is, that MSPI only supports slaves on the bus.
#define MSPI_BAUD_1MBPS (0x03) |
#define MSPI_BAUD_2MBPS (0x01) |
2Mbps MSPI Baud Rate
Definition at line 139 of file mspi.h.
Referenced by sdcard_init().
#define MSPI_BAUD_MAX (0x00) |
Maximum MSPI Baud Rate [bps]
Definition at line 134 of file mspi.h.
Referenced by adxl345_available(), at45db_init(), and mpl115a_init().
#define MSPI_BUS_MANAGER 1 |
#define MSPI_MODE_0 (0x00) |
MSPI Mode 0
Definition at line 100 of file mspi.h.
Referenced by mpl115a_init(), and sdcard_init().
#define MSPI_MODE_1 (0x02) |
#define MSPI_MODE_2 (0x01) |
#define MSPI_MODE_3 (0x03) |
MSPI Mode 3
Definition at line 124 of file mspi.h.
Referenced by adxl345_available(), and at45db_init().
void mspi_chip_release | ( | uint8_t | cs | ) |
This function disables the chip select.
cs | Chip Select: Device ID |
Definition at line 145 of file mspi.c.
Referenced by adxl345_available(), adxl345_get(), adxl345_read(), adxl345_write(), at45db_buffer_to_page(), at45db_busy_wait(), at45db_erase_block(), at45db_erase_chip(), at45db_erase_page(), at45db_init(), at45db_page_to_buf(), at45db_read_buffer(), at45db_read_page_bypassed(), at45db_write_buffer(), at45db_write_page(), mpl115a_cmd(), mpl115a_init(), sdcard_erase_blocks(), sdcard_init(), sdcard_read_block(), sdcard_read_csd(), sdcard_set_CRC(), sdcard_write_block(), sdcard_write_multi_block_next(), sdcard_write_multi_block_start(), and sdcard_write_multi_block_stop().
void mspi_chip_select | ( | uint8_t | cs | ) |
This function enables the chip select by setting the needed I/O pins (BCD-Code)
cs | Chip Select: Device ID |
Definition at line 131 of file mspi.c.
References mspi_mgr_change_mode().
Referenced by adxl345_get(), adxl345_read(), adxl345_write(), at45db_busy_wait(), at45db_erase_block(), at45db_erase_chip(), at45db_erase_page(), at45db_init(), at45db_write_cmd(), mpl115a_cmd(), sdcard_erase_blocks(), sdcard_init(), sdcard_read_block(), sdcard_read_csd(), sdcard_set_CRC(), sdcard_write_block(), sdcard_write_multi_block_next(), sdcard_write_multi_block_start(), and sdcard_write_multi_block_stop().
void mspi_init | ( | uint8_t | cs, |
uint8_t | mode, | ||
uint16_t | baud | ||
) |
Initialize the selected USART in the MSPI mode.
mode | Select the (M)SPI mode (MSPI_MODE_0 ... MSPI_MODE_3) |
baud | The MSPI BAUD rate. Sometimes it is necessary to reduce the SCK. Use MSPI_BAUD_MAX in common case. |
Definition at line 109 of file mspi.c.
References mspi_mgr_add().
Referenced by adxl345_available(), at45db_init(), mpl115a_init(), and sdcard_init().
void mspi_mgr_add | ( | uint8_t | cs, |
uint8_t | mode, | ||
uint16_t | baud | ||
) |
This function add a device to the SPI device table and calculates the specific checksum.
cs | Chip Select: Device ID |
mode | Select the (M)SPI mode (MSPI_MODE_0 ... MSPI_MODE_3) |
baud | The MSPI BAUD rate. Sometimes it is necessary to reduce the SCK. Use MSPI_BAUD_MAX in common case. |
Definition at line 187 of file mspi.c.
Referenced by mspi_init().
void mspi_mgr_change_mode | ( | spi_dev | new_config | ) |
This function changes the SPI configuration.
spi_dev | The specified entry of the SPI Device Table |
Definition at line 195 of file mspi.c.
Referenced by mspi_chip_select().
uint8_t mspi_transceive | ( | uint8_t | data | ) |
This function can be use either to transmit or receive data via spi.
data |
|
Definition at line 152 of file mspi.c.
Referenced by adxl345_get(), adxl345_read(), adxl345_write(), at45db_busy_wait(), at45db_init(), at45db_read_buffer(), at45db_read_page_bypassed(), at45db_write_buffer(), at45db_write_cmd(), at45db_write_page(), mpl115a_cmd(), sdcard_init(), sdcard_read_block(), sdcard_read_csd(), sdcard_write_block(), sdcard_write_cmd(), sdcard_write_multi_block_next(), and sdcard_write_multi_block_stop().