A more detailed description of the file should written here.
Definition in file sensor_three_phase_BLDC.h.
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
ADC multiplexing | |
| #define | ADC_MUX_SHUNT_H ((0 << REFS1) | (0 << REFS0) | (1 << ADLAR) | (1 << MUX2)) |
| #define | ADC_MUX_SHUNT_L ((0 << REFS1) | (0 << REFS0) | (1 << ADLAR) | (1 << MUX2) | (1 << MUX0)) |
| #define | ADC_MUX_SPEED_REF ((0 << REFS1) | (0 << REFS0) | (1 << ADLAR)) |
PWM output configuration (for both TC0 and TC2) | |
| #define | COM0P1_CCW ((UL_ON)|(VL_OFF)|(1<<WGM01)|(1<<WGM00)) |
| #define | COM0P1_CW ((UL_OFF)|(VL_OFF)|(1<<WGM01)|(1<<WGM00)) |
| #define | COM0P2_CCW ((UL_ON)|(VL_OFF)|(1<<WGM01)|(1<<WGM00)) |
| #define | COM0P2_CW ((UL_OFF)|(VL_OFF)|(1<<WGM01)|(1<<WGM00)) |
| #define | COM0P3_CCW ((UL_OFF)|(VL_ON)|(1<<WGM01)|(1<<WGM00)) |
| #define | COM0P3_CW ((UL_OFF)|(VL_ON)|(1<<WGM01)|(1<<WGM00)) |
| #define | COM0P4_CCW ((UL_OFF)|(VL_ON)|(1<<WGM01)|(1<<WGM00)) |
| #define | COM0P4_CW ((UL_OFF)|(VL_ON)|(1<<WGM01)|(1<<WGM00)) |
| #define | COM0P5_CCW ((UL_OFF)|(VL_OFF)|(1<<WGM01)|(1<<WGM00)) |
| #define | COM0P5_CW ((UL_ON)|(VL_OFF)|(1<<WGM01)|(1<<WGM00)) |
| #define | COM0P6_CCW ((UL_OFF)|(VL_OFF)|(1<<WGM01)|(1<<WGM00)) |
| #define | COM0P6_CW ((UL_ON)|(VL_OFF)|(1<<WGM01)|(1<<WGM00)) |
| #define | COM2P1_CCW ((WL_OFF)|(1<<WGM21)|(1<<WGM20)) |
| #define | COM2P1_CW ((WL_ON)|(1<<WGM21)|(1<<WGM20)) |
| #define | COM2P2_CCW ((WL_OFF)|(1<<WGM21)|(1<<WGM20)) |
| #define | COM2P2_CW ((WL_ON)|(1<<WGM21)|(1<<WGM20)) |
| #define | COM2P3_CCW ((WL_OFF)|(1<<WGM21)|(1<<WGM20)) |
| #define | COM2P3_CW ((WL_OFF)|(1<<WGM21)|(1<<WGM20)) |
| #define | COM2P4_CCW ((WL_OFF)|(1<<WGM21)|(1<<WGM20)) |
| #define | COM2P4_CW ((WL_OFF)|(1<<WGM21)|(1<<WGM20)) |
| #define | COM2P5_CCW ((WL_ON)|(1<<WGM21)|(1<<WGM20)) |
| #define | COM2P5_CW ((WL_OFF)|(1<<WGM21)|(1<<WGM20)) |
| #define | COM2P6_CCW ((WL_ON)|(1<<WGM21)|(1<<WGM20)) |
| #define | COM2P6_CW ((WL_OFF)|(1<<WGM21)|(1<<WGM20)) |
| #define | HP1 ((1<<HALL1)|(0<<HALL2)|(1<<HALL3)) |
| #define | HP2 ((1<<HALL1)|(0<<HALL2)|(0<<HALL3)) |
| #define | HP3 ((1<<HALL1)|(1<<HALL2)|(0<<HALL3)) |
| #define | HP4 ((0<<HALL1)|(1<<HALL2)|(0<<HALL3)) |
| #define | HP5 ((0<<HALL1)|(1<<HALL2)|(1<<HALL3)) |
| #define | HP6 ((0<<HALL1)|(0<<HALL2)|(1<<HALL3)) |
| #define | UL_OFF ((0<<COM0A1)|(0<<COM0A0)) |
| #define | UL_ON ((1<<COM0A1)|(0<<COM0A0)) |
| #define | VL_OFF ((0<<COM0B1)|(0<<COM0B0)) |
| #define | VL_ON ((1<<COM0B1)|(0<<COM0B0)) |
| #define | WL_OFF ((0<<COM2B1)|(0<<COM2B0)) |
| #define | WL_ON ((1<<COM2B1)|(0<<COM2B0)) |
Port control registers for Hall sensor inputs. | |
| #define | DDR_HALL DDRB |
| #define | PIN_HALL PINB |
| #define | PORT_HALL PORTB |
Port control registers for drive stages. | |
| #define | DDR_MC DDRD |
| #define | PIN_MC PIND |
| #define | PORT_MC PORTD |
Hall sensor input pins. | |
| #define | HALL1 PB1 |
| #define | HALL2 PB2 |
| #define | HALL3 PB3 |
| #define | HALL_MASK ((1<<HALL1)|(1<<HALL2)|(1<<HALL3)) |
Output pins to drive stages. | |
| #define | MC_MASK ((1<<UL)|(1<<VL)|(1<<WL)|(1<<UH)|(1<<VH)|(1<<WH)) |
| #define | UH PD7 |
| #define | UL PD6 |
| #define | VH PD4 |
| #define | VL PD5 |
| #define | WH PD2 |
| #define | WL PD3 |
CCW driving configuration | |
| IO driving configuration (driving enabled by setting IO to output)for counter clockwise rotation. | |
| #define | PDP1_CCW ((1<<UL)|(0<<VL)|(0<<WL)|(0<<UH)|(1<<VH)|(0<<WH)) |
| #define | PDP2_CCW ((1<<UL)|(0<<VL)|(0<<WL)|(0<<UH)|(0<<VH)|(1<<WH)) |
| #define | PDP3_CCW ((0<<UL)|(1<<VL)|(0<<WL)|(0<<UH)|(0<<VH)|(1<<WH)) |
| #define | PDP4_CCW ((0<<UL)|(1<<VL)|(0<<WL)|(1<<UH)|(0<<VH)|(0<<WH)) |
| #define | PDP5_CCW ((0<<UL)|(0<<VL)|(1<<WL)|(1<<UH)|(0<<VH)|(0<<WH)) |
| #define | PDP6_CCW ((0<<UL)|(0<<VL)|(1<<WL)|(0<<UH)|(1<<VH)|(0<<WH)) |
CW driving configuration | |
| IO driving configuration (driving enabled by setting IO to output)for clockwise rotation. | |
| #define | PDP1_CW ((0<<UL)|(0<<VL)|(1<<WL)|(0<<UH)|(1<<VH)|(0<<WH)) |
| #define | PDP2_CW ((0<<UL)|(0<<VL)|(1<<WL)|(1<<UH)|(0<<VH)|(0<<WH)) |
| #define | PDP3_CW ((0<<UL)|(1<<VL)|(0<<WL)|(1<<UH)|(0<<VH)|(0<<WH)) |
| #define | PDP4_CW ((0<<UL)|(1<<VL)|(0<<WL)|(0<<UH)|(0<<VH)|(1<<WH)) |
| #define | PDP5_CW ((1<<UL)|(0<<VL)|(0<<WL)|(0<<UH)|(0<<VH)|(1<<WH)) |
| #define | PDP6_CW ((1<<UL)|(0<<VL)|(0<<WL)|(0<<UH)|(1<<VH)|(0<<WH)) |
Defines | |
| #define | ADC_REF_VOLTAGE 5.0f |
| ADC reference voltage in Volts. | |
| #define | CLOCKWISE 1 |
| Used by Set_Direction() for CW rotation. | |
| #define | COUNTERCLOCKWISE 0 |
| Used by Set_Direction() for CCW rotation. | |
| #define | CURRENT_SHUNT_RESISTANCE 0.22f |
| Current shunt resistanse in Ohms. | |
| #define | MAX_CURRENT 1.0f |
| Max motor current in Amperes. | |
| #define | MAX_CURRENT_ADC (signed int)(MAX_SHUNT_VOLTAGE / VOLTS_PER_ADC_STEP) |
| Calc max value for raw ADC reading. | |
| #define | MAX_SHUNT_VOLTAGE (MAX_CURRENT * CURRENT_SHUNT_RESISTANCE) |
| Max current shunt voltage. | |
| #define | OVERCURRENT_PIN PC1 |
| Over-current LED signalling (active low). | |
| #define | PATTERN_COM0_OFFSET 6 |
| Offset for Timer 0 Output Compare config pattern in table. | |
| #define | PATTERN_COM2_OFFSET 12 |
| Offset for Timer 2 Output Compare config pattern in table. | |
| #define | PATTERN_DRV_OFFSET 0 |
| Offset for drive pattern in table. | |
| #define | VOLTS_PER_ADC_STEP (ADC_REF_VOLTAGE / 256) |
| Volts per LSB with 8-bit ADC. | |
| #define ADC_MUX_SHUNT_H ((0 << REFS1) | (0 << REFS0) | (1 << ADLAR) | (1 << MUX2)) |
| #define ADC_MUX_SHUNT_L ((0 << REFS1) | (0 << REFS0) | (1 << ADLAR) | (1 << MUX2) | (1 << MUX0)) |
Definition at line 157 of file sensor_three_phase_BLDC.h.
| #define ADC_MUX_SPEED_REF ((0 << REFS1) | (0 << REFS0) | (1 << ADLAR)) |
| #define ADC_REF_VOLTAGE 5.0f |
| #define CLOCKWISE 1 |
Used by Set_Direction() for CW rotation.
Definition at line 148 of file sensor_three_phase_BLDC.h.
Referenced by main(), and Set_Direction().
| #define COM0P1_CCW ((UL_ON)|(VL_OFF)|(1<<WGM01)|(1<<WGM00)) |
Definition at line 112 of file sensor_three_phase_BLDC.h.
| #define COM0P1_CW ((UL_OFF)|(VL_OFF)|(1<<WGM01)|(1<<WGM00)) |
Definition at line 125 of file sensor_three_phase_BLDC.h.
| #define COM0P2_CCW ((UL_ON)|(VL_OFF)|(1<<WGM01)|(1<<WGM00)) |
Definition at line 114 of file sensor_three_phase_BLDC.h.
| #define COM0P2_CW ((UL_OFF)|(VL_OFF)|(1<<WGM01)|(1<<WGM00)) |
Definition at line 127 of file sensor_three_phase_BLDC.h.
| #define COM0P3_CCW ((UL_OFF)|(VL_ON)|(1<<WGM01)|(1<<WGM00)) |
Definition at line 116 of file sensor_three_phase_BLDC.h.
| #define COM0P3_CW ((UL_OFF)|(VL_ON)|(1<<WGM01)|(1<<WGM00)) |
Definition at line 129 of file sensor_three_phase_BLDC.h.
| #define COM0P4_CCW ((UL_OFF)|(VL_ON)|(1<<WGM01)|(1<<WGM00)) |
Definition at line 118 of file sensor_three_phase_BLDC.h.
| #define COM0P4_CW ((UL_OFF)|(VL_ON)|(1<<WGM01)|(1<<WGM00)) |
Definition at line 131 of file sensor_three_phase_BLDC.h.
| #define COM0P5_CCW ((UL_OFF)|(VL_OFF)|(1<<WGM01)|(1<<WGM00)) |
Definition at line 120 of file sensor_three_phase_BLDC.h.
| #define COM0P5_CW ((UL_ON)|(VL_OFF)|(1<<WGM01)|(1<<WGM00)) |
Definition at line 133 of file sensor_three_phase_BLDC.h.
| #define COM0P6_CCW ((UL_OFF)|(VL_OFF)|(1<<WGM01)|(1<<WGM00)) |
Definition at line 122 of file sensor_three_phase_BLDC.h.
| #define COM0P6_CW ((UL_ON)|(VL_OFF)|(1<<WGM01)|(1<<WGM00)) |
Definition at line 135 of file sensor_three_phase_BLDC.h.
| #define COM2P1_CCW ((WL_OFF)|(1<<WGM21)|(1<<WGM20)) |
Definition at line 113 of file sensor_three_phase_BLDC.h.
| #define COM2P1_CW ((WL_ON)|(1<<WGM21)|(1<<WGM20)) |
Definition at line 126 of file sensor_three_phase_BLDC.h.
| #define COM2P2_CCW ((WL_OFF)|(1<<WGM21)|(1<<WGM20)) |
Definition at line 115 of file sensor_three_phase_BLDC.h.
| #define COM2P2_CW ((WL_ON)|(1<<WGM21)|(1<<WGM20)) |
Definition at line 128 of file sensor_three_phase_BLDC.h.
| #define COM2P3_CCW ((WL_OFF)|(1<<WGM21)|(1<<WGM20)) |
Definition at line 117 of file sensor_three_phase_BLDC.h.
| #define COM2P3_CW ((WL_OFF)|(1<<WGM21)|(1<<WGM20)) |
Definition at line 130 of file sensor_three_phase_BLDC.h.
| #define COM2P4_CCW ((WL_OFF)|(1<<WGM21)|(1<<WGM20)) |
Definition at line 119 of file sensor_three_phase_BLDC.h.
| #define COM2P4_CW ((WL_OFF)|(1<<WGM21)|(1<<WGM20)) |
Definition at line 132 of file sensor_three_phase_BLDC.h.
| #define COM2P5_CCW ((WL_ON)|(1<<WGM21)|(1<<WGM20)) |
Definition at line 121 of file sensor_three_phase_BLDC.h.
| #define COM2P5_CW ((WL_OFF)|(1<<WGM21)|(1<<WGM20)) |
Definition at line 134 of file sensor_three_phase_BLDC.h.
| #define COM2P6_CCW ((WL_ON)|(1<<WGM21)|(1<<WGM20)) |
Definition at line 123 of file sensor_three_phase_BLDC.h.
| #define COM2P6_CW ((WL_OFF)|(1<<WGM21)|(1<<WGM20)) |
Definition at line 136 of file sensor_three_phase_BLDC.h.
| #define COUNTERCLOCKWISE 0 |
| #define CURRENT_SHUNT_RESISTANCE 0.22f |
| #define DDR_HALL DDRB |
| #define DDR_MC DDRD |
| #define HALL1 PB1 |
Definition at line 48 of file sensor_three_phase_BLDC.h.
| #define HALL2 PB2 |
Definition at line 49 of file sensor_three_phase_BLDC.h.
| #define HALL3 PB3 |
Definition at line 50 of file sensor_three_phase_BLDC.h.
| #define HALL_MASK ((1<<HALL1)|(1<<HALL2)|(1<<HALL3)) |
| #define HP1 ((1<<HALL1)|(0<<HALL2)|(1<<HALL3)) |
Definition at line 138 of file sensor_three_phase_BLDC.h.
| #define HP2 ((1<<HALL1)|(0<<HALL2)|(0<<HALL3)) |
Definition at line 139 of file sensor_three_phase_BLDC.h.
| #define HP3 ((1<<HALL1)|(1<<HALL2)|(0<<HALL3)) |
Definition at line 140 of file sensor_three_phase_BLDC.h.
| #define HP4 ((0<<HALL1)|(1<<HALL2)|(0<<HALL3)) |
Definition at line 141 of file sensor_three_phase_BLDC.h.
| #define HP5 ((0<<HALL1)|(1<<HALL2)|(1<<HALL3)) |
Definition at line 142 of file sensor_three_phase_BLDC.h.
| #define HP6 ((0<<HALL1)|(0<<HALL2)|(1<<HALL3)) |
Definition at line 143 of file sensor_three_phase_BLDC.h.
| #define MAX_CURRENT 1.0f |
| #define MAX_CURRENT_ADC (signed int)(MAX_SHUNT_VOLTAGE / VOLTS_PER_ADC_STEP) |
Calc max value for raw ADC reading.
Definition at line 169 of file sensor_three_phase_BLDC.h.
Referenced by main().
| #define MAX_SHUNT_VOLTAGE (MAX_CURRENT * CURRENT_SHUNT_RESISTANCE) |
| #define MC_MASK ((1<<UL)|(1<<VL)|(1<<WL)|(1<<UH)|(1<<VH)|(1<<WH)) |
| #define OVERCURRENT_PIN PC1 |
Over-current LED signalling (active low).
Definition at line 101 of file sensor_three_phase_BLDC.h.
Referenced by main().
| #define PATTERN_COM0_OFFSET 6 |
Offset for Timer 0 Output Compare config pattern in table.
Definition at line 66 of file sensor_three_phase_BLDC.h.
Referenced by PCINT0_ISR().
| #define PATTERN_COM2_OFFSET 12 |
Offset for Timer 2 Output Compare config pattern in table.
Definition at line 67 of file sensor_three_phase_BLDC.h.
Referenced by PCINT0_ISR().
| #define PATTERN_DRV_OFFSET 0 |
| #define PDP1_CCW ((1<<UL)|(0<<VL)|(0<<WL)|(0<<UH)|(1<<VH)|(0<<WH)) |
Definition at line 77 of file sensor_three_phase_BLDC.h.
| #define PDP1_CW ((0<<UL)|(0<<VL)|(1<<WL)|(0<<UH)|(1<<VH)|(0<<WH)) |
Definition at line 93 of file sensor_three_phase_BLDC.h.
| #define PDP2_CCW ((1<<UL)|(0<<VL)|(0<<WL)|(0<<UH)|(0<<VH)|(1<<WH)) |
Definition at line 78 of file sensor_three_phase_BLDC.h.
| #define PDP2_CW ((0<<UL)|(0<<VL)|(1<<WL)|(1<<UH)|(0<<VH)|(0<<WH)) |
Definition at line 94 of file sensor_three_phase_BLDC.h.
| #define PDP3_CCW ((0<<UL)|(1<<VL)|(0<<WL)|(0<<UH)|(0<<VH)|(1<<WH)) |
Definition at line 79 of file sensor_three_phase_BLDC.h.
| #define PDP3_CW ((0<<UL)|(1<<VL)|(0<<WL)|(1<<UH)|(0<<VH)|(0<<WH)) |
Definition at line 95 of file sensor_three_phase_BLDC.h.
| #define PDP4_CCW ((0<<UL)|(1<<VL)|(0<<WL)|(1<<UH)|(0<<VH)|(0<<WH)) |
Definition at line 80 of file sensor_three_phase_BLDC.h.
| #define PDP4_CW ((0<<UL)|(1<<VL)|(0<<WL)|(0<<UH)|(0<<VH)|(1<<WH)) |
Definition at line 96 of file sensor_three_phase_BLDC.h.
| #define PDP5_CCW ((0<<UL)|(0<<VL)|(1<<WL)|(1<<UH)|(0<<VH)|(0<<WH)) |
Definition at line 81 of file sensor_three_phase_BLDC.h.
| #define PDP5_CW ((1<<UL)|(0<<VL)|(0<<WL)|(0<<UH)|(0<<VH)|(1<<WH)) |
Definition at line 97 of file sensor_three_phase_BLDC.h.
| #define PDP6_CCW ((0<<UL)|(0<<VL)|(1<<WL)|(0<<UH)|(1<<VH)|(0<<WH)) |
Definition at line 82 of file sensor_three_phase_BLDC.h.
| #define PDP6_CW ((1<<UL)|(0<<VL)|(0<<WL)|(0<<UH)|(1<<VH)|(0<<WH)) |
Definition at line 98 of file sensor_three_phase_BLDC.h.
| #define PIN_HALL PINB |
| #define PIN_MC PIND |
Definition at line 41 of file sensor_three_phase_BLDC.h.
| #define PORT_HALL PORTB |
| #define PORT_MC PORTD |
| #define UH PD7 |
Definition at line 29 of file sensor_three_phase_BLDC.h.
| #define UL PD6 |
Definition at line 26 of file sensor_three_phase_BLDC.h.
| #define UL_OFF ((0<<COM0A1)|(0<<COM0A0)) |
Definition at line 106 of file sensor_three_phase_BLDC.h.
| #define UL_ON ((1<<COM0A1)|(0<<COM0A0)) |
Definition at line 105 of file sensor_three_phase_BLDC.h.
| #define VH PD4 |
Definition at line 30 of file sensor_three_phase_BLDC.h.
| #define VL PD5 |
Definition at line 27 of file sensor_three_phase_BLDC.h.
| #define VL_OFF ((0<<COM0B1)|(0<<COM0B0)) |
Definition at line 108 of file sensor_three_phase_BLDC.h.
| #define VL_ON ((1<<COM0B1)|(0<<COM0B0)) |
Definition at line 107 of file sensor_three_phase_BLDC.h.
| #define VOLTS_PER_ADC_STEP (ADC_REF_VOLTAGE / 256) |
| #define WH PD2 |
Definition at line 31 of file sensor_three_phase_BLDC.h.
| #define WL PD3 |
Definition at line 28 of file sensor_three_phase_BLDC.h.
| #define WL_OFF ((0<<COM2B1)|(0<<COM2B0)) |
Definition at line 110 of file sensor_three_phase_BLDC.h.
| #define WL_ON ((1<<COM2B1)|(0<<COM2B0)) |
Definition at line 109 of file sensor_three_phase_BLDC.h.
1.4.7