-
Notifications
You must be signed in to change notification settings - Fork 2
Main Board Pseudo Code
Nick Molo edited this page Dec 7, 2014
·
1 revision
This is the basics of the code for the Main Board.
while(1){ //Big 'ol while loop
if dmaReadDone == true //Checks if dma has received a new, updated packet
myBuffer = dmaReadBuffer
else
myBuffer = myBuffer
end
if packetValid(myBuffer) == true //checks if the packet is valid
while (i < 9){ //for motors 1-8
motorPacket = motorPacketCreate(myBuffer, i) //generate packet for each motor
if motorDmaDone = true //again waits until the dma is done transmitting
motorDma = motorPacket
i++
else
motorDma = motorDma //do nothing really
i=i
}
moveClaw(myBuffer) //doing claw stuff
moveDistanceUnit(myBuffer) //doing distance measurement stuff
takeDistanceMeasurement(myBuffer) //taking a reading (probably gonna need a serial interface
//not sure if we should use DMA yet
setCamera(myBuffer) //changes between camera views
setCameraLed(myBuffer) //Sets brigntness of the leds on the cameras
setTubeLed(myBuffer) //sets brightness of the leds in the tube
readStuff()
sendPacket = sendPacketCreate(stuff goes here) //creates packet with data read from things (TBD)
if dmaSendDone == true //waits until packet is done being sent up
dmaSendBuffer = sendPacket
else
dmaSendBuffer = dmaSendBuffer
end
}