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

d21 d51 bus align

parent 574e8402
No related branches found
No related tags found
No related merge requests found
// head or drop on the bus // compile-time configur8or
#ifndef CONFIG_H_
#define CONFIG_H_
// for the bus: head, or drop?
//#define UCBUS_IS_HEAD //#define UCBUS_IS_HEAD
// *genuine* max is 63 !
#define UCBUS_MAX_DROPS 32
#define UCBUS_IS_DROP #define UCBUS_IS_DROP
// and D21 or D51?
//#define UCBUS_IS_D51
#define UCBUS_IS_D21
// 3, 2, or 1 MBaud:
#define UCBUS_BAUD 2
// if you're using the 'module board' https://gitlab.cba.mit.edu/jakeread/ucbus-module
// the first (og) revision has an SMT header, and some of the RS485 pins are varied,
// set this flag. otherwise, if you have thru-hole JTAG header, comment it out
//#define IS_OG_MODULE
#endif
\ No newline at end of file
...@@ -28,5 +28,14 @@ ...@@ -28,5 +28,14 @@
#define DEBUG1PIN_TOGGLE DEBUG1PIN_PORT.OUTTGL.reg = DEBUG1PIN_BM #define DEBUG1PIN_TOGGLE DEBUG1PIN_PORT.OUTTGL.reg = DEBUG1PIN_BM
#define DEBUG1PIN_SETUP DEBUG1PIN_PORT.DIRSET.reg = DEBUG1PIN_BM; DEBUG1PIN_OFF #define DEBUG1PIN_SETUP DEBUG1PIN_PORT.DIRSET.reg = DEBUG1PIN_BM; DEBUG1PIN_OFF
// the "bus light" : led pts to gnd
#define DEBUG2PIN_PIN 22
#define DEBUG2PIN_PORT PORT->Group[0]
#define DEBUG2PIN_BM (uint32_t)(1 << DEBUG2PIN_PIN)
#define DEBUG2PIN_ON DEBUG2PIN_PORT.OUTSET.reg = DEBUG2PIN_BM
#define DEBUG2PIN_OFF DEBUG2PIN_PORT.OUTCLR.reg = DEBUG2PIN_BM
#define DEBUG2PIN_TOGGLE DEBUG2PIN_PORT.OUTTGL.reg = DEBUG2PIN_BM
#define DEBUG2PIN_SETUP DEBUG2PIN_PORT.DIRSET.reg = DEBUG2PIN_BM; DEBUG2PIN_OFF
#define ERRLIGHT_ON #define ERRLIGHT_ON
#define ERRLIGHT_OFF #define ERRLIGHT_OFF
#include <Arduino.h> #include <Arduino.h>
#include "indicators.h" #include "indicators.h"
#include "config.h" #include "config.h"
//#include "drivers/ucBusHead.h"
//#include "drivers/step_a4950.h" //#include "drivers/step_a4950.h"
//#include "osape-d21/osape/osap/osap.h"
//#include "osape-d21/vertices/vt_usbSerial.h"
#include "osape-d21/vertices/ucBusDrop.h" #include "osape-d21/osape/osap/osap.h"
#include "osape-d21/vertices/vt_usbSerial.h"
#include "osape-d21/vertices/ucbus/vt_ucBusDrop.h"
#include "osape-d21/vertices/ucbus/ucBusDrop.h"
/* // bus light on PA22, to flip:
// -------------------------------------------------------- Dummy
EP_ONDATA_RESPONSES onDemoData(uint8_t* data, uint16_t len){
DEBUG2PIN_TOGGLE;
return EP_ONDATA_ACCEPT;
}
vertex_t* demoEP = osapBuildEndpoint("demo", onDemoData, nullptr);
vertex_t* spiBusDummy = osapBuildEndpoint("spiDummy", nullptr, nullptr); /*
// -------------------------------------------------------- Axis Pick // -------------------------------------------------------- Axis Pick
...@@ -42,11 +49,18 @@ vertex_t* cScaleEp = osapBuildEndpoint("currentScale", nullptr, nullptr); ...@@ -42,11 +49,18 @@ vertex_t* cScaleEp = osapBuildEndpoint("currentScale", nullptr, nullptr);
void setup() { void setup() {
CLKLIGHT_SETUP; CLKLIGHT_SETUP;
BUSLIGHT_SETUP; //BUSLIGHT_SETUP;
DEBUG1PIN_SETUP; DEBUG1PIN_SETUP;
// setup demo light
DEBUG2PIN_SETUP;
// osap setup... // osap setup...
// osapSetup(); osapSetup();
ucBusDrop_setup(2); vt_usbSerial_setup();
osapAddVertex(vt_usbSerial);
vt_ucBusDrop_setup(false, 2);
osapAddVertex(vt_ucBusDrop);
// demo endpoint (?)
osapAddVertex(demoEP);
// startup stepper HW // startup stepper HW
// step_a4950_init(); // step_a4950_init();
// step_a4950_set_cscale(0.25F); // step_a4950_set_cscale(0.25F);
...@@ -56,8 +70,6 @@ void setup() { ...@@ -56,8 +70,6 @@ void setup() {
//osapAddVertex(spiBusDummy); // 1 //osapAddVertex(spiBusDummy); // 1
//osapAddVertex(axisPickEp); // 2 //osapAddVertex(axisPickEp); // 2
//osapAddVertex(axisInvertEp); // 3 //osapAddVertex(axisInvertEp); // 3
// pinMode();
PORT->Group[0].DIRSET.reg = (uint32_t)(1 << 14);
} }
// -------------------------------------------------------- LOOP // -------------------------------------------------------- LOOP
...@@ -66,15 +78,21 @@ void setup() { ...@@ -66,15 +78,21 @@ void setup() {
unsigned long last_tick = 0; unsigned long last_tick = 0;
void loop() { void loop() {
// digitalWrite(); // DEBUG2PIN_TOGGLE;
PORT->Group[0].OUTSET.reg = (uint32_t)(1 << 14);
PORT->Group[0].OUTCLR.reg = (uint32_t)(1 << 14);
// do osap things, // do osap things,
// osapLoop(); osapLoop();
// blink // blink
if(millis() > last_tick + CLK_TICK){ if(millis() > last_tick + CLK_TICK){
//step_a4950_step(); //step_a4950_step();
CLKLIGHT_TOGGLE; //CLKLIGHT_TOGGLE;
last_tick = millis(); last_tick = millis();
} }
} }
void ucBusDrop_onPacketARx(uint8_t* inBufferA, volatile uint16_t len){
}
void ucBusDrop_onRxISR(void){
}
\ No newline at end of file
Subproject commit d7df297e7039d697def2a1252e34eebfa3981e1d Subproject commit b8595b13aff606d9be49ccd251e73281d7111603
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment