c - stm32函数在 "Standard Library"

标签 c stm32 standard-library

我有这个功能,这是“HAL”库:

void ENC28_writeBuf(uint16_t len, uint8_t* data)
{
    uint8_t spiData[2];
    HAL_GPIO_WritePin(GPIOD, GPIO_PIN_7, GPIO_PIN_RESET);
    spiData[0] = ENC28_WRITE_BUF_MEM;
    HAL_SPI_Transmit(&hspi1, spiData, 1, 100);
    HAL_SPI_Transmit(&hspi1, data, len, 100);
    HAL_GPIO_WritePin(GPIOD, GPIO_PIN_7, GPIO_PIN_SET);
}

但我想用 Standart Perhibral Library 为 stm32 编写。我如何在 STD 中编写此函数?

最佳答案

首先需要在std库中编写SPI、GPIO、Clock的初始化函数。那样的话,我们就无法知道你用的是哪个SPI1引脚,你用的是哪个stm32处理器?

你需要提供详细的pin number信息,stm32 processor number。回答就够了。

关于c - stm32函数在 "Standard Library",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53407043/

相关文章:

microcontroller - STM32L151 RTC闹钟中断

c++ - 将 std::map 与 std::list::iterator 一起使用

c++ - "STL allocate memory internally"是什么意思?

rust - 为什么 Read::read_to_string() 不返回字符串?

c - Waitpid 被系统调用中断

c - 如何修复---->警告: extra tokens at end of#include directive

c - C shell 中的输出重定向

c - 从 C 中的结构数组中检索结构以进行 qsort

linux - Minicom 没有启动

c++ - gcc 如何决定隐式包含哪些库?