Skip to content

Conversation

oclyke
Copy link
Contributor

@oclyke oclyke commented Nov 15, 2019

@nseidle these are some changes that I had to make when getting the TFLM code to run on Edge. My concern is about the 2nd commit. Maybe one solution would be to implement a template function that could be used wherever the original macro would have been used. That way the signatures can be different (conflict is with min as used here):

stl_algobase.h

  template<typename _Tp, typename _Compare>
    _GLIBCXX14_CONSTEXPR
    inline const _Tp&
    min(const _Tp& __a, const _Tp& __b, _Compare __comp)
    {
      //return __comp(__b, __a) ? __b : __a;
      if (__comp(__b, __a))
	return __b;
      return __a;
    }

this should be pretty uncontroversial  - instead of always initializing the ADC it will only happen the first time analogRead gets called. This prevents surprises when runnin bare-HAL code
This is more controversial. We need to figure out how this plays with examples and such. The reason for removing these is that they seem to conflict with the STL library, and that is used in TFLM.
@oclyke oclyke requested a review from nseidle November 15, 2019 16:32
@oclyke
Copy link
Contributor Author

oclyke commented Nov 15, 2019

After discussion with Kirk we agreed that ```that's just the way it is``` in Arduino. Solved the TFLM example support by simply placing this at the top of the example

``` c++
#ifdef min
#undef min
#endif

#ifdef max
#undef max
#endif
```
@oclyke oclyke removed the request for review from nseidle November 15, 2019 19:53
@oclyke oclyke merged commit ecb0b3f into master Nov 15, 2019
@oclyke oclyke deleted the tensorflow-micro-lite-compatibility branch November 15, 2019 19:54
@nseidle
Copy link
Member

nseidle commented Nov 18, 2019

I like the adc setup fix.

I think the #ifdef undef fix is fine. If min/max functions are wrong because of our overwriting, the user has bigger problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants