diff --git a/firmware/src/bsp/mcu/mcu_hal.h b/firmware/src/bsp/mcu/mcu_hal.h index 83c664c..01f9e14 100644 --- a/firmware/src/bsp/mcu/mcu_hal.h +++ b/firmware/src/bsp/mcu/mcu_hal.h @@ -10,41 +10,43 @@ namespace mcu { /* */ -const uint8_t GPIO0 = 0; //PC5 Mode -const uint8_t GPIO1 = 1; //PC4 Pot -const uint8_t GPIO2 = 2; //PE1 Down -const uint8_t GPIO3 = 3; //PE3 Up -const uint8_t GPIO4 = 4; //PD7 Dimm -const uint8_t GPIO5 = 5; //PB7 Brakes -const uint8_t GPIO6 = 6; //PB6 Handbrake -const uint8_t GPIO7 = 7; //PB5 Handbrake pull -const uint8_t GPIO8 = 8; //PD6 Speed pull -const uint8_t GPIO9 = 9; //PD0 LED0 -const uint8_t GPIO10 = 10; //PD1 LED1 -const uint8_t GPIO11 = 11; //PD2 LED2 -const uint8_t GPIO12 = 12; //PD3 LED3 -const uint8_t GPIO13 = 13; //PD4 LED4 -const uint8_t GPIO14 = 14; //PD5 LED5 -const uint8_t GPIO15 = 15; //PB0 DCCD Enable -const uint8_t GPIO16 = 16; //PB1 DCCD PWM -const uint8_t GPIO17 = 17; //PB2 LED PWM +const uint8_t GPIO_DIN1 = 0; +const uint8_t GPIO_DIN2 = 1; +const uint8_t GPIO_DIN3 = 2; +const uint8_t GPIO_DIN4 = 3; +const uint8_t GPIO_HVDIN1 = 4; +const uint8_t GPIO_HVDIN2 = 5; +const uint8_t GPIO_HVDIN3 = 6; +const uint8_t GPIO_HVDIN3_PULL = 7; +const uint8_t GPIO_OD1 = 8; +const uint8_t GPIO_OD2 = 9; +const uint8_t GPIO_OD3 = 10; +const uint8_t GPIO_OD4 = 11; +const uint8_t GPIO_OD5 = 12; +const uint8_t GPIO_OD6 = 13; +const uint8_t GPIO_OUT_LOW = 14; +const uint8_t GPIO_OUT_HIGH = 15; +const uint8_t GPIO_OD_PWM = 16; +const uint8_t GPIO_FREQ_PULL = 17; +const uint8_t GPIO_FREQ1 = 18; +const uint8_t GPIO_FREQ2 = 19; const uint8_t LEVEL_LOW = 0; const uint8_t LEVEL_HIGH = 1; -const int8_t LEVEL_HIZ = -1; +const int8_t LEVEL_HIZ = -1; -const uint8_t ADC0 = 0; //Output current -const uint8_t ADC1 = 1; //Output voltage -const uint8_t ADC2 = 2; //Battery voltage -const uint8_t ADC3 = 3; //Battery current -const uint8_t ADC4 = 4; //Potentiometer -const uint8_t ADC5 = 5; //Mode -const uint8_t ADC8 = 8; //MCU temperature -const uint8_t ADC14 = 14; //MCU internal reference -const uint8_t ADC15 = 15; //MCU ground +const uint8_t ADC_IOUT = 0; //Output current +const uint8_t ADC_VOUT = 1; //Output voltage +const uint8_t ADC_VBAT = 2; //Battery voltage +const uint8_t ADC_IBAT = 3; //Battery current +const uint8_t ADC_AIN2 = 4; //Potentiometer +const uint8_t ADC_AIN1 = 5; //Mode +const uint8_t ADC_TEMP = 8; //MCU temperature +const uint8_t ADC_IVREF = 14; //MCU internal reference +const uint8_t ADC_GND = 15; //MCU ground -const uint8_t PWM0 = 0; //DCCD -const uint8_t PWM1 = 1; //LED +const uint8_t PWM_OUT = 0; //DCCD +const uint8_t PWM_OD = 1; //LED //ADC definitions typedef enum { @@ -85,6 +87,13 @@ uint16_t adc_read(uint8_t ch); void pwm_write(uint8_t ch, uint16_t dc); uint16_t pwm_read(uint8_t ch); +void timer_reset(uint8_t ch); +uint16_t timer_read(uint8_t ch); +uint16_t timer_read_top(uint8_t ch); + +uint32_t timer_convert_us(uint8_t ch, uint16_t raw); +uint32_t timer_convert_ms(uint8_t ch, uint16_t raw); + uint8_t eeprom_read8b(uint16_t address); uint16_t eeprom_read16b(uint16_t address); uint32_t eeprom_read32b(uint16_t address); diff --git a/firmware/src/uDCCD.cppproj b/firmware/src/uDCCD.cppproj index 04782f9..f730fb9 100644 --- a/firmware/src/uDCCD.cppproj +++ b/firmware/src/uDCCD.cppproj @@ -153,108 +153,12 @@ - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - compile compile - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - compile @@ -274,8 +178,6 @@ - -