Added SPI to K22F

Just copied from K64F the pinmap and removed SPI2, seems to be
identical. And apparantly had a typo in i2c which is fixed now.
pull/476/head
Sissors 2014-09-09 20:26:54 +02:00
parent 654929803b
commit 6585203559
4 changed files with 29 additions and 4 deletions

View File

@ -116,7 +116,6 @@ typedef enum {
typedef enum {
SPI_0 = 0,
SPI_1 = 1,
SPI_2 = 2,
} SPIName;
#ifdef __cplusplus

View File

@ -73,18 +73,44 @@ const PinMap PinMap_UART_RX[] = {
/************SPI***************/
const PinMap PinMap_SPI_SCLK[] = {
{PTD1 , SPI_0, 2},
{PTE2 , SPI_1, 2},
{PTA15, SPI_0, 2},
{PTB11, SPI_1, 2},
{PTC5 , SPI_0, 2},
{PTD5 , SPI_1, 7},
{NC , NC , 0}
};
const PinMap PinMap_SPI_MOSI[] = {
{PTD2 , SPI_0, 2},
{PTE1 , SPI_1, 2},
{PTE3 , SPI_1, 7},
{PTA16, SPI_0, 2},
{PTB16, SPI_1, 2},
{PTC6 , SPI_0, 2},
{PTD6 , SPI_1, 7},
{NC , NC , 0}
};
const PinMap PinMap_SPI_MISO[] = {
{PTD3 , SPI_0, 2},
{PTE1 , SPI_1, 7},
{PTE3 , SPI_1, 2},
{PTA17, SPI_0, 2},
{PTB17, SPI_1, 2},
{PTC7 , SPI_0, 2},
{PTD7 , SPI_1, 7},
{NC , NC , 0}
};
const PinMap PinMap_SPI_SSEL[] = {
{PTD0 , SPI_0, 2},
{PTE4 , SPI_1, 2},
{PTA14, SPI_0, 2},
{PTB10, SPI_1, 2},
{PTC4 , SPI_0, 2},
{PTD4 , SPI_1, 7},
{NC , NC , 0}
};

View File

@ -30,8 +30,8 @@
#define DEVICE_I2C 1
#define DEVICE_I2CSLAVE 1
#define DEVICE_SPI 0
#define DEVICE_SPISLAVE 0
#define DEVICE_SPI 1
#define DEVICE_SPISLAVE 1
#define DEVICE_CAN 0

View File

@ -251,7 +251,7 @@ void i2c_slave_mode(i2c_t *obj, int enable_slave) {
int i2c_slave_receive(i2c_t *obj) {
uint32_t i2c_addrs[] = I2C_BASE_ADDRS;
switch(HW_I2C_S_RD(i2c_addrs[obj->instance]) {
switch(HW_I2C_S_RD(i2c_addrs[obj->instance])) {
// read addressed
case 0xE6:
return 1;