6#include "dawn/porting/pot.hxx"
10#include <nuttx/analog/pot.h>
14#include "dawn/debug.hxx"
15#include "dawn/porting/config.hxx"
25int pot_open(
const char *path)
29 fd = open(path, O_RDWR | O_NONBLOCK);
30 DAWNINFO(
"POT: open %s %d\n", path, fd);
33 DAWNERR(
"Failed to open POT file %s (error %d)\n", path, fd);
55int pot_get_nwipers(
int fd, uint8_t *nwipers)
57 struct pot_info_s info;
60 ret = ioctl(fd, POTIOC_GET_INFO,
reinterpret_cast<unsigned long>(&info));
66 *nwipers = info.nwipers;
76 struct pot_wiper_s wiper;
79 wiper.wiper = pot->wiper;
82 ret = ioctl(fd, POTIOC_SET_WIPER,
reinterpret_cast<unsigned long>(&wiper));
97 struct pot_wiper_s wiper;
100 wiper.wiper = pot->wiper;
103 ret = ioctl(fd, POTIOC_GET_WIPER,
reinterpret_cast<unsigned long>(&wiper));
109 pot->val = wiper.val;