当前位置: 首页>>代码示例>>C++>>正文


C++ DDR函数代码示例

本文整理汇总了C++中DDR函数的典型用法代码示例。如果您正苦于以下问题:C++ DDR函数的具体用法?C++ DDR怎么用?C++ DDR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了DDR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: pwm_init

/**
 * @brief Initializes the PWM module
 *
 * This sets up the involved timers in a way that the PWM signal(s) are
 * generated. It needs to be called once before the module and its
 * functionality can be used.
 *
 * @note No signal(s) are actually being output until `pwm_on()` is invoked.
 *
 * @see PWM_RED
 * @see PWM_GREEN
 * @see PWM_BLUE
 */
void pwm_init()
{

    PORT(PWM_RED) &= ~_BV(BIT(PWM_RED));
    DDR(PWM_RED) |= _BV(BIT(PWM_RED));

    #if (ENABLE_RGB_SUPPORT == 1)

        PORT(PWM_GREEN) &= ~_BV(BIT(PWM_GREEN));
        DDR(PWM_GREEN) |= _BV(BIT(PWM_GREEN));
        PORT(PWM_BLUE) &= ~_BV(BIT(PWM_BLUE));
        DDR(PWM_BLUE) |= _BV(BIT(PWM_BLUE));

        /*
         * Waveform generation mode: Fast PWM
         * Top: 0xFF
         * Update of OCRx: Bottom
         * Prescaler: 8
         */
        TCCR2A = _BV(WGM21) | _BV(WGM20);
        TCCR2B = _BV(CS21);

    #endif

    /*
     * Waveform generation mode: Fast PWM
     * Top: 0xFF
     * Update of OCRx: Bottom
     * Prescaler: 8
     */
    TCCR0A = _BV(WGM01) | _BV(WGM00);
    TCCR0B = _BV(CS01);

}
开发者ID:Wordclock,项目名称:firmware,代码行数:47,代码来源:pwm.c

示例2: KBD_init

//=============================================================================
void KBD_init(void)
{
  DDR(BEEPER) |= BEEPER_LINE;
  PORT(BEEPER) &= ~BEEPER_LINE;
  DDR(BUTTON_1) &= ~BUTTON_1_LINE;
  PORT(BUTTON_1) |= BUTTON_1_LINE;
}
开发者ID:andrewdoynikov,项目名称:PS_16x2,代码行数:8,代码来源:button.c

示例3: data_dir_out

//----------------------------------------------------------------------------------------
//
//		 Ustawienie wszystkich 4 linii danych jako WYj�cia
//
//----------------------------------------------------------------------------------------
static inline void data_dir_out(void)
{
	DDR(LCD_D7PORT)	|= (1<<LCD_D7);
	DDR(LCD_D6PORT)	|= (1<<LCD_D6);
	DDR(LCD_D5PORT)	|= (1<<LCD_D5);
	DDR(LCD_D4PORT)	|= (1<<LCD_D4);
}
开发者ID:rungokarol,项目名称:AquariumAVR,代码行数:12,代码来源:lcd44780.c

示例4: hwInit

/* Hardware initialization */
static void hwInit(void)
{
	extFunc = eeprom_read_byte((uint8_t*)EEPROM_EXT_FUNC);
	#if 0
	loadTempParams();
	if (extFunc == USE_DS18B20) {
		ds18x20SearchDevices();
		tempInit();							/* Init temperature control */
	}
	#endif
	I2CInit();								/* I2C bus */
	displayInit();							/* Load params and text labels before fb scan started */
	rcInit();								/* IR Remote control */
	inputInit();							/* Buttons/encoder polling */
	adcInit();								/* Analog-to-digital converter */

	sei();									/* Gloabl interrupt enable */

	//tunerInit(extFunc);						/* Tuner */

	DDR(STMU_STBY) |= STMU_STBY_LINE;		/* Standby port */
	DDR(STMU_MUTE) |= STMU_MUTE_LINE;		/* Mute port */
	sndInit(extFunc);						/* Load labels/icons/etc */

	setStbyTimer(0);

	return;
}
开发者ID:devttys1,项目名称:ampcontrol,代码行数:29,代码来源:main.c

示例5: lcd_init

/* initializes lcd for use, this or lcd_init_wo_ir MUST be called first
 *
 * Note: this function does NOT assume internel reset circuit power 
 * conditions were met
 */
void lcd_init(void) 
{
	int i; 

	/* set control pins as output */
	DDR(EN_PORT) |= _BV(EN_PIN);
	DDR(RW_PORT) |= _BV(RW_PIN);
	DDR(RS_PORT) |= _BV(RS_PIN); 

	/* set data pins as output */
	data_pins_out();

	/* wait until lcd is finished booting */
	_delay_us(BOOT_DELAY);	

	/* set control pins for function set */
	for (i = 0; i < 3; i++) {
		set_rs_low();
		set_rw_low();
		set_data_pins(F_SET_INITIAL);
		toggle_e(); 
		_delay_us(INIT_DELAY); 
	}

	/* final function set, set's 8bit operation, 2-line disp, 5x8 font */
	set_data_pins(F_SET_DEFAULT);
	toggle_e(); 
	_delay_us(INIT_DELAY); 

	lcd_command(DISP_OFF);		/* display off */
	lcd_command(CLEAR_DISP);	/* display clear*/
	lcd_command(ENTRY_DEFAULT); 	/* set entry mode to INC, no shift */
	lcd_command(DISP_ON);		/* display on */
}
开发者ID:dand33,项目名称:sys_monitor,代码行数:39,代码来源:lcd_driver.c

示例6: data_dir_in

//----------------------------------------------------------------------------------------
//
//		 Ustawienie wszystkich 4 linii danych jako WEj�cia
//
//----------------------------------------------------------------------------------------
static inline void data_dir_in(void)
{
	DDR(LCD_D7PORT)	&= ~(1<<LCD_D7);
	DDR(LCD_D6PORT)	&= ~(1<<LCD_D6);
	DDR(LCD_D5PORT)	&= ~(1<<LCD_D5);
	DDR(LCD_D4PORT)	&= ~(1<<LCD_D4);
}
开发者ID:rungokarol,项目名称:AquariumAVR,代码行数:12,代码来源:lcd44780.c

示例7: spi_init

/*
 * Initialize SPI bus.
 */
void
spi_init(void)
{
  static unsigned char spi_inited = 0;

  if (spi_inited)
    return;

  /* Initalize ports for communication with SPI units. */
  /* CSN=SS and must be output when master! */  
  #if defined (__AVR_ATmega644P__)
  /*SPI Specific Initialization.*/
  /* Set SS, CLK and MOSI as output. */
  /* 
    * The DDxn bit in the DDRx Register selects the direction of this pin. If DDxn is written logic one,
    * Pxn is configured as an output pin. If DDxn is written logic zero, Pxn is configured as an input
    * pin.
  */
  printf("\n spi_init starting \n");
  // 1 = Output, 0 = Input
  //CE(Chip Enable Rx or Tx), Output--PD6
  //CSN(SPI Chip Select), Output--PD4
  //SCK(SPI Clock), Output--PB7/SCL
  //MISO(SPI Data Input), Input--PB6/MISO
  //MOSI(SPI Data Output), Output--PB5/MOSI
  //IRQ, Output--None
  DDR(SSPORT) |= BV(SSPIN) | BV(CEPIN);  	//DDR(SSPORT) |= BV(CEPIN);  //chip enable, need remove this chip enable pin in the HW
  DDR(SPIPORT) |= BV(SCKPIN) | BV(MOSIPIN);
  
  /* If PORTxn is written logic one when the pin is configured as an output pin, the port pin is driven
    * high (one). If PORTxn is written logic zero when the pin is configured as an output pin, the port
    * pin is driven low (zero).
 */
  //PORT(SPIPORT) |= BV(SCKPIN) | BV(MOSIPIN);		//driven to high
  PORT(SSPORT) |= BV(SSPIN) | BV(CEPIN); 		//driven to high
  
  //Enable pull-up resistors (page 74), if it is input, set PORTx means pull-up
  PORT(SSPORT) |= BV(MISOPIN); //Pulling up a pin that is grounded will cause 90uA current leak
  printf("\n PORTB=0x%x, DDRB=0x%x, PORTD:0x%x, DDRD=0x%x \n", PORT(SPIPORT), DDR(SPIPORT), PORT(SSPORT), DDR(SSPORT) );
#else
#error "\n No CPU select, spi_init() failed in spi.c \n"
#endif

#if USE_SPI_SIMULATOR
#else
  /* In the SPI master mode, must set SS(SlaveSelect) to output, actually this pin should connect to the CS pin the SPI slave device */
  DDR(SPIPORT) |= BV(4);
  PORT(SPIPORT) |= BV(4);
  /* Enable SPI module and master operation. */
  SPCR = BV(SPE) | BV(MSTR) |BV(SPR0); // | BV(SPIE);  

  /* Enable doubled SPI speed in master mode. */
  //SPSR = BV(SPI2X);  
  printf("\n spi end, SPCR=0x%x\n", SPCR);
#endif    
}
开发者ID:hummingbird2012,项目名称:hummingbird,代码行数:59,代码来源:spi.c

示例8: config_right_motor

void config_right_motor() {

	DDR(RIGHT_MOTOR_A_PORT) |= RIGHT_MOTOR_A;
	DDR(RIGHT_MOTOR_B_PORT) |= RIGHT_MOTOR_B;
	shift_right_motor_brake();
	TCCR2A = 0x03; //WGM(2:0) = "011" : Fast-PWM, TOP = 0xFF, BOTTOM = 0x00
	TCCR2B = 0x01; //CS(2:0)  = "001" : select I/Oclk
	OCR2A = 0x00;
	OCR2B = 0x00;
} 
开发者ID:dmcarr92,项目名称:cpu-Org-Microprocessors,代码行数:10,代码来源:motor_driver.c

示例9: config_left_motor

void config_left_motor() {

	DDR(LEFT_MOTOR_A_PORT) |= LEFT_MOTOR_A;
	DDR(LEFT_MOTOR_B_PORT) |= LEFT_MOTOR_B;
	shift_left_motor_brake();
	TCCR0A = 0x03;
	TCCR0B = 0x01;
	OCR0A = 0x00;
	OCR0B = 0x00;
} 
开发者ID:dmcarr92,项目名称:cpu-Org-Microprocessors,代码行数:10,代码来源:motor_driver.c

示例10: eeprom_init

void eeprom_init(void)
{
    // piny dla !CS jako wyjœcia
    DDR(EEPROM_SS_PORT) |= (1<<EEPROM_SS_PIN);      // bank #0
    DDR(EEPROM_SS_PORT) |= (1<<(EEPROM_SS_PIN+1));  // bank #1

    // ustaw na CS stan wysoki
    spi_unselect(EEPROM_SS_PORT, EEPROM_SS_PIN);
    spi_unselect(EEPROM_SS_PORT, EEPROM_SS_PIN + 1);
}
开发者ID:cscscheng,项目名称:telemetry,代码行数:10,代码来源:eeprom.c

示例11: lcdDriver_init

void lcdDriver_init() 
{
	DDR(DISPLAY_CS_PORT) |= (1 << DISPLAY_CS_PIN);
	DDR(DISPLAY_WR_PORT) |= (1 << DISPLAY_WR_PIN);
	DDR(DISPLAY_RD_PORT) |= (1 << DISPLAY_RD_PIN);
	DDR(DISPLAY_A0_PORT) |= (1 << DISPLAY_A0_PIN);
	DISPLAY_WR_PORT |= (1 << DISPLAY_WR_PIN);
	DISPLAY_RD_PORT |= (1 << DISPLAY_RD_PIN);
	DISPLAY_A0_PORT &= ~(1 << DISPLAY_A0_PIN);
}
开发者ID:ploegerdaniel,项目名称:ATMega,代码行数:10,代码来源:ses_lcdDriver.c

示例12: I2CswSendBit

static void I2CswSendBit(uint8_t bit)
{
	if (bit)
		DDR(I2C_SDA) &= ~I2C_SDA_LINE;		// Pullup SDA = 1
	else
		DDR(I2C_SDA) |= I2C_SDA_LINE;		// Active SDA = 0
	I2CswGetBit();

	return;
}
开发者ID:Vladim00,项目名称:matrixclock,代码行数:10,代码来源:i2csw.c

示例13: I2CswStop

void I2CswStop(void)
{
	DDR(I2C_SCL) |= I2C_SCL_LINE;			// Active SCL = 0
	DDR(I2C_SDA) |= I2C_SDA_LINE;			// Active SDA = 0
	_delay_us(5);
	DDR(I2C_SCL) &= ~I2C_SCL_LINE;			// Pullup SCL = 1
	_delay_us(5);
	DDR(I2C_SDA) &= ~I2C_SDA_LINE;			// Pullup SDA = 1

	return;
}
开发者ID:Vladim00,项目名称:matrixclock,代码行数:11,代码来源:i2csw.c

示例14: KBD_init

//=============================================================================
void KBD_init(void)
{
  DDR(BEEPER) |= BEEPER_LINE;
  PORT(BEEPER) |= BEEPER_LINE;
  DDR(BUTTON_LEFT) &= ~(1 << BUTTON_LEFT_LINE);
  PORT(BUTTON_LEFT) |= (1 << BUTTON_LEFT_LINE);
  DDR(BUTTON_SET) &= ~(1 << BUTTON_SET_LINE);
  PORT(BUTTON_SET) |= (1 << BUTTON_SET_LINE);
  DDR(BUTTON_RIGHT) &= ~(1 << BUTTON_RIGHT_LINE);
  PORT(BUTTON_RIGHT) |= (1 << BUTTON_RIGHT_LINE);
}
开发者ID:andrewdoynikov,项目名称:MiniClock,代码行数:12,代码来源:button.c

示例15: open_log_init

void open_log_init(void) {
    uart1Init();
    uartSetBaudRate(1,9600);
    
	OPEN_LOG_PWR_PORT &= ~(1<<OPEN_LOG_PWR_PIN);
	DDR(OPEN_LOG_PWR_PORT) |= (1<<OPEN_LOG_PWR_PIN);
	
	//	setup our reset port and pin, hold reset high
	OPEN_LOG_RESET_PORT |= (1<<OPEN_LOG_RESET_PIN);
	DDR(OPEN_LOG_RESET_PORT) |= (1<<OPEN_LOG_RESET_PIN);
}
开发者ID:BlackBears,项目名称:High-altitude-balloon-project-Master2,代码行数:11,代码来源:openlog.c


注:本文中的DDR函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。