Started another rework
This commit is contained in:
@@ -10,41 +10,43 @@ namespace mcu {
|
|||||||
/*
|
/*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const uint8_t GPIO0 = 0; //PC5 Mode
|
const uint8_t GPIO_DIN1 = 0;
|
||||||
const uint8_t GPIO1 = 1; //PC4 Pot
|
const uint8_t GPIO_DIN2 = 1;
|
||||||
const uint8_t GPIO2 = 2; //PE1 Down
|
const uint8_t GPIO_DIN3 = 2;
|
||||||
const uint8_t GPIO3 = 3; //PE3 Up
|
const uint8_t GPIO_DIN4 = 3;
|
||||||
const uint8_t GPIO4 = 4; //PD7 Dimm
|
const uint8_t GPIO_HVDIN1 = 4;
|
||||||
const uint8_t GPIO5 = 5; //PB7 Brakes
|
const uint8_t GPIO_HVDIN2 = 5;
|
||||||
const uint8_t GPIO6 = 6; //PB6 Handbrake
|
const uint8_t GPIO_HVDIN3 = 6;
|
||||||
const uint8_t GPIO7 = 7; //PB5 Handbrake pull
|
const uint8_t GPIO_HVDIN3_PULL = 7;
|
||||||
const uint8_t GPIO8 = 8; //PD6 Speed pull
|
const uint8_t GPIO_OD1 = 8;
|
||||||
const uint8_t GPIO9 = 9; //PD0 LED0
|
const uint8_t GPIO_OD2 = 9;
|
||||||
const uint8_t GPIO10 = 10; //PD1 LED1
|
const uint8_t GPIO_OD3 = 10;
|
||||||
const uint8_t GPIO11 = 11; //PD2 LED2
|
const uint8_t GPIO_OD4 = 11;
|
||||||
const uint8_t GPIO12 = 12; //PD3 LED3
|
const uint8_t GPIO_OD5 = 12;
|
||||||
const uint8_t GPIO13 = 13; //PD4 LED4
|
const uint8_t GPIO_OD6 = 13;
|
||||||
const uint8_t GPIO14 = 14; //PD5 LED5
|
const uint8_t GPIO_OUT_LOW = 14;
|
||||||
const uint8_t GPIO15 = 15; //PB0 DCCD Enable
|
const uint8_t GPIO_OUT_HIGH = 15;
|
||||||
const uint8_t GPIO16 = 16; //PB1 DCCD PWM
|
const uint8_t GPIO_OD_PWM = 16;
|
||||||
const uint8_t GPIO17 = 17; //PB2 LED PWM
|
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_LOW = 0;
|
||||||
const uint8_t LEVEL_HIGH = 1;
|
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 ADC_IOUT = 0; //Output current
|
||||||
const uint8_t ADC1 = 1; //Output voltage
|
const uint8_t ADC_VOUT = 1; //Output voltage
|
||||||
const uint8_t ADC2 = 2; //Battery voltage
|
const uint8_t ADC_VBAT = 2; //Battery voltage
|
||||||
const uint8_t ADC3 = 3; //Battery current
|
const uint8_t ADC_IBAT = 3; //Battery current
|
||||||
const uint8_t ADC4 = 4; //Potentiometer
|
const uint8_t ADC_AIN2 = 4; //Potentiometer
|
||||||
const uint8_t ADC5 = 5; //Mode
|
const uint8_t ADC_AIN1 = 5; //Mode
|
||||||
const uint8_t ADC8 = 8; //MCU temperature
|
const uint8_t ADC_TEMP = 8; //MCU temperature
|
||||||
const uint8_t ADC14 = 14; //MCU internal reference
|
const uint8_t ADC_IVREF = 14; //MCU internal reference
|
||||||
const uint8_t ADC15 = 15; //MCU ground
|
const uint8_t ADC_GND = 15; //MCU ground
|
||||||
|
|
||||||
const uint8_t PWM0 = 0; //DCCD
|
const uint8_t PWM_OUT = 0; //DCCD
|
||||||
const uint8_t PWM1 = 1; //LED
|
const uint8_t PWM_OD = 1; //LED
|
||||||
|
|
||||||
//ADC definitions
|
//ADC definitions
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@@ -85,6 +87,13 @@ uint16_t adc_read(uint8_t ch);
|
|||||||
void pwm_write(uint8_t ch, uint16_t dc);
|
void pwm_write(uint8_t ch, uint16_t dc);
|
||||||
uint16_t pwm_read(uint8_t ch);
|
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);
|
uint8_t eeprom_read8b(uint16_t address);
|
||||||
uint16_t eeprom_read16b(uint16_t address);
|
uint16_t eeprom_read16b(uint16_t address);
|
||||||
uint32_t eeprom_read32b(uint16_t address);
|
uint32_t eeprom_read32b(uint16_t address);
|
||||||
|
|||||||
@@ -153,108 +153,12 @@
|
|||||||
</ToolchainSettings>
|
</ToolchainSettings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="bsp\ain.cpp">
|
|
||||||
<SubType>compile</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="bsp\ain.h">
|
|
||||||
<SubType>compile</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="bsp\board.cpp">
|
|
||||||
<SubType>compile</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="bsp\board.h">
|
|
||||||
<SubType>compile</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="bsp\din.cpp">
|
|
||||||
<SubType>compile</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="bsp\din.h">
|
|
||||||
<SubType>compile</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="bsp\dio.cpp">
|
|
||||||
<SubType>compile</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="bsp\dio.h">
|
|
||||||
<SubType>compile</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="bsp\halfbridge.cpp">
|
|
||||||
<SubType>compile</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="bsp\halfbridge.h">
|
|
||||||
<SubType>compile</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="bsp\mcu\mcu_hal.h">
|
<Compile Include="bsp\mcu\mcu_hal.h">
|
||||||
<SubType>compile</SubType>
|
<SubType>compile</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="bsp\mcu\mcu_hal_r8.cpp">
|
<Compile Include="bsp\mcu\mcu_hal_r8.cpp">
|
||||||
<SubType>compile</SubType>
|
<SubType>compile</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="bsp\dout.cpp">
|
|
||||||
<SubType>compile</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="bsp\dout.h">
|
|
||||||
<SubType>compile</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="bsp\pwm.cpp">
|
|
||||||
<SubType>compile</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="bsp\pwm.h">
|
|
||||||
<SubType>compile</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="hw\button.cpp">
|
|
||||||
<SubType>compile</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="hw\button.h">
|
|
||||||
<SubType>compile</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="hw\display_led.cpp">
|
|
||||||
<SubType>compile</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="hw\display_led.h">
|
|
||||||
<SubType>compile</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="hw\fuse.cpp">
|
|
||||||
<SubType>compile</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="hw\fuse.h">
|
|
||||||
<SubType>compile</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="hw\devices.cpp">
|
|
||||||
<SubType>compile</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="hw\devices.h">
|
|
||||||
<SubType>compile</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="hw\potentiometer.cpp">
|
|
||||||
<SubType>compile</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="hw\potentiometer.h">
|
|
||||||
<SubType>compile</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="hw\reg_out.cpp">
|
|
||||||
<SubType>compile</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="hw\reg_out.h">
|
|
||||||
<SubType>compile</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="logic\button_force.cpp">
|
|
||||||
<SubType>compile</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="logic\button_force.h">
|
|
||||||
<SubType>compile</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="logic\cfg_mem.cpp">
|
|
||||||
<SubType>compile</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="logic\cfg_mem.h">
|
|
||||||
<SubType>compile</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="logic\dccd_force.cpp">
|
|
||||||
<SubType>compile</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="logic\dccd_force.h">
|
|
||||||
<SubType>compile</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="main.cpp">
|
<Compile Include="main.cpp">
|
||||||
<SubType>compile</SubType>
|
<SubType>compile</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -274,8 +178,6 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="bsp" />
|
<Folder Include="bsp" />
|
||||||
<Folder Include="bsp\mcu" />
|
<Folder Include="bsp\mcu" />
|
||||||
<Folder Include="hw" />
|
|
||||||
<Folder Include="logic" />
|
|
||||||
<Folder Include="utils" />
|
<Folder Include="utils" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
|
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
|
||||||
|
|||||||
Reference in New Issue
Block a user