如何在 C 文件中使用 esp8266 的引出线?

How to use pinout with esp8266 from C file?

我有一个我要解决的任务的非常基本的例子。在 arduino.ino 的主循环中,我使用 sample.h 中的定义调​​用 device.c 中的 sample_run() 函数。从这里开始,我试图了解如何使用 device.c 中的 GPIO 引脚。这可以使用 arduino ide 来完成吗?我附上了一些我正在尝试做的示例代码。

arduino.ino

#include "sample.h"
#include "esp8266/sample_init.h"

void setup() {
}

void loop() {
  sample_run();
}

sample.h

#ifndef SAMPLE_H
#define SAMPLE_H

#ifdef __cplusplus
extern "C" {
#endif

    void sample_run(void);

#ifdef __cplusplus
}
#endif

#endif /* SAMPLE_H */

device.c

#include "sample.h"
void sample_run(void)
{
    //I would like to turn on/off led here
}

在device.c中:#include "Arduino.h"

为什么使用 .c 文件而不是 .cpp?