Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two minor fixes, add missing include and provide pin definitions for A0 to A7 #122

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Added

- Minimal Wire mocks. Will not provide support for unit testing I2C communication yet, but will allow compilation of libraries that use I2C.
- Provide pin definitions for A0 to A7.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But only on some platforms, right?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most platforms have such definitions. Maybe this can be controlled using a NUM_ANALOG_PINS (which would be good to define in any case, along with NUM_DIGITAL_PINS, since those are at least defined for AVR-based boards: https://github.com/rlcamp/ArduinoCore-avr/blob/4c9f899f8eef12989903e474beea3a71a90f511c/variants/standard/pins_arduino.h#L28-L29)


### Changed

20 changes: 20 additions & 0 deletions cpp/arduino/ArduinoDefines.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include <stdint.h>
#include <avr/pgmspace.h>

#define HIGH 0x1
@@ -91,4 +92,23 @@

#if defined(__AVR_ATmega328P__) || defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega328__) || defined(__AVR_ATmega168__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
#define LED_BUILTIN 13

#define PIN_A0 (14)
#define PIN_A1 (15)
#define PIN_A2 (16)
#define PIN_A3 (17)
#define PIN_A4 (18)
#define PIN_A5 (19)
#define PIN_A6 (20)
#define PIN_A7 (21)

constexpr uint8_t A0 = PIN_A0;
constexpr uint8_t A1 = PIN_A1;
constexpr uint8_t A2 = PIN_A2;
constexpr uint8_t A3 = PIN_A3;
constexpr uint8_t A4 = PIN_A4;
constexpr uint8_t A5 = PIN_A5;
constexpr uint8_t A6 = PIN_A6;
constexpr uint8_t A7 = PIN_A7;

#endif
2 changes: 2 additions & 0 deletions cpp/arduino/Godmode.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include <ostream>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming that I was breaking compilation (somewhere) without this. Can you describe where the trouble was?


#include "Godmode.h"
#include "HardwareSerial.h"
#include "SPI.h"