uint32_t AS5040::encoder_error(void) { uint16_t error_code; // not yet implemented uint32_t raw_value; raw_value = read_chip(); error_code = raw_value & 0b0000000000111111; err_value.DECn = error_code & 2; err_value.INCn = error_code & 4; err_value.LIN = error_code & 8; err_value.COF = error_code & 16; err_value.OCF = error_code & 32; return error_code; }
int main(int argc, char *argv[]) { char *mode; if (argc == 1) { printf("Syntax: epsiflash erase|read|burn [filename]\n"); exit (1);} hardware_init(); filename = argv[2]; mode = argv[1]; probe_chip(); printf("Chip: %s - %dKB, %s\n", chips[chipindex].name, chips[chipindex].size / 1024, chips[chipindex].adapter); if (strcmp(chips[chipindex].name,"UNKNOWN")==0) { fprintf(stderr,"Chip is unsupported or not inserted properly\n"); exit(-1); } if (strcmp(mode,"burn")==0) { program_chip(); printf("\n"); exit(1); } if (strcmp(mode,"read")==0) { read_chip(); printf("\n"); exit(1); } if (strcmp(mode, "erase")==0) { erase_chip(); printf("\n"); exit(1); } return 0; }
uint32_t AS5040::encoder_value(void) { return (read_chip() >> 6); }