本文整理汇总了C++中GPIO_SetBits函数的典型用法代码示例。如果您正苦于以下问题:C++ GPIO_SetBits函数的具体用法?C++ GPIO_SetBits怎么用?C++ GPIO_SetBits使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GPIO_SetBits函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: motorLeftFrontBackward
inline void motorLeftFrontBackward() {
GPIO_SetBits(pinOfMotorLeftFrontBackwardGPIO(), pinOfMotorLeftFrontBackwardPin());
GPIO_ResetBits(pinOfMotorLeftFrontForwardGPIO(), pinOfMotorLeftFrontForwardPin());
}
示例2: main
/**
* @brief Main Function
*/
int main()
{
/* Set Systme init */
SystemInit();
/* GPIO LED(R) Set */
GPIO_InitDef.GPIO_Pin = GPIO_Pin_0; // Set to Pin_0 (LED(R))
GPIO_InitDef.GPIO_Mode = GPIO_Mode_OUT; // Set to Mode Output
GPIO_Init(GPIOC, &GPIO_InitDef);
PAD_AFConfig(PAD_PC,GPIO_Pin_0, PAD_AF1); // PAD Config - LED used 2nd Function
/* GPIO LED(G) Set */
GPIO_InitDef.GPIO_Pin = GPIO_Pin_4; // Set to Pin_4 (LED(G))
GPIO_InitDef.GPIO_Mode = GPIO_Mode_OUT; // Set to Mode Output
GPIO_Init(GPIOC, &GPIO_InitDef);
PAD_AFConfig(PAD_PC,GPIO_Pin_4, PAD_AF1); // PAD Config - LED used 2nd Function
/* GPIO LED(B) Set */
GPIO_InitDef.GPIO_Pin = GPIO_Pin_5; // Set to Pin_5 (LED(B))
GPIO_InitDef.GPIO_Mode = GPIO_Mode_OUT; // Set to Mode Output
GPIO_Init(GPIOC, &GPIO_InitDef);
PAD_AFConfig(PAD_PC,GPIO_Pin_5, PAD_AF1); // PAD Config - LED used 2nd Function
GPIO_SetBits(GPIOC, GPIO_Pin_0); // LED(R) Off
GPIO_SetBits(GPIOC, GPIO_Pin_4); // LED(G) Off
GPIO_SetBits(GPIOC, GPIO_Pin_5); // LED(B) Off
while(1)
{
// LED(RGB) On/off
delay_ms(500);
GPIO_ResetBits(GPIOC, GPIO_Pin_0);
GPIO_ResetBits(GPIOC, GPIO_Pin_4);
GPIO_ResetBits(GPIOC, GPIO_Pin_5);
delay_ms(500);
GPIO_SetBits(GPIOC, GPIO_Pin_0);
GPIO_SetBits(GPIOC, GPIO_Pin_4);
GPIO_SetBits(GPIOC, GPIO_Pin_5);
// LED(RG) On/off
delay_ms(500);
GPIO_ResetBits(GPIOC, GPIO_Pin_0);
GPIO_ResetBits(GPIOC, GPIO_Pin_4);
delay_ms(500);
GPIO_SetBits(GPIOC, GPIO_Pin_0);
GPIO_SetBits(GPIOC, GPIO_Pin_4);
// LED(GB) On/off
delay_ms(500);
GPIO_ResetBits(GPIOC, GPIO_Pin_4);
GPIO_ResetBits(GPIOC, GPIO_Pin_5);
delay_ms(500);
GPIO_SetBits(GPIOC, GPIO_Pin_4);
GPIO_SetBits(GPIOC, GPIO_Pin_5);
// LED(BR) On/off
delay_ms(500);
GPIO_ResetBits(GPIOC, GPIO_Pin_0);
GPIO_ResetBits(GPIOC, GPIO_Pin_5);
delay_ms(500);
GPIO_SetBits(GPIOC, GPIO_Pin_0);
GPIO_SetBits(GPIOC, GPIO_Pin_5);
// LED(R) On/off
delay_ms(500);
GPIO_ResetBits(GPIOC, GPIO_Pin_0);
delay_ms(500);
GPIO_SetBits(GPIOC, GPIO_Pin_0);
// LED(G) On/off
delay_ms(500);
GPIO_ResetBits(GPIOC, GPIO_Pin_4);
delay_ms(500);
GPIO_SetBits(GPIOC, GPIO_Pin_4);
// LED(B) On/off
delay_ms(500);
GPIO_ResetBits(GPIOC, GPIO_Pin_5);
delay_ms(500);
GPIO_SetBits(GPIOC, GPIO_Pin_5);
}
}
示例3: MAL_GetStatus
/*******************************************************************************
* Function Name : MAL_GetStatus
* Description : Get status
* Input : None
* Output : None
* Return : None
*******************************************************************************/
uint16_t MAL_GetStatus (uint8_t lun)
{
#ifdef USE_STM3210E_EVAL
NAND_IDTypeDef NAND_ID;
uint32_t DeviceSizeMul = 0, NumberOfBlocks = 0;
#else
uint32_t temp_block_mul = 0;
sMSD_CSD MSD_csd;
uint32_t DeviceSizeMul = 0;
#endif
if (lun == 0)
{
#ifdef USE_STM3210E_EVAL
if (SD_Init() == SD_OK)
{
SD_GetCardInfo(&SDCardInfo);
SD_SelectDeselect((uint32_t) (SDCardInfo.RCA << 16));
DeviceSizeMul = (SDCardInfo.SD_csd.DeviceSizeMul + 2);
if(SDCardInfo.CardType == SDIO_HIGH_CAPACITY_SD_CARD)
{
Mass_Block_Count[0] = (SDCardInfo.SD_csd.DeviceSize + 1) * 1024;
}
else
{
NumberOfBlocks = ((1 << (SDCardInfo.SD_csd.RdBlockLen)) / 512);
Mass_Block_Count[0] = ((SDCardInfo.SD_csd.DeviceSize + 1) * (1 << DeviceSizeMul) << (NumberOfBlocks/2));
}
Mass_Block_Size[0] = 512;
Status = SD_SelectDeselect((uint32_t) (SDCardInfo.RCA << 16));
Status = SD_EnableWideBusOperation(SDIO_BusWide_4b);
if ( Status != SD_OK )
{
return MAL_FAIL;
}
Status = SD_SetDeviceMode(SD_DMA_MODE);
if ( Status != SD_OK )
{
return MAL_FAIL;
}
#else
MSD_GetCSDRegister(&MSD_csd);
DeviceSizeMul = MSD_csd.DeviceSizeMul + 2;
temp_block_mul = (1 << MSD_csd.RdBlockLen)/ 512;
Mass_Block_Count[0] = ((MSD_csd.DeviceSize + 1) * (1 << (DeviceSizeMul))) * temp_block_mul;
Mass_Block_Size[0] = 512;
Mass_Memory_Size[0] = (Mass_Block_Count[0] * Mass_Block_Size[0]);
#endif
Mass_Memory_Size[0] = Mass_Block_Count[0] * Mass_Block_Size[0];
GPIO_SetBits(USB_LED_PORT, GPIO_Pin_7);
return MAL_OK;
#ifdef USE_STM3210E_EVAL
}
#endif
}
#ifdef USE_STM3210E_EVAL
else
{
FSMC_NAND_ReadID(&NAND_ID);
if (NAND_ID.Device_ID != 0 )
{
/* only one zone is used */
Mass_Block_Count[1] = NAND_ZONE_SIZE * NAND_BLOCK_SIZE * NAND_MAX_ZONE ;
Mass_Block_Size[1] = NAND_PAGE_SIZE;
Mass_Memory_Size[1] = (Mass_Block_Count[1] * Mass_Block_Size[1]);
return MAL_OK;
}
}
#endif
GPIO_ResetBits(USB_LED_PORT, GPIO_Pin_7);
return MAL_FAIL;
}
示例4: keypress
static void keypress(unsigned int key)
{
switch(KeyValue)
{
case KeyValueMenu:
CounterBack=0;
SetVIN_NUM=1;
OK_Counter=0;
CounterBack=0;
UpAndDown=1;//
pMenuItem=&Menu_2_InforCheck;
pMenuItem->show();
reset_firstset=0;
deviceID_set_num=0;
break;
case KeyValueOk:
if(deviceID_set_num==0)
deviceID_set_num=1;
else if(deviceID_set_num==1)
deviceID_set_num=2;
else if(deviceID_set_num==2)
deviceID_set_num=3;
else if(deviceID_set_num==3)
deviceID_set_num=4;
else if(deviceID_set_num==4)
deviceID_set_num=5;
if(reset_firstset==0)
reset_firstset=1;
else if(reset_firstset==3)
reset_firstset=4;
else if(reset_firstset==4)
reset_firstset=5;
break;
case KeyValueUP:
if(deviceID_set_num==5)
deviceID_set_num=6;
else if(deviceID_set_num==6)
deviceID_set_num=7;
else if(deviceID_set_num==7)
deviceID_set_num=8;
else if(deviceID_set_num==8)
deviceID_set_num=9;
else if(deviceID_set_num==9)
deviceID_set_num=10;
if(reset_firstset==1)
reset_firstset=2;
else if(reset_firstset==2)
reset_firstset=3;
else if(reset_firstset==5)
reset_firstset=6;
break;
case KeyValueDown:
reset_firstset=0;
deviceID_set_num=0;
//打印开电
GPIO_SetBits(GPIOB,GPIO_Pin_7);
print_rec_flag=1;//打印标志
break;
}
KeyValue=0;
}
示例5: st7735_sendData
void st7735_sendData(uint8_t data){
GPIO_SetBits(GPIOA, ST7735_PIN_A0);
st7735_sendByte(data);
}
示例6: led_on
void led_on(uint8_t led) {
GPIO_SetBits(leds_port[led], leds[led]);
}
示例7: ISR_LED_RGB_TIMER
void ISR_LED_RGB_TIMER(void)
{
vu8 gbUSB_Enable = 0;
gbLEDPwm = (++gbLEDPwm)&0x1f;
if( GPIO_ReadInputDataBit(PORT_PA13, PIN_PA13) != SET ) gbUSB_Enable = 0;
else gbUSB_Enable = 1;
if( gbUSB_Enable == 0 )
{
gbLEDHeadR = 0;
gbLEDHeadG = 0x1F;
gbLEDHeadB = 0;
if( bLED_Counter )
{
wLED_Timer--;
if( wLED_Timer == 0 )
{
bLED_Counter--;
wLED_Timer = BLINK_TIME;
if( bLedBlinkFlag ) bLedBlinkFlag = 0;
else bLedBlinkFlag = 1;
if( bLED_Counter == 0 ) bLedBlinkFlag = 0;
}
}
if( !bLedBlinkFlag )
{
GPIO_SetBits(PORT_LED5_R, PIN_LED5_R);
GPIO_SetBits(PORT_LED5_G, PIN_LED5_G);
GPIO_SetBits(PORT_LED5_B, PIN_LED5_B);
}
else
{
GPIO_SetBits(PORT_LED5_R, PIN_LED5_R);
GPIO_ResetBits(PORT_LED5_G, PIN_LED5_G);
GPIO_SetBits(PORT_LED5_B, PIN_LED5_B);
}
}
else
{
bLED_Counter=BLINK_COUNT;
wLED_Timer=BLINK_TIME;
if (gbLEDPwm >= gbLEDHeadR)
{
GPIO_SetBits(PORT_LED5_R, PIN_LED5_R);
}
else
{
GPIO_ResetBits(PORT_LED5_R, PIN_LED5_R);
}
if (gbLEDPwm >= gbLEDHeadG)
{
GPIO_SetBits(PORT_LED5_G, PIN_LED5_G);
}
else
{
GPIO_ResetBits(PORT_LED5_G, PIN_LED5_G);
}
if (gbLEDPwm >= gbLEDHeadB)
{
GPIO_SetBits(PORT_LED5_B, PIN_LED5_B);
}
else
{
GPIO_ResetBits(PORT_LED5_B, PIN_LED5_B);
}
}
if (gbLEDPwm >= gbLEDEyeR)
{
GPIO_SetBits(PORT_LED6_R, PIN_LED6_R);
}
else
{
GPIO_ResetBits(PORT_LED6_R, PIN_LED6_R);
}
if (gbLEDPwm >= gbLEDEyeG)
{
GPIO_SetBits(PORT_LED6_G, PIN_LED6_G);
}
else
{
GPIO_ResetBits(PORT_LED6_G, PIN_LED6_G);
}
if (gbLEDPwm >= gbLEDEyeB)
{
GPIO_SetBits(PORT_LED6_B, PIN_LED6_B);
}
else
{
GPIO_ResetBits(PORT_LED6_B, PIN_LED6_B);
}
}
示例8: W5500DeSelect
void W5500DeSelect(void)
{
GPIO_SetBits(W5500_CS_PORT,W5500_CS_PIN);
}
示例9: main
int main(void)
{
SystemInit();
SystemCoreClockUpdate(); // inicjalizacja dystrybucji czasu procesora
/* Enable the SPI periph */
RCC_APB2PeriphClockCmd(LIS302DL_SPI_CLK, ENABLE);
/* Enable SCK, MOSI and MISO GPIO clocks */
RCC_AHB1PeriphClockCmd(LIS302DL_SPI_SCK_GPIO_CLK | LIS302DL_SPI_MISO_GPIO_CLK |
LIS302DL_SPI_MOSI_GPIO_CLK, ENABLE);
/* Enable CS GPIO clock */
RCC_AHB1PeriphClockCmd(LIS302DL_SPI_CS_GPIO_CLK, ENABLE);
/* Enable INT1 GPIO clock */
RCC_AHB1PeriphClockCmd(LIS302DL_SPI_INT1_GPIO_CLK, ENABLE);
/* Enable INT2 GPIO clock */
RCC_AHB1PeriphClockCmd(LIS302DL_SPI_INT2_GPIO_CLK, ENABLE);
GPIO_PinAFConfig(LIS302DL_SPI_SCK_GPIO_PORT, LIS302DL_SPI_SCK_SOURCE,
LIS302DL_SPI_SCK_AF);
GPIO_PinAFConfig(LIS302DL_SPI_MISO_GPIO_PORT, LIS302DL_SPI_MISO_SOURCE,
LIS302DL_SPI_MISO_AF);
GPIO_PinAFConfig(LIS302DL_SPI_MOSI_GPIO_PORT, LIS302DL_SPI_MOSI_SOURCE,
LIS302DL_SPI_MOSI_AF);
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
/* SPI SCK pin configuration */
GPIO_InitStructure.GPIO_Pin = LIS302DL_SPI_SCK_PIN;
GPIO_Init(LIS302DL_SPI_SCK_GPIO_PORT, &GPIO_InitStructure);
/* SPI MOSI pin configuration */
GPIO_InitStructure.GPIO_Pin = LIS302DL_SPI_MOSI_PIN;
GPIO_Init(LIS302DL_SPI_MOSI_GPIO_PORT, &GPIO_InitStructure);
/* SPI MISO pin configuration */
GPIO_InitStructure.GPIO_Pin = LIS302DL_SPI_MISO_PIN;
GPIO_Init(LIS302DL_SPI_MISO_GPIO_PORT, &GPIO_InitStructure);
/* SPI configuration -------------------------------------------------------*/
SPI_InitTypeDef SPI_InitStructure;
SPI_I2S_DeInit(LIS302DL_SPI);
SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex;
SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b;
SPI_InitStructure.SPI_CPOL = SPI_CPOL_Low;
SPI_InitStructure.SPI_CPHA = SPI_CPHA_1Edge;
SPI_InitStructure.SPI_NSS = SPI_NSS_Soft;
SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_4;
SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB;
SPI_InitStructure.SPI_CRCPolynomial = 7;
SPI_InitStructure.SPI_Mode = SPI_Mode_Master;
SPI_Init(LIS302DL_SPI, &SPI_InitStructure);
/* Enable SPI1 */
SPI_Cmd(LIS302DL_SPI, ENABLE);
/* Configure GPIO PIN for Lis Chip select */
GPIO_InitStructure.GPIO_Pin = LIS302DL_SPI_CS_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(LIS302DL_SPI_CS_GPIO_PORT, &GPIO_InitStructure);
/* Deselect : Chip Select high */
GPIO_SetBits(LIS302DL_SPI_CS_GPIO_PORT, LIS302DL_SPI_CS_PIN);
/* Configure GPIO PINs to detect Interrupts */
GPIO_InitStructure.GPIO_Pin = LIS302DL_SPI_INT1_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(LIS302DL_SPI_INT1_GPIO_PORT, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = LIS302DL_SPI_INT2_PIN;
GPIO_Init(LIS302DL_SPI_INT2_GPIO_PORT, &GPIO_InitStructure);
LIS302DL_InitTypeDef LIS302DL_InitStruct;
uint8_t ctrl = 0x00;
/* Set configuration of LIS302DL*/
LIS302DL_InitStruct.Power_Mode = LIS302DL_LOWPOWERMODE_ACTIVE;
LIS302DL_InitStruct.Output_DataRate = LIS302DL_DATARATE_100;
LIS302DL_InitStruct.Axes_Enable = LIS302DL_X_ENABLE | LIS302DL_Y_ENABLE |
LIS302DL_Z_ENABLE;
LIS302DL_InitStruct.Full_Scale = LIS302DL_FULLSCALE_2_3;
LIS302DL_InitStruct.Self_Test = LIS302DL_SELFTEST_NORMAL;
LIS302DL_Init(&LIS302DL_InitStruct);
LIS302DL_InterruptConfigTypeDef LIS302DL_InterruptStruct;
/* Set configuration of Internal High Pass Filter of LIS302DL*/
LIS302DL_InterruptStruct.Latch_Request = LIS302DL_INTERRUPTREQUEST_LATCHED;
LIS302DL_InterruptStruct.SingleClick_Axes = LIS302DL_CLICKINTERRUPT_Z_ENABLE;
LIS302DL_InterruptStruct.DoubleClick_Axes = LIS302DL_DOUBLECLICKINTERRUPT_Z_ENABLE;
LIS302DL_InterruptConfig(&LIS302DL_InterruptStruct);
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD | RCC_AHB1Periph_GPIOA, ENABLE);
/* Configure PD12, PD13, PD14 and PD15 in output pushpull mode */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_13| GPIO_Pin_14| GPIO_Pin_15;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
//.........这里部分代码省略.........
示例10: initMPU6000
void initMPU6000(void)
{
///////////////////////////////////
GPIO_ResetBits(MPU6000_CS_GPIO, MPU6000_CS_PIN);
spiTransfer(MPU6000_SPI, MPU6000_PWR_MGMT_1); // Device Reset
spiTransfer(MPU6000_SPI, BIT_H_RESET);
GPIO_SetBits(MPU6000_CS_GPIO, MPU6000_CS_PIN);
delay(150);
GPIO_ResetBits(MPU6000_CS_GPIO, MPU6000_CS_PIN);
spiTransfer(MPU6000_SPI, MPU6000_PWR_MGMT_1); // Clock Source PPL with Z axis gyro reference
spiTransfer(MPU6000_SPI, MPU_CLK_SEL_PLLGYROZ);
GPIO_SetBits(MPU6000_CS_GPIO, MPU6000_CS_PIN);
delayMicroseconds(1);
GPIO_ResetBits(MPU6000_CS_GPIO, MPU6000_CS_PIN);
spiTransfer(MPU6000_SPI, MPU6000_USER_CTRL); // Disable Primary I2C Interface
spiTransfer(MPU6000_SPI, BIT_I2C_IF_DIS);
GPIO_SetBits(MPU6000_CS_GPIO, MPU6000_CS_PIN);
delayMicroseconds(1);
GPIO_ResetBits(MPU6000_CS_GPIO, MPU6000_CS_PIN);
spiTransfer(MPU6000_SPI, MPU6000_PWR_MGMT_2);
spiTransfer(MPU6000_SPI, 0x00);
GPIO_SetBits(MPU6000_CS_GPIO, MPU6000_CS_PIN);
delayMicroseconds(1);
GPIO_ResetBits(MPU6000_CS_GPIO, MPU6000_CS_PIN);
spiTransfer(MPU6000_SPI, MPU6000_SMPLRT_DIV); // Accel Sample Rate 1000 Hz, Gyro Sample Rate 8000 Hz
spiTransfer(MPU6000_SPI, 0x00);
GPIO_SetBits(MPU6000_CS_GPIO, MPU6000_CS_PIN);
delayMicroseconds(1);
GPIO_ResetBits(MPU6000_CS_GPIO, MPU6000_CS_PIN);
spiTransfer(MPU6000_SPI, MPU6000_CONFIG); // Accel and Gyro DLPF Setting
spiTransfer(MPU6000_SPI, eepromConfig.dlpfSetting);
GPIO_SetBits(MPU6000_CS_GPIO, MPU6000_CS_PIN);
delayMicroseconds(1);
GPIO_ResetBits(MPU6000_CS_GPIO, MPU6000_CS_PIN);
spiTransfer(MPU6000_SPI, MPU6000_ACCEL_CONFIG); // Accel +/- 4 G Full Scale
spiTransfer(MPU6000_SPI, BITS_FS_4G);
GPIO_SetBits(MPU6000_CS_GPIO, MPU6000_CS_PIN);
delayMicroseconds(1);
GPIO_ResetBits(MPU6000_CS_GPIO, MPU6000_CS_PIN);
spiTransfer(MPU6000_SPI, MPU6000_GYRO_CONFIG); // Gyro +/- 1000 DPS Full Scale
spiTransfer(MPU6000_SPI, BITS_FS_1000DPS);
GPIO_SetBits(MPU6000_CS_GPIO, MPU6000_CS_PIN);
///////////////////////////////////
setSPIdivisor(MPU6000_SPI, 2); // 21 MHz SPI clock (within 20 +/- 10%)
///////////////////////////////////
delay(100);
computeMPU6000RTData();
}
示例11: main
/* Private function ----------------------------------------------------------*/
int main(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
uint8_t cnt=0;
/* Set the Vector Table base adress at 0x8004000 */
NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x4000);
/* LED0 -> PB0 LED1 -> PB1 */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(GPIOB, &GPIO_InitStructure);
// Initialize protocol stack in RTU mode for a slave with address 10 = 0x0A
// MB_RTU, Device ID: 1, USART portL: 1 (este configurat in portserial.h, Baud rate: 38400, Parity: NONE)
eMBInit(MB_RTU, 1, 1, 38400, MB_PAR_NONE);
// Enable the Modbus Protocol Stack.
eMBEnable();
while(1)
{
// Reset the flag. It will only be set if the modbus pooling has a request
Modbus_Request_Flag = 0;
// Call the main polling loop of the Modbus protocol stack.
eMBPoll();
if (Modbus_Request_Flag) GPIO_SetBits(GPIOB , GPIO_Pin_0);
Delay(0xffff);
if (Modbus_Request_Flag) GPIO_ResetBits(GPIOB , GPIO_Pin_0);
cnt++;
if (cnt == 4) \
{
writeInputRegister(1, 111);
writeInputRegister(2, 222);
writeInputRegister(98, 111);
writeInputRegister(99, 222);
writeHoldingRegister(1, 333);
writeHoldingRegister(2, 444);
writeHoldingRegister(98, 333);
writeHoldingRegister(99, 444);
writeCoil(1, 0);
writeCoil(2, 1);
writeCoil(58, 1);
writeCoil(59, 0);
}
if (cnt == 8)
{
writeInputRegister(1, 222);
writeInputRegister(2, 111);
writeInputRegister(98, 222);
writeInputRegister(99, 111);
writeHoldingRegister(1, 444);
writeHoldingRegister(2, 333);
writeHoldingRegister(98, 444);
writeHoldingRegister(99, 333);
writeCoil(1, 1);
writeCoil(2, 0);
writeCoil(58, 0);
writeCoil(59, 1);
cnt = 0;
}
}
}
示例12: motorRightBackBackward
inline void motorRightBackBackward() {
GPIO_SetBits(pinOfMotorRightBackBackwardGPIO(), pinOfMotorRightBackBackwardPin());
GPIO_ResetBits(pinOfMotorRightBackForwardGPIO(), pinOfMotorRightBackForwardPin());
}
示例13: EVAL_AUDIO_TransferComplete_CallBack
void EVAL_AUDIO_TransferComplete_CallBack(uint32_t pBuffer, uint32_t Size)
{
GPIO_SetBits(GPIOD, GPIO_Pin_12); // LED12
Make_Sound(BUFF_LEN_DIV2); // Fill buffer second half
}
示例14: error
void
error (uint8_t numerror)
{
GPIO_SetBits(BLINK_PORT, (numerror << LED1));
}
示例15: keyScanOutputReset
void keyScanOutputReset(void) {
uint8_t i = 0;
for (i = 0; i < NUM_KEY_OUT; i++) {
GPIO_SetBits(keyScanOutput[i].port, keyScanOutput[i].bit);
}
}