yezhonghui2024 commented on PR #17487:
URL: https://github.com/apache/nuttx/pull/17487#issuecomment-3668046678
> > I used framework charged, the code cannot be simply converted into a
sample
>
> Okay, I understand. However, more information than what's provided is
needed for the testing section.
we can test like this:
int main(int argc, char** argv)
{
int ret;
int fd;
int temp, cap, current, vol;
int fd = open("/dev/charge/fakegauge", O_RDRW);
if (fd < 0) {
return -EINVAL;
}
ret = ioctl(fd, BATIOC_TEMPERATURE, (unsigned long)((uintptr_t)(&temp)));
if (ret < 0) {
printf("can not get battery temperature\n");
}
ret = ioctl(fd, BATIOC_CAPACITY, (unsigned long)((uintptr_t)(&cap)));
if (ret < 0) {
printf("can not get battery capacity\n");
}
ret = ioctl(fd, BATIOC_CURRENT, (unsigned long)((uintptr_t)(¤t)));
if (ret < 0) {
printf("can not get battery current\n");
}
ret = ioctl(fd, BATIOC_VOLTAGE, (unsigned long)((uintptr_t)(&vol)));
if (ret < 0) {
printf("can not get battery voltage\n");
}
return ret;
}
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]