step_cl.h 1.2 KB
Newer Older
Jake Read's avatar
Jake Read committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*
osap/drivers/step_cl.h

stepper in closed loop mode 

Jake Read at the Center for Bits and Atoms
(c) Massachusetts Institute of Technology 2020

This work may be reproduced, modified, distributed, performed, and
displayed for any purpose, but must acknowledge the squidworks and ponyo
projects. Copyright is retained and must be preserved. The work is provided as
is; no warranty is provided, and users accept all liability.
*/

#ifndef STEP_CL_H_
#define STEP_CL_H_ 

#include <Arduino.h>

#include "step_a4950.h"
#include "enc_as5047.h"

class Step_CL {
    private:
        static Step_CL* instance;
26
        float calib_readings[201];
Jake Read's avatar
Jake Read committed
27
        float _tc;
Jake Read's avatar
Jake Read committed
28
29
30
31
32

    public:
        Step_CL();
        static Step_CL* getInstance(void);
        void init(void);
33
        void print_table(void);
Jake Read's avatar
Jake Read committed
34
        void set_torque(float tc);
Jake Read's avatar
Jake Read committed
35
        float get_torque(void);
Jake Read's avatar
Jake Read committed
36
37
        void run_torque_loop(void);
        boolean calibrate(void);
Jake Read's avatar
Jake Read committed
38
        boolean is_calibrating;
Jake Read's avatar
Jake Read committed
39
40
41
42
43
        //float __attribute__((__aligned__(256))) lut[16384]; // nor does this ! 
        //float lut[16384]; // nor does this work 
        //step_cl_calib_table_t lut; // not even this works ?? too big ?? 
};

Jake Read's avatar
Jake Read committed
44
45
extern const float lut[];

Jake Read's avatar
Jake Read committed
46
47
48
extern Step_CL* step_cl;

#endif