📄 led_testbench.c
字号:
//===============================================================================
// TEXAS INSTRUMENTS INCORPORATED PROPRIETARY INFORMATION
//
// Property of Texas Instruments
// For Unrestricted Internal Use Only
// Unauthorized reproduction and/or distribution is strictly prohibited.
// This product is protected under copyright law and trade secret law
// as an unpublished work.
// Created 2000, (C) Copyright 2000 Texas Instruments. All rights reserved.
//===============================================================================
//
#include "global_types.h"
#include "mapping.h"
#include "gpio.h"
#include "led_testbench.h"
//-------------------------------------------------------------------------------
// NAME : LED_InitSynchro
//
// DESCRIPTION : - Init the GPIO direction for synchro signals
// * LED_STATUS_PIN = output
// * LED_SYNC_PIN = input
// * LED_STATUS_PIN = output
//
// - drive LED_STATUS_PIN and LED_EXEC_PIN pins to '0'
//
// PARAMETERS : none
//
// RETURN VALUE : None
//
//--------------------------------------------------------------------------------
void LED_InitSynchro(void)
{
// sets directions
GPIO_ClearOeBit(GPIO1_BASE_ADDR_ARM, LED_STATUS_PIN);
GPIO_ClearOeBit(GPIO1_BASE_ADDR_ARM, LED_EXEC_PIN);
GPIO_SetOeBit(GPIO1_BASE_ADDR_ARM, LED_SYNC_PIN);
// Reset status & exec pins
GPIO_ClearDataOutBit(GPIO1_BASE_ADDR_ARM, LED_STATUS_PIN);
GPIO_ClearDataOutBit(GPIO1_BASE_ADDR_ARM, LED_EXEC_PIN);
}
//-------------------------------------------------------------------------------
// NAME : LED_SetPin
//
// DESCRIPTION : - Set or Reset LED_STATUS_PIN or LED_EXEC_PIN pins
//
// PARAMETERS : bit value
//
// RETURN VALUE : None
//
//------------------------------------------------------------------------------
void LED_SetstatusPin( LED_PINOUT Pin, BOOL BitValue)
{
if (BitValue==True)
GPIO_SetDataOutBit(GPIO1_BASE_ADDR_ARM, Pin);
else
GPIO_ClearDataOutBit(GPIO1_BASE_ADDR_ARM, Pin);
}
void LED_SetexecPin( LED_PINOUT Pin, BOOL BitValue)
{
//GPIO2 has pins from 32 to 63
Pin %= 32;
if (BitValue==True)
GPIO_SetDataOutBit(GPIO2_BASE_ADDR_ARM, Pin);
else
GPIO_ClearDataOutBit(GPIO2_BASE_ADDR_ARM, Pin);
}
//-------------------------------------------------------------------------------
// NAME : LED_PollSync
//
// DESCRIPTION : - Poll Sync pin until reset
//
// PARAMETERS : bit value
//
// RETURN VALUE : None
//
//------------------------------------------------------------------------------
void LED_PollSync( void)
{
while (GPIO_GetInputPin(GPIO1_BASE_ADDR_ARM, LED_SYNC_PIN) != 0);
}
/* EOF */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -