SteppersCAN: add CAN & start working on steppers

This commit is contained in:
eddyem
2020-04-18 20:11:59 +03:00
parent e51a45040b
commit 131f6fab44
29 changed files with 1939 additions and 510 deletions

View File

@@ -367,7 +367,7 @@ static void can_process_fifo(uint8_t fifo_num){
/* TODO: check filter match index if more than one ID can receive */
CAN_message msg;
uint8_t *dat = msg.data;
uint8_t len = box->RDTR & 0x7;
uint8_t len = box->RDTR & 0x0f;
msg.length = len;
msg.ID = box->RIR >> 21;
//msg.filterNo = (box->RDTR >> 8) & 0xff;

View File

@@ -167,7 +167,7 @@ static CAN_message *parseCANmsg(char *txt){
return NULL;
}
canmsg.ID = (uint16_t)(N&0x7ff);
SEND("ID="); printuhex(canmsg.ID); newline();
//SEND("ID="); printuhex(canmsg.ID); newline();
ctr = 0;
continue;
}
@@ -546,7 +546,6 @@ void printuhex(uint32_t val){
uint8_t *ptr = (uint8_t*)&val + 3;
int8_t i, j;
for(i = 0; i < 4; ++i, --ptr){
if(*ptr == 0 && i != 3) continue; // omit leading zeros
for(j = 1; j > -1; --j){
uint8_t half = (*ptr >> (4*j)) & 0x0f;
if(half < 10) bufputchar(half + '0');

Binary file not shown.