本文整理汇总了C++中GPIO_SetBits函数的典型用法代码示例。如果您正苦于以下问题:C++ GPIO_SetBits函数的具体用法?C++ GPIO_SetBits怎么用?C++ GPIO_SetBits使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GPIO_SetBits函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: motorLeftFrontBackward
inline void motorLeftFrontBackward() {
GPIO_SetBits(pinOfMotorLeftFrontBackwardGPIO(), pinOfMotorLeftFrontBackwardPin());
GPIO_ResetBits(pinOfMotorLeftFrontForwardGPIO(), pinOfMotorLeftFrontForwardPin());
}
开发者ID:tolinsqy,项目名称:Spy-Robot-Low-Level,代码行数:4,代码来源:motors.c
示例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);
}
}
开发者ID:Wiznet,项目名称:W7500P,代码行数:85,代码来源:main.c
示例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;
}
开发者ID:neirons,项目名称:pythondatalogger,代码行数:85,代码来源:mass_mal.c
示例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;
}
开发者ID:nathanlnw,项目名称:HB_LOCAL_TakePhoto,代码行数:67,代码来源:Menu_1_Idle.c
示例5: st7735_sendData
void st7735_sendData(uint8_t data){
GPIO_SetBits(GPIOA, ST7735_PIN_A0);
st7735_sendByte(data);
}
开发者ID:Levsha128,项目名称:ST7735-for-stm32,代码行数:4,代码来源:st7735.c
示例6: led_on
void led_on(uint8_t led) {
GPIO_SetBits(leds_port[led], leds[led]);
}
开发者ID:tomasachaval,项目名称:TP5-PWMySPI,代码行数:3,代码来源:bsp.c
示例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);
}
}
开发者ID:DresnerRobotics,项目名称:CM730-Firmware,代码行数:100,代码来源:isr.c
示例8: W5500DeSelect
void W5500DeSelect(void)
{
GPIO_SetBits(W5500_CS_PORT,W5500_CS_PIN);
}
开发者ID:bangbh81,项目名称:paho-mqtt-subscribe-example,代码行数:4,代码来源:W5500HardwareDriver.c
示例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;
//.........这里部分代码省略.........
开发者ID:Gabo991,项目名称:PUT_PTM13_Miernik_mocy,代码行数:101,代码来源:main.c
示例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();
}
开发者ID:Tarsisnat,项目名称:aq32plus,代码行数:68,代码来源:mpu6000.c
示例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;
}
}
}
开发者ID:MBARM,项目名称:MatchboxARM,代码行数:76,代码来源:main.c
示例12: motorRightBackBackward
inline void motorRightBackBackward() {
GPIO_SetBits(pinOfMotorRightBackBackwardGPIO(), pinOfMotorRightBackBackwardPin());
GPIO_ResetBits(pinOfMotorRightBackForwardGPIO(), pinOfMotorRightBackForwardPin());
}
开发者ID:tolinsqy,项目名称:Spy-Robot-Low-Level,代码行数:4,代码来源:motors.c
示例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
}
开发者ID:SynthMurphy,项目名称:Murphy_STM32,代码行数:5,代码来源:main.c
示例14: error
void
error (uint8_t numerror)
{
GPIO_SetBits(BLINK_PORT, (numerror << LED1));
}
开发者ID:phaltness,项目名称:32f4,代码行数:5,代码来源:main.c
示例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);
}
}
开发者ID:httpftpli,项目名称:key,代码行数:6,代码来源:keyscan.c
示例16: main
/**
* @brief Main program.
* @param None
* @retval None
*/
int main(void)
{
// int c;
/*!< At this stage the microcontroller clock setting is already configured,
this is done through SystemInit() function which is called from startup
file (startup_stm32f10x_xx.s) before to branch to application main.
To reconfigure the default setting of SystemInit() function, refer to
system_stm32f10x.c file
*/
SystemInit();
RCC_GetClocksFreq(&RCC_Clocks);
SysTick_Config(SystemCoreClock / SYSTICK_FREQUENCY_HZ);
#ifdef TRACEUART
TRACEUART_Configuration();
#endif //TRACEUART
UART_Configuration();
LED_Init();
/* Output a message on Hyperterminal using printf function */
printf("\n\r\n\r");
printf("*** LATTICE FW LOADER V1.00 Build by phalt on ("__DATE__ "-" __TIME__ ")\n\r");
printf("*** LATTICE FW LOADER V1.00 Rebooting ...\n\r");
/*
* wait for a keystroke (or a button press if you want.)
*/
// printf("\n\rPress Return to start, any other key To Enter the Console ...\n\r");
// c = awaitkey(DEFAULT_BOOT_DELAY);
if(1) //(((c != '\r') && (c != '\n') && (c != '\0')))
{
Delay(500);
GPIO_ResetBits(BLINK_PORT, (0xF << LED1));
// traceprintf("\rtrace start OK\n\r");
// Codec_GPIO_Init();
// Delay(1);
// /* Reset the Codec Registers */
// Codec_Reset();
// Delay(1);
// /* Initialize the Control interface of the Audio Codec */
// Codec_CtrlInterface_Init();
// Delay(1);
if(1)
{
GPIO_SetBits(BLINK_PORT, (0xF << LED1));
// WavePlayBack(AUDIOFREQ, 1);
WavePlayerInit(AUDIOFREQ);
GPIO_ResetBits(BLINK_PORT, (0xF << LED1));
}
while(1) //eugene loop
{
// Codec_CtrlInterface_Init();
GPIO_SetBits(BLINK_PORT, (0x1 << LED1));
// Codec_Write();
Codec_ReadRegister(0x00); //test read of codec
GPIO_ResetBits(BLINK_PORT, (0x1 << LED1));
Delay(1000);
}
if(1) //test
{
init_builtin_cmds();
serial_term();
}
}
printf("*** JUMP to Application now ...\n\r");
run_app(0x08000000);
/* Infinite loop */
while (1);
}
开发者ID:phaltness,项目名称:32f4,代码行数:81,代码来源:main.c
示例17: ETH_GPIO_Config
/**
* @brief Configures the different GPIO ports.
* @param None
* @retval None
*/
void ETH_GPIO_Config(void)
{
volatile uint32_t i;
GPIO_InitTypeDef GPIO_InitStructure;
/* Enable GPIOs clocks */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOB |
RCC_AHB1Periph_GPIOC | RCC_AHB1Periph_GPIOE, ENABLE);
/* Enable SYSCFG clock */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
/* MII/RMII Media interface selection --------------------------------------*/
SYSCFG_ETH_MediaInterfaceConfig(SYSCFG_ETH_MediaInterface_RMII);
/* Ethernet pins configuration ************************************************/
/*
ETH_MDIO --------------> PA2
ETH_MDC ---------------> PC1
ETH_RMII_REF_CLK-------> PA1
ETH_RMII_CRS_DV -------> PA7
ETH_RMII_RXD0 -------> PC4
ETH_RMII_RXD1 -------> PC5
ETH_RMII_TX_EN -------> PB11
ETH_RMII_TXD0 -------> PB12
ETH_RMII_TXD1 -------> PB13
ETH_RST_PIN -------> PE2
*/
/* Configure PA1,PA2 and PA7 */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_7;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL ;
GPIO_Init(GPIOA, &GPIO_InitStructure);
GPIO_PinAFConfig(GPIOA, GPIO_PinSource1, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOA, GPIO_PinSource2, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOA, GPIO_PinSource7, GPIO_AF_ETH);
/* Configure PB11,PB12 and PB13 */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13;
GPIO_Init(GPIOB, &GPIO_InitStructure);
GPIO_PinAFConfig(GPIOB, GPIO_PinSource11, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOB, GPIO_PinSource12, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOB, GPIO_PinSource13, GPIO_AF_ETH);
/* Configure PC1, PC4 and PC5 */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_4 | GPIO_Pin_5;
GPIO_Init(GPIOC, &GPIO_InitStructure);
GPIO_PinAFConfig(GPIOC, GPIO_PinSource1, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOC, GPIO_PinSource4, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOC, GPIO_PinSource5, GPIO_AF_ETH);
/* Configure the PHY RST pin */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOE, &GPIO_InitStructure);
GPIO_ResetBits(GPIOE, GPIO_Pin_2);
for (i = 0; i < 20000; i++);
GPIO_SetBits(GPIOE, GPIO_Pin_2);
for (i = 0; i < 20000; i++);
}
开发者ID:elmat-dev,项目名称:Remote_Dev,代码行数:73,代码来源:stm32f4x7_eth_bsp.c
示例18: main
/**
* @brief main entry point.
* @par Parameters None
* @retval void None
* @par Required preconditions: None
*/
void main(void)
{
uint8_t PayloadLength,
data_sensor,
*bufMessage;
/* deinit I/O ports */
DeInitClock();
DeInitGPIO();
/* Select HSI as system clock source */
#ifdef USE_HSI
CLK_SYSCLKSourceConfig(CLK_SYSCLKSource_HSI);
CLK_SYSCLKDivConfig(CLK_SYSCLKDiv_16);
#else
CLK_SYSCLKSourceSwitchCmd(ENABLE);
/* Select 2MHz HSE as system clock source */
CLK_SYSCLKSourceConfig(CLK_SYSCLKSource_HSE);
CLK_SYSCLKDivConfig(CLK_SYSCLKDiv_4);
CLK_HSICmd(DISABLE);
#endif
// Initializes the LCD glass
LCD_GLASS_Init();
/* LED button init: GPIO set in push pull */
GPIO_Init( LED_GPIO_PORT, LED_GPIO_PIN, GPIO_Mode_Out_PP_Low_Fast);
// set to 0
GPIOE->ODR &= ~LED_GPIO_PIN;
/* USER button init: GPIO set in input interrupt active mode */
GPIO_Init( BUTTON_GPIO_PORT, USER_GPIO_PIN, GPIO_Mode_In_FL_IT);
EXTI_SetPinSensitivity(EXTI_Pin_7, EXTI_Trigger_Falling);
//* Init Bar on LCD all are OFF
BAR0_OFF;
BAR1_OFF;
BAR2_OFF;
BAR3_OFF;
enableInterrupts();
//* At power on VDD diplays
bufMessage = NDEFmessage;
if (EEMenuState > STATE_TEMPMEAS)
EEMenuState = STATE_CHECKNDEFMESSAGE;
FLASH_Unlock(FLASH_MemType_Data );
state_machine = EEMenuState ;
delayLFO_ms (1);
if (EEInitial == 0)
{
User_WriteFirmwareVersion ();
EEInitial =1;
}
while (1)
{
switch (state_machine)
{
case STATE_VREFF:
// measure the voltage available at the output of the M24LR04E-R
Vref_measure();
delayLFO_ms (2);
//turn on led
GPIO_SetBits(GPIOE, GPIO_Pin_6);
break;
case STATE_VBIO:
//measure the output voltage of biosensor through Pin 7 Port E
CLK_PeripheralClockConfig(CLK_Peripheral_ADC1, ENABLE);
ADC_DeInit(ADC1);
ADC_VrefintCmd(ENABLE);
delay_10us(3);
GPIO_DeInit(GPIOE);
GPIO_Init(GPIOE,GPIO_Pin_7 ,/*GPIO_Mode_In_FL_No_IT*/GPIO_Mode_In_PU_No_IT);
ADC_Cmd(ADC1, ENABLE);
ADC_Init(ADC1, ADC_ConversionMode_Single,ADC_Resolution_12Bit, ADC_Prescaler_1);
ADC_SamplingTimeConfig(ADC1, ADC_Group_FastChannels, ADC_SamplingTime_9Cycles);
ADC_ChannelCmd(ADC1, ADC_Channel_3, ENABLE);
//.........这里部分代码省略.........
开发者ID:SWilliams100,项目名称:biosensor-code,代码行数:101,代码来源:main.c
示例19: STM32_EVAL_LEDOn
/**
* @brief Turn selected LEDs On.
* @param LED: Specifies the Led to be set on.
* This parameter can be one of following parameters:
* @arg LED1: Led 1
* @arg LED2: Led 2
* @arg LED3: Led 3
* @arg LED4: Led 4
* @retval: None
*/
void STM32_EVAL_LEDOn(Led_TypeDef LED)
{
/* Turn on the relative LED */
GPIO_SetBits(GPIO_PORT[LED], GPIO_PIN[LED]);
}
开发者ID:jiesse,项目名称:time-meter,代码行数:16,代码来源:stm3210_eval.c
示例20: TS_PinForceUp
void TS_PinForceUp()
{
GPIO_SetBits(tsGpioPort,tsPin);
GPIO_Init(tsGpioPort, &GPIO_InitStructureDown);
}
开发者ID:vehar,项目名称:STM32L15x_prj,代码行数:5,代码来源:CustDs1820.c
注:本文中的GPIO_SetBits函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论