Code Monkey home page Code Monkey logo

win32arduino's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

sidey79

win32arduino's Issues

License header in all files

A copy of the license should be inserted in all installed files since the LICENSE file cannot be copied to the install directory.

wrong syntax for variables on windows

When defining the environment Variables on a windows system, it is not correct to get the information from the variable wirh a $

Instead the following setting:

RAPIDASSIST_HOME=$WIN32ARDUINO_HOME/lib/RapidAssist

does not work on a windows system, it must be

RAPIDASSIST_HOME=%WIN32ARDUINO_HOME%/lib/RapidAssist

Circle CI integration

Circle CI is a continuous integration and delivery platform. It offset different features that are not available by Travis CI or AppVeyor.

Missing build step in v2.2.1

Looking at the 'Build Steps' specified in INSTALL.md. There is no mention of the mandatory RAPIDASSIST_HOME environment variable.

A new build step should be added at step 2.5. It should read something like:

2.5 Define the environment variable RAPIDASSIST_HOME such that RAPIDASSIST_HOME=$WIN32ARDUINO_HOME/lib/RapidAssist.

Implement pinMode() function properly.

The pinMode() function must be fully implemented.

The following features are required:

  • pin mode should be saved for all pins.
  • pins set to INPUT_PULLUP should be set to HIGH by default to simulate the internal pull-up resistor
  • calling digitalWrite on an input pin should activate the internal pull-up resistor

Find a new name for library

Once the library will be ported to linux (see issue #15 ), the name win32Arduino should be changed to something that does not sounds like win32 only.

Multiple names are suggested:

  • x86Arduino
  • testArduino
  • x86TestArduino
  • UnitTestArduino
  • ArduinoPCTest / PcTestArduino

cmake doesn't find GTEST via find_package

On master i've tryed building win32arduino, but it doesn't work, because it is not finding gtest.

I've searched a little bit, how to register gtest to cmake, but i have no idea how to do that:

CMake Error at C:/Program Files/CMake/share/cmake-3.12/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR
  GTEST_MAIN_LIBRARY)
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.12/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  C:/Program Files/CMake/share/cmake-3.12/Modules/FindGTest.cmake:196 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:125 (find_package)

Tag for version 2.2.1 builds as 2.3.0

The CMakeLists.txt file available in tag 2.2.1 is incorrectly configured as version 2.3.0. This should be addressed immediately as this can result in great confusion since version 2.3.0 may be released soon.

Replace downloaded googletest third party library by a git submodule

The command ant install is currently handling the download, extraction and compilation of the googletest library. The code should be updated to use a git submodule instead which would be easier to handle for git users.

The file CMakeList.txt should also be updated to reference googletests' own CMakeList.txt file which would compile gtest library along the win32Arduino and prevent the manual compilation of googletest as a mandatory prebuild step.

Logging should be in memory until a test completes

The logging mecanism is way too slow. The current implementation opens and closes the file each time an arduino function is called which is not effective with arduino functions that are time based (calls millis() multiple times).

A possible implementation would be to log every calls to memory and flush the memory to file when eixting the program or when changing the log filename. This would greatly speed up the process.

Crash on calling millis() before entering main()

A possible crash can occurs when executing Arduino examples using win32Arduino. If an example creates a static variable or a class which calls a timing function (i.e. millis()) during initialization, then win32Arduino timing strategy might not be initialized yet which creates a null pointer exception in arduino.cpp, line 714.

The issue is certainly related to a race condition between the initialization of the sketch example variable and win32Arduino’s timing strategy initialization.

One workaround is to add the following code before the sketch variable declaration:

#include "IncrementalClockStrategy.h"

bool init()
{
  //force incremental clock strategy of win32Arduino library
  testarduino::IncrementalClockStrategy & wClock = testarduino::IncrementalClockStrategy::getInstance();
  testarduino::setClockStrategy(&wClock);
  return true;
}
static bool _initialized = init();

Add support for F macro

Hi, is there any chance to get support of a F macro?

I think a macro without any functionality is enough
#define F(V1) V1

win32Arduino on Linux

Is there any chance to get rid of the win32 specific libs / functions used in this lib?

I wanted to run some integration tests with travic ci but there are serval things missing.

Refactor the automatic time strategy

Rename the following functions:

  • setMicrosResolution()
  • setMicrosCounter()
    to meaningful names. The solution must clearly identify that the time increases automatically by given step each time the function is called.

Proposed names:

  • setMicrosAutoIncrements()
  • setMillisAutoIncrements()

Refactor the time strategies

Create an enum for strategies:

  • CLOCK_REALTIME
  • CLOCK_MANUAL
  • CLOCK_AUTO_INCREMENT

Create the functions that matches each strategies:

  • setMicrosAutoIncrement()
  • setMillisAutoIncrement() (or define millis() from micros())
  • setMicrosManualTime()
  • setMillisManualTime()

Move time handling code from arduino.cpp to new independent classes

class ITimeStrategy
{
public:
  virtual uint32_t millis() = 0;
  virtual uint32_t micros() = 0;
};

//milliseconds are realtime. Microseconds are evaluated from elapsed milliseconds (increments of 1000)
class RealtimeStrategy : public virtual ITimeStrategy
{
private:
  RealtimeStrategy();
  ~RealtimeStrategy();
public:
  static RealtimeStrategy & getInstance();
public:
  virtual uint32_t millis();
  virtual uint32_t micros();
};

//microseconds increases by a constant amount for every call to micros() functions. milliseconds are evaluated from microseconds.
class IncrementalTimeStrategy : public virtual ITimeStrategy
{
private:
  IncrementalTimeStrategy();
  ~IncrementalTimeStrategy();
public:
  static IncrementalTimeStrategy & getInstance();
public:
  virtual uint32_t millis();
  virtual uint32_t micros();
  void setMicrosecondsResolution(uint32_t iResolution);
  uint32_t getMicrosecondsResolution() const;
  void setMicrosecondsCounter(uint32_t iCounter);
  uint32_t getMicrosecondsCounter() const;
};

testarduino::setTimeStrategy(ITimeStrategy * strategy);

Create new API functions for attachFunctionCallback()

testarduino::reset(); //to reset to a known state all features. Call between each tests.

void log(const char * iValue, ...);
testarduino::detachAllInterrupts();
testarduino::setPinValue(const uint8_t & pin, const uint16_t & value);

typedef void (*Callback)();
testarduino::attachFunctionCallback(const char * name, Callback c);
testarduino::detachFunctionCallback(const char * name, Callback c);

struct Interrupt
{
  ISR _func;
  uint8_t mode; //CHANGE, FALLING, RISING
};

typedef std::vector<Interrupt> InterruptList;

//define PIN
struct PIN_REGISTRY
{
  uint16_t value; //10 bits to support analog values
  InterruptList interrupts;
};

Change api functions to match officials signatures of Arduino.h

Some functions defined in Arduino.h does not match the official signatures from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\Arduino.h of Arduino IDE version 1.8.13.

For examples:

void tone(uint8_t _pin, unsigned int frequency, unsigned long duration = 0);
void noTone(uint8_t _pin);
int digitalRead(uint8_t pin);
int analogRead(uint8_t pin);
void analogWrite(uint8_t pin, int val);
unsigned long millis(void);
unsigned long micros(void);
void delay(unsigned long ms);
void delayMicroseconds(unsigned int us);
unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout);
unsigned long pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout);
long random(long);
long random(long, long);
void randomSeed(unsigned long);

Implement 'make install' command support

The current implementation of the library requires user to define multiple environment variables:

  • Define the GOOGLETEST_HOME environment variable to build.
  • Define the RAPIDASSIST_HOME variable to allow using this library in an external project.

This effect cascade through all projects and as a result, makes the whole process really heavy and complicated. For instance, assume once want to compile project foo which have the following dependencies: foo -> bar -> baz -> RapidAssist. It makes no sense that project foo should define variables for a super deep dependency it does not even know about.

Since the projects that use RapidAssist are expected to be configured with CMake, it would make sense to implement the make install command. This way, all projects that uses RapidAssist could
use the find_package(rapidassist) command and configure (almost automatically) their dependencies.

rapidassist outside of win32arduino?

RapidAssist can not be deployed into another path. But it is also not a submobule of win32Arduin repository and i haven't found the depency on that in install.md.

If i place rapidassist in another directory the following occures:

after cmake.. the following error occures:

WIN32ARDUINO_VERSION_STRING: 2.2.2

CMake Error at CMakeLists.txt:109 (add_subdirectory):
add_subdirectory not given a binary directory but the given source
directory
"...../Project/tests/RapidAssist" is not
a subdirectory of
"...../Project/tests/win32arduino". When
specifying an out-of-tree source a binary directory must be explicitly
specified.

So one option is, to implement rapidassist as a submodule in this repository

Assign callback functions for time based event programming

  • When clock mode is simulated, allow user to set a custom callback on millis() and micros() functions which can be used to change pin state or trigger other events.
  • Allow assign callback for digitalRead(), digitalWrite(), analogRead() and analogWrite() functions to implement event based changes for tests. Moved to issue #11

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.