mirror of
https://github.com/hybridgroup/gobot.git
synced 2025-04-26 13:48:49 +08:00
Adding godocs documentation to digispark package
This commit is contained in:
parent
bf7bc97c3a
commit
04eb685a6c
@ -13,6 +13,7 @@ type DigisparkAdaptor struct {
|
||||
connect func(*DigisparkAdaptor)
|
||||
}
|
||||
|
||||
// NewDigisparkAdaptor create a Digispark adaptor with specified name
|
||||
func NewDigisparkAdaptor(name string) *DigisparkAdaptor {
|
||||
return &DigisparkAdaptor{
|
||||
Adaptor: *gobot.NewAdaptor(
|
||||
@ -25,26 +26,36 @@ func NewDigisparkAdaptor(name string) *DigisparkAdaptor {
|
||||
}
|
||||
}
|
||||
|
||||
// Connect starts connection to digispark, returns true if successful
|
||||
func (d *DigisparkAdaptor) Connect() bool {
|
||||
d.connect(d)
|
||||
d.SetConnected(true)
|
||||
return true
|
||||
}
|
||||
|
||||
// Reconnect retries connection to digispark, returns true if successful
|
||||
func (d *DigisparkAdaptor) Reconnect() bool {
|
||||
return d.Connect()
|
||||
}
|
||||
|
||||
func (d *DigisparkAdaptor) Finalize() bool { return true }
|
||||
// Finalize returns true if finalization is successful
|
||||
func (d *DigisparkAdaptor) Finalize() bool { return true }
|
||||
|
||||
// Disconnect returns true if connection to digispark is ended successfully
|
||||
func (d *DigisparkAdaptor) Disconnect() bool { return true }
|
||||
|
||||
// DigitalWrite writes level to specified pin using littlewire
|
||||
func (d *DigisparkAdaptor) DigitalWrite(pin string, level byte) {
|
||||
p, _ := strconv.Atoi(pin)
|
||||
|
||||
d.littleWire.PinMode(uint8(p), 0)
|
||||
d.littleWire.DigitalWrite(uint8(p), level)
|
||||
}
|
||||
|
||||
// DigitalRead (not yet implemented)
|
||||
func (d *DigisparkAdaptor) DigitalRead(pin string, level byte) {}
|
||||
|
||||
// PwmWrite updates pwm pin with sent value
|
||||
func (d *DigisparkAdaptor) PwmWrite(pin string, value byte) {
|
||||
if d.pwm == false {
|
||||
d.littleWire.PwmInit()
|
||||
@ -53,9 +64,14 @@ func (d *DigisparkAdaptor) PwmWrite(pin string, value byte) {
|
||||
}
|
||||
d.littleWire.PwmUpdateCompare(value, value)
|
||||
}
|
||||
|
||||
// AnalogRead (not yet implemented)
|
||||
func (d *DigisparkAdaptor) AnalogRead(string) int { return -1 }
|
||||
|
||||
// InitServo (not yet implemented)
|
||||
func (d *DigisparkAdaptor) InitServo() {}
|
||||
|
||||
// ServoWrite updates servo location with specified angle
|
||||
func (d *DigisparkAdaptor) ServoWrite(pin string, angle uint8) {
|
||||
if d.servo == false {
|
||||
d.littleWire.ServoInit()
|
||||
@ -64,6 +80,11 @@ func (d *DigisparkAdaptor) ServoWrite(pin string, angle uint8) {
|
||||
d.littleWire.ServoUpdateLocation(angle, angle)
|
||||
}
|
||||
|
||||
func (d *DigisparkAdaptor) I2cStart(byte) {}
|
||||
// I2cStart (not yet implemented)
|
||||
func (d *DigisparkAdaptor) I2cStart(byte) {}
|
||||
|
||||
// I2cRead (not yet implemented)
|
||||
func (d *DigisparkAdaptor) I2cRead(uint16) []uint16 { return make([]uint16, 0) }
|
||||
func (d *DigisparkAdaptor) I2cWrite([]uint16) {}
|
||||
|
||||
// I2cWrite (not yet implemented)
|
||||
func (d *DigisparkAdaptor) I2cWrite([]uint16) {}
|
||||
|
49
platforms/digispark/doc.go
Normal file
49
platforms/digispark/doc.go
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
This package provides the Gobot adaptor for the [Digispark](http://digistump.com/products/1) ATTiny-based USB development board with the [Little Wire](http://littlewire.cc/) protocol firmware installed.
|
||||
|
||||
Installing:
|
||||
|
||||
This package requires installing `libusb`.
|
||||
Then you can install the package with:
|
||||
|
||||
go get github.com/hybridgroup/gobot && go install github.com/hybridgroup/gobot/platforms/digispark
|
||||
|
||||
Example:
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/hybridgroup/gobot"
|
||||
"github.com/hybridgroup/gobot/platforms/digispark"
|
||||
"github.com/hybridgroup/gobot/platforms/gpio"
|
||||
)
|
||||
|
||||
func main() {
|
||||
gbot := gobot.NewGobot()
|
||||
|
||||
digisparkAdaptor := digispark.NewDigisparkAdaptor("Digispark")
|
||||
led := gpio.NewLedDriver(digisparkAdaptor, "led", "0")
|
||||
|
||||
work := func() {
|
||||
gobot.Every(1*time.Second, func() {
|
||||
led.Toggle()
|
||||
})
|
||||
}
|
||||
|
||||
robot := gobot.NewRobot("blinkBot",
|
||||
[]gobot.Connection{digisparkAdaptor},
|
||||
[]gobot.Device{led},
|
||||
work,
|
||||
)
|
||||
|
||||
gbot.AddRobot(robot)
|
||||
|
||||
gbot.Start()
|
||||
}
|
||||
|
||||
For further information refer to digispark README:
|
||||
https://github.com/hybridgroup/gobot/blob/master/platforms/digispark/README.md
|
||||
*/
|
||||
package digispark
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
Cross platform computer interface library for Little Wire project
|
||||
|
||||
|
||||
http://littlewire.cc
|
||||
|
||||
Copyright (C) <2013> ihsan Kehribar <ihsan@kehribar.me>
|
||||
@ -26,7 +26,7 @@
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* See the littleWire.h for the function descriptions/comments
|
||||
* See the littleWire.h for the function descriptions/comments
|
||||
/*****************************************************************************/
|
||||
#include "littleWire.h"
|
||||
|
||||
@ -87,10 +87,10 @@ int littlewire_search()
|
||||
|
||||
if((dev->descriptor.idVendor == VENDOR_ID) && (dev->descriptor.idProduct == PRODUCT_ID))
|
||||
{
|
||||
udev = usb_open(dev);
|
||||
if (udev)
|
||||
{
|
||||
if (dev->descriptor.iSerialNumber)
|
||||
udev = usb_open(dev);
|
||||
if (udev)
|
||||
{
|
||||
if (dev->descriptor.iSerialNumber)
|
||||
{
|
||||
ret = usb_get_string_simple(udev, dev->descriptor.iSerialNumber, string, sizeof(string));
|
||||
if (ret > 0)
|
||||
@ -100,7 +100,7 @@ int littlewire_search()
|
||||
}
|
||||
}
|
||||
usb_close(udev);
|
||||
lw_totalDevices++;
|
||||
lw_totalDevices++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -112,7 +112,7 @@ int littlewire_search()
|
||||
littleWire* littlewire_connect_byID(int desiredID)
|
||||
{
|
||||
littleWire *tempHandle = NULL;
|
||||
|
||||
|
||||
if(desiredID > (lw_totalDevices-1))
|
||||
{
|
||||
return tempHandle;
|
||||
@ -217,7 +217,7 @@ void analog_init(littleWire* lwHandle, unsigned char voltageRef)
|
||||
|
||||
unsigned int analogRead(littleWire* lwHandle, unsigned char channel)
|
||||
{
|
||||
lwStatus=usb_control_msg(lwHandle, 0xC0, 15, channel, 0, rxBuffer, 8, USB_TIMEOUT);
|
||||
lwStatus=usb_control_msg(lwHandle, 0xC0, 15, channel, 0, rxBuffer, 8, USB_TIMEOUT);
|
||||
|
||||
return ((rxBuffer[1] *256) + (rxBuffer[0]));
|
||||
}
|
||||
@ -311,16 +311,16 @@ void i2c_write(littleWire* lwHandle, unsigned char* sendBuffer, unsigned char le
|
||||
void i2c_read(littleWire* lwHandle, unsigned char* readBuffer, unsigned char length, unsigned char endWithStop)
|
||||
{
|
||||
int i=0;
|
||||
|
||||
|
||||
if(endWithStop)
|
||||
lwStatus=usb_control_msg(lwHandle, 0xC0, 46, (length<<8) + 1, 1, rxBuffer, 8, USB_TIMEOUT);
|
||||
else
|
||||
lwStatus=usb_control_msg(lwHandle, 0xC0, 46, (length<<8) + 0, 0, rxBuffer, 8, USB_TIMEOUT);
|
||||
|
||||
|
||||
delay(3);
|
||||
|
||||
lwStatus=usb_control_msg(lwHandle, 0xC0, 40, 0, 0, rxBuffer, 8, USB_TIMEOUT);
|
||||
|
||||
|
||||
for(i=0;i<length;i++)
|
||||
readBuffer[i]=rxBuffer[i];
|
||||
}
|
||||
@ -343,7 +343,7 @@ void onewire_writeByte(littleWire* lwHandle, unsigned char messageToSend)
|
||||
|
||||
unsigned char onewire_readByte(littleWire* lwHandle)
|
||||
{
|
||||
lwStatus=usb_control_msg(lwHandle, 0xC0, 43, 0, 0, rxBuffer, 8, USB_TIMEOUT);
|
||||
lwStatus=usb_control_msg(lwHandle, 0xC0, 43, 0, 0, rxBuffer, 8, USB_TIMEOUT);
|
||||
delay(3);
|
||||
lwStatus=usb_control_msg(lwHandle, 0xC0, 40, 0, 0, rxBuffer, 8, USB_TIMEOUT);
|
||||
return rxBuffer[0];
|
||||
@ -353,7 +353,7 @@ unsigned char onewire_readBit(littleWire* lwHandle)
|
||||
{
|
||||
lwStatus=usb_control_msg(lwHandle, 0xC0, 50, 0, 0, rxBuffer, 8, USB_TIMEOUT);
|
||||
lwStatus=usb_control_msg(lwHandle, 0xC0, 40, 0, 0, rxBuffer, 8, USB_TIMEOUT);
|
||||
return rxBuffer[0];
|
||||
return rxBuffer[0];
|
||||
}
|
||||
|
||||
unsigned char onewire_resetPulse(littleWire* lwHandle)
|
||||
@ -361,7 +361,7 @@ unsigned char onewire_resetPulse(littleWire* lwHandle)
|
||||
lwStatus=usb_control_msg(lwHandle, 0xC0, 41, 0, 0, rxBuffer, 8, USB_TIMEOUT);
|
||||
delay(3);
|
||||
lwStatus=usb_control_msg(lwHandle, 0xC0, 40, 0, 0, rxBuffer, 8, USB_TIMEOUT);
|
||||
return rxBuffer[0];
|
||||
return rxBuffer[0];
|
||||
}
|
||||
|
||||
void softPWM_state(littleWire* lwHandle,unsigned char state)
|
||||
@ -388,7 +388,7 @@ void ws2812_preload(littleWire* lwHandle, unsigned char r,unsigned char g,unsign
|
||||
{
|
||||
lwStatus=usb_control_msg(lwHandle, 0xC0, 54, (g<<8) | 0x20, (b<<8) | r, rxBuffer, 8, USB_TIMEOUT);
|
||||
}
|
||||
|
||||
|
||||
int customMessage(littleWire* lwHandle,unsigned char* receiveBuffer,unsigned char command,unsigned char d1,unsigned char d2, unsigned char d3, unsigned char d4)
|
||||
{
|
||||
int i;
|
||||
@ -440,8 +440,8 @@ int onewire_nextAddress(littleWire* lwHandle)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// issue the search command
|
||||
onewire_writeByte(lwHandle,0xF0);
|
||||
// issue the search command
|
||||
onewire_writeByte(lwHandle,0xF0);
|
||||
|
||||
// loop to do the search
|
||||
do
|
||||
@ -514,7 +514,7 @@ int onewire_nextAddress(littleWire* lwHandle)
|
||||
// check for last device
|
||||
if (LastDiscrepancy == 0)
|
||||
LastDeviceFlag = 1;
|
||||
|
||||
|
||||
search_result = 1;
|
||||
}
|
||||
}
|
||||
@ -564,6 +564,6 @@ char *littleWire_errorName () {
|
||||
case -12: return "Not supported"; break;
|
||||
case -99: return "Other"; break;
|
||||
default: return "unknown";
|
||||
}
|
||||
}
|
||||
else return 0;
|
||||
}
|
||||
|
@ -10,206 +10,133 @@ type LittleWire struct {
|
||||
lwHandle *C.littleWire
|
||||
}
|
||||
|
||||
//int littlewire_search();
|
||||
//func LittleWireSearch() interface{} {
|
||||
// return int(C.littlewire_search())
|
||||
//}
|
||||
|
||||
//littleWire* littlewire_connect_byID(int desiredID);
|
||||
//func littleWireConnectByID(desiredID int) *littleWire {
|
||||
// littleWire = new(LittleWire)
|
||||
// C.littlewire_connect_byID(desiredID)
|
||||
//}
|
||||
|
||||
//littleWire* littlewire_connect_bySerialNum(int mySerial);
|
||||
//func littleWireConnectBySerialNum(mySerial int) *littleWire {
|
||||
// return C.littlewire_connect_bySerialNum(mySerial)
|
||||
//}
|
||||
|
||||
//littleWire* littleWire_connect();
|
||||
func LittleWireConnect() *LittleWire {
|
||||
return &LittleWire{
|
||||
lwHandle: C.littleWire_connect(),
|
||||
}
|
||||
}
|
||||
|
||||
//unsigned char readFirmwareVersion(littleWire* lwHandle);
|
||||
func (l *LittleWire) ReadFirmwareVersion() string {
|
||||
version := uint8(C.readFirmwareVersion(l.lwHandle))
|
||||
return fmt.Sprintf("%v.%v", version&0xF0>>4, version&0x0F)
|
||||
}
|
||||
|
||||
//void changeSerialNumber(littleWire* lwHandle,int serialNumber);
|
||||
func (l *LittleWire) ChangeSerialNumber(serialNumber int) {
|
||||
C.changeSerialNumber(l.lwHandle, C.int(serialNumber))
|
||||
}
|
||||
|
||||
//int customMessage(littleWire* lwHandle,unsigned char* receiveBuffer,unsigned char command,unsigned char d1,unsigned char d2, unsigned char d3, unsigned char d4);
|
||||
//func (littleWire *LittleWire) CustomMessage(receiveBuffer *[]uint8, command uint8, d1 uint8, d2 uint8, d3 uint8, d4 uint8) int {
|
||||
// return int(C.customMessage(littleWire.lwHandle, receiveBuffer, command, d1, d2, d3, d4))
|
||||
//}
|
||||
|
||||
//int littleWire_error ();
|
||||
func (l *LittleWire) LittleWireError() int {
|
||||
return int(C.littleWire_error())
|
||||
}
|
||||
|
||||
//char *littleWire_errorName ();
|
||||
//func LittleWireErrorName() string{
|
||||
// return string(C.littleWire_errorName())
|
||||
//}
|
||||
|
||||
//void digitalWrite(littleWire* lwHandle, unsigned char pin, unsigned char state);
|
||||
func (l *LittleWire) DigitalWrite(pin uint8, state uint8) {
|
||||
C.digitalWrite(l.lwHandle, C.uchar(pin), C.uchar(state))
|
||||
}
|
||||
|
||||
//void pinMode(littleWire* lwHandle, unsigned char pin, unsigned char mode);
|
||||
func (l *LittleWire) PinMode(pin uint8, mode uint8) {
|
||||
C.pinMode(l.lwHandle, C.uchar(pin), C.uchar(mode))
|
||||
}
|
||||
|
||||
//unsigned char digitalRead(littleWire* lwHandle, unsigned char pin);
|
||||
func (l *LittleWire) DigitalRead(pin uint8) uint8 {
|
||||
return uint8(C.digitalRead(l.lwHandle, C.uchar(pin)))
|
||||
}
|
||||
|
||||
//void internalPullup(littleWire* lwHandle, unsigned char pin, unsigned char state);
|
||||
func (l *LittleWire) InternalPullup(pin uint8, state uint8) {
|
||||
C.internalPullup(l.lwHandle, C.uchar(pin), C.uchar(state))
|
||||
}
|
||||
|
||||
//void analog_init(littleWire* lwHandle, unsigned char voltageRef);
|
||||
func (l *LittleWire) AnalogInit(voltageRef uint8) {
|
||||
C.analog_init(l.lwHandle, C.uchar(voltageRef))
|
||||
}
|
||||
|
||||
//unsigned int analogRead(littleWire* lwHandle, unsigned char channel);
|
||||
func (l *LittleWire) AnalogRead(channel uint8) uint {
|
||||
return uint(C.analogRead(l.lwHandle, C.uchar(channel)))
|
||||
}
|
||||
|
||||
//void pwm_init(littleWire* lwHandle);
|
||||
func (l *LittleWire) PwmInit() {
|
||||
C.pwm_init(l.lwHandle)
|
||||
}
|
||||
|
||||
//void pwm_stop(littleWire* lwHandle);
|
||||
func (l *LittleWire) PwmStop() {
|
||||
C.pwm_stop(l.lwHandle)
|
||||
}
|
||||
|
||||
//void pwm_updateCompare(littleWire* lwHandle, unsigned char channelA, unsigned char channelB);
|
||||
func (l *LittleWire) PwmUpdateCompare(channelA uint8, channelB uint8) {
|
||||
C.pwm_updateCompare(l.lwHandle, C.uchar(channelA), C.uchar(channelB))
|
||||
}
|
||||
|
||||
//void pwm_updatePrescaler(littleWire* lwHandle, unsigned int value);
|
||||
func (l *LittleWire) PwmUpdatePrescaler(value uint) {
|
||||
C.pwm_updatePrescaler(l.lwHandle, C.uint(value))
|
||||
}
|
||||
|
||||
//void spi_init(littleWire* lwHandle);
|
||||
func (l *LittleWire) SpiInit() {
|
||||
C.spi_init(l.lwHandle)
|
||||
}
|
||||
|
||||
//void spi_sendMessage(littleWire* lwHandle, unsigned char * sendBuffer, unsigned char * inputBuffer, unsigned char length ,unsigned char mode);
|
||||
//func (littleWire *LittleWire) SpiSendMessage(sendBuffer *[]uint8, inputBuffer *[]uint8, length uint8, mode uint8) {
|
||||
// C.spi_sendMessage(littleWire.lwHandle, sendBuffer, inputBuffer, length, mode)
|
||||
//}
|
||||
|
||||
//unsigned char debugSpi(littleWire* lwHandle, unsigned char message);
|
||||
func (l *LittleWire) DebugSpi(message uint8) uint8 {
|
||||
return uint8(C.debugSpi(l.lwHandle, C.uchar(message)))
|
||||
}
|
||||
|
||||
//void spi_updateDelay(littleWire* lwHandle, unsigned int duration);
|
||||
func (l *LittleWire) SpiUpdateDelay(duration uint) {
|
||||
C.spi_updateDelay(l.lwHandle, C.uint(duration))
|
||||
}
|
||||
|
||||
//void i2c_init(littleWire* lwHandle);
|
||||
func (l *LittleWire) I2cInit() {
|
||||
C.i2c_init(l.lwHandle)
|
||||
}
|
||||
|
||||
//unsigned char i2c_start(littleWire* lwHandle, unsigned char address7bit, unsigned char direction);
|
||||
func (l *LittleWire) I2cStart(address7bit uint8, direction uint8) uint8 {
|
||||
return uint8(C.i2c_start(l.lwHandle, C.uchar(address7bit), C.uchar(direction)))
|
||||
}
|
||||
|
||||
//void i2c_write(littleWire* lwHandle, unsigned char* sendBuffer, unsigned char length, unsigned char endWithStop);
|
||||
//func (littleWire *LittleWire) I2cWrite(sendBuffer *[]uint8, length uint8, endWithStop uint8) {
|
||||
// C.i2c_write(littleWire.lwHandle, sendBuffer, length, endWithStop)
|
||||
//}
|
||||
|
||||
//void i2c_read(littleWire* lwHandle, unsigned char* readBuffer, unsigned char length, unsigned char endWithStop);
|
||||
//func (littleWire *LittleWire) I2cRead(readBuffer *[]uint8, length uint8, endWithStop uint8) {
|
||||
// C.i2c_read(littleWire.lwHandle, readBuffer, length, endWithStop)
|
||||
//}
|
||||
|
||||
//void i2c_updateDelay(littleWire* lwHandle, unsigned int duration);
|
||||
func (l *LittleWire) I2cUpdateDelay(duration uint) {
|
||||
C.i2c_updateDelay(l.lwHandle, C.uint(duration))
|
||||
}
|
||||
|
||||
//void onewire_sendBit(littleWire* lwHandle, unsigned char bitValue);
|
||||
func (l *LittleWire) OneWireSendBit(bitValue uint8) {
|
||||
C.onewire_sendBit(l.lwHandle, C.uchar(bitValue))
|
||||
}
|
||||
|
||||
//void onewire_writeByte(littleWire* lwHandle, unsigned char messageToSend);
|
||||
func (l *LittleWire) OneWireWriteByte(messageToSend uint8) {
|
||||
C.onewire_writeByte(l.lwHandle, C.uchar(messageToSend))
|
||||
}
|
||||
|
||||
//unsigned char onewire_readByte(littleWire* lwHandle);
|
||||
func (l *LittleWire) OneWireReadByte() uint8 {
|
||||
return uint8(C.onewire_readByte(l.lwHandle))
|
||||
}
|
||||
|
||||
//unsigned char onewire_readBit(littleWire* lwHandle);
|
||||
func (l *LittleWire) OneWireReadBit() uint8 {
|
||||
return uint8(C.onewire_readBit(l.lwHandle))
|
||||
}
|
||||
|
||||
//unsigned char onewire_resetPulse(littleWire* lwHandle);
|
||||
func (l *LittleWire) OneWireResetPulse() uint8 {
|
||||
return uint8(C.onewire_resetPulse(l.lwHandle))
|
||||
}
|
||||
|
||||
//int onewire_firstAddress(littleWire* lwHandle);
|
||||
func (l *LittleWire) OneWireFirstAddress() int {
|
||||
return int(C.onewire_firstAddress(l.lwHandle))
|
||||
}
|
||||
|
||||
//int onewire_nextAddress(littleWire* lwHandle);
|
||||
func (l *LittleWire) OneWireNextAddress() int {
|
||||
return int(C.onewire_nextAddress(l.lwHandle))
|
||||
}
|
||||
|
||||
//void softPWM_state(littleWire* lwHandle,unsigned char state);
|
||||
func (l *LittleWire) SoftPWMState(state uint8) {
|
||||
C.softPWM_state(l.lwHandle, C.uchar(state))
|
||||
}
|
||||
|
||||
//void softPWM_write(littleWire* lwHandle,unsigned char ch1,unsigned char ch2,unsigned char ch3);
|
||||
func (l *LittleWire) SoftPWMWrite(ch1 uint8, ch2 uint8, ch3 uint8) {
|
||||
C.softPWM_write(l.lwHandle, C.uchar(ch1), C.uchar(ch2), C.uchar(ch3))
|
||||
}
|
||||
|
||||
//void ws2812_write(littleWire* lwHandle, unsigned char pin,unsigned char r,unsigned char g,unsigned char b);
|
||||
func (l *LittleWire) Ws2812Write(pin uint8, r uint8, g uint8, b uint8) {
|
||||
C.ws2812_write(l.lwHandle, C.uchar(pin), C.uchar(r), C.uchar(g), C.uchar(b))
|
||||
}
|
||||
|
||||
//void ws2812_flush(littleWire* lwHandle, unsigned char pin);
|
||||
func (l *LittleWire) Ws2812Flush(pin uint8) {
|
||||
C.ws2812_flush(l.lwHandle, C.uchar(pin))
|
||||
}
|
||||
|
||||
//void ws2812_preload(littleWire* lwHandle, unsigned char r,unsigned char g,unsigned char b);
|
||||
func (l *LittleWire) Ws2812Preload(r uint8, g uint8, b uint8) {
|
||||
C.ws2812_preload(l.lwHandle, C.uchar(r), C.uchar(g), C.uchar(b))
|
||||
}
|
||||
|
@ -3,12 +3,10 @@ package digispark
|
||||
//#include "littleWire_servo.h"
|
||||
import "C"
|
||||
|
||||
//void servo_init(littleWire* lwHandle);
|
||||
func (l *LittleWire) ServoInit() {
|
||||
C.servo_init(l.lwHandle)
|
||||
}
|
||||
|
||||
//void servo_updateLocation(littleWire* lwHandle,unsigned char locationChannelA,unsigned char locationChannelB);
|
||||
func (l *LittleWire) ServoUpdateLocation(locationChannelA uint8, locationChannelB uint8) {
|
||||
C.servo_updateLocation(l.lwHandle, C.uchar(locationChannelA), C.uchar(locationChannelB))
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ package digispark
|
||||
//#include "littleWire_util.h"
|
||||
import "C"
|
||||
|
||||
//void delay(unsigned int duration);
|
||||
func Delay(duration uint) {
|
||||
C.delay(C.uint(duration))
|
||||
}
|
||||
|
@ -1,18 +0,0 @@
|
||||
package digispark
|
||||
|
||||
/*
|
||||
#include <opendevice.h>
|
||||
*/
|
||||
//import "C"
|
||||
|
||||
/*
|
||||
//int usbGetStringAscii(usb_dev_handle *dev, int index, char *buf, int buflen);
|
||||
func usbGetStringAscii(dev *usb_dev_handle, index int, buf *int8, buflen int) int {
|
||||
return int(C.usbGetStringAscii(dev, index, buf, buflen))
|
||||
}
|
||||
|
||||
//int usbOpenDevice(usb_dev_handle **device, int vendorID, char *vendorNamePattern, int productID, char *productNamePattern, char *serialNamePattern, FILE *printMatchingDevicesFp, FILE *warningsFp);
|
||||
func usbOpenDevice(device **usb_dev_handle, vendorID int, vendorNamePattern *int8, productID int, productNamePattern *int8, serialNamePattern *int8, printMatchingDevicesFp *FILE, warningsFp *FILE) int {
|
||||
return int(usbOpenDevice(device, vendorID, vendorNamePattern, productID, productNamePattern, serialNamePattern, printMatchingDevicesFp, warningsFp))
|
||||
}
|
||||
*/
|
Loading…
x
Reference in New Issue
Block a user