Skip to content
Snippets Groups Projects
Commit 75ebaa6c authored by Jake Read's avatar Jake Read
Browse files

new bus head for easy delimit

parent 233581e0
Branches
No related tags found
No related merge requests found
...@@ -203,9 +203,6 @@ void setup() { ...@@ -203,9 +203,6 @@ void setup() {
DEBUG2PIN_SETUP; DEBUG2PIN_SETUP;
DEBUG3PIN_SETUP; DEBUG3PIN_SETUP;
DEBUG4PIN_SETUP; DEBUG4PIN_SETUP;
// l i g h t s
ERRLIGHT_ON;
CLKLIGHT_ON;
// osap // osap
osapSetup(); osapSetup();
// ports // ports
...@@ -231,7 +228,7 @@ void setup() { ...@@ -231,7 +228,7 @@ void setup() {
smoothieRoll->init(20000); smoothieRoll->init(20000);
// 25kHz base (40us period) or // 25kHz base (40us period) or
// 20kHz base (50us period) // 20kHz base (50us period)
d51ClockBoss->start_ticker_a(100); d51ClockBoss->start_ticker_a(50);
} }
void loop() { void loop() {
...@@ -242,7 +239,7 @@ void loop() { ...@@ -242,7 +239,7 @@ void loop() {
} // end loop } // end loop
// runs on period defined by timer_a setup: // runs on period defined by timer_a setup:
volatile uint16_t timeTick = 0; volatile uint32_t timeTick = 0;
volatile uint64_t timeBlink = 0; volatile uint64_t timeBlink = 0;
uint16_t blinkTime = 1000; uint16_t blinkTime = 1000;
...@@ -252,22 +249,17 @@ void TC0_Handler(void){ ...@@ -252,22 +249,17 @@ void TC0_Handler(void){
// runs at period established above... // runs at period established above...
TC0->COUNT32.INTFLAG.bit.MC0 = 1; TC0->COUNT32.INTFLAG.bit.MC0 = 1;
TC0->COUNT32.INTFLAG.bit.MC1 = 1; TC0->COUNT32.INTFLAG.bit.MC1 = 1;
DEBUG1PIN_TOGGLE; DEBUG1PIN_HI;
timeTick ++;
timeBlink ++;
if(timeBlink > blinkTime){
//DEBUG1PIN_TOGGLE;
CLKLIGHT_TOGGLE;
sysErrLightCheck();
timeBlink = 0;
}
// do bus action first: want downstream clocks to be deterministic-ish // do bus action first: want downstream clocks to be deterministic-ish
ucBusHead_timerISR(); ucBusHead_timerISR();
// do step tick // do step tick
smoothieRoll->step_tick(); smoothieRoll->step_tick();
// every n ticks, ship position? // every n ticks, ship position?
// each of these ticks drops 10 data bytes, so if we have 17 byte packet, can do every 2nd packet // each of these ticks drops 10 data bytes, so if we have 17 byte packet, can do every 2nd packet
// which would occupy the full bus - notgood - or we can do every 3rd... I'll pick every 4th. // which would occupy the full bus - notgood - or we can do every 3rd... I'll pick every 4th.
timeTick ++;
if(timeTick > 3){ if(timeTick > 3){
DEBUG2PIN_HI; DEBUG2PIN_HI;
timeTick = 0; timeTick = 0;
...@@ -287,4 +279,13 @@ void TC0_Handler(void){ ...@@ -287,4 +279,13 @@ void TC0_Handler(void){
ucBusHead_transmitA(motion_packet, 17); ucBusHead_transmitA(motion_packet, 17);
DEBUG2PIN_LO; DEBUG2PIN_LO;
} }
// do blinking, lol
timeBlink ++;
if(timeBlink > blinkTime){
CLKLIGHT_TOGGLE;
sysErrLightCheck();
timeBlink = 0;
}
DEBUG1PIN_LO;
} }
Subproject commit 0beaf064563e5773f2979d09ad40cefd786ca383 Subproject commit 2694d0c983f0da1679cceb31b41d79e128a2b81d
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment