<commit_before>package unicornhat

// #include "ws2812-RPi.h"
// #include "unicornhat-bridge.h"
import "C"
import "fmt"

type Color struct {
	r, g, b byte
}

// initialization of hardware
func InitHardware() {
	C.initHardware()
}

func Initialize(numPixels int) {
	C.init(C.int(numPixels))
}

func StartTransfer() {
	C.startTransfer()
}

// Led updates
func Show() {
	C.show()
}

func GetBrightness() float64 {
	return float64(C.getBrightness())
}
func SetBrightness(brightness float64) byte {
	return byte(C.setBrightness(C.double(brightness)))
}

func ClearPWMBuffer() {
	C.clearPWMBuffer()
}

func Clear() {
	C.clear()
}

func ClearLEDBuffer() {
	C.clearLEDBuffer()
}

func GetPixelColor(pixel uint) Color {
	container := C.getPixelColor(C.uint(pixel))
	return NewColor(byte(container.r), byte(container.g), byte(container.b))
}

func NewColor(r, g, b byte) Color {
	return Color { r: r, g: g, b: b }
}
<commit_msg>Basic interface library implemented<commit_after>// Interface functions with the pimoroni UnicornHat
package unicornhat

//#include "ws2812-RPi.h"
//
//double getDefaultBrightnessMacro() {
//	return DEFAULT_BRIGHTNESS;
//}
import "C"

type Pixel struct {
	R, G, B byte
}

// initialization of hardware
func InitHardware() {
	C.initHardware()
}

func Initialize(numPixels int) {
	C.init(C.int(numPixels))
}

func StartTransfer() {
	C.startTransfer()
}

// Led updates
func Show() {
	C.show()
}

func GetBrightness() float64 {
	return float64(C.getBrightness())
}
func SetBrightness(brightness float64) bool {
	return (C.setBrightness(C.double(brightness)) == 1)
}

func ClearPWMBuffer() {
	C.clearPWMBuffer()
}

func Clear() {
	C.clear()
}

func ClearLEDBuffer() {
	C.clearLEDBuffer()
}

func GetPixelColor(pixel uint) Pixel {
	return fromNativePixel(C.getPixelColor(C.uint(pixel)))
}
func NewPixel(r, g, b byte) Pixel {
	return Pixel { R: r, G: g, B: b }
	
}
func Color(r, g, b byte) Pixel {
	return fromNativePixel(C.Color(C.uchar(r), C.uchar(g), C.uchar(b)))
}
func RGB2Color(r, g, b byte) Pixel {
	return fromNativePixel(C.RGB2Color(C.uchar(r), C.uchar(g), C.uchar(b)))
}

func (this Pixel) nativePixel() C.Color_t {
	var v C.Color_t
	v.r = C.uchar(this.R)
	v.g = C.uchar(this.G)
	v.b = C.uchar(this.B)
	return v
}

func fromNativePixel(pixel C.Color_t) Pixel {
	return NewPixel(byte(pixel.r), byte(pixel.g), byte(pixel.b))
}


func NumPixels() uint {
	return uint(C.numPixels())
}

func SetPixelColor(pixel uint, r, g, b byte) bool {
	return (C.setPixelColor(C.uint(pixel), C.uchar(r), C.uchar(g), C.uchar(b)) == 1)
}

func SetPixelColorType(pixel uint, color Pixel) bool {
	return (C.setPixelColorT(C.uint(pixel), color.nativePixel()) == 1)
}

func DefaultBrightness() float64 {
	return float64(C.getDefaultBrightnessMacro())
}


{'fraction_non_alphanumeric': 0.15588662790697674, 'fraction_numerical': 0.010537790697674418, 'mean_word_length': 4.606924643584521, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7006471', 'n_tokens_mistral': 1110, 'n_tokens_neox': 1070, 'n_words': 243}