Exemplo n.º 1
0
GpioClass::GpioClass (const GpioPortNum port, const uint32_t no, const GPIOMode_TypeDef type) :
  io(cPortTab[port].portAdr), pos(1UL << no), num(no) {
  // Povol hodiny
  RCC->AHB1ENR |= cPortTab[port].clkMask;
  // A nastav pin (pořadí dle ST knihovny).
  setSpeed (GPIO_Speed_2MHz);
  setOType (GPIO_OType_PP);
  setMode  (type);
  setPuPd  (GPIO_PuPd_NOPULL);
}
Exemplo n.º 2
0
bool Transporter::Create(uint32 entry, int32 Time)
{
    auto gameobject_info = sMySQLStore.getGameObjectProperties(entry);
    if (gameobject_info == nullptr)
    {
        LOG_ERROR("Failed to create Transporter with go entry %u. Invalid gameobject!", entry);
        return false;
    }

    // Create transport
    float x, y, z, o;
    uint32 mapid;
    x = m_WayPoints[0].x;
    y = m_WayPoints[0].y;
    z = m_WayPoints[0].z;
    mapid = m_WayPoints[0].mapid;
    o = m_WayPoints[0].o;

    if (!CreateFromProto(entry, mapid, x, y, z, o))
        return false;

    // Override these flags to avoid mistakes in proto
    setFlags(GO_FLAG_TRANSPORT | GO_FLAG_NEVER_DESPAWN);
    setAnimationProgress(255);

    setOType(GAMEOBJECT_TYPE_MO_TRANSPORT);

    m_overrides = GAMEOBJECT_INFVIS | GAMEOBJECT_ONMOVEWIDE;

    m_period = Time;

    // Set position
    SetMapId(mapid);
    SetPosition(x, y, z, o);
    setLevel(m_period);

    return true;
}