Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc4a0ada

Browse files
committed
[NanoEvery] Fix digitalPinToAnalogInput macro
1 parentafcf3aa commitc4a0ada

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

‎variants/nona4809/pins_arduino.h‎

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,14 @@
2727
#include"timers.h"
2828

2929
#defineNUM_DIGITAL_PINS 22 // (14 on digital headers + 8 on analog headers)
30-
#defineNUM_ANALOG_INPUTS8
30+
#defineNUM_ANALOG_INPUTS14
3131
#defineNUM_RESERVED_PINS 6 // (TOSC1/2, VREF, RESET, DEBUG USART Rx/Tx)
3232
#defineNUM_INTERNALLY_USED_PINS 10 // (2 x Chip select + 2 x UART + 4 x IO + LED_BUILTIN + 1 unused pin)
3333
#defineNUM_I2C_PINS 2 // (SDA / SCL)
3434
#defineNUM_SPI_PINS 3 // (MISO / MOSI / SCK)
3535
#defineNUM_TOTAL_FREE_PINS (NUM_DIGITAL_PINS)
3636
#defineNUM_TOTAL_PINS (NUM_DIGITAL_PINS + NUM_RESERVED_PINS + NUM_INTERNALLY_USED_PINS + NUM_I2C_PINS + NUM_SPI_PINS)
3737
#defineANALOG_INPUT_OFFSET 14
38-
#definedigitalPinToAnalogInput(p) ((p < NUM_ANALOG_INPUTS) ? (p) : (p) - ANALOG_INPUT_OFFSET)
3938

4039
#defineEXTERNAL_NUM_INTERRUPTS 48
4140

@@ -90,14 +89,14 @@ static const uint8_t SCL = PIN_WIRE_SCL;
9089

9190
#defineLED_BUILTIN (13)
9291

93-
#definePIN_A0 (17)
94-
#definePIN_A1 (16)
95-
#definePIN_A2 (15)
96-
#definePIN_A3 (14)
97-
#definePIN_A4 (26) // PF2 / AIN12
98-
#definePIN_A5 (27) // PF3 / AIN13
99-
#definePIN_A6 (18)
100-
#definePIN_A7 (19)
92+
#definePIN_A0 (0) // AIN3
93+
#definePIN_A1 (1) // AIN2
94+
#definePIN_A2 (2) // AIN1
95+
#definePIN_A3 (3) // AIN0
96+
#definePIN_A4 (4) // PF2 / AIN12
97+
#definePIN_A5 (5) // PF3 / AIN13
98+
#definePIN_A6 (6) // AIN5
99+
#definePIN_A7 (7) // AIN4
101100

102101
staticconstuint8_tA0=PIN_A0;
103102
staticconstuint8_tA1=PIN_A1;
@@ -321,9 +320,22 @@ const uint8_t PROGMEM digital_pin_to_timer[] = {
321320
NOT_ON_TIMER// 40 PF6 RESET
322321
};
323322

323+
constuint8_tPROGMEManalog_pin_to_channel[]= {
324+
3,
325+
2,
326+
1,
327+
0,
328+
12,
329+
13,
330+
5,
331+
4
332+
};
324333

325334
#endif
326335

336+
externconstuint8_tanalog_pin_to_channel[];
337+
#definedigitalPinToAnalogInput(p) ((p < NUM_ANALOG_INPUTS) ? pgm_read_byte(analog_pin_to_channel + p) : NOT_A_PIN )
338+
327339
// These serial port names are intended to allow libraries and architecture-neutral
328340
// sketches to automatically default to the correct port name for a particular type
329341
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp