Skip to content

Commit cfe8ce1

Browse files
committed
FEAT 1.6.0 final checks and compile tests
1 parent 31dff10 commit cfe8ce1

File tree

10 files changed

+66
-70
lines changed

10 files changed

+66
-70
lines changed

src/Encoder.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include "common/foc_utils.h"
66
#include "common/hardware_utils.h"
77
#include "common/Sensor.h"
8-
#include "common/sensor_utils.h"
98

109

1110
/**

src/HallSensor.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include "common/foc_utils.h"
66
#include "common/hardware_utils.h"
77
#include "common/Sensor.h"
8-
#include "common/sensor_utils.h"
98

109

1110
class HallSensor: public Sensor{

src/MagneticSensorAnalog.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include "common/foc_utils.h"
66
#include "common/hardware_utils.h"
77
#include "common/Sensor.h"
8-
#include "common/sensor_utils.h"
98

109
/**
1110
* This sensor has been tested with AS5600 running in 'analog mode'. This is where output pin of AS6000 is connected to an analog pin on your microcontroller.

src/MagneticSensorI2C.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
#include "MagneticSensorI2C.h"
22

3+
/** Typical configuration for the 12bit AMS AS5600 magnetic sensor over I2C interface */
4+
MagneticSensorI2CConfig_s AS5600_I2C = {
5+
.chip_address = 0x36,
6+
.clock_speed = 1000000,
7+
.bit_resolution = 12,
8+
.angle_register = 0x0E,
9+
.data_start_bit = 11
10+
};
11+
12+
/** Typical configuration for the 12bit AMS AS5048 magnetic sensor over I2C interface */
13+
MagneticSensorI2CConfig_s AS5048_I2C = {
14+
.chip_address = 0x40, // highly configurable. if A1 and A2 are held low, this is probable value
15+
.clock_speed = 1000000,
16+
.bit_resolution = 14,
17+
.angle_register = 0xFE,
18+
.data_start_bit = 15
19+
};
20+
21+
322
// MagneticSensorI2C(uint8_t _chip_address, float _cpr, uint8_t _angle_register_msb)
423
// @param _chip_address I2C chip address
524
// @param _bit_resolution bit resolution of the sensor

src/MagneticSensorI2C.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,16 @@
66
#include "common/foc_utils.h"
77
#include "common/hardware_utils.h"
88
#include "common/Sensor.h"
9-
#include "common/sensor_utils.h"
109

10+
struct MagneticSensorI2CConfig_s {
11+
int chip_address;
12+
long clock_speed;
13+
int bit_resolution;
14+
int angle_register;
15+
int data_start_bit;
16+
};
17+
// some predefined structures
18+
extern MagneticSensorI2CConfig_s AS5600_I2C,AS5048_I2C;
1119

1220
class MagneticSensorI2C: public Sensor{
1321
public:

src/MagneticSensorSPI.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
#include "MagneticSensorSPI.h"
22

3+
/** Typical configuration for the 14bit AMS AS5147 magnetic sensor over SPI interface */
4+
MagneticSensorSPIConfig_s AS5147_SPI = {
5+
.spi_mode = SPI_MODE1,
6+
.clock_speed = 1000000,
7+
.bit_resolution = 14,
8+
.angle_register = 0xCFFF,
9+
.data_start_bit = 13,
10+
.command_rw_bit = 14,
11+
.command_parity_bit = 15
12+
};
13+
14+
/** Typical configuration for the 14bit MonolithicPower MA730 magnetic sensor over SPI interface */
15+
MagneticSensorSPIConfig_s MA730_SPI = {
16+
.spi_mode = SPI_MODE0,
17+
.clock_speed = 1000000,
18+
.bit_resolution = 14,
19+
.angle_register = 0x0000,
20+
.data_start_bit = 15,
21+
.command_rw_bit = 0, // not required
22+
.command_parity_bit = 0 // parity not implemented
23+
};
24+
25+
326
// MagneticSensorSPI(int cs, float _bit_resolution, int _angle_register)
427
// cs - SPI chip select pin
528
// _bit_resolution sensor resolution bit number

src/MagneticSensorSPI.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,21 @@
66
#include "common/foc_utils.h"
77
#include "common/hardware_utils.h"
88
#include "common/Sensor.h"
9-
#include "common/sensor_utils.h"
109

1110
#define DEF_ANGLE_REGISTAR 0x3FFF
1211

12+
struct MagneticSensorSPIConfig_s {
13+
int spi_mode;
14+
long clock_speed;
15+
int bit_resolution;
16+
int angle_register;
17+
int data_start_bit;
18+
int command_rw_bit;
19+
int command_parity_bit;
20+
};
21+
// typical configuration structures
22+
extern MagneticSensorSPIConfig_s AS5147_SPI, MA730_SPI;
23+
1324
class MagneticSensorSPI: public Sensor{
1425
public:
1526
/**

src/SimpleFOC.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ void loop() {
8787
#define SIMPLEFOC_H
8888

8989
#include "BLDCMotor.h"
90-
#include "SepperMotor.h"
90+
#include "StepperMotor.h"
9191
#include "Encoder.h"
9292
#include "MagneticSensorSPI.h"
9393
#include "MagneticSensorI2C.h"

src/common/hardware_utils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ void _setPwmFrequency(const int pinA, const int pinB, const int pinC, const int
5959
analogWrite(pinD, 0);
6060
analogWriteFrequency(50000); // set 50kHz
6161
analogWriteResolution(12); // resolution 12 bit 0 - 4096
62-
62+
}
6363
#elif defined(__arm__) && defined(CORE_TEENSY) //if teensy 3x / 4x / LC boards
6464
analogWrite(pinA, 0);
6565
analogWriteFrequency(pinA, 50000); // set 50kHz
@@ -70,7 +70,7 @@ void _setPwmFrequency(const int pinA, const int pinB, const int pinC, const int
7070
if(pinD) {
7171
analogWrite(pinD, 0);
7272
analogWriteFrequency(50000); // set 50kHz
73-
73+
}
7474
#elif defined(ESP_H) // if esp32 boards
7575

7676
motor_slots_t m_slot = {};

src/common/sensor_utils.h

Lines changed: 0 additions & 62 deletions
This file was deleted.

0 commit comments

Comments
 (0)