Core2 for AWS IoT EduKit BSP 1.5.1
External Grove Connector Expansion Ports

The APIs for the side expansion ports wrap Espressif's peripherals APIs to simplify configuration and usage of GPIO, I2C, ADC, DAC, and UART. All GPIOs support digital read & write. The APIs provided are only for convenience and may not be sufficient for all peripherals that are plugged in. For accessing complete functionality of all the attached peripherals, visit Espressif's official documentation and view their examples on GitHub. Please note that using Espressif's examples would require changing the pin configurations to the match the available pins listed in the table below.

Port Pin Feature Helpful Macro Definition(s) to Access Pin
A 32 I2C SDA PORT_A_SDA_PIN or GPIO_NUM_32
A 33 I2C SCL PORT_A_SDA_PIN or GPIO_NUM_33
B 26 DAC PORT_B_DAC_PIN or GPIO_NUM_26
B 36 ADC PORT_B_ADC_PIN or GPIO_NUM_36
C 13 UART RX PORT_C_UART_RX_PIN or GPIO_NUM_13
C 14 UART TX PORT_C_UART_TX_PIN or GPIO_NUM_14

Circuit Block Diagram for the external Grove connector expansion ports

To enable this feature using KConfig, use the command pio run --environment core2foraws --target menuconfig from within the root of the project directoy in your PlatformIO terminal window and go to the menu Component Config --> Core2 for AWS features to set the features you want to enable.

Example

The example code sets GPIO 26 (same as PORT_B_DAC_PIN) as an input, creates a FreeRTOS task which periodically (1s) reads from GPIO 26 to see if a peripheral that outputs high on that line is connected. The task prints the returned value to the serial monitor.

#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_log.h"
#include "core2forAWS.h"
static const char *TAG = "INPUT_READ_DEMO";
void readInputTask(){
for(;;){
ESP_LOGI(TAG, "Sensor plugged in (0=no / 1=yes): %d", Core2ForAWS_Port_Read(GPIO_NUM_26));
vTaskDelay(pdMS_TO_TICKS(1000));
}
}
void app_main(void){
esp_err_t err = Core2ForAWS_Port_PinMode(GPIO_NUM_26, INPUT);
if(err == ESP_OK){
xTaskCreatePinnedToCore(readInputTask, "read_pin", 1024*4, NULL, 1, NULL, 1);
}
}
esp_err_t Core2ForAWS_Port_PinMode(gpio_num_t pin, pin_mode_t mode)
Sets the pin mode of the specified pin.
Definition: core2forAWS.c:431
void Core2ForAWS_Init(void)
Initializes the power chip with default values, enables battery charging, and initializes all enabled...
Definition: core2forAWS.c:32
bool Core2ForAWS_Port_Read(gpio_num_t pin)
Reads the value from a specified digital pin that's set as an input — either 1 (high) or 0 (low).
Definition: core2forAWS.c:502
Functions to initialize and access Core2 for AWS IoT EduKit hardware features.
@ INPUT
Set GPIO to input mode.
Definition: core2forAWS.h:215
#define TAG
Definition: i2c_device.c:10

Preprocessor Macros

Type Definitions

Enumerated Type Definitions

Functions