Coder Social home page Coder Social logo

arduino-n64-controller-library's Introduction

About me

I'm a software developer at Microsoft Azure through the Kinvolk acquisition, working on Flatcar Container Linux since it got readied as replacement for CoreOS Container Linux. The work covers a broad range from the high-level build system architecture down to developing the low-level software components and collaborating with various upstream projects (Linux kernel, systemd, etc). I also worked on Lokomotive, Inspektor Gadget, and traceloop.

As a fun interview task at Kinvolk I implemented the idea of a systemd option to define BPF programs as packet filters for all network sockets of a CGroup. This is now part of systemd since version 243 and lets you use a custom network filter for your systemd service. Try out the examples in my bpf-cgroup-filter repo, and read the first and second blog post.

I did my dual degree Master in computer science at TU Berlin and KAIST (South Korea), where I was part of Prof. Sue Moon's Advanced Networking Lab. I did my Bachelor in computer science at FU Berlin. I'm part of the German association Forum Computer Scientists for Peace and Social Responsibility, where Joseph Weizenbaum was a founding member (I recommend you to watch some of his interviews or the documentary »Plug & Pray«).

My Master's thesis was about memory-safe userspace networking to protect against security vulnerabilities in the OS kernel's TCP/IP network stack due to memory corruption bugs. The solution consists of usnetd a memory-safe L4 switch to share a NIC between multiple userspace network stacks and the kernel's network stack, and usnet_sockets a Rust userspace networking library based on smoltcp that is still able to integrate with the loopback device. It offers various options on direct or shared NIC access. It uses my usnet_devices library for netmap, macvtap, and UNIX domain sockets smoltcp interfaces.

In my spare time I maintain GNOME Disks and implemented filesystem resize, check, and repair support for it in a GSoC project. This made me also work on udisks and libblockdev. Please reach out if you want to improve GNOME Disks. I still have a long todo list even though I don't find the time to write new code.

I like compilers and compression, and even more if both are combined. My Bachelor's thesis was about a compiler for a subset of Python to ZPAQL bytecode. ZPAQ is a compression format which embeds the decompression bytecode in the archive, allowing to change the algorithm without requiring the decoder to be updated. This idea addressed the incompatibility problem that all the versions of PAQ compressors had, and also allowed to choose different algorithms depending on the type of input data. However, ZPAQL wasn't used by many people because it is an assembly-like language. With a Python-like language to compile from I wanted to lower this barrier to write custom compression algorithms and also prove that the format can embed non-context modeling algorithms like Brotli (which I ported to Python from a Rust implementation). Custom algorithms are useful because the key element in data compression is prediction of future data which works best when the current context is taken into account. E.g., with ZPAQ it was easy to write a compression model for PNM image data that uses the color of the neighbor pixels to predict the next. The generated code is not the fastest because my malloc implementation isn't but it is a good playground for data compression. A fun exercise was to detect the decimal digits of Pi and then switch from a generic text compression model to perfectly predicting the next digits of Pi, essentially wasting almost no bytes on storing this seemingly random string it in a text despite it appearing like incompressible random data to any other compression algorithm.

In university I also worked on a Twee to Z-Code compiler with a tracing garbage collector. If you are into Arduinos you may find my library for Nintendo 64 controllers useful which you can try out playing a tetris port on your TV (or anything that displays the composite video signal the Arduino generates in software). I'll spare you my QBasic and Visual Basic code but if GitHub existed then, you would find it here ;)

I'm not actively writing on my blog but you can find my email address there, or create an issue in this readme repo to contact me.

My GNOME Account: gitlab.gnome.org/kailueke

arduino-n64-controller-library's People

Contributors

per1234 avatar pothos avatar schaal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

arduino-n64-controller-library's Issues

Code not working on Adafruit Trinket Pro

Hello there,

I hope you are well.

I completed my code and this is my final version working and tested on Arduino Uno:

#include <N64Controller.h> // https://github.com/pothos/arduino-n64-controller-library also available in Arduino IDE

const int N64ControllerPin =  12;
const int relayPin =  8;
N64Controller player1 (N64ControllerPin);

void setup() {
    pinMode(relayPin, OUTPUT);
    player1.begin();
}

void loop() {
    delay(30);
    player1.update();
    if (player1.Z() && player1.R() && player1.A() && player1.B() && player1.Start()) {
      digitalWrite(relayPin, HIGH);
      delay(500);
      digitalWrite(relayPin, LOW);
      delay(7000);
    }

}

Since I will have to put this into the Nintendo 64 case and it will use 3.3v logic (like the controller) I have chosen an Adafruit Trinket Pro 3.3v 12Mhz (Arduino compatible).
I flashed the sketch on the Trinket Pro without any issue but now I see a very strange behavior:
If I press just the button "A" alone I immediately trigger the relay...
The same behavior if I press "B" alone or "Start" alone or "Z".
If I press "L" alone, on the other hand, it behaves like it should (no relay trigger).

Is there maybe something that will not allow the code to work on this 3.3v 12Mhz board?

Thanks for your kind help.

Cannot compile the Example

Hello there,

I have tried to install this library and run a very minimal example:

#include <N64Controller.h>

N64Controller player1 (12); // this controller for player one is on PIN 12

void setup() {
    player1.begin(); // Initialisation
}

void loop() {
    delay(30);
    player1.update(); // read key state
}

When I try to compile I get:

sketch/src/N64Controller.cpp.o (symbol from plugin): In function `N64Controller::N64Controller(unsigned char)':
(.text+0x0): multiple definition of `N64Controller::N64Controller(unsigned char)'
sketch/N64Controller.cpp.o (symbol from plugin):(.text+0x0): first defined here
sketch/src/N64Controller.cpp.o (symbol from plugin): In function `N64Controller::N64Controller(unsigned char)':
(.text+0x0): multiple definition of `N64Controller::N64Controller(unsigned char)'
sketch/N64Controller.cpp.o (symbol from plugin):(.text+0x0): first defined here
sketch/src/N64Controller.cpp.o (symbol from plugin): In function `N64Controller::N64Controller(unsigned char)':
Multiple libraries were found for "N64Controller.h"
(.text+0x0): multiple definition of `N64Controller::begin()'
 Used: /root/Arduino/libraries/N64Controller
sketch/N64Controller.cpp.o (symbol from plugin):(.text+0x0): first defined here
 Not used: /root/Arduino/libraries/src
 Not used: /home/pitto/arduino/libraries/arduino-n64-controller-library
sketch/src/N64Controller.cpp.o (symbol from plugin): In function `N64Controller::N64Controller(unsigned char)':
(.text+0x0): multiple definition of `N64Controller::print_N64_status()'
sketch/N64Controller.cpp.o (symbol from plugin):(.text+0x0): first defined here
sketch/src/N64Controller.cpp.o (symbol from plugin): In function `N64Controller::N64Controller(unsigned char)':
(.text+0x0): multiple definition of `N64Controller::update()'
sketch/N64Controller.cpp.o (symbol from plugin):(.text+0x0): first defined here
sketch/src/N64Interface.cpp.o (symbol from plugin): In function `N64Interface_PINB::init()':
(.text+0x0): multiple definition of `N64Interface_PINB::init()'
sketch/N64Interface.cpp.o (symbol from plugin):(.text+0x0): first defined here
sketch/src/N64Interface.cpp.o (symbol from plugin): In function `N64Interface_PINB::init()':
(.text+0x0): multiple definition of `N64Interface_PINB::send(unsigned char*, char)'
sketch/N64Interface.cpp.o (symbol from plugin):(.text+0x0): first defined here
sketch/src/N64Interface.cpp.o (symbol from plugin): In function `N64Interface_PINB::init()':
(.text+0x0): multiple definition of `N64Interface_PINB::get()'
sketch/N64Interface.cpp.o (symbol from plugin):(.text+0x0): first defined here
sketch/src/N64Interface.cpp.o (symbol from plugin): In function `N64Interface_PINB::init()':
(.text+0x0): multiple definition of `N64Interface_PIND::init()'
sketch/N64Interface.cpp.o (symbol from plugin):(.text+0x0): first defined here
sketch/src/N64Interface.cpp.o (symbol from plugin): In function `N64Interface_PINB::init()':
(.text+0x0): multiple definition of `N64Interface_PIND::send(unsigned char*, char)'
sketch/N64Interface.cpp.o (symbol from plugin):(.text+0x0): first defined here
sketch/src/N64Interface.cpp.o (symbol from plugin): In function `N64Interface_PINB::init()':
(.text+0x0): multiple definition of `N64Interface_PIND::get()'
sketch/N64Interface.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/N64Controller/N64Controller.cpp.o (symbol from plugin): In function `N64Controller::N64Controller(unsigned char)':
(.text+0x0): multiple definition of `N64Controller::N64Controller(unsigned char)'
sketch/N64Controller.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/N64Controller/N64Controller.cpp.o (symbol from plugin): In function `N64Controller::N64Controller(unsigned char)':
(.text+0x0): multiple definition of `N64Controller::N64Controller(unsigned char)'
sketch/N64Controller.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/N64Controller/N64Controller.cpp.o (symbol from plugin): In function `N64Controller::N64Controller(unsigned char)':
(.text+0x0): multiple definition of `N64Controller::begin()'
sketch/N64Controller.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/N64Controller/N64Controller.cpp.o (symbol from plugin): In function `N64Controller::N64Controller(unsigned char)':
(.text+0x0): multiple definition of `N64Controller::print_N64_status()'
sketch/N64Controller.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/N64Controller/N64Controller.cpp.o (symbol from plugin): In function `N64Controller::N64Controller(unsigned char)':
(.text+0x0): multiple definition of `N64Controller::update()'
sketch/N64Controller.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/N64Controller/N64Interface.cpp.o (symbol from plugin): In function `N64Interface_PINB::init()':
(.text+0x0): multiple definition of `N64Interface_PINB::init()'
sketch/N64Interface.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/N64Controller/N64Interface.cpp.o (symbol from plugin): In function `N64Interface_PINB::init()':
(.text+0x0): multiple definition of `N64Interface_PINB::send(unsigned char*, char)'
sketch/N64Interface.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/N64Controller/N64Interface.cpp.o (symbol from plugin): In function `N64Interface_PINB::init()':
(.text+0x0): multiple definition of `N64Interface_PINB::get()'
sketch/N64Interface.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/N64Controller/N64Interface.cpp.o (symbol from plugin): In function `N64Interface_PINB::init()':
(.text+0x0): multiple definition of `N64Interface_PIND::init()'
sketch/N64Interface.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/N64Controller/N64Interface.cpp.o (symbol from plugin): In function `N64Interface_PINB::init()':
(.text+0x0): multiple definition of `N64Interface_PIND::send(unsigned char*, char)'
sketch/N64Interface.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/N64Controller/N64Interface.cpp.o (symbol from plugin): In function `N64Interface_PINB::init()':
(.text+0x0): multiple definition of `N64Interface_PIND::get()'
sketch/N64Interface.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino Uno.

Can you please suggest me how to fix this?
Thanks!

Question about wiring

Hello there,

I have completed the project.

My aim was to hook up the controller to an arduino (I couldn't use the 3.3v one so I used a 5v and it worked immediately) and trigger a relay using a specific button combination.

I connected all the parts and used external 3.3v to feed N64 controller, all went well.

Do I decided to put everything in the N64 and close it.
This is where things got weird...
If I connect the arduino to the gamepad signal in the N64 (I soldered a wire to the corresponding part on the motherboard)...
It doesn't work!

If I hook up the controller directly to the arduino it works without issues.

I am...
Puzzled.

Here's a video that shows the behavior:
https://photos.app.goo.gl/rC8u2McYJG5y3sAV7

Can you please share more information about your wiring?

Thanks!

ESP32 support?

I am trying to use an esp32 for this project as I want to make a fully enclosed wireless PC compatible controller. When I try to add this library I get an "incompatible" message in my examples drop down

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.