本文整理汇总了C++中DELAY_US函数的典型用法代码示例。如果您正苦于以下问题:C++ DELAY_US函数的具体用法?C++ DELAY_US怎么用?C++ DELAY_US使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DELAY_US函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: iec_init
// Initialize all IEC lines to idle
struct ProtocolFunctions *
iec_init()
{
iec_release(IO_ATN | IO_CLK | IO_DATA | IO_RESET);
DELAY_US(10);
return &iecFunctions;
}
示例2: SCI_SendPacket
//
// SCI_SendPacket - Sends a Packet to the host which contains
// status in the data and address. It sends the
// statusCode global variable contents. It then waits
// for an ACK or NAK from the host.
//
Uint16 SCI_SendPacket(Uint16 command, Uint16 status, Uint16 length,
Uint16* data)
{
int i;
SCIA_Flush();
DELAY_US(100000);
SCI_SendWord(0x1BE4);
SCI_SendWord(length);
checksum = 0;
SCI_SendWord(command);
SCI_SendWord(status);
for(i = 0; i < (length-2)/2; i++)
{
SCI_SendWord(*(data + i));
}
SCI_SendChecksum();
SCI_SendWord(0xE41B);
//
// Receive an ACK or NAK
//
return SCIA_GetACK();
}
示例3: InitADC
void InitADC(void)
{
EALLOW;
//write configurations
AdcaRegs.ADCCTL2.bit.PRESCALE = 0X2; //set ADCCLK divider to /4
AdcbRegs.ADCCTL2.bit.PRESCALE = 0X2; //set ADCCLK divider to /4
AdccRegs.ADCCTL2.bit.PRESCALE = 0X2; //set ADCCLK divider to /4
AdcdRegs.ADCCTL2.bit.PRESCALE = 0X2; //set ADCCLK divider to /4
AdcSetMode(ADC_ADCA, ADC_RESOLUTION_12BIT, ADC_SIGNALMODE_SINGLE);
AdcSetMode(ADC_ADCB, ADC_RESOLUTION_12BIT, ADC_SIGNALMODE_SINGLE);
AdcSetMode(ADC_ADCC, ADC_RESOLUTION_12BIT, ADC_SIGNALMODE_SINGLE);
AdcSetMode(ADC_ADCD, ADC_RESOLUTION_12BIT, ADC_SIGNALMODE_SINGLE);
//Set pulse positions to late
AdcaRegs.ADCCTL1.bit.INTPULSEPOS = 1;
AdcbRegs.ADCCTL1.bit.INTPULSEPOS = 1;
AdccRegs.ADCCTL1.bit.INTPULSEPOS = 1;
AdcdRegs.ADCCTL1.bit.INTPULSEPOS = 1;
//power up the ADC
AdcaRegs.ADCCTL1.bit.ADCPWDNZ = 1;
AdcbRegs.ADCCTL1.bit.ADCPWDNZ = 1;
AdccRegs.ADCCTL1.bit.ADCPWDNZ = 1;
AdcdRegs.ADCCTL1.bit.ADCPWDNZ = 1;
//delay for 1ms to allow ADC time to power up
DELAY_US(1000);
EDIS;
SetupADC();
}
示例4: InitAdc
//---------------------------------------------------------------------------
// InitAdc:
//---------------------------------------------------------------------------
// This function initializes ADC to a known state.
//
void InitAdc(void)
{
extern void DSP28x_usDelay(Uint32 Count);
// *IMPORTANT*
// The ADC_cal function, which copies the ADC calibration values from TI reserved
// OTP into the ADCREFSEL and ADCOFFTRIM registers, occurs automatically in the
// Boot ROM. If the boot ROM code is bypassed during the debug process, the
// following function MUST be called for the ADC to function according
// to specification. The clocks to the ADC MUST be enabled before calling this
// function.
// See the device data manual and/or the ADC Reference
// Manual for more information.
EALLOW;
SysCtrlRegs.PCLKCR0.bit.ADCENCLK = 1;
ADC_cal();
EDIS;
// To powerup the ADC the ADCENCLK bit should be set first to enable
// clocks, followed by powering up the bandgap, reference circuitry, and ADC core.
// Before the first conversion is performed a 5ms delay must be observed
// after power up to give all analog circuits time to power up and settle
// Please note that for the delay function below to operate correctly the
// CPU_CLOCK_SPEED define statement in the DSP2833x_Examples.h file must
// contain the correct CPU clock period in nanoseconds.
AdcRegs.ADCTRL3.all = 0x00E0; // Power up bandgap/reference/ADC circuits
DELAY_US(ADC_usDELAY); // Delay before converting ADC channels
}
示例5: rtty_txbit
void rtty_txbit (int bit)
{
/*
* Sends one bit of data
*
*/
if (bit)
{
/* mark */
RTTY_PORT |= RTTY_MARK_PIN;
RTTY_PORT &= ~(RTTY_SPACE_PIN);
}
else
{
/* space */
RTTY_PORT |= RTTY_SPACE_PIN;
RTTY_PORT &= ~(RTTY_MARK_PIN);
}
// __delay_cycles(RTTY_BAUDRATE/2); /* depends on configuration */
// __delay_cycles(RTTY_BAUDRATE/2);
// @1Mhz, delay == 20000 == 50baud
// @8Mhz, delay == ? == 50 baud
//P1OUT ^= BIT3;
DELAY_US(20000);// 1/50*1000000 - (1/t)*f
// DELAY_US(7000);
// DELAY_US(15800); //47.5 baud
}
示例6: switch_pll_on
static void switch_pll_on(void)
{
trx_irq_reason_t irq_status;
uint8_t poll_counter = 0;
/* Check if trx is in TRX_OFF; only from PLL_ON the following procedure is applicable */
if (pal_trx_bit_read(SR_TRX_STATUS) != TRX_OFF) {
Assert("Switch PLL_ON failed, because trx is not in TRX_OFF" ==
0);
return;
}
pal_trx_reg_read(RG_IRQ_STATUS); /* clear PLL lock bit */
/* Switch PLL on */
pal_trx_reg_write(RG_TRX_STATE, CMD_PLL_ON);
/* Check if PLL has been locked. */
do {
irq_status = (trx_irq_reason_t) pal_trx_reg_read(RG_IRQ_STATUS);
if (irq_status & TRX_IRQ_PLL_LOCK) {
return; // PLL is locked now
}
/* Wait a time interval of typical value for state change. */
DELAY_US(TRX_OFF_TO_PLL_ON_TIME_US);
poll_counter++;
} while (poll_counter < PLL_LOCK_ATTEMPTS);
}
示例7: ConfigureADC
//
// ConfigureADC - Write ADC configurations and power up the ADC for both
// ADC A and ADC B
//
void ConfigureADC(void)
{
EALLOW;
//
//write configurations
//
AdcaRegs.ADCCTL2.bit.PRESCALE = 6; //set ADCCLK divider to /4
AdcSetMode(ADC_ADCA, ADC_RESOLUTION_12BIT, ADC_SIGNALMODE_SINGLE);
//
//Set pulse positions to late
//
AdcaRegs.ADCCTL1.bit.INTPULSEPOS = 1;
//
//power up the ADC
//
AdcaRegs.ADCCTL1.bit.ADCPWDNZ = 1;
//
//delay for 1ms to allow ADC time to power up
//
DELAY_US(1000);
EDIS;
}
示例8: LTC_discharge_cells_3_4
void LTC_discharge_cells_3_4()
{
//The discharge duration only lasts for a couple of seconds on the LED. Need confirmation.
void LTC_wakeup(void);
LTC_wakeup();
SpiaRegs.SPITXBUF = ((unsigned)0x80) << 8;
SpiaRegs.SPITXBUF = ((unsigned)0x01) << 8;
SpiaRegs.SPITXBUF = ((unsigned)0x4D) << 8;
SpiaRegs.SPITXBUF = ((unsigned)0x7A) << 8;
while(SpiaRegs.SPIFFTX.bit.TXFFST != 0) {} //wait
SpiaRegs.SPITXBUF = ((unsigned)0xE1) << 8;
SpiaRegs.SPITXBUF = ((unsigned)0xE2) << 8;
SpiaRegs.SPITXBUF = ((unsigned)0x44) << 8;
SpiaRegs.SPITXBUF = ((unsigned)0x9C) << 8;
while(SpiaRegs.SPIFFTX.bit.TXFFST != 0) {} //wait
SpiaRegs.SPITXBUF = ((unsigned)0x0C) << 8;
SpiaRegs.SPITXBUF = ((unsigned)0xF0) << 8;
//calculated PECs
SpiaRegs.SPITXBUF = ((unsigned)0xD2) << 8;
SpiaRegs.SPITXBUF = ((unsigned)0xA4) << 8;
DELAY_US(100);
}
示例9: InitSPIConfig
void InitSPIConfig() {
EALLOW;
ClkCfgRegs.LOSPCP.bit.LSPCLKDIV = 0;
EDIS;
// Initialize SPI FIFO registers
SpiaRegs.SPIFFTX.all = 0xE040;
SpiaRegs.SPIFFRX.all = 0x2044;
SpiaRegs.SPIFFCT.all = 0x0;
SpiaRegs.SPICCR.bit.SPISWRESET = 0; // SPI on reset,must be set to 1
SpiaRegs.SPICTL.all = 0x0006; // Enable master mode, normal phase,
// enable talk, and SPI int disabled.
// SpiaRegs.SPIBRR.all = 0x007F;
SpiaRegs.SPIBRR.bit.SPI_BIT_RATE = 0; // SPICLK set to /SPI_BIT_RATE+1
SpiaRegs.SPICCR.bit.CLKPOLARITY = 1;// Data is output on the rising edge of the SPICLK signal
SpiaRegs.SPICCR.bit.HS_MODE = 0; // disable High Mode
SpiaRegs.SPICCR.bit.SPILBK = 0; // disable SPI lookback
SpiaRegs.SPICCR.bit.SPICHAR = 7; // transmit 8-bit data
SpiaRegs.SPICCR.bit.SPISWRESET = 1; // disable SPI on reset
SpiaRegs.SPIPRI.bit.FREE = 1; // Set so breakpoints don't disturb xmission
DELAY_US(1);
}
示例10: IeeeDetect
//
// Check if device is connected to IEEE-488 port (device pullups)
// This function needs to run quickly so it won't delay IEC initialization
// if no IEEE device is attached and powered on.
//
static bool IeeeDetect(void)
{
bool flg;
#ifdef DEBUG_LED
debug_LED_blink(10);
#endif
// reset pullups and test IO
IeeeDav(0);
IeeeEoi(0);
//IeeeRen(0);
IeeeSetPullup(0, IEEE_DAV_I, IEEE_DAV_O);
IeeeSetPullup(0, IEEE_EOI_I, IEEE_EOI_O);
//IeeeSetPullup(0, IEEE_REN_I, IEEE_REN_O);
DELAY_US(100);
//flg = (IEEE_REN && IEEE_DAV && IEEE_EOI);
flg = (IEEE_DAV && IEEE_EOI);
if(flg)
{
#ifdef DEBUG_LED
debug_LED_blink(5);
#endif
}
else
{
#ifdef DEBUG_LED
debug_LED_blink(1);
#endif
}
return (flg);
}
示例11: radio_do_cca
radio_cca_t radio_do_cca(void)
{
uint8_t tmp, trxcmd, trxstatus;
radio_cca_t ret = RADIO_CCA_FREE;
trxcmd = trx_reg_read(RG_TRX_STATE);
trx_reg_write(RG_TRX_STATE, CMD_RX_ON);
tmp = 130;
do
{
trxstatus = trx_bit_read(SR_TRX_STATUS);
if ((RX_ON == trxstatus) || (BUSY_RX == trxstatus))
{
break;
}
DELAY_US(32); /* wait for one octett */
}
while(--tmp);
trx_reg_write(RG_TRX_STATE, CMD_PLL_ON);
trx_reg_write(RG_TRX_STATE, CMD_RX_ON);
trx_bit_write(SR_CCA_REQUEST,1);
DELAY_US(140);
/* we need to read the whole status register
* because CCA_DONE and CCA_STATUS are valid
* only for one read, after the read they are reset
*/
tmp = trx_reg_read(RG_TRX_STATUS);
if(0 == (tmp & 0x80))
{
ret = RADIO_CCA_FAIL;
}
else if (tmp & 0x40)
{
ret = RADIO_CCA_FREE;
}
else
{
ret = RADIO_CCA_BUSY;
}
trx_reg_write(RG_TRX_STATE, trxcmd);
return ret;
}
示例12: MaquinaEstadoDetecaoRogowiski
void MaquinaEstadoDetecaoRogowiski(Uint16 valorIn)
{
static Uint16 i = 0;
static float tensao = 0;
Uint16 valor;
//return 1; //enquanto o circuito nao eh ajeitado, mantem desabilitada a funcionalidade
//CpuTimer0Regs.TCR.bit.TIE = 0; // 0 = Disable/ 1 = Enable Timer Interrupt
if(FlagDetectandoBobina == 1)
{
if(PinoDetecaoRogowiski == 0) {
//LIBERA_INTEGRADOR;
RESETA_INTEGRADOR;
DELAY_US(2);
i = 0;
tensao = 0;
PinoDetecaoRogowiski_ligaFonteC; //Habilita fonte de corrente
}
tensao += (float)valorIn - Adc_offset[0];
if(++i > 100)
{
tensao = tensao / 100.0;
tensao *= 2.0;
if(tensao >= LIMIAR_SUPERIOR_BOBINA) {
GpioDataRegs.GPBDAT.bit.GPIO34 = 0;
//SciReportarErro(ERRO_AUSENCIA_BOBINA);
FlagResultadoDetecaoBobina = 0; //Bobina Ausente
}
if(tensao < LIMIAR_SUPERIOR_BOBINA) {
GpioDataRegs.GPBDAT.bit.GPIO34 = 1;
FlagResultadoDetecaoBobina = 1; //Bobina Presente
}
PinoDetecaoRogowiski_deslFonteC; //Desabilita fonte de corrente
DELAY_US(2);
RESETA_INTEGRADOR;
DELAY_US(2);
FlagDetectandoBobina = 0; //Termina algoritmo de detecao
}
}
}
示例13: iec_wait_clk
// Wait up to 400 us for CLK to be pulled by the drive.
static void
iec_wait_clk(void)
{
uint8_t count = 200;
while (iec_get(IO_CLK) == 0 && count-- != 0)
DELAY_US(2);
}
示例14: enable_controller
/**
* Enable control ISR
*/
static void enable_controller()
{
stop_DMA();
DELAY_US(5);
start_DMA();
HRADCs_Info.enable_Sampling = 1;
enable_pwm_tbclk();
}
示例15: Iw7027_writeSingleByte
void Iw7027_writeSingleByte(uint8 chipsel, uint8 regaddress, uint8 txdata)
{
//Selest chip
Hal_SpiMaster_setCsPin(chipsel);
DELAY_US(IW_SPI_MASTER_TRANS_START_DELAY);
//Send Head & address
Hal_SpiMaster_sendSingleByte(0xC0);
Hal_SpiMaster_sendSingleByte(regaddress);
//Send Data
Hal_SpiMaster_sendSingleByte(txdata);
//Unselest all chip
DELAY_US(IW_SPI_MASTER_TRANS_STOP_DELAY);
Hal_SpiMaster_setCsPin(0x00);
}