Fix style issues in spi-eeprom.c/h

This commit is contained in:
Mario Hüttel 2022-07-16 15:09:41 +02:00
parent 3e82cf69b4
commit 8ac1d52240
2 changed files with 26 additions and 24 deletions

View File

@ -28,12 +28,12 @@
* @brief Initialize the SPI for the eeprom. * @brief Initialize the SPI for the eeprom.
* @return 0 if succesful * @return 0 if succesful
*/ */
int spi_eeprom_init(); int spi_eeprom_init(void);
/** /**
* @brief Uninitialize the SPI EEPROM * @brief Uninitialize the SPI EEPROM
*/ */
void spi_eeprom_deinit(); void spi_eeprom_deinit(void);
/** /**
* @brief Read from SPI EEPROM * @brief Read from SPI EEPROM

View File

@ -1,22 +1,22 @@
/* Reflow Oven Controller /* Reflow Oven Controller
* *
* Copyright (C) 2021 Mario Hüttel <mario.huettel@gmx.net> * Copyright (C) 2021 Mario Hüttel <mario.huettel@gmx.net>
* *
* This file is part of the Reflow Oven Controller Project. * This file is part of the Reflow Oven Controller Project.
* *
* The reflow oven controller is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
* *
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful, * 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 * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with the reflow oven controller project. * along with the reflow oven controller project.
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <reflow-controller/settings/spi-eeprom.h> #include <reflow-controller/settings/spi-eeprom.h>
#include <stm-periph/spi.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); 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; static struct stm_spi_dev spi_dev;
struct stm_spi_settings settings; 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) & 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); 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); SPI_EEPROM_SPI_PORT->MODER |= OUTPUT(SPI_EEPROM_CS_PIN);
SETAF(SPI_EEPROM_SPI_PORT, SPI_EEPROM_MISO_PIN, SPI_EEPROM_SPI_ALTFUNC_NO); SETAF(SPI_EEPROM_SPI_PORT, SPI_EEPROM_MISO_PIN, SPI_EEPROM_SPI_ALTFUNC_NO);
@ -85,7 +86,7 @@ int spi_eeprom_init()
return -1; return -1;
} }
void spi_eeprom_deinit() void spi_eeprom_deinit(void)
{ {
spi_deinit(eeprom_spi_handle); 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]; uint8_t cmd[2];
/* Wait for the previous write to finish */ /* Wait for the previous write to finish */
while (spi_eeprom_write_in_progress()); while (spi_eeprom_write_in_progress())
;
/* Set the write enable latch */ /* Set the write enable latch */
spi_eeprom_set_write_enable_latch(true); spi_eeprom_set_write_enable_latch(true);