kolontsov / richcomm-ups-mchck

Simple USB UPS interface using MC HCK

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simple USB UPS interface using MC HCK

DESCRIPTION

I needed to build USB device that is recognizable as UPS by Network UPS Tools (NUT).

It seems that one of the simplest USB drivers in NUT is drivers/richcomm_usb.c.

This code implements richcomm_usb.c protocol using MC HCK prototype board based on Freescale Kinetis K20 MCU (ARM Cortex-M4). I just had spare kit and wanted to try the SDK, so the code has a lot of comments.

REQUIREMENTS

BUILD AND INSTALL

  • Clone this repository to examples/ subdirectory of MC HCK toolchain.
  • cd richcomm-ups-mchck; make
  • Plug MC HCK into USB port; type make flash, press push button on the board, wait ~1 sec and press Enter.
  • lsusb -v now shows MC HCK as "Richcomm UPS emulator".

DEMO

See rcm_handle_data() function that imitates power failure and battery discharge.

You can check your current UPS status with upsc (look for ups.status).

UNLICENSE

This source code is in public domain. For more information, please refer to http://unlicense.org/

About

Simple USB UPS interface using MC HCK


Languages

Language:C 100.0%