2013-11-17

Olimex memory refreshing basic tests


// **********************************************************************
// Program  - Fong EKG v5.06
// Function - Testing Olimex EKG
// Author   - TL Fong
// Build    - 2013.11.17.01
// Date     - 2013nov17hkt0932
// Hardware - WuyinS/Olimex/CooCox/MagicBlue/WHUT/Somy LPC1114/C14/301
//            Olimex EKG Board (SHIELD-EKG/EMG Rev B, Bulgaria 2011)
// Software - GCC ARM 4.7, CoIDE 1.7.5,  CoLinkEx 1.1, Flash Magic v7.66
// ***********************************************************************

#include "test050.h"

// ***********************************************************************
// Main Function
// ***********************************************************************

int main()
{
// *** Test Olimex Eval Board 2013nov17 ***
testBlinkOlimexLed1(); // OK 2013nov17
testOlimexLedKey01();  // OK 2013nov17
}

// ***********************************************************************
// End
// ***********************************************************************

// ***********************************************************************
// test050.h 2013nov10hkt1151
// ***********************************************************************

#include "led050.h"
#include "key050.h"
#include "spi050.h"
#include "adc050.h"
#include "eeprom050.h"
#include "mled050.h"

// ***************************************************************************
// Function - Blink Olimex Led01 (P30)
// Call     - testBlinkOlimexLed1()
// Date     - 2013oct27
// ***************************************************************************
void testBlinkOlimexLed1()
{
setupGpioPinOutputLow050(OlimexBoardLedPortPinArray1); // Setup as output P30
blinkLed0501(OlimexBoardLedPortPinArray1); // Blink
}

void testOlimexLedKey01() // tested OK 2013oct13
{
// *** For all mcu boards - setup GPIO pin as out and toggle ***
setupGpioPinOutputLow050(PortPinArrayP09); // setup GPIO pin as ooutput
blinkLed0501(PortPinArrayP09); // blink led

// *** Olimex test only - setup I/O pins for testing ***
setupOlimexGpio050(); // setup Olimex GPIO pins as output and input

// *** Olimex test only - blink single LED and run all LEDs***
blinkOlimexLed(LED_7, ON_ONE_FIFTH_SECOND, OFF_ONE_FIFTH_SECOND, REPEAT_6_TIMES); // blink one Led
runOlimexLeds();  // sequentially blink all 8 Leds

// *** Olimex test only - echo key by led ***
echoOlimexKeyByLed(KEY_1, LED_1); // echo Olimex key by led
echoOlimexKeyByLed(KEY_2, LED_2); // echo Olimex key by led
echoOlimexKeyByLed(KEY_1, LED_3); // echo Olimex key by led

// *** For all mcu boards, given mcu board struct, echo key by led ***
echoKeyByLed0504(OlimexLpc1114DevBoardStruct, KEY_1, LED_5); // given mcuboard struct, echo key by led
}

/*
// *** Olimex LED port pin array ***

#define MAX_OLIMEX_LED_PIN_NUMBER 8 // 2013oct11

portPinArray OlimexBoardLedPortPinArray1 = {PORT3, PIN0}; // LED 0 2013oct11
portPinArray OlimexBoardLedPortPinArray2 = {PORT3, PIN1}; // LED 1 2013oct11
portPinArray OlimexBoardLedPortPinArray3 = {PORT3, PIN2}; // LED 2 2013oct11
portPinArray OlimexBoardLedPortPinArray4 = {PORT3, PIN3}; // LED 3 2013oct11
portPinArray OlimexBoardLedPortPinArray5 = {PORT3, PIN4}; // LED 4 2013oct11
portPinArray OlimexBoardLedPortPinArray6 = {PORT3, PIN5}; // LED 5 2013oct11
portPinArray OlimexBoardLedPortPinArray7 = {PORT2, PIN6}; // LED 6 2013oct11
portPinArray OlimexBoardLedPortPinArray8 = {PORT2, PIN7}; // LED 7 2013oct11

portPinArrayPointerArray OlimexBoardLedPortPinArrayPointerArray[MAX_OLIMEX_LED_PIN_NUMBER] = \
  {&OlimexBoardLedPortPinArray1, &OlimexBoardLedPortPinArray2, \
  &OlimexBoardLedPortPinArray3, &OlimexBoardLedPortPinArray4, \
  &OlimexBoardLedPortPinArray5, &OlimexBoardLedPortPinArray6, \
  &OlimexBoardLedPortPinArray7, &OlimexBoardLedPortPinArray8};

// *** Olimex Key port pin array ***

#define MAX_OLIMEX_KEY_PIN_NUMBER 2

portPinArray OlimexBoardKeyPortPinArray1 = {PORT2, PIN9};
portPinArray OlimexBoardKeyPortPinArray2 = {PORT1, PIN4};

portPinArrayPointerArray OlimexBoardKeyPortPinArrayPointerArray[MAX_OLIMEX_KEY_PIN_NUMBER] = \
    {&OlimexBoardKeyPortPinArray1, &OlimexBoardKeyPortPinArray2};

// *** Olimex LPC1114 Board Struct ***

mcuBoardStruct OlimexLpc1114DevBoardStruct = {OlimexBoardLedPortPinArrayPointerArray, \
OlimexBoardKeyPortPinArrayPointerArray};
*/

// ***************************************************************************
// Function - Blink P09 LED
// Call     - testBlinkLpc1114LedP03()
// Date     - 2013oct27
// ***************************************************************************
void testBlinkLpc1114LedP09()
{
    setupGpioPinOutputLow050(PortPinArrayP09); // Setup as output
blinkLed0501(PortPinArrayP09); // Blink
}

void testOlimex7segmentLed0201()
{
    // *** system self diagnostic test - blink LED P09 ***
setupGpioPinOutputLow050(PortPinArrayP03); // setup GPIO pin as output
blinkLed0501(PortPinArrayP03); // blink led

// *** Testing 7 segment LED ***
displayAllDigits050(OlimexBoardSevenSegmentLedPortPinArrayPointerArray2, MAX_OLIMEX_7_SEG_LED_PIN_NUMBER);
}

.END

No comments:

Post a Comment