Compare commits
8 Commits
ba8072c21d
...
v0.3
Author | SHA1 | Date | |
---|---|---|---|
00b8d1f48e | |||
8ac1d52240 | |||
3e82cf69b4 | |||
62b256fd18 | |||
74111826a0 | |||
69d7724c8f | |||
48f69d0fb5 | |||
8fd924829e |
@@ -37,10 +37,11 @@
|
||||
* If the pointer is invalid, the function using this macro will return with
|
||||
* CONFIG_PARSER_PARAM_ERR
|
||||
*/
|
||||
#define config_parser_check_handle(handle) do { if (!(handle) || \
|
||||
((struct config_parser *)(handle))->magic != CONFIG_PARSER_MAGIC) \
|
||||
return CONFIG_PARSER_PARAM_ERR; \
|
||||
} while (0)
|
||||
#define config_parser_check_handle(handle) do { \
|
||||
if (!(handle) || \
|
||||
((struct config_parser *)(handle))->magic != CONFIG_PARSER_MAGIC) \
|
||||
return CONFIG_PARSER_PARAM_ERR; \
|
||||
} while (0)
|
||||
|
||||
config_parser_handle_t config_parser_open_file(struct config_parser *config_parser, bool write, const char *file_name,
|
||||
char *working_buffer, size_t buff_size)
|
||||
@@ -92,17 +93,17 @@ static int parse_value(struct config_parser_entry *entry, char *value_start_toke
|
||||
if (value_start_token[0] != '-') {
|
||||
/* Try parsing as ul */
|
||||
entry->value.uint_val = strtoul(value_start_token, &endptr, 0);
|
||||
if (endptr == value_start_token) {
|
||||
if (endptr == value_start_token)
|
||||
return -1;
|
||||
}
|
||||
|
||||
entry->type = CONFIG_PARSER_TYPE_UINT;
|
||||
goto exit;
|
||||
} else {
|
||||
/* Try parsing as int */
|
||||
entry->value.int_val = strtod(value_start_token, &endptr);
|
||||
if (endptr == value_start_token) {
|
||||
if (endptr == value_start_token)
|
||||
return -1;
|
||||
}
|
||||
|
||||
entry->type = CONFIG_PARSER_TYPE_INT;
|
||||
}
|
||||
|
||||
@@ -110,14 +111,16 @@ exit:
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum config_parser_ret config_parser_get_line(config_parser_handle_t handle, struct config_parser_entry *entry, bool force_float)
|
||||
enum config_parser_ret config_parser_get_line(config_parser_handle_t handle, struct config_parser_entry *entry,
|
||||
bool force_float)
|
||||
{
|
||||
struct config_parser *p;
|
||||
config_parser_check_handle(handle);
|
||||
p = CONFIG_PARSER(handle);
|
||||
char *token;
|
||||
int token_round = 0;
|
||||
|
||||
config_parser_check_handle(handle);
|
||||
p = CONFIG_PARSER(handle);
|
||||
|
||||
if (!entry)
|
||||
return CONFIG_PARSER_PARAM_ERR;
|
||||
|
||||
@@ -131,8 +134,7 @@ enum config_parser_ret config_parser_get_line(config_parser_handle_t handle, str
|
||||
if (token[0] == '#') {
|
||||
if (token_round == 0)
|
||||
return CONFIG_PARSER_LINE_COMMENT;
|
||||
else
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (token_round) {
|
||||
@@ -140,9 +142,8 @@ enum config_parser_ret config_parser_get_line(config_parser_handle_t handle, str
|
||||
entry->name = token;
|
||||
break;
|
||||
case 1: /* = Symbol */
|
||||
if (strcmp(token, "=")) {
|
||||
if (strcmp(token, "="))
|
||||
return CONFIG_PARSER_LINE_MALFORM;
|
||||
}
|
||||
break;
|
||||
case 2: /* VALUE */
|
||||
if (parse_value(entry, token))
|
||||
@@ -172,6 +173,7 @@ enum config_parser_ret config_parser_reset_to_start(config_parser_handle_t handl
|
||||
{
|
||||
FRESULT res;
|
||||
struct config_parser *p;
|
||||
|
||||
config_parser_check_handle(handle);
|
||||
p = CONFIG_PARSER(handle);
|
||||
|
||||
@@ -194,6 +196,7 @@ enum config_parser_ret config_parser_close_file(config_parser_handle_t handle)
|
||||
{
|
||||
struct config_parser *p;
|
||||
FRESULT res;
|
||||
|
||||
config_parser_check_handle(handle);
|
||||
p = CONFIG_PARSER(handle);
|
||||
|
||||
|
@@ -28,12 +28,12 @@
|
||||
* @brief Initialize the SPI for the eeprom.
|
||||
* @return 0 if succesful
|
||||
*/
|
||||
int spi_eeprom_init();
|
||||
int spi_eeprom_init(void);
|
||||
|
||||
/**
|
||||
* @brief Uninitialize the SPI EEPROM
|
||||
*/
|
||||
void spi_eeprom_deinit();
|
||||
void spi_eeprom_deinit(void);
|
||||
|
||||
/**
|
||||
* @brief Read from SPI EEPROM
|
||||
|
@@ -1,22 +1,22 @@
|
||||
/* Reflow Oven Controller
|
||||
*
|
||||
* Copyright (C) 2020 Mario Hüttel <mario.huettel@gmx.net>
|
||||
*
|
||||
* This file is part of the Reflow Oven Controller Project.
|
||||
*
|
||||
* The reflow oven controller is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with the reflow oven controller project.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
*
|
||||
* Copyright (C) 2020 Mario Hüttel <mario.huettel@gmx.net>
|
||||
*
|
||||
* This file is part of the Reflow Oven Controller Project.
|
||||
*
|
||||
* The reflow oven controller is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with the reflow oven controller project.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <reflow-controller/safety/stack-check.h>
|
||||
#include <stdint.h>
|
||||
@@ -26,7 +26,7 @@
|
||||
extern char __ld_top_of_stack;
|
||||
extern char __ld_end_stack;
|
||||
|
||||
int32_t stack_check_get_usage()
|
||||
int32_t stack_check_get_usage(void)
|
||||
{
|
||||
uint32_t stack_top;
|
||||
uint32_t stack_ptr;
|
||||
@@ -37,7 +37,7 @@ int32_t stack_check_get_usage()
|
||||
return stack_top - stack_ptr;
|
||||
}
|
||||
|
||||
int32_t stack_check_get_free()
|
||||
int32_t stack_check_get_free(void)
|
||||
{
|
||||
uint32_t upper_heap_boundary;
|
||||
uint32_t stack_ptr;
|
||||
@@ -102,9 +102,6 @@ int stack_check_corruption_detect_area(void)
|
||||
&__ld_start_stack_corruption_detect_area;
|
||||
crc_unit_reset();
|
||||
crc_unit_input_array(&__ld_start_stack_corruption_detect_area, area_size_in_words);
|
||||
if (crc_unit_get_crc() == 0UL) {
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return crc_unit_get_crc() == 0UL ? 0 : -1;
|
||||
}
|
||||
|
@@ -1,22 +1,22 @@
|
||||
/* Reflow Oven Controller
|
||||
*
|
||||
* Copyright (C) 2020 Mario Hüttel <mario.huettel@gmx.net>
|
||||
*
|
||||
* This file is part of the Reflow Oven Controller Project.
|
||||
*
|
||||
* The reflow oven controller is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with the reflow oven controller project.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
*
|
||||
* Copyright (C) 2020 Mario Hüttel <mario.huettel@gmx.net>
|
||||
*
|
||||
* This file is part of the Reflow Oven Controller Project.
|
||||
*
|
||||
* The reflow oven controller is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with the reflow oven controller project.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup watchdog
|
||||
@@ -50,7 +50,8 @@ int watchdog_setup(uint8_t prescaler)
|
||||
RCC->CSR |= RCC_CSR_LSION;
|
||||
__DSB();
|
||||
/** - Wait for the oscillator to be ready */
|
||||
while (!(RCC->CSR & RCC_CSR_LSIRDY));
|
||||
while (!(RCC->CSR & RCC_CSR_LSIRDY))
|
||||
;
|
||||
|
||||
if (prescaler == 4U)
|
||||
prescaler_reg_val = 0UL;
|
||||
@@ -68,23 +69,24 @@ int watchdog_setup(uint8_t prescaler)
|
||||
prescaler_reg_val = 6UL;
|
||||
|
||||
/** - (De)activate the watchdog during debug access according to @ref WATCHDOG_HALT_DEBUG */
|
||||
if (WATCHDOG_HALT_DEBUG) {
|
||||
if (WATCHDOG_HALT_DEBUG)
|
||||
DBGMCU->APB1FZ |= DBGMCU_APB1_FZ_DBG_IWDG_STOP;
|
||||
} else {
|
||||
else
|
||||
DBGMCU->APB1FZ &= ~DBGMCU_APB1_FZ_DBG_IWDG_STOP;
|
||||
}
|
||||
|
||||
/** - Unlock registers */
|
||||
IWDG->KR = STM32_WATCHDOG_REGISTER_ACCESS_KEY;
|
||||
|
||||
/** - Wait until prescaler can be written */
|
||||
while (IWDG->SR & IWDG_SR_PVU);
|
||||
while (IWDG->SR & IWDG_SR_PVU)
|
||||
;
|
||||
|
||||
/** - Write prescaler value */
|
||||
IWDG->PR = prescaler_reg_val;
|
||||
|
||||
/* - Wait until reload value can be written */
|
||||
while (IWDG->SR & IWDG_SR_RVU);
|
||||
while (IWDG->SR & IWDG_SR_RVU)
|
||||
;
|
||||
|
||||
/** - Set reload value fixed to 0xFFF */
|
||||
IWDG->RLR = 0xFFFU;
|
||||
|
@@ -1,22 +1,22 @@
|
||||
/* Reflow Oven Controller
|
||||
*
|
||||
* Copyright (C) 2020 Mario Hüttel <mario.huettel@gmx.net>
|
||||
*
|
||||
* This file is part of the Reflow Oven Controller Project.
|
||||
*
|
||||
* The reflow oven controller is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with the reflow oven controller project.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
*
|
||||
* Copyright (C) 2020 Mario Hüttel <mario.huettel@gmx.net>
|
||||
*
|
||||
* This file is part of the Reflow Oven Controller Project.
|
||||
*
|
||||
* The reflow oven controller is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with the reflow oven controller project.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <reflow-controller/settings/settings-eeprom.h>
|
||||
#include <reflow-controller/settings/spi-eeprom.h>
|
||||
@@ -37,6 +37,7 @@ struct eeprom_calibration_settings {
|
||||
};
|
||||
|
||||
#define EEPROM_OVER_TEMP_CONFIG_BASE_ADDR (EEPROM_CALIBRATION_BASE_ADDR + sizeof(struct eeprom_calibration_settings))
|
||||
|
||||
struct eeprom_over_temp_config {
|
||||
float over_temperature;
|
||||
uint32_t over_temp_crc;
|
||||
@@ -54,7 +55,7 @@ static bool check_eeprom_header(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
static void settings_eeprom_zero()
|
||||
static void settings_eeprom_zero(void)
|
||||
{
|
||||
settings_eeprom_save_calibration(0.0f, 0.0f, false);
|
||||
settings_eeprom_save_overtemp_limit(0.0f, false);
|
||||
@@ -62,7 +63,7 @@ static void settings_eeprom_zero()
|
||||
|
||||
bool settings_eeprom_detect_and_prepare(void)
|
||||
{
|
||||
bool eeprom_ready = false;;
|
||||
bool eeprom_ready = false;
|
||||
|
||||
int res;
|
||||
|
||||
@@ -77,7 +78,10 @@ bool settings_eeprom_detect_and_prepare(void)
|
||||
if (check_eeprom_header() == false) {
|
||||
/* Try to write a new header and check it again */
|
||||
spi_eeprom_write(0, expected_header, sizeof(expected_header));
|
||||
while (spi_eeprom_write_in_progress());
|
||||
|
||||
while (spi_eeprom_write_in_progress())
|
||||
;
|
||||
|
||||
if (check_eeprom_header() == false) {
|
||||
goto ret_deinit_crc;
|
||||
} else {
|
||||
|
@@ -1,22 +1,22 @@
|
||||
/* Reflow Oven Controller
|
||||
*
|
||||
* Copyright (C) 2020 Mario Hüttel <mario.huettel@gmx.net>
|
||||
*
|
||||
* This file is part of the Reflow Oven Controller Project.
|
||||
*
|
||||
* The reflow oven controller is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with the reflow oven controller project.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
*
|
||||
* Copyright (C) 2020 Mario Hüttel <mario.huettel@gmx.net>
|
||||
*
|
||||
* This file is part of the Reflow Oven Controller Project.
|
||||
*
|
||||
* The reflow oven controller is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with the reflow oven controller project.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <reflow-controller/settings/settings-sd-card.h>
|
||||
#include <stm-periph/unique-id.h>
|
||||
@@ -72,18 +72,12 @@ static int create_controller_folder(void)
|
||||
ret = 0;
|
||||
} else {
|
||||
filesystem_result = f_mkdir(foldername);
|
||||
if (filesystem_result == FR_OK) {
|
||||
ret = 1;
|
||||
} else {
|
||||
ret = -1;
|
||||
}
|
||||
ret = filesystem_result == FR_OK ? 1 : -1;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int sd_card_settings_save_calibration(float sens_deviation, float offset, bool active)
|
||||
{
|
||||
char path[200];
|
||||
|
@@ -1,22 +1,22 @@
|
||||
/* Reflow Oven Controller
|
||||
*
|
||||
* Copyright (C) 2020 Mario Hüttel <mario.huettel@gmx.net>
|
||||
*
|
||||
* This file is part of the Reflow Oven Controller Project.
|
||||
*
|
||||
* The reflow oven controller is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with the reflow oven controller project.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
*
|
||||
* Copyright (C) 2020 Mario Hüttel <mario.huettel@gmx.net>
|
||||
*
|
||||
* This file is part of the Reflow Oven Controller Project.
|
||||
*
|
||||
* The reflow oven controller is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with the reflow oven controller project.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <reflow-controller/settings/settings.h>
|
||||
#include <reflow-controller/settings/settings-sd-card.h>
|
||||
@@ -39,7 +39,7 @@ int settings_load_calibration(float *sens_dev, float *offset)
|
||||
int res;
|
||||
|
||||
if (settings_use_eeprom) {
|
||||
res =settings_eeprom_load_calibration(sens_dev, offset, &active);
|
||||
res = settings_eeprom_load_calibration(sens_dev, offset, &active);
|
||||
if (!res && !active)
|
||||
res = -1;
|
||||
} else {
|
||||
|
@@ -1,22 +1,22 @@
|
||||
/* Reflow Oven Controller
|
||||
*
|
||||
* Copyright (C) 2021 Mario Hüttel <mario.huettel@gmx.net>
|
||||
*
|
||||
* This file is part of the Reflow Oven Controller Project.
|
||||
*
|
||||
* The reflow oven controller is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with the reflow oven controller project.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
*
|
||||
* Copyright (C) 2021 Mario Hüttel <mario.huettel@gmx.net>
|
||||
*
|
||||
* This file is part of the Reflow Oven Controller Project.
|
||||
*
|
||||
* The reflow oven controller is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with the reflow oven controller project.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <reflow-controller/settings/spi-eeprom.h>
|
||||
#include <stm-periph/spi.h>
|
||||
@@ -52,7 +52,7 @@ static void eeprom_cs_deactivate(void)
|
||||
SPI_EEPROM_SPI_PORT->ODR |= (1<<SPI_EEPROM_CS_PIN);
|
||||
}
|
||||
|
||||
int spi_eeprom_init()
|
||||
int spi_eeprom_init(void)
|
||||
{
|
||||
static struct stm_spi_dev spi_dev;
|
||||
struct stm_spi_settings settings;
|
||||
@@ -61,7 +61,8 @@ int spi_eeprom_init()
|
||||
|
||||
SPI_EEPROM_SPI_PORT->MODER &= MODER_DELETE(SPI_EEPROM_CS_PIN) & MODER_DELETE(SPI_EEPROM_MISO_PIN) &
|
||||
MODER_DELETE(SPI_EEPROM_MOSI_PIN) & MODER_DELETE(SPI_EEPROM_SCK_PIN);
|
||||
SPI_EEPROM_SPI_PORT->MODER |= ALTFUNC(SPI_EEPROM_MISO_PIN) | ALTFUNC(SPI_EEPROM_SCK_PIN) | ALTFUNC(SPI_EEPROM_MOSI_PIN);
|
||||
SPI_EEPROM_SPI_PORT->MODER |= ALTFUNC(SPI_EEPROM_MISO_PIN) | ALTFUNC(SPI_EEPROM_SCK_PIN) |
|
||||
ALTFUNC(SPI_EEPROM_MOSI_PIN);
|
||||
SPI_EEPROM_SPI_PORT->MODER |= OUTPUT(SPI_EEPROM_CS_PIN);
|
||||
|
||||
SETAF(SPI_EEPROM_SPI_PORT, SPI_EEPROM_MISO_PIN, SPI_EEPROM_SPI_ALTFUNC_NO);
|
||||
@@ -85,7 +86,7 @@ int spi_eeprom_init()
|
||||
return -1;
|
||||
}
|
||||
|
||||
void spi_eeprom_deinit()
|
||||
void spi_eeprom_deinit(void)
|
||||
{
|
||||
spi_deinit(eeprom_spi_handle);
|
||||
|
||||
@@ -166,7 +167,8 @@ static void spi_eeprom_do_write_page(uint32_t addr, const uint8_t *data, uint8_t
|
||||
uint8_t cmd[2];
|
||||
|
||||
/* Wait for the previous write to finish */
|
||||
while (spi_eeprom_write_in_progress());
|
||||
while (spi_eeprom_write_in_progress())
|
||||
;
|
||||
/* Set the write enable latch */
|
||||
spi_eeprom_set_write_enable_latch(true);
|
||||
|
||||
|
Reference in New Issue
Block a user