Skip to content

Commit

Permalink
Master5.1 s3 gpio48 and platform txt review (#8726)
Browse files Browse the repository at this point in the history
* variants + S3 GPIO48

* fixes unphone8.build.flash_type

* fixes unphone8.build.flash_type

* heltec board name issue step 1

* heltec board name issue step 2

* fixes defines and new boards

* final review
  • Loading branch information
SuGlider authored Oct 6, 2023
1 parent 709c935 commit ab6a25e
Show file tree
Hide file tree
Showing 214 changed files with 557 additions and 1,898 deletions.
2 changes: 1 addition & 1 deletion boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23802,7 +23802,7 @@ unphone8.build.partitions=default_8MB
unphone8.build.defines=-DBOARD_HAS_PSRAM -DUNPHONE_SPIN=8
unphone8.build.loop_core=-DARDUINO_RUNNING_CORE=1
unphone8.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1
unphone8.build.flash_type=qspi
unphone8.build.flash_type=qio
unphone8.build.psram_type=qspi
unphone8.build.memory_type={build.flash_type}_{build.psram_type}

Expand Down
12 changes: 12 additions & 0 deletions cores/esp32/Arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,18 @@
#define NOT_AN_INTERRUPT -1
#define NOT_ON_TIMER 0

// some defines generic for all SoC moved from variants/board_name/pins_arduino.h
#define NUM_DIGITAL_PINS SOC_GPIO_PIN_COUNT // All GPIOs
#if SOC_ADC_PERIPH_NUM == 1
#define NUM_ANALOG_INPUTS (SOC_ADC_CHANNEL_NUM(0)) // Depends on the SoC (ESP32C6, ESP32H2, ESP32C2, ESP32P4)
#elif SOC_ADC_PERIPH_NUM == 2
#define NUM_ANALOG_INPUTS (SOC_ADC_CHANNEL_NUM(0)+SOC_ADC_CHANNEL_NUM(1)) // Depends on the SoC (ESP32, ESP32S2, ESP32S3, ESP32C3)
#endif
#define EXTERNAL_NUM_INTERRUPTS NUM_DIGITAL_PINS // All GPIOs
#define analogInputToDigitalPin(p) (((p)<NUM_ANALOG_INPUTS)?(analogChannelToDigitalPin(p)):-1)
#define digitalPinToInterrupt(p) (((p)<NUM_DIGITAL_PINS)?(p):NOT_AN_INTERRUPT)
#define digitalPinHasPWM(p) ((p)<NUM_DIGITAL_PINS)

typedef bool boolean;
typedef uint8_t byte;
typedef unsigned int word;
Expand Down
3 changes: 3 additions & 0 deletions cores/esp32/esp32-hal-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ extern void __attachInterruptFunctionalArg(uint8_t pin, voidFuncPtrArg userFunc,
{
static bool interrupt_initialized = false;

// makes sure that pin -1 (255) will never work -- this follows Arduino standard
if (pin >= SOC_GPIO_PIN_COUNT) return;

if(!interrupt_initialized) {
esp_err_t err = gpio_install_isr_service((int)ARDUINO_ISR_FLAG);
interrupt_initialized = (err == ESP_OK) || (err == ESP_ERR_INVALID_STATE);
Expand Down
12 changes: 3 additions & 9 deletions variants/AirM2M_CORE_ESP32C3/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,10 @@

#include <stdint.h>

#define EXTERNAL_NUM_INTERRUPTS 22
#define NUM_DIGITAL_PINS 22
#define NUM_ANALOG_INPUTS 6

#define analogInputToDigitalPin(p) (((p)<NUM_ANALOG_INPUTS)?(analogChannelToDigitalPin(p)):-1)
#define digitalPinToInterrupt(p) (((p)<NUM_DIGITAL_PINS)?(p):-1)
#define digitalPinHasPWM(p) (p < EXTERNAL_NUM_INTERRUPTS)

static const uint8_t LED_BUILTIN = 12;
#define BUILTIN_LED LED_BUILTIN
#define BUILTIN_LED LED_BUILTIN // backward compatibility
#define LED_BUILTIN LED_BUILTIN // allow testing #ifdef LED_BUILTIN

static const uint8_t LED_BUILTIN_AUX = 13;

static const uint8_t TX = 21;
Expand Down
9 changes: 0 additions & 9 deletions variants/Aventen_S3_Sync/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,13 @@
#define Pins_Arduino_h

#include <stdint.h>
#include "soc/soc_caps.h"

#define USB_VID 0x303a
#define USB_PID 0x1001
#define USB_MANUFACTURER "Aventen"
#define USB_PRODUCT "Aventen S3 Sync"
#define USB_SERIAL ""

#define NUM_DIGITAL_PINS SOC_GPIO_PIN_COUNT // GPIO 0..48
#define NUM_ANALOG_INPUTS 20 // GPIO 1..20
#define EXTERNAL_NUM_INTERRUPTS NUM_DIGITAL_PINS // All GPIOs

#define analogInputToDigitalPin(p) (((p)<NUM_ANALOG_INPUTS)?(analogChannelToDigitalPin(p)):-1)
#define digitalPinToInterrupt(p) (((p)<NUM_DIGITAL_PINS)?(p):NOT_AN_INTERRUPT)
#define digitalPinHasPWM(p) (p < NUM_DIGITAL_PINS)

static const uint8_t TX = 43;
static const uint8_t RX = 44;

Expand Down
17 changes: 9 additions & 8 deletions variants/Bee_Data_Logger/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,14 @@
#define Pins_Arduino_h

#include <stdint.h>
#include "soc/soc_caps.h"

#define USB_VID 0x303A
#define USB_PID 0x815C
#define USB_MANUFACTURER "Smart Bee Designs"
#define USB_PRODUCT "Bee Data Logger"
#define USB_SERIAL ""

#define EXTERNAL_NUM_INTERRUPTS 46
#define NUM_DIGITAL_PINS 13
#define NUM_ANALOG_INPUTS 7

#define analogInputToDigitalPin(p) (((p)<20)?(analogChannelToDigitalPin(p)):-1)
#define digitalPinToInterrupt(p) (((p)<48)?(p):-1)
#define digitalPinHasPWM(p) (p < 46)

static const uint8_t TX = 43;
static const uint8_t RX = 44;

Expand Down Expand Up @@ -74,5 +67,13 @@ static const uint8_t LDO2 = 34;
static const uint8_t RGB_DATA = 40;
static const uint8_t RGB_PWR = 34;

#define PIN_NEOPIXEL RGB_DATA
// BUILTIN_LED can be used in new Arduino API digitalWrite() like in Blink.ino
static const uint8_t LED_BUILTIN = SOC_GPIO_PIN_COUNT+PIN_NEOPIXEL;
#define BUILTIN_LED LED_BUILTIN // backward compatibility
#define LED_BUILTIN LED_BUILTIN // allow testing #ifdef LED_BUILTIN
// RGB_BUILTIN and RGB_BRIGHTNESS can be used in new Arduino API neopixelWrite()
#define RGB_BUILTIN LED_BUILTIN
#define RGB_BRIGHTNESS 64

#endif /* Pins_Arduino_h */
8 changes: 0 additions & 8 deletions variants/Bee_Motion/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@
#define USB_PRODUCT "Bee Motion S3"
#define USB_SERIAL ""

#define EXTERNAL_NUM_INTERRUPTS 46
#define NUM_DIGITAL_PINS 21
#define NUM_ANALOG_INPUTS 12

#define analogInputToDigitalPin(p) (((p)<20)?(analogChannelToDigitalPin(p)):-1)
#define digitalPinToInterrupt(p) (((p)<48)?(p):-1)
#define digitalPinHasPWM(p) (p < 46)

static const uint8_t TX = 43;
static const uint8_t RX = 44;

Expand Down
22 changes: 13 additions & 9 deletions variants/Bee_Motion_Mini/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,26 @@

#include <stdint.h>


#define EXTERNAL_NUM_INTERRUPTS 4
#define NUM_DIGITAL_PINS 4
#define NUM_ANALOG_INPUTS 2

#define analogInputToDigitalPin(p) (((p)<6)?(analogChannelToDigitalPin(p)):-1)
#define digitalPinToInterrupt(p) (((p)<22)?(p):-1)
#define digitalPinHasPWM(p) (p < 22)

static const uint8_t TX = 21;
static const uint8_t RX = 20;

static const uint8_t BOOT_BTN = 9;
static const uint8_t PIR = 5;

static const uint8_t SDA = 8;
static const uint8_t SCL = 9;

static const uint8_t SS = 7;
static const uint8_t MOSI = 6;
static const uint8_t MISO = 5;
static const uint8_t SCK = 4;

static const uint8_t A0 = 0;
static const uint8_t A1 = 1;
static const uint8_t A2 = 2;
static const uint8_t A3 = 3;
static const uint8_t A4 = 4;
static const uint8_t A5 = 5;

#endif /* Pins_Arduino_h */

17 changes: 9 additions & 8 deletions variants/Bee_Motion_S3/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,14 @@
#define Pins_Arduino_h

#include <stdint.h>
#include "soc/soc_caps.h"

#define USB_VID 0x303A
#define USB_PID 0x8113
#define USB_MANUFACTURER "Smart Bee Designs"
#define USB_PRODUCT "Bee Motion S3"
#define USB_SERIAL ""

#define EXTERNAL_NUM_INTERRUPTS 46
#define NUM_DIGITAL_PINS 27
#define NUM_ANALOG_INPUTS 11

#define analogInputToDigitalPin(p) (((p)<20)?(analogChannelToDigitalPin(p)):-1)
#define digitalPinToInterrupt(p) (((p)<48)?(p):-1)
#define digitalPinHasPWM(p) (p < 46)

static const uint8_t TX = 43;
static const uint8_t RX = 44;

Expand Down Expand Up @@ -81,5 +74,13 @@ static const uint8_t LDO2 = 34;
static const uint8_t RGB_DATA = 40;
static const uint8_t RGB_PWR = 34;

#define PIN_NEOPIXEL RGB_DATA
// BUILTIN_LED can be used in new Arduino API digitalWrite() like in Blink.ino
static const uint8_t LED_BUILTIN = SOC_GPIO_PIN_COUNT+PIN_NEOPIXEL;
#define BUILTIN_LED LED_BUILTIN // backward compatibility
#define LED_BUILTIN LED_BUILTIN // allow testing #ifdef LED_BUILTIN
// RGB_BUILTIN and RGB_BRIGHTNESS can be used in new Arduino API neopixelWrite()
#define RGB_BUILTIN LED_BUILTIN
#define RGB_BRIGHTNESS 64

#endif /* Pins_Arduino_h */
18 changes: 10 additions & 8 deletions variants/Bee_S3/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,14 @@
#define Pins_Arduino_h

#include <stdint.h>
#include "soc/soc_caps.h"

#define USB_VID 0x303A
#define USB_PID 0x8110
#define USB_MANUFACTURER "Smart Bee Designs"
#define USB_PRODUCT "BeeS3"
#define USB_SERIAL ""

#define EXTERNAL_NUM_INTERRUPTS 45
#define NUM_DIGITAL_PINS 15
#define NUM_ANALOG_INPUTS 8

#define analogInputToDigitalPin(p) (((p)<20)?(analogChannelToDigitalPin(p)):-1)
#define digitalPinToInterrupt(p) (((p)<48)?(p):-1)
#define digitalPinHasPWM(p) (p < 46)

static const uint8_t TX = 43;
static const uint8_t RX = 44;

Expand Down Expand Up @@ -73,4 +66,13 @@ static const uint8_t VBAT_VOLTAGE = 1;
static const uint8_t RGB_DATA = 48;
static const uint8_t RGB_PWR = 34;

#define PIN_NEOPIXEL RGB_DATA
// BUILTIN_LED can be used in new Arduino API digitalWrite() like in Blink.ino
static const uint8_t LED_BUILTIN = SOC_GPIO_PIN_COUNT+PIN_NEOPIXEL;
#define BUILTIN_LED LED_BUILTIN // backward compatibility
#define LED_BUILTIN LED_BUILTIN // allow testing #ifdef LED_BUILTIN
// RGB_BUILTIN and RGB_BRIGHTNESS can be used in new Arduino API neopixelWrite()
#define RGB_BUILTIN LED_BUILTIN
#define RGB_BRIGHTNESS 64

#endif /* Pins_Arduino_h */
12 changes: 1 addition & 11 deletions variants/ET-Board/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,9 @@

#include <stdint.h>

#define EXTERNAL_NUM_INTERRUPTS 16
#define NUM_DIGITAL_PINS 40
#define NUM_ANALOG_INPUTS 7

#define analogInputToDigitalPin(p) (((p)<20)?(analogChannelToDigitalPin(p)):-1)
#define digitalPinToInterrupt(p) (((p)<40)?(p):-1)
#define digitalPinHasPWM(p) (p < 34)

static const uint8_t LED_BUILTIN = 5;
#define BUILTIN_LED LED_BUILTIN // backward compatibility
#define LED_BUILTIN LED_BUILTIN


#define LED_BUILTIN LED_BUILTIN // allow testing #ifdef LED_BUILTIN

static const uint8_t TX = 34;
static const uint8_t RX = 35;
Expand Down
8 changes: 0 additions & 8 deletions variants/Edgebox-ESP-100/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@

#include <stdint.h>

#define EXTERNAL_NUM_INTERRUPTS 34
#define NUM_DIGITAL_PINS 34
#define NUM_ANALOG_INPUTS 2

#define analogInputToDigitalPin(p) (((p)<2)?(analogChannelToDigitalPin(p)):-1)
#define digitalPinToInterrupt(p) (((p)<34)?(p):-1)
#define digitalPinHasPWM(p) (p < 34)

//Programming and Debugging Port
static const uint8_t TXD = 43;
static const uint8_t RXD = 44;
Expand Down
10 changes: 1 addition & 9 deletions variants/Microduino-esp32/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,9 @@

#include <stdint.h>

#define EXTERNAL_NUM_INTERRUPTS 16
#define NUM_DIGITAL_PINS 22
#define NUM_ANALOG_INPUTS 12

#define analogInputToDigitalPin(p) (((p)<20)?(analogChannelToDigitalPin(p)):-1)
#define digitalPinToInterrupt(p) (((p)<40)?(p):-1)
#define digitalPinHasPWM(p) (p < 34)

static const uint8_t LED_BUILTIN = -1;
#define BUILTIN_LED LED_BUILTIN // backward compatibility
#define LED_BUILTIN LED_BUILTIN
#define LED_BUILTIN LED_BUILTIN // allow testing #ifdef LED_BUILTIN

#define MTDO 15
#define MTDI 12
Expand Down
14 changes: 3 additions & 11 deletions variants/Nebula_S3/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,14 @@
#define Pins_Arduino_h

#include <stdint.h>
#include "soc/soc_caps.h"

#define USB_VID 0x303a
#define USB_PID 0x1001

#define EXTERNAL_NUM_INTERRUPTS 20
#define NUM_DIGITAL_PINS 20
#define NUM_ANALOG_INPUTS 6

#define analogInputToDigitalPin(p) (((p)<6)?(analogChannelToDigitalPin(p)):-1)
#define digitalPinToInterrupt(p) (((p)<20)?(p):-1)
#define digitalPinHasPWM(p) (p < 20)


static const uint8_t LED_BUILTIN = 45;
static const uint8_t LED_BUILTIN = SOC_GPIO_PIN_COUNT + 45;
#define BUILTIN_LED LED_BUILTIN // backward compatibility
#define LED_BUILTIN LED_BUILTIN
#define LED_BUILTIN LED_BUILTIN // allow testing #ifdef LED_BUILTIN
#define RGB_BUILTIN LED_BUILTIN
#define RGB_BRIGHTNESS 64

Expand Down
10 changes: 1 addition & 9 deletions variants/S_ODI_Ultra_v1/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,10 @@

#include <stdint.h>

#define EXTERNAL_NUM_INTERRUPTS 16
#define NUM_DIGITAL_PINS 40
#define NUM_ANALOG_INPUTS 16

#define analogInputToDigitalPin(p) (((p)<20)?(analogChannelToDigitalPin(p)):-1)
#define digitalPinToInterrupt(p) (((p)<40)?(p):-1)
#define digitalPinHasPWM(p) (p < 34)

static const uint8_t LED_BUILTIN = 2;
static const uint8_t LED_BUILTINB = 4;
#define BUILTIN_LED LED_BUILTIN // backward compatibility
#define LED_BUILTIN LED_BUILTIN
#define LED_BUILTIN LED_BUILTIN // allow testing #ifdef LED_BUILTIN
#define BUILTIN_LED2 LED_BUILTINB

static const uint8_t TX = 1;
Expand Down
8 changes: 0 additions & 8 deletions variants/VALTRACK_V4_MFW_ESP32_C3/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@

#include <stdint.h>

#define EXTERNAL_NUM_INTERRUPTS 22
#define NUM_DIGITAL_PINS 22
#define NUM_ANALOG_INPUTS 6

#define analogInputToDigitalPin(p) (((p)<NUM_ANALOG_INPUTS)?(analogChannelToDigitalPin(p)):-1)
#define digitalPinToInterrupt(p) (((p)<NUM_DIGITAL_PINS)?(p):-1)
#define digitalPinHasPWM(p) (p < EXTERNAL_NUM_INTERRUPTS)

static const uint8_t TX = 21;
static const uint8_t RX = 20;

Expand Down
8 changes: 0 additions & 8 deletions variants/VALTRACK_V4_VTS_ESP32_C3/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@

#include <stdint.h>

#define EXTERNAL_NUM_INTERRUPTS 22
#define NUM_DIGITAL_PINS 22
#define NUM_ANALOG_INPUTS 6

#define analogInputToDigitalPin(p) (((p)<NUM_ANALOG_INPUTS)?(analogChannelToDigitalPin(p)):-1)
#define digitalPinToInterrupt(p) (((p)<NUM_DIGITAL_PINS)?(p):-1)
#define digitalPinHasPWM(p) (p < EXTERNAL_NUM_INTERRUPTS)

static const uint8_t TX = 21;
static const uint8_t RX = 20;

Expand Down
8 changes: 0 additions & 8 deletions variants/XIAO_ESP32C3/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@

#include <stdint.h>

#define EXTERNAL_NUM_INTERRUPTS 22
#define NUM_DIGITAL_PINS 22
#define NUM_ANALOG_INPUTS 6

#define analogInputToDigitalPin(p) (((p)<NUM_ANALOG_INPUTS)?(analogChannelToDigitalPin(p)):-1)
#define digitalPinToInterrupt(p) (((p)<NUM_DIGITAL_PINS)?(p):-1)
#define digitalPinHasPWM(p) (p < EXTERNAL_NUM_INTERRUPTS)

static const uint8_t TX = 21;
static const uint8_t RX = 20;

Expand Down
Loading

0 comments on commit ab6a25e

Please sign in to comment.