本文整理汇总了C++中port_pin_set_output_level函数的典型用法代码示例。如果您正苦于以下问题:C++ port_pin_set_output_level函数的具体用法?C++ port_pin_set_output_level怎么用?C++ port_pin_set_output_level使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了port_pin_set_output_level函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hal_ctrlPinInit
/*==============================================================================
hal_ctrlPinInit()
=============================================================================*/
void * hal_ctrlPinInit(en_targetExtPin_t e_pinType)
{
struct port_config pin_conf;
port_get_config_defaults(&pin_conf);
pinDesc_t * p_pin = NULL;
/* Configure SPI interface */
port_get_config_defaults(&pin_conf);
switch (e_pinType){
case E_TARGET_RADIO_RST:
pin_conf.direction = PORT_PIN_DIR_OUTPUT;
port_pin_set_config(st_rst, &pin_conf); // RST_PIN
port_pin_set_output_level(st_rst, true); // RST_PIN
p_pin = &st_rst;
break;
case E_TARGET_RADIO_SLPTR:
pin_conf.direction = PORT_PIN_DIR_OUTPUT;
port_pin_set_config(st_slp_tr, &pin_conf); // SLP_PIN
port_pin_set_output_level(st_slp_tr, true); // SLP_PIN
p_pin = &st_slp_tr;
break;
default:
free(p_pin);
break;
}
return p_pin;
} /* hal_ctrlPinInit */
示例2: SPI_Read_AD5421
void SPI_Read_AD5421(uint8_t* data)
{
port_pin_set_output_level(PIN_PA18, 0);
//spi_read_buffer_wait(&spi_master_instance_AD5421, data, 3, 0);
spi_transceive_buffer_wait(&spi_master_instance_AD5421, data, data, 3);
port_pin_set_output_level(PIN_PA18, 1);
}
示例3: SPI_Read_ADXL
void SPI_Read_ADXL(uint8_t* data)
{
port_pin_set_output_level(PIN_PA06, 0);
//spi_read_buffer_wait(&spi_master_instance_ADXL, data, 2, 0);
spi_transceive_buffer_wait(&spi_master_instance_ADXL, data, data, 2);
port_pin_set_output_level(PIN_PA06, 1);
}
示例4: ksz8851snl_hard_reset
/**
* \internal
* \brief Perform hardware reset of the PHY.
*/
static inline void ksz8851snl_hard_reset(void)
{
/* Perform hardware reset with respect to the reset timing from the datasheet. */
port_pin_set_output_level(KSZ8851SNL_RSTN_PIN, false);
delay_ms(100);
port_pin_set_output_level(KSZ8851SNL_RSTN_PIN, true);
delay_ms(100);
}
示例5: led_set
/**
* \brief Set LED0 on Xplained board on/off
*/
void led_set(bool state)
{
if (state) {
port_pin_set_output_level(LED_0_PIN, LED_0_ACTIVE);
} else {
port_pin_set_output_level(LED_0_PIN, LED_0_INACTIVE);
}
}
示例6: update_led_state
/* Updates the board LED to the current button state. */
static void update_led_state(void)
{
bool pin_state = port_pin_get_input_level(BUTTON_0_PIN);
if (pin_state) {
port_pin_set_output_level(LED_0_PIN, LED_0_INACTIVE);
} else {
port_pin_set_output_level(LED_0_PIN, LED_0_ACTIVE);
}
}
示例7: nm_bsp_reset
/**
* @fn nm_bsp_reset
* @brief Reset NMC1500 SoC by setting CHIP_EN and RESET_N signals low,
* CHIP_EN high then RESET_N high
*/
void nm_bsp_reset(void)
{
port_pin_set_output_level(CONF_WINC_PIN_CHIP_ENABLE, false);
port_pin_set_output_level(CONF_WINC_PIN_RESET, false);
nm_bsp_sleep(100);
port_pin_set_output_level(CONF_WINC_PIN_CHIP_ENABLE, true);
nm_bsp_sleep(100);
port_pin_set_output_level(CONF_WINC_PIN_RESET, true);
nm_bsp_sleep(100);
}
示例8: leds_arch_set
void
leds_arch_set(unsigned char new_led_status)
{
led_status = new_led_status;
if (led_status & LEDS_GREEN) {
port_pin_set_output_level(LED_0_PIN, LED_0_ACTIVE);
} else {
port_pin_set_output_level(LED_0_PIN, LED_0_INACTIVE);
}
}
示例9: RH
//------------ --------------------
//-----湿度读取子程序 ------------
//---------------------- ----------
//----以下变量均为全局变量--------
//----温度高8位== U8T_data_H------
//----温度低8位== U8T_data_L------
//----湿度高8位== U8RH_data_H-----
//----湿度低8位== U8RH_data_L-----
//----校验 8位 == U8checkdata-----
//----调用相关子程序如下----------
//---- delay_us();, delay_ms();COM();
//--------------------- -----------
void RH(void)
{
//主机拉低18ms
port_pin_set_config(DATA, &pinc);
port_pin_set_output_level(DATA, false);
delay_ms(18);
port_pin_set_output_level(DATA, true);
//总线由上拉电阻拉高 主机延时20us
delay_us(20);
//主机设为输入 判断从机响应信号
port_pin_set_output_level(DATA, true);
port_pin_set_config(DATA, &pini);
//判断从机是否有低电平响应信号 如不响应则跳出,响应则向下运行
if(!port_pin_get_input_level(DATA)) //T !
{
U8FLAG=2;
//判断从机是否发出 80us 的低电平响应信号是否结束
while((!port_pin_get_input_level(DATA))&&U8FLAG++);
U8FLAG=2;
//判断从机是否发出 80us 的高电平,如发出则进入数据接收状态
while((port_pin_get_input_level(DATA))&&U8FLAG++);
//数据接收状态
Run_COM();
U8RH_data_H_temp=U8comdata;
Run_COM();
U8RH_data_L_temp=U8comdata;
Run_COM();
U8T_data_H_temp=U8comdata;
Run_COM();
U8T_data_L_temp=U8comdata;
Run_COM();
U8checkdata_temp=U8comdata;
port_pin_set_config(DATA, &pinc);
port_pin_set_output_level(DATA, true);
//数据校验
U8Temp=(U8T_data_H_temp+U8T_data_L_temp+U8RH_data_H_temp+U8RH_data_L_temp);
if(U8Temp==U8checkdata_temp)
{
U8RH_data_H=U8RH_data_H_temp;
U8RH_data_L=U8RH_data_L_temp;
U8T_data_H=U8T_data_H_temp;
U8T_data_L=U8T_data_L_temp;
U8checkdata=U8checkdata_temp;
}//fi
}//fi
}
示例10: rf212_init
/**
* \brief Init the radio
* \return Returns success/fail
* \retval 0 Success
*/
static int
rf212_init(void)
{
volatile uint8_t regtemp;
uint8_t radio_state; /* don't optimize this away, it's important */
//uint8_t temp;
PRINTF("RF212: init.\n");
/* init SPI and GPIOs, wake up from sleep/power up. */
//rf212_arch_init();
trx_spi_init();
/* reset will put us into TRX_OFF state */
/* reset the radio core */
port_pin_set_output_level(AT86RFX_RST_PIN, false);
delay_cycles_ms(1);
port_pin_set_output_level(AT86RFX_RST_PIN, true);
port_pin_set_output_level(AT86RFX_SLP_PIN, false); /*wakeup from sleep*/
/* before enabling interrupts, make sure we have cleared IRQ status */
regtemp = trx_reg_read(RF212_REG_IRQ_STATUS);
printf("After wake from sleep\n");
radio_state = rf212_status();
printf("After arch read reg: state 0x%04x\n", radio_state);
/* Assign regtemp to regtemp to avoid compiler warnings */
regtemp = regtemp;
if(radio_state == STATE_P_ON) {
trx_reg_write(RF212_REG_TRX_STATE, TRXCMD_TRX_OFF);
}
trx_irq_init((FUNC_PTR)rf212_interrupt_poll);
ENABLE_TRX_IRQ();
system_interrupt_enable_global();
/* Configure the radio using the default values except these. */
trx_reg_write(RF212_REG_TRX_CTRL_1, RF212_REG_TRX_CTRL_1_CONF);
trx_reg_write(RF212_REG_PHY_CC_CCA, RF212_REG_PHY_CC_CCA_CONF);
trx_reg_write(RF212_REG_PHY_TX_PWR_CONF, RF212_REG_PHY_TX_PWR_CONF);
//temp = rf212_arch_read_reg(RF212_REG_TRX_CTRL_2);
trx_reg_write(RF212_REG_TRX_CTRL_2, RF212_REG_TRX_CTRL_2_CONF);
trx_reg_write(RF212_REG_IRQ_MASK, RF212_REG_IRQ_MASK_CONF);
#if HW_CSMA_FRAME_RETRIES
trx_bit_write(SR_MAX_FRAME_RETRIES, 3);
trx_bit_write(SR_MAX_CSMA_RETRIES, 4);
#else
trx_bit_write(SR_MAX_FRAME_RETRIES, 0);
trx_bit_write(SR_MAX_CSMA_RETRIES, 7);
#endif
SetPanId(IEEE802154_CONF_PANID);
rf_generate_random_seed();
/* start the radio process */
process_start(&rf212_radio_process, NULL);
return 0;
}
示例11: write_buffer
/*---------------------------------------------------------------------------*/
static int
write_buffer(const unsigned char * buffer, uint8_t len)
{
port_pin_set_output_level(RS485_TXE, true);
if (usart_write_buffer_wait(&usart_instance, buffer, len) == STATUS_OK) {
port_pin_set_output_level(RS485_TXE, false);
return len;
} else {
return -1;
}
}
示例12: write_byte
/*---------------------------------------------------------------------------*/
static int
write_byte(const unsigned char b)
{
port_pin_set_output_level(RS485_TXE, true);
if (usart_write_wait(&usart_instance, b) == STATUS_OK) {
port_pin_set_output_level(RS485_TXE, false);
return 1;
} else {
return -1;
}
}
示例13: nm_bsp_deinit
/**
* @fn nm_bsp_deinit
* @brief De-iInitialize BSP
* @return 0 in case of success and -1 in case of failure
*/
sint8 nm_bsp_deinit(void)
{
struct port_config pin_conf;
port_get_config_defaults(&pin_conf);
/* Configure control pins as input no pull up. */
pin_conf.direction = PORT_PIN_DIR_INPUT;
pin_conf.input_pull = PORT_PIN_PULL_NONE;
port_pin_set_output_level(CONF_WINC_PIN_CHIP_ENABLE, false);
port_pin_set_output_level(CONF_WINC_PIN_RESET, false);
port_pin_set_config(CONF_WINC_SPI_INT_PIN, &pin_conf);
return M2M_SUCCESS;
}
示例14: _hal_ledInit
void _hal_ledInit( void )
{
struct port_config pin_conf;
port_get_config_defaults(&pin_conf);
/* Configure LEDs as outputs, turn them off */
pin_conf.direction = PORT_PIN_DIR_OUTPUT;
port_pin_set_config(LED_0_PIN, &pin_conf);
port_pin_set_output_level(LED_0_PIN, LED_0_INACTIVE);
port_pin_set_config(LED_1_PIN, &pin_conf);
port_pin_set_output_level(LED_1_PIN, LED_1_INACTIVE);
port_pin_set_config(LED_2_PIN, &pin_conf);
port_pin_set_output_level(LED_2_PIN, LED_2_INACTIVE);
}
示例15: init_chip_pins
/*
* @fn init_chip_pins
* @brief Initialize reset, chip enable and wake pin
*/
static void init_chip_pins(void)
{
struct port_config pin_conf;
port_get_config_defaults(&pin_conf);
/* Configure control pins as output. */
pin_conf.direction = PORT_PIN_DIR_OUTPUT;
port_pin_set_config(CONF_WINC_PIN_RESET, &pin_conf);
port_pin_set_config(CONF_WINC_PIN_CHIP_ENABLE, &pin_conf);
port_pin_set_config(CONF_WINC_PIN_WAKE, &pin_conf);
port_pin_set_output_level(CONF_WINC_PIN_CHIP_ENABLE, false);
port_pin_set_output_level(CONF_WINC_PIN_RESET, false);
}