// ***************************************************************************
// Program - Fong EKG v0.96
// Function - Testing Olimex EKG
// Author - TL Fong
// Build - 2013.12.02.01
// Date - 2013dec01hkt0959
// Hardware - WuyinS/Olimex/CooCox/MagicBlue/WHUT/Somy LPC1114/C14/301
// Olimex EKG/EMG R.B 2011
// Software - CoIDE 1.7.5, CoLinkEx 1.1, Flash Magic v7.66, GCC ARM 4.7
// **************************************************************************
#include "test050.h"
// ***************************************************************************
// Main Function
// ***************************************************************************
int main()
{
checkSpiPortPinAssignment();
}
// ***************************************************************************
// End
// ***************************************************************************
// ***********************************************************************
// test050.h 2013dec03hkt1043
// ***********************************************************************
#include "led050.h"
#include "key050.h"
#include "adc050.h"
#include "eeprom050.h"
#include "spi080.h"
#include "mled080.h"
#define DEBUG 1
#define NO_DEBUG 0
void checkSpiPortPinAssignment()
{
checkSpiPortPinAssignmentV097();
}
// ***************************************************************************
// End
// ***************************************************************************
// ***********************************************************************
// spi080.h 2013dec03hkt1045
// ***********************************************************************
#include "gpio050.h"
#include "led050.h"
#include "lpc11xx_ssp.h"
#include "semihosting.h"
#include "stdio.h"
#include "config050.h"
#ifndef SPI_HEADER_SEEN
#define SPI_HEADER_SEEN
// *** SPI #defines ***
#define SPI_SLAVE_SELECT_TOTAL 9
#define SPI_CHANNEL_TOTAL 2
#define SPI_CHANNEL_0 0
#define SPI_CHANNEL_1 1
#define SLAVE_SELECT_0 0
#define SLAVE_SELECT_1 1
#define SLAVE_SELECT_2 2
#define SLAVE_SELECT_3 3
#define SLAVE_SELECT_4 4
#define SLAVE_SELECT_5 5
#define SLAVE_SELECT_6 6
#define SLAVE_SELECT_7 8
#define SLAVE_SELECT_8 8
typedef int slaveSelectPortPinArray[2]; // PORT_INDEX = 0, PIN_INDEX = 1
typedef slaveSelectPortPinArray *slaveSelectPortPinArrayPointerArray[SPI_SLAVE_SELECT_TOTAL];
typedef slaveSelectPortPinArrayPointerArray *slaveSelectPortPinArrayPointerArrayPointerArray[SPI_CHANNEL_TOTAL];
slaveSelectPortPinArray SlaveSelectPortPinArray00 = {PORT0, PIN2};
slaveSelectPortPinArray SlaveSelectPortPinArray01 = {PORT3, PIN0};
slaveSelectPortPinArray SlaveSelectPortPinArray02 = {PORT3, PIN1};
slaveSelectPortPinArray SlaveSelectPortPinArray03 = {PORT3, PIN2};
slaveSelectPortPinArray SlaveSelectPortPinArray04 = {PORT3, PIN3};
slaveSelectPortPinArray SlaveSelectPortPinArray05 = {PORT2, PIN6};
slaveSelectPortPinArray SlaveSelectPortPinArray06 = {PORT2, PIN7};
slaveSelectPortPinArray SlaveSelectPortPinArray07 = {PORT2, PIN8};
slaveSelectPortPinArray SlaveSelectPortPinArray08 = {PORT2, PIN9};
slaveSelectPortPinArray SlaveSelectPortPinArray10 = {PORT2, PIN0};
slaveSelectPortPinArray SlaveSelectPortPinArray11 = {PORT3, PIN0};
slaveSelectPortPinArray SlaveSelectPortPinArray12 = {PORT3, PIN1};
slaveSelectPortPinArray SlaveSelectPortPinArray13 = {PORT3, PIN2};
slaveSelectPortPinArray SlaveSelectPortPinArray14 = {PORT3, PIN3};
slaveSelectPortPinArray SlaveSelectPortPinArray15 = {PORT2, PIN6};
slaveSelectPortPinArray SlaveSelectPortPinArray16 = {PORT2, PIN7};
slaveSelectPortPinArray SlaveSelectPortPinArray17 = {PORT2, PIN8};
slaveSelectPortPinArray SlaveSelectPortPinArray18 = {PORT2, PIN9};
slaveSelectPortPinArrayPointerArray SlaveSelectPortPinArrayPointerArrayWuyinsSpi0 = \
{
&SlaveSelectPortPinArray00, \
&SlaveSelectPortPinArray01, \
&SlaveSelectPortPinArray02, \
&SlaveSelectPortPinArray03, \
&SlaveSelectPortPinArray04, \
&SlaveSelectPortPinArray05, \
&SlaveSelectPortPinArray06, \
&SlaveSelectPortPinArray07, \
&SlaveSelectPortPinArray08
};
slaveSelectPortPinArrayPointerArray SlaveSelectPortPinArrayPointerArrayWuyinsSpi1 = \
{
&SlaveSelectPortPinArray10, \
&SlaveSelectPortPinArray11, \
&SlaveSelectPortPinArray12, \
&SlaveSelectPortPinArray13, \
&SlaveSelectPortPinArray14, \
&SlaveSelectPortPinArray15, \
&SlaveSelectPortPinArray16, \
&SlaveSelectPortPinArray17, \
&SlaveSelectPortPinArray18
};
slaveSelectPortPinArrayPointerArrayPointerArray SlaveSelectPortPinArrayPointerArrayPointerArrayWuyinsSpi = \
{
&SlaveSelectPortPinArrayPointerArrayWuyinsSpi0, \
&SlaveSelectPortPinArrayPointerArrayWuyinsSpi1
};
void checkSpiPortPinAssignmentV097()
{
printf("\n*** Check SPI slave select port pin assignment ***\n\n");
printf("\n*** SlaveSelectPortPinArray00 = %d,%d \n\n", \
SlaveSelectPortPinArray00[PORT_INDEX], \
SlaveSelectPortPinArray00[PIN_INDEX]);
printf("\n*** SlaveSelectPortPinArray08 = %d,%d \n\n", \
SlaveSelectPortPinArray08[PORT_INDEX], \
SlaveSelectPortPinArray08[PIN_INDEX]);
printf("\n*** SlaveSelectPortPinArray00 = %d,%d \n\n", \
(*SlaveSelectPortPinArrayPointerArrayWuyinsSpi0[SLAVE_SELECT_0])[PORT_INDEX], \
(*SlaveSelectPortPinArrayPointerArrayWuyinsSpi0[SLAVE_SELECT_0])[PIN_INDEX]);
printf("\n*** SlaveSelectPortPinArray08 = %d,%d \n\n", \
(*SlaveSelectPortPinArrayPointerArrayWuyinsSpi0[SLAVE_SELECT_8])[PORT_INDEX], \
(*SlaveSelectPortPinArrayPointerArrayWuyinsSpi0[SLAVE_SELECT_8])[PIN_INDEX]);
printf("\n*** SlaveSelectPortPinArray00 = %d,%d \n\n", \
(*(*SlaveSelectPortPinArrayPointerArrayPointerArrayWuyinsSpi[SPI_CHANNEL_0])[SLAVE_SELECT_0])[PORT_INDEX], \
(*(*SlaveSelectPortPinArrayPointerArrayPointerArrayWuyinsSpi[SPI_CHANNEL_0])[SLAVE_SELECT_0])[PIN_INDEX]);
printf("\n*** SlaveSelectPortPinArray08 = %d,%d \n\n", \
(*(*SlaveSelectPortPinArrayPointerArrayPointerArrayWuyinsSpi[SPI_CHANNEL_0])[SLAVE_SELECT_8])[PORT_INDEX], \
(*(*SlaveSelectPortPinArrayPointerArrayPointerArrayWuyinsSpi[SPI_CHANNEL_0])[SLAVE_SELECT_8])[PIN_INDEX]);
printf("\n*** SlaveSelectPortPinArray10 = %d,%d \n\n", \
(*(*SlaveSelectPortPinArrayPointerArrayPointerArrayWuyinsSpi[SPI_CHANNEL_1])[SLAVE_SELECT_0])[PORT_INDEX], \
(*(*SlaveSelectPortPinArrayPointerArrayPointerArrayWuyinsSpi[SPI_CHANNEL_1])[SLAVE_SELECT_0])[PIN_INDEX]);
printf("\n*** SlaveSelectPortPinArray18 = %d,%d \n\n", \
(*(*SlaveSelectPortPinArrayPointerArrayPointerArrayWuyinsSpi[SPI_CHANNEL_1])[SLAVE_SELECT_8])[PORT_INDEX], \
(*(*SlaveSelectPortPinArrayPointerArrayPointerArrayWuyinsSpi[SPI_CHANNEL_1])[SLAVE_SELECT_8])[PIN_INDEX]);
printf("\n*** End of Check SPI slave select port pin assignment ***\n\n");
// *** Sample output ***
// *** Check SPI slave select port pin assignment ***
// *** SlaveSelectPortPinArray00 = 0,2
// *** SlaveSelectPortPinArray08 = 2,9
// *** SlaveSelectPortPinArray00 = 0,2
// *** SlaveSelectPortPinArray08 = 2,9
// *** SlaveSelectPortPinArray00 = 0,2
// *** SlaveSelectPortPinArray08 = 2,9
// *** SlaveSelectPortPinArray10 = 2,0
// *** SlaveSelectPortPinArray18 = 2,9
// *** End of Check SPI slave select port pin assignment ***
}
// ***************************************************************************
// End
// ***************************************************************************
No comments:
Post a Comment