Skip to content

Commit

Permalink
Added RAK4631 e-ink display support
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobeva committed May 20, 2024
1 parent f3558b6 commit 055083f
Show file tree
Hide file tree
Showing 6 changed files with 2,181 additions and 326 deletions.
17 changes: 3 additions & 14 deletions Bluetooth.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

#if MCU_VARIANT == MCU_ESP32


#elif MCU_VARIANT == MCU_NRF52
#endif

#if MCU_VARIANT == MCU_ESP32
#if HAS_BLUETOOTH == true
#include "BluetoothSerial.h"
Expand Down Expand Up @@ -265,6 +259,8 @@ void bt_disable_pairing() {

void bt_pairing_complete(uint16_t conn_handle, uint8_t auth_status) {
if (auth_status == BLE_GAP_SEC_STATUS_SUCCESS) {
bt_state = BT_STATE_CONNECTED;
cable_state = CABLE_STATE_DISCONNECTED;
bt_disable_pairing();
} else {
bt_ssp_pin = 0;
Expand All @@ -285,11 +281,6 @@ bool bt_passkey_callback(uint16_t conn_handle, uint8_t const passkey[6], bool ma
return false;
}

void bt_connect_callback(uint16_t conn_handle) {
bt_state = BT_STATE_CONNECTED;
cable_state = CABLE_STATE_DISCONNECTED;
}

void bt_disconnect_callback(uint16_t conn_handle, uint8_t reason) {
bt_state = BT_STATE_ON;
}
Expand All @@ -308,10 +299,9 @@ bool bt_setup_hw() {
Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
Bluefruit.autoConnLed(false);
if (Bluefruit.begin()) {
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
Bluefruit.setTxPower(8); // Check bluefruit.h for supported values
Bluefruit.Security.setIOCaps(true, true, false);
Bluefruit.Security.setPairPasskeyCallback(bt_passkey_callback);
Bluefruit.Periph.setConnectCallback(bt_connect_callback);
Bluefruit.Periph.setDisconnectCallback(bt_disconnect_callback);
Bluefruit.Security.setPairCompleteCallback(bt_pairing_complete);
const ble_gap_addr_t gap_addr = Bluefruit.getAddr();
Expand Down Expand Up @@ -348,7 +338,6 @@ void bt_start() {

blebas.begin();

// non-connectable advertising
Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
Bluefruit.Advertising.addTxPower();

Expand Down
24 changes: 22 additions & 2 deletions Boards.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
#define BOARD_GENERIC_NRF52 0x50
#define BOARD_RAK4631 0x51

#define OLED 0x01
#define EINK_BW 0x02
#define EINK_3C 0x03

#if defined(__AVR_ATmega1284P__)
#define PLATFORM PLATFORM_AVR
#define MCU_VARIANT MCU_1284P
Expand Down Expand Up @@ -147,6 +151,7 @@

#elif BOARD_MODEL == BOARD_TBEAM
#define HAS_DISPLAY true
#define DISPLAY OLED
#define HAS_PMU true
#define HAS_BLUETOOTH true
#define HAS_BLE true
Expand Down Expand Up @@ -184,6 +189,7 @@

#elif BOARD_MODEL == BOARD_LORA32_V1_0
#define HAS_DISPLAY true
#define DISPLAY OLED
#define HAS_BLUETOOTH true
#define HAS_BLE true
#define HAS_CONSOLE true
Expand All @@ -201,6 +207,7 @@

#elif BOARD_MODEL == BOARD_LORA32_V2_0
#define HAS_DISPLAY true
#define DISPLAY OLED
#define HAS_BLUETOOTH true
#define HAS_BLE true
#define HAS_CONSOLE true
Expand All @@ -218,6 +225,7 @@

#elif BOARD_MODEL == BOARD_LORA32_V2_1
#define HAS_DISPLAY true
#define DISPLAY OLED
#define HAS_BLUETOOTH true
#define HAS_BLE true
#define HAS_PMU true
Expand All @@ -239,6 +247,7 @@

#elif BOARD_MODEL == BOARD_HELTEC32_V2
#define HAS_DISPLAY true
#define DISPLAY OLED
#define HAS_BLUETOOTH true
#define HAS_CONSOLE true
#define HAS_EEPROM true
Expand Down Expand Up @@ -292,6 +301,7 @@

#elif BOARD_MODEL == BOARD_RNODE_NG_20
#define HAS_DISPLAY true
#define DISPLAY OLED
#define HAS_BLUETOOTH true
#define HAS_NP true
#define HAS_CONSOLE true
Expand All @@ -312,6 +322,7 @@

#elif BOARD_MODEL == BOARD_RNODE_NG_21
#define HAS_DISPLAY true
#define DISPLAY OLED
#define HAS_BLUETOOTH true
#define HAS_CONSOLE true
#define HAS_PMU true
Expand Down Expand Up @@ -346,6 +357,7 @@
#define HAS_TCXO true

#define HAS_DISPLAY true
#define DISPLAY OLED
#define HAS_CONSOLE false
#define HAS_BLUETOOTH false
#define HAS_BLE true
Expand Down Expand Up @@ -397,11 +409,12 @@
#elif MCU_VARIANT == MCU_NRF52
#if BOARD_MODEL == BOARD_RAK4631
#define HAS_EEPROM false
#define HAS_DISPLAY false
#define HAS_DISPLAY true
#define DISPLAY EINK_3C
#define HAS_BLUETOOTH false
#define HAS_BLE true
#define HAS_CONSOLE false
#define HAS_PMU false
#define HAS_PMU true
#define HAS_NP false
#define HAS_SD false
#define HAS_TCXO true
Expand All @@ -425,6 +438,13 @@
const int pin_miso = 45;
const int pin_busy = 46;
const int pin_dio = 47;

const int pin_disp_cs = SS;
const int pin_disp_dc = WB_IO1;
const int pin_disp_reset = -1;
const int pin_disp_busy = WB_IO4;
const int pin_disp_en = WB_IO2;

const int pin_led_rx = LED_BLUE;
const int pin_led_tx = LED_GREEN;
const int pin_tcxo_enable = -1;
Expand Down
Loading

0 comments on commit 055083f

Please sign in to comment.