# HG changeset patch # User Jan Mulder # Date 1558120744 -7200 # Node ID 5ca177d2df5dcb83652ac1286f81a76efa427684 # Parent b70c26be71a09e4b7133c358386a8cf1cc42572e cleanup: remove commented/unused code, make static without any functional change. Signed-off-by: Jan Mulder diff -r b70c26be71a0 -r 5ca177d2df5d Discovery/Src/base.c --- a/Discovery/Src/base.c Fri May 17 06:38:56 2019 +0000 +++ b/Discovery/Src/base.c Fri May 17 21:19:04 2019 +0200 @@ -206,7 +206,6 @@ #include "display.h" #include "gfx_engine.h" #include "show_logbook.h" -//#include "test_vpm.h" #include "text_multilanguage.h" #include "tHome.h" #include "tInfo.h" @@ -215,7 +214,6 @@ #include "tMenuEdit.h" #include "tMenuEditGasOC.h" #include "tStructure.h" -//#include "gfx_specialeffects.h" #include "externLogbookFlash.h" #include "tComm.h" #include "tCCR.h" @@ -250,34 +248,26 @@ //#define QUICK_SLEEP /* Private define ------------------------------------------------------------*/ -//#define BUFFER_SIZE ((uint32_t)0x00177000) -//#define WRITE_READ_ADDR ((uint32_t)0x0000) #define REFRESH_COUNT ((uint32_t)0x0569) /**< for SDRAM refresh counter (90Mhz SD clock) */ #define INVALID_BUTTON ((uint8_t) 0xFF) /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ -RTC_HandleTypeDef RtcHandle; /* used to change time and date, no RTC is running on this MCU */ +static RTC_HandleTypeDef RtcHandle; /* used to change time and date, no RTC is running on this MCU */ TIM_HandleTypeDef TimHandle; /* used in stm32f4xx_it.c too */ -TIM_HandleTypeDef TimBacklightHandle; /* used in stm32f4xx_it.c too */ +static TIM_HandleTypeDef TimBacklightHandle; #ifdef DEMOMODE TIM_HandleTypeDef TimDemoHandle; /* used in stm32f4xx_it.c too */ #endif -uint8_t LastButtonPressed; -uint32_t LastButtonPressedTick; -uint32_t BaseTick100ms; /* Tick at last 100ms cycle */ - -/* -uint32_t time_before; -uint32_t time_between; -uint32_t time_after; -*/ +static uint8_t LastButtonPressed; +static uint32_t LastButtonPressedTick; +static uint32_t BaseTick100ms; /* Tick at last 100ms cycle */ /* SDRAM handler declaration */ -SDRAM_HandleTypeDef hsdram; -FMC_SDRAM_TimingTypeDef SDRAM_Timing; -FMC_SDRAM_CommandTypeDef command; +static SDRAM_HandleTypeDef hsdram; +static FMC_SDRAM_TimingTypeDef SDRAM_Timing; +static FMC_SDRAM_CommandTypeDef command; /* This was used for Dual Boot */ //FLASH_OBProgramInitTypeDef OBInit; @@ -285,16 +275,12 @@ /* Private variables with external access ------------------------------------*/ -uint32_t globalStateID = 0; -uint8_t globalModeID = SURFMODE; -uint32_t time_without_button_pressed_deciseconds = 0; /**< langbeschreibung (eigenes Feld) warum diese variable verwendet wird um den sleepmode zu aktivieren */ +static uint32_t globalStateID = 0; +static uint32_t time_without_button_pressed_deciseconds = 0; /**< langbeschreibung (eigenes Feld) warum diese variable verwendet wird um den sleepmode zu aktivieren */ uint8_t bootToBootloader = 0; ///< set in tComm.c to install firmware updates, calls resetToFirmwareUpdate() -//uint8_t dataEx_VPM_call = 0; -uint8_t returnFromCommCleanUpRequest = 0; ///< use this to exit bluetooth mode and call tComm_exit() +static uint8_t returnFromCommCleanUpRequest = 0; ///< use this to exit bluetooth mode and call tComm_exit() uint32_t base_tempLightLevel = 0; -uint8_t updateButtonsToDefault = 0; -uint8_t wasFirmwareUpdateCheckBattery = 0; - +static uint8_t wasFirmwareUpdateCheckBattery = 0; static uint8_t DoDisplayRefresh = 0; /* trigger to refresh display data */ /* Private function prototypes -----------------------------------------------*/ @@ -355,7 +341,6 @@ uint8_t lastsecond = 0xFF; #endif - set_globalState( StBoot0 ); LastButtonPressed = 0; @@ -382,23 +367,11 @@ } //settingsGetPointer()->bluetoothActive = 0; /* MX_Bluetooth_PowerOff(); unnecessary as part of MX_GPIO_Init() */ //settingsGetPointer()->compassBearing = 0; - set_new_settings_missing_in_ext_flash(); // inlcudes update of firmware version 161121 + set_new_settings_missing_in_ext_flash(); // includes update of firmware version 161121 GFX_init( &pLayerInvisible ); TIM_BACKLIGHT_init(); - /* - GFX_helper_font_memory_list(&FontT24); - GFX_helper_font_memory_list(&FontT42); - GFX_helper_font_memory_list(&FontT48); - GFX_helper_font_memory_list(&FontT54); - GFX_helper_font_memory_list(&FontT84); - GFX_helper_font_memory_list(&FontT105); - GFX_helper_font_memory_list(&FontT144); - */ - - - // new 170508: bluetooth on at start settingsGetPointer()->bluetoothActive = 1; MX_Bluetooth_PowerOn(); @@ -443,7 +416,6 @@ display_power_on__2_of_2__post_RGB(); GFX_use_colorscheme( settingsGetPointer()->tX_colorscheme ); -// ----------------------------- tHome_init(); tI_init(); tM_init(); @@ -490,10 +462,6 @@ if( bootToBootloader ) resetToFirmwareUpdate(); - // this will allways reset after RTE reset -> no good! -// if(DataEX_was_power_on()) // new to allow for update after RTE update -// resetToFirmwareUpdate(); - tCCR_control(); if( tComm_control() )// will stop while loop if tComm Mode started until exit from UART { @@ -932,7 +900,7 @@ } -void EvaluateButton() +static void EvaluateButton() { uint8_t action = 0; SStateList status; @@ -1012,7 +980,7 @@ } } -void gotoSleep(void) +static void gotoSleep(void) { /* not at the moment of testing */ // ext_flash_erase_firmware_if_not_empty(); @@ -1023,21 +991,6 @@ // ----------------------------- -uint8_t get_globalMode(void) -{ - return globalModeID; -} - - -void set_globalMode(uint8_t newMode) -{ - if((newMode != DIVEMODE) && (newMode != SURFMODE)) - return; - - globalModeID = newMode; -} - - uint32_t get_globalState(void) { return globalStateID; @@ -1654,7 +1607,7 @@ #endif -void deco_loop(void) +static void deco_loop(void) { typedef enum { @@ -1735,7 +1688,7 @@ counter++; } -void resetToFirmwareUpdate(void) +static void resetToFirmwareUpdate(void) { __HAL_RCC_CLEAR_RESET_FLAGS(); HAL_NVIC_SystemReset(); diff -r b70c26be71a0 -r 5ca177d2df5d Discovery/Src/data_central.c --- a/Discovery/Src/data_central.c Fri May 17 06:38:56 2019 +0000 +++ b/Discovery/Src/data_central.c Fri May 17 21:19:04 2019 +0200 @@ -75,7 +75,7 @@ SDiveState stateSim = { 0 }; SDiveState stateDeco = { 0 }; -SDevice stateDevice = +static SDevice stateDevice = { /* max is 0x7FFFFFFF, min is 0x80000000 but also defined in stdint.h :-) */ @@ -94,7 +94,7 @@ .voltageMinimum.value_int32 = INT32_MAX, }; -SVpmRepetitiveData stateVPM = +static SVpmRepetitiveData stateVPM = { .repetitive_variables_not_valid = 1, .is_data_from_RTE_CPU = 0, @@ -175,65 +175,26 @@ uint8_t decoLock = DECO_CALC_undefined; -int ascent_rate_meter_per_min = 12; -int descent_rate_meter_per_min = 20; -int max_depth = 70; -int bottom_time = 10; + +static int descent_rate_meter_per_min = 20; +static int max_depth = 70; +static int bottom_time = 10; _Bool vpm_crush(SDiveState* pDiveState); void setSimulationValues(int _ascent_rate_meter_per_min, int _descent_rate_meter_per_min, int _max_depth, int _bottom_time ) { - ascent_rate_meter_per_min = _ascent_rate_meter_per_min; descent_rate_meter_per_min = _descent_rate_meter_per_min; max_depth = _max_depth; bottom_time = _bottom_time; } - - int current_second(void) { return HAL_GetTick() / 1000; - // printf("milliseconds: %lld\n", milliseconds); - //return milliseconds; } - - #define OXY_ONE_SIXTIETH_PART 0.0166667f -/*void oxygen_calculate_cns(float* oxygen_cns, float pressure_oxygen_real) -{ - int cns_no_range = 0; - _Bool not_found = 1; - //for the cns calculation - const float cns_ppo2_ranges[60][2] = { {0.50, 0.00}, {0.60, 0.14}, {0.64, 0.15}, {0.66, 0.16}, {0.68, 0.17}, {0.70, 0.18}, - {0.74, 0.19}, {0.76, 0.20}, {0.78, 0.21}, {0.80, 0.22}, {0.82, 0.23}, {0.84, 0.24}, - {0.86, 0.25}, {0.88, 0.26}, {0.90, 0.28}, {0.92, 0.29}, {0.94, 0.30}, {0.96, 0.31}, - {0.98, 0.32}, {1.00, 0.33}, {1.02, 0.35}, {1.04, 0.36}, {1.06, 0.38}, {1.08, 0.40}, - {1.10, 0.42}, {1.12, 0.43}, {1.14, 0.43}, {1.16, 0.44}, {1.18, 0.46}, {1.20, 0.47}, - {1.22, 0.48}, {1.24, 0.51}, {1.26, 0.52}, {1.28, 0.54}, {1.30, 0.56}, {1.32, 0.57}, - {1.34, 0.60}, {1.36, 0.62}, {1.38, 0.63}, {1.40, 0.65}, {1.42, 0.68}, {1.44, 0.71}, - {1.46, 0.74}, {1.48, 0.78}, {1.50, 0.83}, {1.52, 0.93}, {1.54, 1.04}, {1.56, 1.19}, - {1.58, 1.47}, {1.60, 2.22}, {1.62, 5.00}, {1.65, 6.25}, {1.67, 7.69}, {1.70, 10.0}, - {1.72,12.50}, {1.74,20.00}, {1.77,25.00}, {1.79,31.25}, {1.80,50.00}, {1.82,100.0}}; - //find the correct cns range for the corresponding ppo2 - cns_no_range = 58; - while (cns_no_range && not_found) - { - if (pressure_oxygen_real > cns_ppo2_ranges[cns_no_range][0]) - { - cns_no_range++; - not_found = 0; - } - else - cns_no_range--; - } - - //calculate cns for the actual ppo2 for 1 second - *oxygen_cns += OXY_ONE_SIXTIETH_PART * cns_ppo2_ranges[cns_no_range][1]; -}*/ - uint8_t calc_MOD(uint8_t gasId) { int16_t oxygen, maxppO2, result; @@ -261,40 +222,6 @@ return result; } -uint8_t calc_MinOD(uint8_t gasId) -{ - int16_t oxygen, minppO2, result; - SSettings *pSettings; - - pSettings = settingsGetPointer(); - - oxygen = (int16_t)(pSettings->gas[gasId].oxygen_percentage); - minppO2 =(int16_t)(pSettings->ppO2_min); - result = 10 * minppO2; - result += 9; - result /= oxygen; - result -= 10; - - if(result < 0) - return 0; - - if(result > 255) - return 255; - - return result; -} -/* -float calc_ppO2(float input_ambient_pressure_bar, SGas* pGas) -{ - float percent_N2 = 0; - float percent_He = 0; - float percent_O2 = 0; - decom_get_inert_gases(input_ambient_pressure_bar, pGas, &percent_N2, &percent_He); - percent_O2 = 1 - percent_N2 - percent_He; - - return (input_ambient_pressure_bar - WATER_VAPOUR_PRESSURE) * percent_O2; -}*/ - float get_ambiant_pressure_simulation(long dive_time_seconds, float surface_pressure_bar ) { static @@ -651,7 +578,7 @@ } -int32_t helper_days_from_civil(int32_t y, uint32_t m, uint32_t d) +static int32_t helper_days_from_civil(int32_t y, uint32_t m, uint32_t d) { y += 2000; y -= m <= 2; @@ -663,7 +590,7 @@ } -uint8_t helper_weekday_from_days(int32_t z) +static uint8_t helper_weekday_from_days(int32_t z) { return (uint8_t)(z >= -4 ? (z+4) % 7 : (z+5) % 7 + 6); } @@ -714,95 +641,12 @@ sTime->SubSeconds = 0; } - -/* -void initDiveState(SDiveSettings * pDiveSettings, SVpm * pVpm) -{ - SSettings* pSettings = settingsGetPointer(); - for(int i = 0; i< NUM_GASES; i++) - { - pDiveSettings->gas[i] = pSettings->gas[i]; - pDiveSettings->gas[NUM_OFFSET_DILUENT + i] = pSettings->gas[NUM_OFFSET_DILUENT + i]; - pDiveSettings->setpoint[i] = pSettings->setpoint[i]; - } - pDiveSettings->diveMode = pSettings->dive_mode; - - pDiveSettings->gf_high = pSettings->GF_high; - pDiveSettings->gf_low = pSettings->GF_low; - pDiveSettings->last_stop_depth_bar = ((float)pSettings->last_stop_depth_meter) / 10.0; - pDiveSettings->ascentRate_meterperminute = 10; - pDiveSettings->vpm_conservatism = 1; - - pDiveSettings->input_next_stop_increment_depth_bar = ((float)pSettings->stop_increment_depth_meter) / 10.0f; - - vpm_init(pVpm, pDiveSettings->vpm_conservatism, 0, 0); -} -*/ -_Bool deco_zone_reached(void) -{ - if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) - return stateUsed->lifeData.pressure_ambient_bar <= stateUsed->diveSettings.internal__pressure_first_stop_ambient_bar_as_upper_limit_for_gf_low_otherwise_zero; - else - return stateUsed->vpm.deco_zone_reached; - -} - - void resetEvents(const SDiveState *pStateUsed) { memset((void *)&pStateUsed->events, 0, sizeof(SEvents)); } -/* This is derived from crc32b but does table lookup. First the table -itself is calculated, if it has not yet been set up. -Not counting the table setup (which would probably be a separate -function), when compiled to Cyclops with GCC, this function executes in -7 + 13n instructions, where n is the number of bytes in the input -message. It should be doable in 4 + 9n instructions. In any case, two -of the 13 or 9 instrucions are load byte. - This is Figure 14-7 in the text. */ - -/* http://www.hackersdelight.org/ i guess ;-) *hw */ - -uint32_t crc32c_checksum(uint8_t* message, uint16_t length, uint8_t* message2, uint16_t length2) { - int i, j; - uint32_t byte, crc, mask; - static unsigned int table[256] = {0}; - - /* Set up the table, if necessary. */ - if (table[1] == 0) { - for (byte = 0; byte <= 255; byte++) { - crc = byte; - for (j = 7; j >= 0; j--) { // Do eight times. - mask = -(crc & 1); - crc = (crc >> 1) ^ (0xEDB88320 & mask); - } - table[byte] = crc; - } - } - - /* Through with table setup, now calculate the CRC. */ - i = 0; - crc = 0xFFFFFFFF; - while (length--) { - byte = message[i]; - crc = (crc >> 8) ^ table[(crc ^ byte) & 0xFF]; - i = i + 1; - } - if(length2) - { - i = 0; - while (length2--) { - byte = message2[i]; - crc = (crc >> 8) ^ table[(crc ^ byte) & 0xFF]; - i = i + 1; - } - } - return ~crc; -} - - uint32_t CRC_CalcBlockCRC_moreThan768000(uint32_t *buffer1, uint32_t *buffer2, uint32_t words) { cm_t crc_model; diff -r b70c26be71a0 -r 5ca177d2df5d Discovery/Src/display.c --- a/Discovery/Src/display.c Fri May 17 06:38:56 2019 +0000 +++ b/Discovery/Src/display.c Fri May 17 21:19:04 2019 +0200 @@ -34,7 +34,7 @@ } -void send(uint8_t *pData, uint16_t inputlength) +static void send(uint8_t *pData, uint16_t inputlength) { HAL_GPIO_WritePin(DISPLAY_CSB_GPIO_PORT,DISPLAY_CSB_PIN,GPIO_PIN_RESET); // chip select @@ -48,7 +48,7 @@ } -uint16_t convert8to9to8(uint8_t *pInput, uint8_t *pOutput,uint16_t inputlength) +static uint16_t convert8to9to8(uint8_t *pInput, uint8_t *pOutput,uint16_t inputlength) { uint16_t outputlength; uint8_t readbit = 0x80;//0b1000000; @@ -227,55 +227,6 @@ } -void display_power_off(void) -{ - uint8_t aTxBuffer[1]; - uint8_t bTxBuffer[9]; - uint16_t i,length; - - for(i=0;i<9;i++) - bTxBuffer[i] = 0; - - aTxBuffer[0] = DISPLAY_OFF; - length = convert8to9to8((uint8_t*)aTxBuffer,(uint8_t*)bTxBuffer,1); - send((uint8_t*)bTxBuffer, length); - HAL_Delay(5); - - aTxBuffer[0] = SLEEP_IN; - length = convert8to9to8((uint8_t*)aTxBuffer,(uint8_t*)bTxBuffer,1); - send((uint8_t*)bTxBuffer, length); -} - - -void display_sleep(void) -{ - uint8_t aTxBuffer[1]; - uint8_t bTxBuffer[9]; - uint16_t i,length; - - for(i=0;i<9;i++) - bTxBuffer[i] = 0; - - aTxBuffer[0] = SLEEP_IN; - length = convert8to9to8((uint8_t*)aTxBuffer,(uint8_t*)bTxBuffer,1); - send((uint8_t*)bTxBuffer, length); -} - - -void display_sleep_release(void) -{ - uint8_t aTxBuffer[1]; - uint8_t bTxBuffer[9]; - uint16_t i,length; - - for(i=0;i<9;i++) - bTxBuffer[i] = 0; - - aTxBuffer[0] = SLEEP_OUT; - length = convert8to9to8((uint8_t*)aTxBuffer,(uint8_t*)bTxBuffer,1); - send((uint8_t*)bTxBuffer, length); -} - static void Display_Error_Handler(void) { while(1) diff -r b70c26be71a0 -r 5ca177d2df5d Discovery/Src/externCPU2bootloader.c --- a/Discovery/Src/externCPU2bootloader.c Fri May 17 06:38:56 2019 +0000 +++ b/Discovery/Src/externCPU2bootloader.c Fri May 17 21:19:04 2019 +0200 @@ -35,37 +35,26 @@ /* Exported variables --------------------------------------------------------*/ /* Private types -------------------------------------------------------------*/ -#define BOOTLOADSPITIMEOUT 5000 /* Private variables ---------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ -uint8_t boot_sync_frame(void); -uint8_t boot_ack(void); -uint8_t boot_get(uint8_t *RxBuffer); -uint8_t boot_get_id(uint8_t *RxBuffer); -uint8_t boot_get_version(uint8_t *RxBuffer); -//uint8_t boot_go(uint32_t address); -uint8_t boot_write_memory(uint32_t address, uint8_t length_minus_1, uint8_t *data); -//uint8_t boot_erase_memory(uint16_t data_frame, uint16_t *page_numbers); -uint8_t boot_erase_memory(void); -uint8_t boot_write_protect(uint8_t number_of_sectors_minus_one, uint8_t *sector_codes); -/* -uint8_t boot_write_unprotect(void); -uint8_t boot_readout_protect(void); -uint8_t boot_readout_unprotect(void); -*/ -void Bootoader_send_command(uint8_t command); -void Bootloader_spi_single(uint8_t TxByte); -void Bootloader_spi(uint16_t lengthData, uint8_t *aTxBuffer, uint8_t *aRxBuffer); -void Bootloader_Error_Handler(void); +static uint8_t boot_sync_frame(void); +static uint8_t boot_ack(void); +static uint8_t boot_get_id(uint8_t *RxBuffer); +static uint8_t boot_get_version(uint8_t *RxBuffer); +static uint8_t boot_write_memory(uint32_t address, uint8_t length_minus_1, uint8_t *data); +static uint8_t boot_erase_memory(void); +static void Bootloader_send_command(uint8_t command); +static void Bootloader_spi_single(uint8_t TxByte); +static void Bootloader_spi(uint16_t lengthData, uint8_t *aTxBuffer, uint8_t *aRxBuffer); +static void Bootloader_Error_Handler(void); /* Exported functions --------------------------------------------------------*/ uint8_t extCPU2bootloader_start(uint8_t *version, uint16_t *chipID) { -// uint8_t aTxBuffer[256] = { 0 }; uint8_t aRxBuffer[256] = { 0 }; HAL_GPIO_WritePin(SMALLCPU_CSB_GPIO_PORT,SMALLCPU_CSB_PIN,GPIO_PIN_RESET); @@ -89,7 +78,7 @@ { uint8_t version = 0; uint16_t chipID = 0; -// uint8_t ret; + if(!extCPU2bootloader_start(&version,&chipID)) return 0; if(!boot_erase_memory()) @@ -135,28 +124,16 @@ /* Private functions --------------------------------------------------------*/ -uint8_t boot_sync_frame(void) +static uint8_t boot_sync_frame(void) { Bootloader_spi_single(0x5a); return boot_ack(); } - -uint8_t boot_get(uint8_t *RxBuffer) +static uint8_t boot_get_version(uint8_t *RxBuffer) { Bootloader_spi_single(0x5a); - Bootoader_send_command(0x00); - if(!boot_ack()) - return 0; - Bootloader_spi(14, NULL, RxBuffer); - return boot_ack(); -} - - -uint8_t boot_get_version(uint8_t *RxBuffer) -{ - Bootloader_spi_single(0x5a); - Bootoader_send_command(0x01); + Bootloader_send_command(0x01); if(!boot_ack()) return 0; Bootloader_spi(3, NULL, RxBuffer); @@ -164,23 +141,16 @@ } -uint8_t boot_get_id(uint8_t *RxBuffer) +static uint8_t boot_get_id(uint8_t *RxBuffer) { Bootloader_spi_single(0x5a); - Bootoader_send_command(0x02); + Bootloader_send_command(0x02); if(!boot_ack()) return 0; Bootloader_spi(5, NULL, RxBuffer); return boot_ack(); } -/* -uint8_t boot_go(uint32_t address) -{ - -} -*/ - uint8_t boot_write_memory(uint32_t address, uint8_t length_minus_1, uint8_t *data) { @@ -189,7 +159,7 @@ uint16_t length; Bootloader_spi_single(0x5a); - Bootoader_send_command(0x31); + Bootloader_send_command(0x31); if(!boot_ack()) return 1; HAL_Delay(5); @@ -223,13 +193,12 @@ return 1; } -//uint8_t boot_erase_memory(uint16_t data_frame, uint16_t *page_numbers) -uint8_t boot_erase_memory(void) +static uint8_t boot_erase_memory(void) { uint8_t special_erase_with_checksum[3] = {0xFF, 0xFF, 0x00}; Bootloader_spi_single(0x5a); - Bootoader_send_command(0x44); + Bootloader_send_command(0x44); if(!boot_ack()) return 0; Bootloader_spi(3, special_erase_with_checksum, NULL); @@ -243,30 +212,13 @@ uint8_t boot_write_unprotect(void) { Bootloader_spi_single(0x5a); - Bootoader_send_command(0x73); + Bootloader_send_command(0x73); if(!boot_ack()) return 0; return boot_ack(); } -/* -uint8_t boot_write_protect(uint8_t number_of_sectors_minus_one, uint8_t *sector_codes) -{ - -} - -uint8_t boot_readout_protect(void) -{ - -} - -uint8_t boot_readout_unprotect(void) -{ - -} -*/ - -uint8_t boot_ack(void) +static uint8_t boot_ack(void) { uint8_t answer = 0; @@ -287,7 +239,7 @@ return 0; } -void Bootoader_send_command(uint8_t command) +static void Bootloader_send_command(uint8_t command) { uint8_t send[2]; uint8_t receive[2]; @@ -297,13 +249,13 @@ Bootloader_spi(2, send, receive); } -void Bootloader_spi_single(uint8_t TxByte) +static void Bootloader_spi_single(uint8_t TxByte) { Bootloader_spi(1,&TxByte, 0); } -void Bootloader_spi(uint16_t lengthData, uint8_t *aTxBuffer, uint8_t *aRxBuffer) +static void Bootloader_spi(uint16_t lengthData, uint8_t *aTxBuffer, uint8_t *aRxBuffer) { uint8_t dummy[256] = { 0 }; uint8_t *tx_data; @@ -334,10 +286,7 @@ } -void Bootloader_Error_Handler(void) +static void Bootloader_Error_Handler(void) { while(1); } - - - diff -r b70c26be71a0 -r 5ca177d2df5d Discovery/Src/logbook_miniLive.c --- a/Discovery/Src/logbook_miniLive.c Fri May 17 06:38:56 2019 +0000 +++ b/Discovery/Src/logbook_miniLive.c Fri May 17 21:19:04 2019 +0200 @@ -32,9 +32,9 @@ */ #define MLLsize (296) -uint16_t MLLdataDepth[MLLsize]; -uint16_t MLLpointer = 0; -uint8_t MLLtickIntervallSeconds = 2; +static uint16_t MLLdataDepth[MLLsize]; +static uint16_t MLLpointer = 0; +static uint8_t MLLtickIntervallSeconds = 2; uint16_t *getMiniLiveLogbookPointerToData(void) diff -r b70c26be71a0 -r 5ca177d2df5d Discovery/Src/ostc.c --- a/Discovery/Src/ostc.c Fri May 17 06:38:56 2019 +0000 +++ b/Discovery/Src/ostc.c Fri May 17 21:19:04 2019 +0200 @@ -40,7 +40,9 @@ UART_HandleTypeDef UartHandle; +#ifdef USART_PIEZO UART_HandleTypeDef UartPiezoTxHandle; +#endif UART_HandleTypeDef UartIR_HUD_Handle; __IO ITStatus UartReady = RESET; @@ -90,42 +92,6 @@ HAL_SPI_Init(&cpu2DmaSpi); } - -void MX_GPIO_Backlight_max_static_only_Init(void) -{ - GPIO_InitTypeDef GPIO_InitStruct; - TIM_BACKLIGHT_GPIO_ENABLE(); - - GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; - GPIO_InitStruct.Pull = GPIO_NOPULL;//GPIO_PULLUP; /* should be normally high */ - GPIO_InitStruct.Speed = GPIO_SPEED_LOW; - - GPIO_InitStruct.Pin = TIM_BACKLIGHT_PIN; - HAL_GPIO_Init(TIM_BACKLIGHT_GPIO_PORT, &GPIO_InitStruct); - - HAL_GPIO_WritePin(TIM_BACKLIGHT_GPIO_PORT,TIM_BACKLIGHT_PIN,GPIO_PIN_SET); -} - - -void MX_GPIO_One_Button_only_Init(void) -{ - GPIO_InitTypeDef GPIO_InitStruct; - BUTTON_NEXT_GPIO_ENABLE(); - - GPIO_InitStruct.Mode = GPIO_MODE_INPUT; - GPIO_InitStruct.Pull = GPIO_NOPULL;//GPIO_PULLUP; /* should be normally high */ - GPIO_InitStruct.Speed = GPIO_SPEED_LOW; - - GPIO_InitStruct.Pin = BUTTON_NEXT_PIN; - HAL_GPIO_Init(BUTTON_NEXT_GPIO_PORT, &GPIO_InitStruct); -} - - -GPIO_PinState MX_GPIO_Read_The_One_Button(void) -{ - return HAL_GPIO_ReadPin(BUTTON_NEXT_GPIO_PORT, BUTTON_NEXT_PIN); -} - void MX_GPIO_Init(void) { GPIO_InitTypeDef GPIO_InitStruct; @@ -263,26 +229,6 @@ #endif } - -void MX_SmallCPU_NO_Reset_Helper(void) -{ -#ifdef SMALLCPU_NRESET_PIN - GPIO_InitTypeDef GPIO_InitStruct; - - GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; - GPIO_InitStruct.Pull = GPIO_NOPULL; - GPIO_InitStruct.Speed = GPIO_SPEED_LOW; - - SMALLCPU_NRESET_GPIO_ENABLE(); - HAL_GPIO_Init(SMALLCPU_NRESET_GPIO_PORT, &GPIO_InitStruct); - HAL_GPIO_WritePin(SMALLCPU_NRESET_GPIO_PORT,SMALLCPU_NRESET_PIN,GPIO_PIN_SET); -// HAL_Delay(100); -// GPIO_InitStruct.Mode = GPIO_MODE_INPUT; -// HAL_GPIO_Init(SMALLCPU_NRESET_GPIO_PORT, &GPIO_InitStruct); -#endif -} - - void MX_SmallCPU_Reset_To_Standard(void) { #ifdef SMALLCPU_NRESET_PIN @@ -303,23 +249,6 @@ #endif } - -uint8_t MX_UART_ButtonAdjust(uint8_t *array) -{ -#ifdef USART_PIEZO - uint8_t answer[4]; - HAL_UART_Transmit(&UartPiezoTxHandle,array,4,1000); - HAL_UART_Receive(&UartPiezoTxHandle,answer,4,2000); - if( (answer[0] == array[0]) - &&(answer[1] == array[1]) - &&(answer[2] == array[2]) - &&(answer[3] == array[3])) - return 1; -#endif - return 0; -} - - void MX_UART_Init(void) { /*##-1- Configure the UART peripheral ######################################*/ @@ -375,8 +304,6 @@ UartReady = SET; } - - //void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) { diff -r b70c26be71a0 -r 5ca177d2df5d Discovery/Src/simulation.c --- a/Discovery/Src/simulation.c Fri May 17 06:38:56 2019 +0000 +++ b/Discovery/Src/simulation.c Fri May 17 21:19:04 2019 +0200 @@ -51,7 +51,7 @@ //Private functions -static float sim_get_ambiant_pressure(SDiveState * pDiveState); +static float sim_get_ambient_pressure(SDiveState * pDiveState); static void sim_reduce_deco_time_one_second(SDiveState* pDiveState); static void simulation_set_aim_depth(int depth_meter); @@ -157,7 +157,7 @@ pDiveState->lifeData.sensorVoltage_mV[2] = stateRealGetPointer()->lifeData.sensorVoltage_mV[2]; pDiveState->lifeData.dive_time_seconds += 1; - pDiveState->lifeData.pressure_ambient_bar = sim_get_ambiant_pressure(pDiveState); + pDiveState->lifeData.pressure_ambient_bar = sim_get_ambient_pressure(pDiveState); if(!is_ambient_pressure_close_to_surface(&pDiveState->lifeData) && !(stateSimGetPointer()->lifeData.counterSecondsShallowDepth) ) { @@ -303,14 +303,14 @@ /** ****************************************************************************** - * @brief simulates ambiant pressure depending on aim depth + * @brief simulates ambient pressure depending on aim depth ****************************************************************************** * @note if aim_depth != actual depth, the depth change within one second * (depending on descent or ascent) rate is calculated * @param SDiveState* pDiveState: - * @return float : new ambiant pressure + * @return float : new ambient pressure */ -static float sim_get_ambiant_pressure(SDiveState * pDiveState) +static float sim_get_ambient_pressure(SDiveState * pDiveState) { //Calc next depth uint8_t actual_deco_stop = decom_get_actual_deco_stop(pDiveState); @@ -351,7 +351,7 @@ * @param SDiveState* pDiveState: * @return void */ -void sim_reduce_deco_time_one_second(SDiveState* pDiveState) +static void sim_reduce_deco_time_one_second(SDiveState* pDiveState) { SDecoinfo* pDecoinfo; if(pDiveState->diveSettings.deco_type.ub.standard == GF_MODE)