Пример #1
0
void Init(void)
{
    /********************************************
    *   Init User Button
    ********************************************/
    GPIO_InitTypeDef  GPIO_InitStructure;

    RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);

    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
    GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;  // OD but doesn't matter (input)
    GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;  // doesn't matter (input)
    GPIO_Init(GPIOA, &GPIO_InitStructure);


    /********************************************
    *   Init Hardware for states
    ********************************************/
    initTrackLine();
    initBluetooth();

    /********************************************
    *   Init Motor output commands
    ********************************************/
    RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOD, ENABLE);

    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_6;
    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(GPIOD, &GPIO_InitStructure);
}
Пример #2
0
 /**
  * @brief Scene::Scene
  * @param parent
  */
 Scene::Scene(QObject *parent)
     : QGraphicsScene(parent)
     , m_ShowRelationTrack(false)
     , m_TrackRelationIsActive(false)
     , m_TrackFrom(nullptr)
     , m_TrackTo(nullptr)
 {
     initTrackLine();
 }