From 7c05ea745069dcd1e58cd70cf7f4ed270bc5c476 Mon Sep 17 00:00:00 2001 From: Martin Vladic Date: Thu, 26 Sep 2019 09:58:04 +0200 Subject: [PATCH] HW OVP --- src/eez/apps/psu/channel.cpp | 2 +- src/eez/index.cpp | 6 +- src/eez/index.h | 2 +- src/eez/modules/dcm220/channel.cpp | 4 +- src/eez/modules/dcm220/channel.h | 2 +- src/eez/modules/dcpX05/channel.cpp | 2 +- src/eez/modules/dcpX05/channel.h | 2 +- src/third_party/stm32_r1b5/.cproject | 808 +++++++++++++------------- src/third_party/stm32_r1b5/.mxproject | 4 +- src/third_party/stm32_r1b5/Src/gpio.c | 4 +- src/third_party/stm32_r1b5/h25005.ioc | 9 +- 11 files changed, 424 insertions(+), 421 deletions(-) diff --git a/src/eez/apps/psu/channel.cpp b/src/eez/apps/psu/channel.cpp index 8d1e330b1..d144b8bbb 100644 --- a/src/eez/apps/psu/channel.cpp +++ b/src/eez/apps/psu/channel.cpp @@ -223,7 +223,7 @@ void Channel::set(uint8_t slotIndex_, uint8_t subchannelIndex_, uint8_t boardRev boardRevision = boardRevision_; subchannelIndex = subchannelIndex_; - channelInterface = g_modules[g_slots[slotIndex].moduleType].channelInterface[slotIndex]; + channelInterface = g_modules[g_slots[slotIndex].moduleType].channelInterfaces ? g_modules[g_slots[slotIndex].moduleType].channelInterfaces[slotIndex] : nullptr; params = &CH_BOARD_REVISION_PARAMS[boardRevision]; diff --git a/src/eez/index.cpp b/src/eez/index.cpp index 247c9ea90..3a62e7b87 100644 --- a/src/eez/index.cpp +++ b/src/eez/index.cpp @@ -136,19 +136,19 @@ ModuleInfo g_modules[] = { 406, CH_BOARD_REVISION_DCP405_R2B5, 1, - dcpX05::g_channelInterface + dcpX05::g_channelInterfaces }, { 220, CH_BOARD_REVISION_DCM220_R1B1, 2, - dcm220::g_channelInterface + dcm220::g_channelInterfaces }, { 505, CH_BOARD_REVISION_DCP505_R1B3, 1, - dcpX05::g_channelInterface + dcpX05::g_channelInterfaces }, }; diff --git a/src/eez/index.h b/src/eez/index.h index 0cd416bd6..537b8fc8a 100644 --- a/src/eez/index.h +++ b/src/eez/index.h @@ -106,7 +106,7 @@ struct ModuleInfo { uint16_t moduleId; uint8_t lasestBoardRevision; // TODO should be lasestModuleRevision uint8_t numChannels; - ChannelInterface **channelInterface; + ChannelInterface **channelInterfaces; }; extern ModuleInfo g_modules[]; diff --git a/src/eez/modules/dcm220/channel.cpp b/src/eez/modules/dcm220/channel.cpp index b8f4cd772..ee71ddd9a 100644 --- a/src/eez/modules/dcm220/channel.cpp +++ b/src/eez/modules/dcm220/channel.cpp @@ -416,7 +416,7 @@ struct Channel : ChannelInterface { static Channel g_channel0(0); static Channel g_channel1(1); static Channel g_channel2(2); -ChannelInterface *g_channelInterface[NUM_SLOTS] = { &g_channel0, &g_channel1, &g_channel2 }; +ChannelInterface *g_channelInterfaces[NUM_SLOTS] = { &g_channel0, &g_channel1, &g_channel2 }; #if defined(EEZ_PLATFORM_STM32) @@ -424,7 +424,7 @@ float readTemperature(int channelIndex) { psu::Channel& channel = psu::Channel::get(channelIndex); int slotIndex = channel.slotIndex; int subchannelIndex = channel.subchannelIndex; - Channel *dcm220Channel = (Channel *)g_channelInterface[slotIndex]; + Channel *dcm220Channel = (Channel *)g_channelInterfaces[slotIndex]; return dcm220Channel->temperature[subchannelIndex]; } diff --git a/src/eez/modules/dcm220/channel.h b/src/eez/modules/dcm220/channel.h index bc40d6ad9..6fa278877 100644 --- a/src/eez/modules/dcm220/channel.h +++ b/src/eez/modules/dcm220/channel.h @@ -23,7 +23,7 @@ namespace eez { namespace dcm220 { -extern ChannelInterface *g_channelInterface[NUM_SLOTS]; +extern ChannelInterface *g_channelInterfaces[NUM_SLOTS]; #if defined(EEZ_PLATFORM_STM32) float readTemperature(int channelIndex); diff --git a/src/eez/modules/dcpX05/channel.cpp b/src/eez/modules/dcpX05/channel.cpp index 966dd5a5e..55c5fe205 100644 --- a/src/eez/modules/dcpX05/channel.cpp +++ b/src/eez/modules/dcpX05/channel.cpp @@ -481,7 +481,7 @@ struct Channel : ChannelInterface { static Channel g_channel0(0); static Channel g_channel1(1); static Channel g_channel2(2); -ChannelInterface *g_channelInterface[NUM_SLOTS] = { &g_channel0, &g_channel1, &g_channel2 }; +ChannelInterface *g_channelInterfaces[NUM_SLOTS] = { &g_channel0, &g_channel1, &g_channel2 }; } // namespace dcpX05 } // namespace eez diff --git a/src/eez/modules/dcpX05/channel.h b/src/eez/modules/dcpX05/channel.h index 466e0f432..3ef5c1602 100644 --- a/src/eez/modules/dcpX05/channel.h +++ b/src/eez/modules/dcpX05/channel.h @@ -23,7 +23,7 @@ namespace eez { namespace dcpX05 { -extern ChannelInterface *g_channelInterface[NUM_SLOTS]; +extern ChannelInterface *g_channelInterfaces[NUM_SLOTS]; } // namespace dcpX05 } // namespace eez diff --git a/src/third_party/stm32_r1b5/.cproject b/src/third_party/stm32_r1b5/.cproject index c0b9ce014..765b33932 100644 --- a/src/third_party/stm32_r1b5/.cproject +++ b/src/third_party/stm32_r1b5/.cproject @@ -1,576 +1,576 @@ - + - + - - - - + + + + - - + - - - - - - - - - + + + + + + + + - - - + + + - + - - - - + + + + - - + - - - - - - + + + + + + - - - + + + - + - + - + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + diff --git a/src/third_party/stm32_r1b5/.mxproject b/src/third_party/stm32_r1b5/.mxproject index 2e60808b9..78e28adc7 100644 --- a/src/third_party/stm32_r1b5/.mxproject +++ b/src/third_party/stm32_r1b5/.mxproject @@ -1,7 +1,7 @@ [PreviousGenFiles] -HeaderPath=C:/Users/Martin/Dropbox/Code/EEZ/modular-psu-firmware/src/third_party/stm32_r1b5/Inc +HeaderPath=C:/Users/mvladic/Dropbox/Code/EEZ/modular-psu-firmware/src/third_party/stm32_r1b5/Inc HeaderFiles=gpio.h;adc.h;crc.h;dac.h;dma.h;dma2d.h;fmc.h;FreeRTOSConfig.h;i2c.h;ltdc.h;lwip.h;lwipopts.h;ethernetif.h;rng.h;rtc.h;sdmmc.h;spi.h;tim.h;usb_device.h;usbd_conf.h;usbd_desc.h;usbd_cdc_if.h;stm32f7xx_it.h;stm32f7xx_hal_conf.h;main.h;ffconf.h;bsp_driver_sd.h;sd_diskio.h;fatfs.h;fatfs_platform.h;eth.h;usart.h; -SourcePath=C:/Users/Martin/Dropbox/Code/EEZ/modular-psu-firmware/src/third_party/stm32_r1b5/Src +SourcePath=C:/Users/mvladic/Dropbox/Code/EEZ/modular-psu-firmware/src/third_party/stm32_r1b5/Src SourceFiles=gpio.c;adc.c;crc.c;dac.c;dma.c;dma2d.c;fmc.c;freertos.c;i2c.c;ltdc.c;lwip.c;ethernetif.c;syscalls.c;rng.c;rtc.c;sdmmc.c;spi.c;tim.c;usb_device.c;usbd_conf.c;usbd_desc.c;usbd_cdc_if.c;stm32f7xx_it.c;stm32f7xx_hal_msp.c;stm32f7xx_hal_timebase_TIM.c;main.c;bsp_driver_sd.c;sd_diskio.c;fatfs.c;fatfs_platform.c;stm32f7xx_hal_timebase_tim.c;eth.c;usart.c; [PreviousLibFiles] diff --git a/src/third_party/stm32_r1b5/Src/gpio.c b/src/third_party/stm32_r1b5/Src/gpio.c index b30a53cb5..a019eea5b 100644 --- a/src/third_party/stm32_r1b5/Src/gpio.c +++ b/src/third_party/stm32_r1b5/Src/gpio.c @@ -125,7 +125,7 @@ void MX_GPIO_Init(void) /*Configure GPIO pins : PAPin PAPin */ GPIO_InitStruct.Pin = SPI2_IRQ_Pin|SPI5_IRQ_Pin; GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING; - GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Pull = GPIO_PULLUP; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); /*Configure GPIO pin : PA10 */ @@ -181,7 +181,7 @@ void MX_GPIO_Init(void) /*Configure GPIO pin : PtPin */ GPIO_InitStruct.Pin = SPI4_IRQ_Pin; GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING; - GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Pull = GPIO_PULLUP; HAL_GPIO_Init(SPI4_IRQ_GPIO_Port, &GPIO_InitStruct); /*Configure GPIO pin : PtPin */ diff --git a/src/third_party/stm32_r1b5/h25005.ioc b/src/third_party/stm32_r1b5/h25005.ioc index 567fe8bfc..6e6244c48 100644 --- a/src/third_party/stm32_r1b5/h25005.ioc +++ b/src/third_party/stm32_r1b5/h25005.ioc @@ -329,8 +329,9 @@ PA13.Mode=Trace_Asynchronous_SW PA13.Signal=SYS_JTMS-SWDIO PA14.Mode=Trace_Asynchronous_SW PA14.Signal=SYS_JTCK-SWCLK -PA15.GPIOParameters=GPIO_Label +PA15.GPIOParameters=GPIO_PuPd,GPIO_Label PA15.GPIO_Label=SPI5_IRQ +PA15.GPIO_PuPd=GPIO_PULLUP PA15.Locked=true PA15.Signal=GPXTI15 PA2.Mode=MII @@ -348,8 +349,9 @@ PA6.Mode=RGB565 PA6.Signal=LTDC_G2 PA7.Mode=MII PA7.Signal=ETH_RX_DV -PA8.GPIOParameters=GPIO_Label +PA8.GPIOParameters=GPIO_PuPd,GPIO_Label PA8.GPIO_Label=SPI2_IRQ +PA8.GPIO_PuPd=GPIO_PULLUP PA8.Locked=true PA8.Signal=GPXTI8 PA9.Mode=Activate_VBUS @@ -396,8 +398,9 @@ PB7.Mode=I2C PB7.Signal=I2C1_SDA PB8.Mode=MII PB8.Signal=ETH_TXD3 -PB9.GPIOParameters=GPIO_Label +PB9.GPIOParameters=GPIO_PuPd,GPIO_Label PB9.GPIO_Label=SPI4_IRQ +PB9.GPIO_PuPd=GPIO_PULLUP PB9.Locked=true PB9.Signal=GPXTI9 PC0.GPIOParameters=GPIO_Speed