/* * Routines to access hardware * * Copyright (c) 2013 Realtek Semiconductor Corp. * * This module is a confidential and proprietary property of RealTek and * possession or use of this module requires written permission of RealTek. */ #include "device.h" #include "port_api.h" // mbed #include "PortNames.h" // mbed #include "main.h" #define PORT_OUTPUT_TEST 1 //1: output test, 0: input test #define LED_PATTERN_NUM 12 port_t port0; const uint8_t led_pattern[LED_PATTERN_NUM]={0x81, 0x42, 0x24, 0x18, 0x00, 0x88, 0x44, 0x22, 0x11, 0xff, 0x00}; const uint8_t My_Port_Def[] = { PA_6, PA_7, PA_5, PD_4, PD_5, PA_4, PA_3, PA_2, 0xFF // must end with 0xFF }; extern void wait_ms(u32); /** * @brief Main program. * @param None * @retval None */ #if PORT_OUTPUT_TEST void main(void) { int i; unsigned int pin_mask; port_mode(&port0, PullNone); // Assign pins to this port port0.pin_def = (uint8_t*)My_Port_Def; pin_mask = 0xFF; // each bit map to 1 pin: 0: pin disable, 1: pin enable port_init(&port0, PortA, pin_mask, PIN_OUTPUT); while(1){ for (i=0;i