本文整理汇总了C++中PIN_SET函数的典型用法代码示例。如果您正苦于以下问题:C++ PIN_SET函数的具体用法?C++ PIN_SET怎么用?C++ PIN_SET使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PIN_SET函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: leds_tick
void leds_tick(void)
{
leds_counter++;
if( leds_open_state == LED_ON){
PIN_SET(LED_OPEN_PIN);
}else if( leds_open_state == LED_OFF ){
PIN_CLEAR(LED_OPEN_PIN);
}else if( leds_open_state == LED_SHORT_FLASH ){
if( (leds_counter % 1024) < 50 ){
PIN_SET(LED_OPEN_PIN);
}else{
PIN_CLEAR(LED_OPEN_PIN);
}
}
}
示例2: leds_init
void leds_init(void)
{
DDR_CONFIG_OUT(LED_OPEN_PIN);
PIN_SET(LED_OPEN_PIN);
leds_open_state = LED_OFF;
leds_counter = 0;
}
示例3: ISR
/*---------------------------------------------------------------------------*/
ISR(UNMI, unmi_interrupt) /* user non-maskable interrupts */
{
ENERGEST_ON(ENERGEST_TYPE_CPU);
PIN_SET(LED_ERROR); /* use PIN_SET instead of LED_ON */
switch (SYSUNIV) {
case SYSUNIV_NMIIFG: /* non-maskable interrupt */
while(1);
break;
case SYSUNIV_OFIFG: /* oscillator fault */
WAIT_FOR_OSC(); /* try to clear the fault flag */
break;
case SYSUNIV_ACCVIFG: /* Flash Memory Access Violation */
/* will be accidentially triggered after flash programming when using
* a voltage between 2.4 and 2.6V (errata SYS12) */
while(1);
break;
case SYSUNIV_SYSBERRIV:
while(1);
break;
default:
while(1);
break;
}
PIN_CLR(LED_ERROR);
ENERGEST_OFF(ENERGEST_TYPE_CPU);
}
示例4: dcf77_init
void
dcf77_init(void)
{
DCFDEBUG("init dcf77\n");
#ifdef DCF1_USE_PON_SUPPORT
DCFDEBUG("PON\n");
/* if module needs a peak on PON to enable dcf77 receiver
* configure pin as output, set low */
PIN_SET(DCF1_PON);
#endif
#if defined(DCF77_PCINT_PIN)
DCFDEBUG("configure_pcint\n");
/* configure */
dcf77_configure_pcint();
#elif defined(DCF77_INT_PIN)
DCFDEBUG("HAVE_DCF77_INT\n");
/* Initialize "real" Interrupt */
_EIMSK |= _BV(DCF77_INT_PIN);
_EICRA = (_EICRA & ~DCF77_INT_ISCMASK) | DCF77_INT_ISC;
#else
DCFDEBUG("Analog Comparator\n");
// Analog Comparator init
ACSR |= _BV(ACIE);
#endif
#ifdef DCF1_USE_PON_SUPPORT
for (uint8_t i = 0; i < 100; i++)
{
wdt_kick();
_delay_ms(10);
}
PIN_CLEAR(DCF1_PON);
#endif
}
示例5: rc5_send_zero
void rc5_send_zero(void)
{
PIN_SET(RC5_SEND);
_delay_loop_2(RC5_PULSE);
PIN_CLEAR(RC5_SEND);
_delay_loop_2(RC5_PULSE);
}
示例6: dht22_sun5i_write_bit
static void dht22_sun5i_write_bit(u8 bit) {
if (dht22_sun5i_gpio_direction != PIN_DIR_OUT) {
dht22_sun5i_gpio_direction = PIN_DIR_OUT;
PIN_DIR(PIN_DIR_OUT);
}
PIN_SET(bit);
}
示例7: usb_init
void
usb_init(void)
{
#ifdef AUTOSET_USB_ENABLE_PIN_SUPPORT
PIN_SET(USB_ENABLE);
#endif /* AUTOSET_USB_ENABLE_PIN_SUPPORT */
#ifdef USB_NET_SUPPORT
usb_net_init();
#endif
#ifdef USB_KEYBOARD_SUPPORT
#endif
#define USB_DDR_CONFIG(pin) DDR_CHAR( pin ## _PORT) &= ~(_BV((pin ## _PIN)) | _BV(USB_INT_PIN))
#define USB_PORT_CONFIG(pin) PORT_CHAR( pin ## _PORT) &= ~(_BV((pin ## _PIN)) | _BV(USB_INT_PIN))
USB_DDR_CONFIG(USB_DMINUS);
USB_PORT_CONFIG(USB_DMINUS);
#undef USB_DDR_CONFIG
#undef USB_PORT_CONFIG
uint8_t i;
/* Reenummerate the device */
usbDeviceDisconnect();
for(i = 0; i < 20; i++){ /* 300 ms disconnect */
_delay_ms(15);
wdt_kick();
}
usbDeviceConnect();
/* USB Initialize */
usbInit();
}
示例8: rfm12_txstart_hard
static void
rfm12_txstart_hard(void)
{
rfm12_status = RFM12_TX;
#ifdef STATUSLED_RFM12_TX_SUPPORT
PIN_SET(STATUSLED_RFM12_TX);
#endif
ACTIVITY_LED_RFM12_TX;
rfm12_index = 0;
rfm12_prologue(RFM12_MODULE_IP);
rfm12_trans(RFM12_CMD_PWRMGT | RFM12_PWRMGT_ET | RFM12_PWRMGT_ES |
RFM12_PWRMGT_EX);
rfm12_epilogue();
/* Force interrupts active no matter what.
*
* If we're forwarding a packet from say Ethernet, uip_buf_unlock won't
* unlock since there's an active RFM12 transfer, but it'd leave
* the RFM12 interrupt disabled as well. */
_uip_buf_lock = 8;
rfm12_int_enable();
}
示例9: buttons_init
void buttons_init(void)
{
DDR_CONFIG_IN(BUTTON_0);
PIN_SET(BUTTON_0);
DDR_CONFIG_IN(BUTTON_1);
PIN_SET(BUTTON_1);
DDR_CONFIG_IN(BUTTON_2);
PIN_SET(BUTTON_2);
buttons_0_counter = 0;
buttons_1_counter = 0;
buttons_2_counter = 0;
buttons_latched_state = 0;
}
示例10: leds_init
void leds_init(void)
{
DDR_CONFIG_OUT(LED1);
DDR_CONFIG_OUT(LED2);
DDR_CONFIG_OUT(LED3);
PIN_SET(LED2);
}
示例11: hd44780_hw_init
void noinline hd44780_hw_init(void)
{
/* init io pins */
CTRL_OUTPUT();
#ifdef HAVE_LCDON
PIN_SET(LCDON);
#endif
PIN_CLEAR(HD44780_RS);
#ifndef HD44780_MULTIENSUPPORT
PIN_CLEAR(HD44780_EN1);
#endif
#ifdef HD44780_MULTIENSUPPORT
PIN_CLEAR(HD44780_EN1);
PIN_CLEAR(HD44780_EN2);
#endif
#ifdef HAVE_HD44780_RW
PIN_CLEAR(HD44780_RW);
#endif
PIN_CLEAR(HD44780_D4);
PIN_CLEAR(HD44780_D5);
PIN_CLEAR(HD44780_D6);
PIN_CLEAR(HD44780_D7);
DATA_OUTPUT();
#ifdef HD44780_BACKLIGHT_SUPPORT
PIN_CLEAR(HD44780_BL);
#endif
}
示例12: modbus_rxstart
uint8_t
modbus_rxstart(uint8_t *data, uint8_t len, int16_t *recv_len) {
#ifdef MODBUS_CLIENT_SUPPORT
if (data[0] == MODBUS_ADDRESS || data[0] == MODBUS_BROADCAST) {
modbus_client_process(data, len, recv_len);
if (data[0] == MODBUS_ADDRESS)
return 1;
}
#endif
if (modbus_data.crc_len != 0) return 0; /* There is an packet on the way */
/* enable the transmitter */
PIN_SET(MODBUS_TX);
modbus_recv_len_ptr = recv_len;
modbus_data.crc = modbus_crc_calc(data, len);
modbus_data.crc_len = 2;
modbus_data.data = data;
modbus_data.len = len;
/* Enable the tx interrupt and send the first character */
modbus_data.sent = 1;
usart(UCSR,B) |= _BV(usart(TXCIE));
usart(UDR) = data[0];
return 1;
}
示例13: resync_led_display
void resync_led_display(void) {
//Setzt einmal Reset
cli();
PIN_SET(LED_RESET); //Reset high
gzeile = 0;
PIN_CLEAR(LED_RESET); //Reset lo
sei();
}
示例14: init_led_display
void init_led_display(void) {
/*Setzen der Data Direction Regiser auf Ausgang
LED_RESET_DDR |= (1<<LED_RESET_PIN);
LED_SELECT_DDR |= (1<<LED_SELECT_PIN);
LED_BRIGHT_DDR |= (1<<LED_BRIGHT_PIN);
LED_RED_DDR |= (1<<LED_RED_PIN);
LED_GREEN_DDR |= (1<<LED_GREEN_PIN);
LED_CLOCK_DDR |= (1<<LED_CLOCK_PIN);
*/
TC2_COUNTER_CURRENT = 0; //Timer 2 Resetten
_TIMSK_TIMER2 |= _BV(TOIE2); //Timer 2 Overflow Interrupt aktiv
_TCCR2_PRESCALE = _BV(CS21) | _BV(CS20); //Prescaler = 8 /32
PIN_SET(LED_RESET); //LED_RESET_PORT |= (1<<LED_RESET_PIN); //Reset high
gzeile = 0; //beginne mit Zeile 0
PIN_CLEAR(LED_RESET); //Reset low
PIN_SET(LED_SELECT); //LED_SELECT_PORT |= (1<<LED_SELECT_PIN); //Select auf high
}
示例15: switch_channel_multiplex
static void switch_channel_multiplex(void)
{
#if FREQCOUNT_CHANNELS > 1
if (freqcount_current_channel & 0x01)
PIN_SET(FREQCOUNT_CHANNEL_MULTIPLEX_BIT1);
else
PIN_CLEAR(FREQCOUNT_CHANNEL_MULTIPLEX_BIT1);
#endif
#if FREQCOUNT_CHANNELS > 2
if (freqcount_current_channel & 0x02)
PIN_SET(FREQCOUNT_CHANNEL_MULTIPLEX_BIT2);
else
PIN_CLEAR(FREQCOUNT_CHANNEL_MULTIPLEX_BIT2);
#endif
#if FREQCOUNT_CHANNELS > 4
if (freqcount_current_channel & 0x04)
PIN_SET(FREQCOUNT_CHANNEL_MULTIPLEX_BIT3);
else
PIN_CLEAR(FREQCOUNT_CHANNEL_MULTIPLEX_BIT3);
#endif
#if FREQCOUNT_CHANNELS > 8
// we have two 74xx251 multiplexers
// they are enabled by setting the respective
// chip select line to low
// otherwise their output is in high-z
if (freqcount_current_channel & 0x08)
{
// bit 8 set: enable multiplexer ic B
PIN_SET(FREQCOUNT_CHANNEL_MULTIPLEX_CS_A);
PIN_CLEAR(FREQCOUNT_CHANNEL_MULTIPLEX_CS_B);
}
else
{
// bit 8 not set: enable multiplexer ic A
PIN_CLEAR(FREQCOUNT_CHANNEL_MULTIPLEX_CS_A);
PIN_SET(FREQCOUNT_CHANNEL_MULTIPLEX_CS_B);
}
#endif
#if FREQCOUNT_CHANNELS > 16
#error sorry, more than 16 frequency counter channels currently not supported
#endif
}