初始提交:龙芯2K0300智能车卖家Demo完整代码

This commit is contained in:
spdis
2026-05-28 15:24:33 +08:00
commit b6b631cef3
80 changed files with 7153 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
/*
* @Author: ilikara 3435193369@qq.com
* @Date: 2024-10-10 15:02:00
* @LastEditors: ilikara 3435193369@qq.com
* @LastEditTime: 2024-12-01 03:49:47
* @FilePath: /smartcar/lib/GPIO.h
* @Description:
*
* Copyright (c) 2024 by ilikara 3435193369@qq.com, All Rights Reserved.
*/
#ifndef GPIO_H
#define GPIO_H
#include <string>
#include <fcntl.h>
#include <unistd.h>
#include <stdexcept>
#include <iostream>
#include <fstream>
#include <sstream>
#include <cstring>
class GPIO
{
public:
GPIO(int gpioNum);
~GPIO();
bool setDirection(const std::string &direction);
bool setEdge(const std::string &edge);
bool setValue(bool value); // 设置 GPIO 输出值
bool readValue(); // 读取 GPIO 输入值
int getFileDescriptor() const; // 获取 GPIO 文件描述符
private:
int gpioNum;
int fd; // 文件描述符
std::string gpioPath;
bool writeToFile(const std::string &path, const std::string &value);
};
#endif // GPIO_H