Defines

Constants

Defines

#define AD_REF_EXT   0x00U
 Presetting value for ADC multiplexer.
#define AD_READIN_COUNT   8
 This value defines how many ADC values will be read and averaged for 1 measure.
#define ADC0   0
 ADC channel #0.
#define ADC1   1
 ADC channel #1.
#define ADC2   2
 ADC channel #2.
#define ADC3   3
 ADC channel #3.
#define ADC4   4
 ADC channel #4.
#define ADC5   5
 ADC channel #5.
#define ADC6   6
 ADC channel #6.
#define ADC7   7
 ADC channel #7.
#define SUM_COUNT   20U
 This value defines the array size of mg_au16Data and thus the span of time used to calculate the motor current sum.
#define AVG_COUNT   8U
 This value defines the array size of mg_au16AvgData and thus the span of time used to calculate the average motor current.
#define WHEEL_SIZE   1280U
 This defines the wheel circumference in millimeters.
#define SPEEDLIMIT_MAX   250U
 This value defines the maximum speed at which the motor can be activated in pedelec mode while the driver is pedaling.
#define SPEEDLIMIT_MIN   30U
 This value defines the minimum speed required to enable the motor.
#define DEFAULT_MAGNET_NUMBER_TACHO   1U
 This value defines the default number of magnets attached to activate the tacho reed switch.
#define DEFAULT_MAGNET_NUMBER_PEDAL   1U
 This value defines the default number of magnets attached to activate the pedal reed switch.
#define RXD_PORT   PORTD
#define RXD_DDR   DDRD
#define RXD_BIT   PD0
#define TXD_PORT   PORTD
#define TXD_DDR   DDRD
#define TXD_BIT   PD1
#define LED1_PORT   PORTB
#define LED1_DDR   DDRB
#define LED1_BIT   PB1
#define LED2_PORT   PORTB
#define LED2_DDR   DDRB
#define LED2_BIT   PB0
#define LED3_PORT   PORTD
#define LED3_DDR   DDRD
#define LED3_BIT   PD7
#define LED4_PORT   PORTD
#define LED4_DDR   DDRD
#define LED4_BIT   PD6
#define LED5_PORT   PORTD
#define LED5_DDR   DDRD
#define LED5_BIT   PD4
#define MUX_VOLT_PORT   PORTC
#define MUX_VOLT_DDR   DDRC
#define MUX_VOLT_BIT   PC4
#define MUX_CURR_PORT   PORTC
#define MUX_CURR_DDR   DDRC
#define MUX_CURR_BIT   PC5
#define SPEAKER_PORT   PORTB
#define SPEAKER_DDR   DDRB
#define SPEAKER_BIT   PB2
#define RELAY_PORT   PORTD
#define RELAY_DDR   DDRD
#define RELAY_BIT   PD5
#define FAN_PORT   PORTC
#define FAN_DDR   DDRC
#define FAN_BIT   PC3
#define INT0_PORT   PORTD
#define INT0_DDR   DDRD
#define INT0_BIT   PD2
#define INT1_PORT   PORTD
#define INT1_DDR   DDRD
#define INT1_BIT   PD3
#define VREF_PORT   PORTC
#define VREF_DDR   DDRC
#define VREF_BIT   7
#define CSBASE_PORT   PORTC
#define CSBASE_DDR   DDRC
#define CSBASE_BIT   PC1
#define R3_PORT   PORTC
#define R3_DDR   DDRC
#define R3_BIT   PC0
#define VTH_PORT   PORTC
#define VTH_DDR   DDRC
#define VTH_BIT   PC2
#define SWITCH_PORT   PORTC
#define SWITCH_DDR   DDRC
#define SWITCH_BIT   6
#define ADC_SWITCH   ADC6
#define ADC_TEMPERATURE   ADC2
#define ADC_VOLTAGE   ADC0
#define ADC_VREF   ADC7
#define ADC_CURRENT   ADC1
#define MAX_CURRENT   523U
 This value defines the maximum current as ADC value.
#define VALUE_TEMP_FAN   45U
 This value defines the fan activation temperature.
#define VALUE_TEMP_WARN   70U
 This value defines temperature warning threshold.
#define VALUE_TEMP_ERROR   80U
 This value defines temperature error threshold.
#define ONE_MINUTE_MS   ((UINT32)60000UL)
 This value is just a difinition for one minute in milliseconds.
#define FW_VERSION   1172U
 This value defines the firmware version which will be stored in flash memory.
#define APPLICATION_CRC   0x5C751A3FUL
 This value defines the firmware CRC32 checksum version which will be stored in flash memory.
#define CRC32POLY   0xEDB88320UL
#define STATIC   static
#define LOCAL_STATIC   static
#define CONST   const
#define VOLATILE   volatile
#define VOLT_10V   448U
 ADC value for 10.0 Volt.
#define VOLT_10V5   472U
 ADC value for 10.5 Volt.
#define VOLT_11V   496U
 ADC value for 11.0 Volt.
#define VOLT_11V5   520U
 ADC value for 11.5 Volt.
#define VOLT_12V   544U
 ADC value for 12.0 Volt.
#define CURR_20A   75U
 ADC value for 20 Ampere.
#define CURR_15A   56U
 ADC value for 15 Ampere.
#define CURR_10A   37U
 ADC value for 10 Ampere.
#define CURR_5A   17U
 ADC value for 5 Ampere.
#define CURR_2A   8U
 ADC value for 2 Ampere.
#define CURR_0A   0U
 ADC value for 0 Ampere.
#define PEDAL_TIMEOUT   2000U
 This value defines how many milliseconds the pedal interrupt missing before setting pedaling RPM to 0.
#define MAX_RELIABLE_SPEED   70U
 This value defines the maximum reliable speed. Used to detect false tacho ticks.
#define SPEED_TIMEOUT   2000U
 This value defines how many milliseconds the tacho interrupt missing before setting current wheel RPM to 0.
#define AVG_COUNT   10U
 Array size of mg_au16Data.
#define WARNING_COUNT   20U
 This value defines how many temperature warnings will be accepted before setting the temperature error flag.
#define OCR_VALUE   ((F_CPU / 64U) / 1000U) - 1U
 Preload value for system timer.
#define NO_TICK   0U
 No timer flags.
#define TICK128   1U
 Flag for 128ms events.
#define TICK256   2U
 Flag for 256ms events.
#define TICK512   4U
 Flag for 512ms events.
#define TICK1024   8U
 Flag for 1024ms events.
#define BAUD_RATE   9600
 Definition for serial transmission speed.
#define AVG_COUNT   40U
 Defines the number of voltage readings used for calculating the average voltage.