/** * \brief This function reads data from EEPROM. * * \param data Address where data is to be read. * \param length Length of data to be read * \param offset Address of the byte from which data to be read. * * \return None. * * \note This muxing depends on the profile in which the EVM is configured. * EEPROMI2CSetUp Shall be called Before this API is used */ void EEPROMI2CRead(unsigned char *data, unsigned int length, unsigned short offset) { unsigned int idx = 0; /* First send the register offset - TX operation */ I2CSetDataCount(I2C_BASE_ADDR, 2); StatusClear(); I2CMasterControl(I2C_BASE_ADDR, I2C_CFG_MST_TX); I2CMasterStart(I2C_BASE_ADDR); /* Wait for the START to actually occir on the bus */ while (0 == I2CMasterBusBusy(I2C_BASE_ADDR)); I2CMasterDataPut(I2C_BASE_ADDR, (unsigned char)((offset >> 8) & 0xFF)); /* Wait for the Tx register to be empty */ while (0 == I2CMasterIntRawStatusEx(I2C_BASE_ADDR, I2C_INT_TRANSMIT_READY)); /* Push offset out and tell CPLD from where we intend to read the data */ I2CMasterDataPut(I2C_BASE_ADDR, (unsigned char)(offset & 0xFF)); I2CMasterIntClearEx(I2C_BASE_ADDR, I2C_INT_TRANSMIT_READY); while(0 == (I2CMasterIntRawStatus(I2C_BASE_ADDR) & I2C_INT_ADRR_READY_ACESS)); StatusClear(); I2CSetDataCount(I2C_BASE_ADDR, length); /* Now that we have sent the register offset, start a RX operation*/ I2CMasterControl(I2C_BASE_ADDR, I2C_CFG_MST_RX); /* Repeated start condition */ I2CMasterStart(I2C_BASE_ADDR); while (length--) { while (0 == I2CMasterIntRawStatusEx(I2C_BASE_ADDR, I2C_INT_RECV_READY)); data[idx++] = (unsigned char)I2CMasterDataGet(I2C_BASE_ADDR); I2CMasterIntClearEx(I2C_BASE_ADDR, I2C_INT_RECV_READY); } I2CMasterStop(I2C_BASE_ADDR); while(0 == (I2CMasterIntRawStatus(I2C_BASE_ADDR) & I2C_INT_STOP_CONDITION)); I2CMasterIntClearEx(I2C_BASE_ADDR, I2C_INT_STOP_CONDITION); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CEntityPanel::OnCursorExited() { if ( m_szMouseOverText[ 0 ] ) { StatusClear(); } }
BaseObject *Objectify::GetVirtualObjects(BaseObject *op, HierarchyHelp *hh) { BaseDocument *doc = op->GetDocument(); BaseContainer *data = op->GetDataInstance(); BaseObject* obj = (BaseObject*)data->GetLink(CTT_OBJECT_LINK,doc,Obase); LONG crntFrame = doc->GetTime().GetFrame(doc->GetFps()); if (!obj) return NULL; if (obj->GetType() != Ospline){ return NULL; } // start new list op->NewDependenceList(); // check cache for validity and check master object for changes Bool dirty = op->CheckCache(hh) || op->IsDirty(DIRTYFLAGS_DATA); // if child list has been modified if (!dirty) dirty = !op->CompareDependenceList(); // mark child objects as processed op->TouchDependenceList(); dirty = dirty || (prevFrame != crntFrame); prevFrame = crntFrame; // if no change has been detected, return original cache if (!dirty) return op->GetCache(hh); SplineObject* spline = (SplineObject*) obj; AutoAlloc<SplineHelp> splineHelp; StatusSetText("Collecting points"); float positioAlongSpline = data->GetReal(POSITION_ALONG_SPLINE,0.5); positioAlongSpline /= 10000.0f; positioAlongSpline = positioAlongSpline > 1.0 ? 1.0: positioAlongSpline; positioAlongSpline = positioAlongSpline < 0.0 ? 0.0: positioAlongSpline; cout<<positioAlongSpline<<endl; vector<vector<float> > points; for (LONG i = 0; i < spline->GetSegmentCount(); i++){ Vector p = spline->GetSplinePoint(positioAlongSpline, i); vector<float> point; point.push_back(p.x); point.push_back(p.y); point.push_back(p.z); points.push_back(point); } StatusSetText("Collected "+LongToString(points.size())+" points"); ksearchNeighbors= data->GetLong(TRIANGULATION_MAX_NEIGHBORS, 100); gp3SearchRadius = data->GetReal(TRIANGULATION_MAX_SEARCH_RADIUS,30.); gp3MaxNeighbors = data->GetLong(KSEARCH_NEIGHBORS, 20); gp3Mu = data->GetReal(KSEARCH_MU, 0.5); vector<vector<float> > surfacePoints; vector<vector<int> > triIndxs; StatusSetBar(0); StatusSetText("Triangulating"); bool useMls = data->GetBool(USE_MLS, false); tri.computeSurface(points, surfacePoints, triIndxs, ksearchNeighbors, gp3SearchRadius, gp3MaxNeighbors, gp3Mu, useMls); StatusSetBar(100); StatusSetText("Got "+LongToString(triIndxs.size())+" triangles"); if (triIndxs.size() == 0){ return NULL; } PolygonObject* myPoly = PolygonObject::Alloc(surfacePoints.size(),triIndxs.size()); Vector* ppoints = myPoly->GetPointW(); vector<float> sp; for (int t = 0; t < surfacePoints.size()-2; t += 3) { sp = surfacePoints[t]; ppoints[t+0] = Vector(sp[0],sp[1],sp[2]); sp = surfacePoints[t+1]; ppoints[t+1] = Vector(sp[0],sp[1],sp[2]); sp = surfacePoints[t+2]; ppoints[t+2] = Vector(sp[0],sp[1],sp[2]); } for (int t = 0; t < triIndxs.size(); t ++) { myPoly->GetPolygonW()[t] = CPolygon(triIndxs[t][0], triIndxs[t][1], triIndxs[t][2], triIndxs[t][2]); } StatusClear(); myPoly->Message(MSG_UPDATE); return ToPoly(myPoly); BaseThread* bt=hh->GetThread(); BaseObject* main = BaseObject::Alloc(Onull); SplineObject* emptySpline = SplineObject::Alloc(0, SPLINETYPE_LINEAR); ModelingCommandData mcd; mcd.doc = doc; mcd.op = emptySpline; if(!SendModelingCommand(MCOMMAND_JOIN, mcd)){ return NULL; } Error: return NULL; }
ApplinkExporter::ExportObject::~ExportObject(void) { StatusClear(); }