Skip to content

Commit

Permalink
firmware: tests: mockups: drivers: Initial structure of the SPI wrap …
Browse files Browse the repository at this point in the history
…functions #69
  • Loading branch information
mgm8 committed Feb 13, 2024
1 parent 2af67c5 commit 3adc3d5
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 0 deletions.
63 changes: 63 additions & 0 deletions firmware/tests/mockups/drivers/spi_wrap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* spi_wrap.c
*
* Copyright The SLCam Contributors.
*
* This file is part of SLCam.
*
* SLCam is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* SLCam 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 SLCam. If not, see <http:/\/www.gnu.org/licenses/>.
*
*/

/**
* \brief SPI driver wrap implementation.
*
* \author Gabriel Mariano Marcelino <[email protected]>
*
* \version 0.2.10
*
* \date 2024/02/13
*
* \addtogroup spi_wrap
* \{
*/

#include "spi.h"

int __wrap_spi_select_slave(spi_port_t port, spi_cs_t cs, bool active)
{
return -1;
}

int __wrap_spi_init(spi_port_t port, spi_config_t config)
{
return -1;
}

int __wrap_spi_write(spi_port_t port, spi_cs_t cs, uint8_t *data, uint16_t len)
{
return -1;
}

int __wrap_spi_read(spi_port_t port, spi_cs_t cs, uint8_t *data, uint16_t len)
{
return -1;
}

int __wrap_spi_transfer(spi_port_t port, spi_cs_t cs, uint8_t *wd, uint8_t *rd, uint16_t len)
{
return -1;
}

/** \} End of spi_wrap group */
57 changes: 57 additions & 0 deletions firmware/tests/mockups/drivers/spi_wrap.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* spi_wrap.h
*
* Copyright The SLCam Contributors.
*
* This file is part of SLCam.
*
* SLCam is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* SLCam 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 SLCam. If not, see <http://www.gnu.org/licenses/>.
*
*/

/**
* \brief SPI driver wrap definition.
*
* \author Gabriel Mariano Marcelino <[email protected]>
*
* \version 0.2.10
*
* \date 2024/02/13
*
* \defgroup spi_wrap SPI Wrap
* \ingroup tests
* \{
*/

#ifndef SPI_WRAP_H_
#define SPI_WRAP_H_

#include <stdint.h>
#include <stdbool.h>

#include <drivers/spi/spi.h>

int __wrap_spi_init(spi_port_t port, spi_config_t config);

int __wrap_spi_select_slave(spi_port_t port, spi_cs_t cs, bool active);

int __wrap_spi_write(spi_port_t port, spi_cs_t cs, uint8_t *data, uint16_t len);

int __wrap_spi_read(spi_port_t port, spi_cs_t cs, uint8_t *data, uint16_t len);

int __wrap_spi_transfer(spi_port_t port, spi_cs_t cs, uint8_t *wd, uint8_t *rd, uint16_t len);

#endif /* SPI_WRAP_H_ */

/** \} End of spi_wrap group */

0 comments on commit 3adc3d5

Please sign in to comment.