Coder Social home page Coder Social logo

matrixorbital / eve-knob Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 1.0 170 KB

An Arduino Project. A simple AS5048 based infinitely rotating knob that you can add to any electronics project

License: MIT License

C 81.85% C++ 18.15%
eve eve2 spi ft812 ft813 matrix-orbital spi-tft tft arduino

eve-knob's Introduction

A small quantity of joy is added to the Universe each time a knob is spun.

Using the AS5048B from AMS allows the knob to rotate freely and infinitely while reading the position via I2C. AMS makes a handy and inexpensive eval-board which is available from Mouser: 985-AS5048A-TS_EK_AB

In essence, this is a rotational encoder capable of 1/20th degree resolution (7300 counts per revolution). The technology is also useful in robotics to quantify wheel rotation or joint extension.

  • Designed for Matrix Orbital EVE2 SPI TFT Displays

    https://www.matrixorbital.com/ftdi-eve

  • This code makes use of the Matrix Orbital EVE2 Library found here:

    https://github.com/MatrixOrbital/EVE2-Library

    • While a copy of the library files (Eve2_81x.c and Eve2_81x.h) is included here, you may look for updated files if you wish. This is optional, but the Eve2-Library is likely to contain an extension of what you have here in case you wish to make some more advanced screens.
  • Matrix Orbital EVE2 SPI TFT display information can be found at: https://www.matrixorbital.com/ftdi-eve

  • An Arduino shield with a connector for Matrix Orbital EVE2 displays is used to interface the Arduino to Eve.
    This shield includes:

    • 20 contact FFC connector for Matrix Orbital EVE2 displays
    • 3 pushbuttons for application control without requiring a touchscreen (useful for initial calibration)
    • Audio amplifier and speaker for audio feedback
    • SD card holder
    • Additionally, the shield board is automatically level shifted for 5V Arduino and works with 3.3V Parallax Propeller ASC+

    Support Forums

    http://www.lcdforums.com/forums/viewforum.php?f=45

eve-knob's People

Contributors

hjakl avatar tharnlago avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

cloudnya-danang

eve-knob's Issues

Cmd_Keys not implemented

I have not found CMD_KEYS implemented in any MatrixOrbital code. I did find it implemented in the Riverdi code and extrapolated to get it into the Matrix Orbital code (nearly identical to the Cmd_Text). However the implementation seems to be somehow flawed. It shows the keys but with the extra "stacking" issue shown below.

Given a single row of keys, each key appears to be on top of a stack of (the same shaped) keys each shifted by a few pixels vertically.
Given multiple rows of keys, just the bottom row appears as above.

Is the EVE engine in the MatrixOrbital hardware not capable of this (hence the lack of current cmd_keys) or is it this implementation?

Here is my implementation..


void Cmd_Keys(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t font, uint16_t options, const char * str)
{
  
  uint16_t DataPtr, LoopCount, StrPtr;
  uint16_t length = (uint16_t)strlen(str);
  if(!length) 
    return;

  // Create a data the same size as the string only make it in 32 bit chunks instead of 8 bit.
  uint32_t* data = (uint32_t*) calloc((length/4)+1, sizeof(uint32_t));
  // With a length of three this allocates int(3/4 + 1) == 1 uint32.

  // Loop over the incoming  string and combine 4 consecutive elements into a single data element.
  StrPtr = 0;
  //for(DataPtr=0; DataPtr<(length/4); DataPtr++, StrPtr += 4)
  for(DataPtr=0; DataPtr<(length/4); DataPtr++, StrPtr += 4)
    data[DataPtr] = (uint32_t)str[StrPtr+3]<<24 | (uint32_t)str[StrPtr+2]<<16 | (uint32_t)str[StrPtr+1]<<8 | (uint32_t)str[StrPtr];
  
  // insert the remaining (less than 4) characters into the last element in data array.
  for(LoopCount=0; LoopCount<(length%4); LoopCount++, StrPtr++)
    data[DataPtr] |= (uint32_t)str[StrPtr] << (LoopCount * 8);

  //printf("-- CMD_KEYS -- Size(%d), DataPtr(%d), LoopCount(%d), Data0(%x)\n", sizeof(data[0]), DataPtr, LoopCount,  data[0]);
 
  Send_CMD(CMD_KEYS);
  Send_CMD( ((uint32_t)y << 16) | x ); // Put two 16 bit values together into one 32 bit value - do it little endian
  Send_CMD( ((uint32_t)h << 16) | w );
  Send_CMD( ((uint32_t)options << 16) | font );
  
  // Loop over the data array and send each 32 bit chunk to the display.
  for (LoopCount = 0; LoopCount <= length / 4; LoopCount++)
  {
	  Send_CMD(data[LoopCount]);
  }

  free(data);

}

won't compile with win10 arduino 1.8.5

First you need to rename the ino file to EVE-Knob.ino (arduino IDE complains if ino filename name doesn't match directory name)

After opening EVE-Knob.ino, compiling for uno gives this error
C:\tmp\EVE-Knob\Eve-Knob.ino:6:24: fatal error: Arduino_AL.h: No such file or directory

File Arduino_AL.h is in the same directory as ino file, but error occurs. At a loss, might be a filename case issue. Please fix.

ps. compiles fine ubuntu 16.04 arduino 1.8.9

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.