Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
i2c_mbed_fpga.h@11:b86aea372744, 2021-03-03 (annotated)
- Committer:
- wuliqunyy
- Date:
- Wed Mar 03 14:55:01 2021 +0000
- Revision:
- 11:b86aea372744
- Parent:
- 10:a8390614edcc
- Child:
- 12:9f8c7f4da5f6
working version with ganymede14 discrete
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
wuliqunyy | 0:fe3c7dde9771 | 1 | #ifndef I2C_MBED_FPGA_H |
wuliqunyy | 0:fe3c7dde9771 | 2 | #define I2C_MBED_FPGA_H |
wuliqunyy | 0:fe3c7dde9771 | 3 | |
wuliqunyy | 6:019ab407ac3c | 4 | #include "nv_bitfield_map.h" |
wuliqunyy | 6:019ab407ac3c | 5 | #include "nv_defines.h" |
wuliqunyy | 6:019ab407ac3c | 6 | #include "nv_defaults.h" |
wuliqunyy | 6:019ab407ac3c | 7 | |
wuliqunyy | 6:019ab407ac3c | 8 | |
wuliqunyy | 6:019ab407ac3c | 9 | #define I2C_SLAVE_ADDR 0x18<<1 |
wuliqunyy | 0:fe3c7dde9771 | 10 | |
wuliqunyy | 5:daab0e0e67e2 | 11 | //Class delclarations |
wuliqunyy | 5:daab0e0e67e2 | 12 | class i2c_mbed_fpga { |
wuliqunyy | 5:daab0e0e67e2 | 13 | |
wuliqunyy | 5:daab0e0e67e2 | 14 | public: |
wuliqunyy | 5:daab0e0e67e2 | 15 | /*constructor*/ |
wuliqunyy | 5:daab0e0e67e2 | 16 | i2c_mbed_fpga(): i2c_master(p9, p10){ |
wuliqunyy | 6:019ab407ac3c | 17 | i2c_master.frequency(35000); |
wuliqunyy | 6:019ab407ac3c | 18 | nv_positin_val = NV_POSITION_DEFUALT; |
wuliqunyy | 6:019ab407ac3c | 19 | nv_start_up_val = NV_START_UP_DEFAULT; |
wuliqunyy | 9:76a0b9f29a2d | 20 | nv_wind_brake_val = NV_WIND_BRAKE_DEFAULT; |
wuliqunyy | 10:a8390614edcc | 21 | ram_open_duty_val = RAM_OPEN_DUTY_DEFAULT; |
wuliqunyy | 11:b86aea372744 | 22 | nv_spd_control_1_val = NV_SPD_CONTROL_1_DEFAULT; |
wuliqunyy | 11:b86aea372744 | 23 | nv_spd_control_2_val = NV_SPD_CONTROL_1_DEFAULT; |
wuliqunyy | 5:daab0e0e67e2 | 24 | }; |
wuliqunyy | 6:019ab407ac3c | 25 | |
wuliqunyy | 6:019ab407ac3c | 26 | int i2c_word_read(char *word); |
wuliqunyy | 5:daab0e0e67e2 | 27 | int i2c_word_write(char *word); |
wuliqunyy | 6:019ab407ac3c | 28 | int i2c_word_safe_write(char *word); |
wuliqunyy | 6:019ab407ac3c | 29 | |
wuliqunyy | 5:daab0e0e67e2 | 30 | int i2c_window_open(); |
wuliqunyy | 5:daab0e0e67e2 | 31 | int i2c_motor_start(); |
wuliqunyy | 5:daab0e0e67e2 | 32 | |
wuliqunyy | 6:019ab407ac3c | 33 | int i2c_set_position_pulse_width(unsigned int manstisa_2b, unsigned int exponenet_3b); |
wuliqunyy | 6:019ab407ac3c | 34 | int i2c_set_position_duty(unsigned int duty_2b); |
wuliqunyy | 6:019ab407ac3c | 35 | int i2c_set_position_maj_vote(unsigned int maj_1b); |
wuliqunyy | 6:019ab407ac3c | 36 | int i2c_set_position_anti_cog(unsigned int cog_1b); |
wuliqunyy | 6:019ab407ac3c | 37 | |
wuliqunyy | 6:019ab407ac3c | 38 | int i2c_set_start_up_pulse_width(unsigned int mantisaa_3b, unsigned int exponent_3b); |
wuliqunyy | 6:019ab407ac3c | 39 | int i2c_set_start_up_duty(unsigned int duty_2b); |
wuliqunyy | 6:019ab407ac3c | 40 | int i2c_set_start_up_num_comm(unsigned int comm); |
wuliqunyy | 6:019ab407ac3c | 41 | int i2c_set_soft_start_up(unsigned int enbale, unsigned int mantisaa_3b, unsigned int exponent_3b, unsigned int step_size, unsigned int num_steps); |
wuliqunyy | 6:019ab407ac3c | 42 | int i2c_set_high_torque_start_up(unsigned int enbale, unsigned int mantisaa_3b, unsigned int exponent_3b); |
wuliqunyy | 6:019ab407ac3c | 43 | int i2c_set_single_pulse_start_up(unsigned int enbale, unsigned int mantisaa_3b, unsigned int exponent_3b); |
wuliqunyy | 11:b86aea372744 | 44 | int i2c_clear_spd_ctrl(); |
wuliqunyy | 9:76a0b9f29a2d | 45 | int i2c_set_loop_mode(unsigned int openloop); |
wuliqunyy | 11:b86aea372744 | 46 | int i2c_set_curve_type(unsigned int curvetype); |
wuliqunyy | 11:b86aea372744 | 47 | int i2c_set_dc_ini(unsigned int ini); |
wuliqunyy | 11:b86aea372744 | 48 | int i2c_set_dc_sr(unsigned int sr); |
wuliqunyy | 9:76a0b9f29a2d | 49 | int i2c_set_open_loop_duty(unsigned int duty); |
wuliqunyy | 6:019ab407ac3c | 50 | |
wuliqunyy | 5:daab0e0e67e2 | 51 | private: |
wuliqunyy | 5:daab0e0e67e2 | 52 | I2C i2c_master; |
wuliqunyy | 6:019ab407ac3c | 53 | unsigned int nv_positin_val; |
wuliqunyy | 6:019ab407ac3c | 54 | unsigned int nv_start_up_val; |
wuliqunyy | 6:019ab407ac3c | 55 | unsigned int nv_wind_brake_val; |
wuliqunyy | 9:76a0b9f29a2d | 56 | unsigned int nv_spd_control_1_val; |
wuliqunyy | 11:b86aea372744 | 57 | unsigned int nv_spd_control_2_val; |
wuliqunyy | 9:76a0b9f29a2d | 58 | unsigned int ram_open_duty_val; |
wuliqunyy | 9:76a0b9f29a2d | 59 | |
wuliqunyy | 6:019ab407ac3c | 60 | |
wuliqunyy | 6:019ab407ac3c | 61 | //Position Detection Task/Functions |
wuliqunyy | 5:daab0e0e67e2 | 62 | }; |
wuliqunyy | 5:daab0e0e67e2 | 63 | |
wuliqunyy | 0:fe3c7dde9771 | 64 | |
wuliqunyy | 0:fe3c7dde9771 | 65 | #endif |