Skip to content

Commit

Permalink
[nRF52] bring up of Cozy Edition
Browse files Browse the repository at this point in the history
  • Loading branch information
lyusupov committed Sep 12, 2024
1 parent 81c519c commit 61eee26
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ Generic<br>NMEA|[Standalone](https://github.com/lyusupov/SoftRF/wiki/Standalone-
[MediaTek](https://en.wikipedia.org/wiki/MediaTek)<br>MT3339|1&nbsp;[**Raspberry**](https://github.com/lyusupov/SoftRF/wiki/Raspberry-Edition)<br>2&nbsp;[**Uni**](https://github.com/lyusupov/SoftRF/wiki/Uni-Edition)<br>3&nbsp;[**Academy**](https://github.com/lyusupov/SoftRF/wiki/Academy-Edition)<br>4&nbsp;[**Lego**](https://github.com/lyusupov/SoftRF/wiki/Lego-Edition)|Q3 2020|![](https://github.com/lyusupov/SoftRF/raw/master/documents/images/icon_good.png)|&nbsp;
[GOKE](http://www.goke.com/en/)<br>GK9501|[**Mini**](https://github.com/lyusupov/SoftRF/wiki/Mini-Edition)|Q3 2020|![](https://github.com/lyusupov/SoftRF/raw/master/documents/images/icon_good.png)|&nbsp;
[UniCore](https://en.unicorecomm.com/)<br>[UC6580](https://en.unicorecomm.com/products/detail/34)|[**Midi**](https://github.com/lyusupov/SoftRF/wiki/Midi-Edition)|Q3 2023|![](https://github.com/lyusupov/SoftRF/raw/master/documents/images/icon_may_need_imp.png)|&nbsp;
[Airoha](https://www.airoha.com/about)<br>[AG3335](https://www.airoha.com/products/p/xZqLkWq0jWqtWS1O)|**Card**|Q3 2024|![](https://github.com/lyusupov/SoftRF/raw/master/documents/images/icon_in_progress.png)|&nbsp;
[Airoha](https://www.airoha.com/about)<br>[AG3335](https://www.airoha.com/products/p/A0Dmm0pijWW3MScb)|**Card**|Q3 2024|![](https://github.com/lyusupov/SoftRF/raw/master/documents/images/icon_in_progress.png)|&nbsp;

# Documentation

Expand Down
1 change: 1 addition & 0 deletions software/firmware/source/SoftRF/src/driver/EEPROM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ void EEPROM_defaults()
NMEA_OFF :
hw_info.model == SOFTRF_MODEL_ACADEMY ||
hw_info.model == SOFTRF_MODEL_CARD ||
hw_info.model == SOFTRF_MODEL_COZY ||
hw_info.model == SOFTRF_MODEL_LEGO ?
NMEA_USB : NMEA_UART;
#endif
Expand Down
64 changes: 61 additions & 3 deletions software/firmware/source/SoftRF/src/platform/nRF52.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ static void TFT_off()

static void TFT_backlight_adjust(uint32_t pin, uint8_t level)
{
analogWrite(pin, level);
analogWrite(pin, 255 - level);
}
#endif /* USE_TFT */

Expand Down Expand Up @@ -624,6 +624,11 @@ SdFat uSD;
static bool uSD_is_attached = false;
#endif /* ENABLE_RECORDER */

#if !defined(EXCLUDE_LED_RING)
Adafruit_NeoPixel T114_Pixels = Adafruit_NeoPixel(2, SOC_GPIO_PIN_T114_LED,
NEO_GRB + NEO_KHZ800);
#endif /* EXCLUDE_LED_RING */

static void nRF52_setup()
{
ui = &ui_settings;
Expand Down Expand Up @@ -928,6 +933,8 @@ static void nRF52_setup()
digitalWrite(SOC_GPIO_PIN_T114_VEXT_EN, HIGH);
pinMode(SOC_GPIO_PIN_T114_VEXT_EN, OUTPUT);

delay(200);

digitalWrite(SOC_GPIO_PIN_T114_TFT_EN, LOW);
pinMode(SOC_GPIO_PIN_T114_TFT_EN, OUTPUT);
digitalWrite(SOC_GPIO_PIN_T114_TFT_BLGT, LOW);
Expand Down Expand Up @@ -1084,7 +1091,12 @@ static void nRF52_setup()
pinMode(SOC_GPIO_PIN_GNSS_T114_WKE, OUTPUT);

pinMode(SOC_GPIO_LED_T114_GREEN, OUTPUT);
digitalWrite(SOC_GPIO_LED_T114_GREEN, HIGH);
ledOn(SOC_GPIO_LED_T114_GREEN);

#if !defined(EXCLUDE_LED_RING)
T114_Pixels.begin();
T114_Pixels.show(); // Initialize all pixels to 'off'
#endif /* EXCLUDE_LED_RING */

lmic_pins.nss = SOC_GPIO_PIN_T114_SS;
lmic_pins.rst = SOC_GPIO_PIN_T114_RST;
Expand Down Expand Up @@ -1330,6 +1342,35 @@ static void nRF52_post_init()
}
#endif /* USE_EXT_I2S_DAC */
}

} else if (nRF52_board == NRF52_HELTEC_T114) {
Serial.println();
Serial.println(F("Heltec T114 Power-on Self Test"));
Serial.println();
Serial.flush();

Serial.println(F("Built-in components:"));

Serial.print(F("RADIO : "));
Serial.println(hw_info.rf == RF_IC_SX1262 ? F("PASS") : F("FAIL"));
Serial.flush();

Serial.println();
Serial.println(F("External components:"));

Serial.print(F("DISPLAY : "));
Serial.println(hw_info.display == DISPLAY_TFT_TTGO_135
? F("PASS") : F("N/A"));
Serial.flush();
Serial.print(F("GNSS : "));
Serial.println(hw_info.gnss != GNSS_MODULE_NONE ? F("PASS") : F("N/A"));
Serial.flush();

Serial.println();
Serial.println(F("Power-on Self Test is complete."));
Serial.println();
Serial.flush();

} else if (nRF52_board == NRF52_SEEED_T1000E) {
Serial.println();
Serial.println(F("Seeed T1000-E Power-on Self Test"));
Expand Down Expand Up @@ -1658,6 +1699,23 @@ static void nRF52_fini(int reason)
pinMode(SOC_GPIO_PIN_3V3_PWR, INPUT_PULLDOWN);
break;

case NRF52_HELTEC_T114:
digitalWrite(SOC_GPIO_PIN_GNSS_T114_RST, INPUT);
digitalWrite(SOC_GPIO_PIN_GNSS_T114_WKE, INPUT);

ledOff(SOC_GPIO_LED_T114_GREEN);
pinMode(SOC_GPIO_LED_T114_GREEN, INPUT);

pinMode(SOC_GPIO_PIN_T114_ADC_EN, INPUT);
pinMode(SOC_GPIO_PIN_T114_TFT_BLGT, INPUT);
pinMode(SOC_GPIO_PIN_T114_TFT_EN, INPUT);
pinMode(SOC_GPIO_PIN_T114_VEXT_EN, INPUT);

pinMode(SOC_GPIO_PIN_SFL_HOLD, INPUT);
pinMode(SOC_GPIO_PIN_SFL_WP, INPUT);
pinMode(SOC_GPIO_PIN_SFL_SS, INPUT);
break;

case NRF52_NORDIC_PCA10059:
default:
// ledOff(SOC_GPIO_LED_PCA10059_GREEN);
Expand Down Expand Up @@ -2308,7 +2366,7 @@ static byte nRF52_Display_setup()
/* Nothing to do */
} else if (nRF52_board == NRF52_HELTEC_T114) {
#if defined(USE_TFT)
#if SPI_INTERFACES_COUNT >= 2
#if SPI_INTERFACES_COUNT == 1
SPI1.setPins(SOC_GPIO_PIN_T114_TFT_MISO,
SOC_GPIO_PIN_T114_TFT_SCK,
SOC_GPIO_PIN_T114_TFT_MOSI);
Expand Down
2 changes: 1 addition & 1 deletion software/firmware/source/SoftRF/src/platform/nRF52.h
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ struct rst_info {
#define USE_BLE_MIDI
#define ENABLE_REMOTE_ID
#define USE_EXT_I2S_DAC
//#define USE_TFT
#define USE_TFT
//#define ENABLE_RECORDER
#else
#undef USE_EPAPER
Expand Down
2 changes: 2 additions & 0 deletions software/firmware/source/libraries/TFT_eSPI/TFT_eSPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5400,7 +5400,9 @@ void TFT_eSPI::getSetup(setup_t &tft_settings)
tft_settings.tft_rd_freq = SPI_READ_FREQUENCY/100000;
#endif
#ifdef TFT_SPI_PORT
#if !defined(ARDUINO_ARCH_NRF52)
tft_settings.port = TFT_SPI_PORT;
#endif
#else
tft_settings.port = 255;
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,7 @@
#undef LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
#undef SMOOTH_FONT

extern SPIClass SPI1;
#define TFT_SPI_PORT SPI1
#define SPI_FREQUENCY 27000000
#define SPI_TOUCH_FREQUENCY 2500000

1 comment on commit 61eee26

@lyusupov
Copy link
Owner Author

Choose a reason for hiding this comment

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

image

Please sign in to comment.