Skip to content
Snippets Groups Projects
Commit 2cf6ca5f authored by q3k's avatar q3k
Browse files

*: kill proto1 support

We have newer badges available for everyone to develop against, and p1
is so different from everything else that it's really not worth
maintaining support for it anymore.
parent e4aad2b6
No related branches found
No related tags found
No related merge requests found
......@@ -4,17 +4,6 @@ stages:
variables:
GIT_SUBMODULE_STRATEGY: recursive
build-p1:
stage: build
tags:
- nixos
script:
- nix-shell nix/shell.nix --command "idf.py -g p1 build"
artifacts:
expose_as: 'Proto 1 ELF'
paths: ['build/badge23.elf']
expire_in: 5 hours
build-p3:
stage: build
tags:
......
......@@ -17,7 +17,6 @@
#define AFE_INCR_CAP 1000
#if defined(CONFIG_FLOW3R_HW_GEN_P3) || defined(CONFIG_FLOW3R_HW_GEN_P4) || defined(CONFIG_FLOW3R_HW_GEN_P6)
static const uint8_t top_map[] = {0, 0, 0, 2, 2, 2, 6, 6, 6, 4, 4, 4};
static const uint8_t top_stages = 12;
static const uint8_t bot_map[] = {1, 1, 3, 3, 5, 7, 7, 9, 9, 8, 8, 8};
......@@ -26,21 +25,6 @@ static const uint8_t bot_stage_config[] = {0,1,2,3,5,6,7,8,9,10,11,12};
#define DEFAULT_THRES_TOP 8000
#define DEFAULT_THRES_BOT 12000
#elif defined(CONFIG_FLOW3R_HW_GEN_P1)
static const uint8_t top_map[] = {2, 2, 2, 0, 0, 8, 8, 8, 6, 6, 4, 4};
static const uint8_t top_stages = 12;
static const uint8_t bot_map[] = {1, 1, 3, 3, 5, 5, 7, 7, 9, 9};
static const uint8_t bot_stages = 10;
static const uint8_t top_segment_map[] = {1,2,0,1,2,1,2,0,1,2,1,2}; //idk
static const uint8_t bot_segment_map[] = {3,0,3,0,3,0,0,3,0,3}; //idk
static const uint8_t bot_stage_config[] = {0,1,2,3,4,5,6,7,8,9,10,11};
#define DEFAULT_THRES_TOP 2000
#define DEFAULT_THRES_BOT 12000
#else
#error "captouch not implemented for this badge generation"
#endif
#if defined(CONFIG_FLOW3R_HW_GEN_P4)
static const uint8_t top_segment_map[] = {1,3,2,2,3,1,1,3,2,1,3,2}; //PETAL_PAD_*
static const uint8_t bot_segment_map[] = {3,0,3,0,0,0,3,0,3,1,2,3}; //PETAL_PAD_*
......
......@@ -9,7 +9,6 @@ idf_component_register(
flow3r_bsp_max98091.c
flow3r_bsp_leds.c
flow3r_bsp_rmtled.c
flow3r_bsp_spiled.c
flow3r_bsp_spio.c
INCLUDE_DIRS
.
......
......@@ -2,15 +2,6 @@ menu "Flow3r Config"
choice FLOW3R_HW_GEN
prompt "Badge23 Hardware Generation"
default FLOW3R_HW_GEN_P4
config FLOW3R_HW_GEN_P1
help
Protoype version 1, a.k.a. proto1. Very early protoype.
Visual identifiers:
- No line in/out jacks
- White bottom board
- USB-C jack points side of leaf
select FLOW3R_ESP32S3
bool "Prototype 1"
config FLOW3R_HW_GEN_P3
help
Prototype version 3, a.k.a. proto3
......
......@@ -9,8 +9,6 @@ esp_err_t flow3r_bsp_audio_write(const void *src, size_t size, size_t *bytes_wri
return i2s_write(0, src, size, bytes_written, ticks_to_wait);
}
#if defined(CONFIG_FLOW3R_HW_GEN_P3) || defined(CONFIG_FLOW3R_HW_GEN_P4) || defined(CONFIG_FLOW3R_HW_GEN_P6)
#include "flow3r_bsp_max98091.h"
void flow3r_bsp_audio_init(void) {
......@@ -80,85 +78,3 @@ void flow3r_bsp_audio_register_poke(uint8_t reg, uint8_t data) {
esp_err_t flow3r_bsp_audio_read(void *dest, size_t size, size_t *bytes_read, TickType_t ticks_to_wait) {
return i2s_read(0, dest, size, bytes_read, ticks_to_wait);
}
#elif defined(CONFIG_FLOW3R_HW_GEN_P1)
void flow3r_bsp_audio_init(void) {
static const i2s_config_t i2s_config = {
.mode = I2S_MODE_MASTER | I2S_MODE_TX,
.sample_rate = FLOW3R_BSP_AUDIO_SAMPLE_RATE,
.bits_per_sample = 16,
.channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT,
.communication_format = I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_MSB,
.intr_alloc_flags = 0, // default interrupt priority
.dma_buf_count = FLOW3R_BSP_AUDIO_DMA_BUFFER_COUNT,
.dma_buf_len = FLOW3R_BSP_AUDIO_DMA_BUFFER_SIZE,
.use_apll = false
};
static const i2s_pin_config_t pin_config = {
.bck_io_num = 13,
.mck_io_num = 11,
.ws_io_num = 12,
.data_out_num = 14,
.data_in_num = I2S_PIN_NO_CHANGE,
};
ESP_ERROR_CHECK(i2s_driver_install(0, &i2s_config, 0, NULL));
i2s_set_pin(0, &pin_config);
ESP_LOGE(TAG, "Prototype1 has a very limited audio codec, most features will not work! Get a newer hardware revision.");
}
float flow3r_bsp_audio_headphones_set_volume(bool mute, float dB) {
// Not supported in this generation.
return 0.0;
}
float flow3r_bsp_audio_speaker_set_volume(bool mute, float dB) {
return 0.0;
}
void flow3r_bsp_audio_headset_set_gain_dB(uint8_t gain_dB) {
// Not supported in this generation.
}
void flow3r_bsp_audio_read_jacksense(flow3r_bsp_audio_jacksense_state_t *st) {
// Not supported in this generation.
st->headphones = false;
st->headset = false;
}
void flow3r_bsp_audio_input_set_source(flow3r_bsp_audio_input_source_t source) {
// Not supported in this generation.
}
void flow3r_bsp_audio_headphones_line_in_set_hardware_thru(bool enable) {
// Not supported in this generation.
}
void flow3r_bsp_audio_speaker_line_in_set_hardware_thru(bool enable) {
// Not supported in this generation.
}
void flow3r_bsp_audio_line_in_set_hardware_thru(bool enable) {
// Not supported in this generation.
}
bool flow3r_bsp_audio_has_hardware_mute(void) {
return false;
}
void flow3r_bsp_audio_register_poke(uint8_t reg, uint8_t data) {
// Not supported in this generation.
}
esp_err_t flow3r_bsp_audio_read(void *dest, size_t size, size_t *bytes_read, TickType_t ticks_to_wait) {
// Not supported in this generation. But pretend we've read silence.
memset(dest, 0, size);
*bytes_read = size;
return ESP_OK;
}
#else
#error "audio not implemented for this badge generation"
#endif
......@@ -9,22 +9,6 @@
static const char *TAG = "flow3r-bsp-display";
#if defined(CONFIG_FLOW3R_HW_GEN_P1)
#define FLOW3R_BSP_GC9A01
flow3r_bsp_gc9a01_config_t gc9a01_config = {
.reset_used = 1,
.backlight_used = 0,
.pin_rst = 38,
.pin_sck = 39,
.pin_mosi = 41,
.pin_cs = 40,
.pin_dc = 42,
.host = 2,
};
#elif defined(CONFIG_FLOW3R_HW_GEN_P3) || defined(CONFIG_FLOW3R_HW_GEN_P4) || defined(CONFIG_FLOW3R_HW_GEN_P6)
#define FLOW3R_BSP_GC9A01
flow3r_bsp_gc9a01_config_t gc9a01_config = {
.reset_used = 0,
.backlight_used = 1,
......@@ -37,11 +21,6 @@ flow3r_bsp_gc9a01_config_t gc9a01_config = {
.host = 2,
};
#else
#error "display unimplemented for this badge generation"
#endif
#ifdef FLOW3R_BSP_GC9A01
static flow3r_bsp_gc9a01_t gc9a01;
static uint8_t gc9a01_initialized = 0;
......@@ -83,4 +62,3 @@ void flow3r_bsp_display_set_backlight(uint8_t percent) {
}
flow3r_bsp_gc9a01_backlight_set(&gc9a01, percent);
}
#endif
\ No newline at end of file
#include "sdkconfig.h"
#if defined(CONFIG_FLOW3R_HW_GEN_P1)
const char *flow3r_bsp_hw_name = "proto1";
#elif defined(CONFIG_FLOW3R_HW_GEN_P3)
#if defined(CONFIG_FLOW3R_HW_GEN_P3)
const char *flow3r_bsp_hw_name = "proto3";
#elif defined(CONFIG_FLOW3R_HW_GEN_P4)
const char *flow3r_bsp_hw_name = "proto4";
......
......@@ -11,14 +11,7 @@ static SemaphoreHandle_t mutex;
static const char *TAG = "flow3r-bsp-i2c";
#if defined(CONFIG_FLOW3R_HW_GEN_P1)
const flow3r_i2c_addressdef flow3r_i2c_addresses = {
.codec = 0, // p1 has no i2c control channel to codec.
.touch_top = 0x2d,
.touch_bottom = 0x2c,
.portexp = { 0x6e, 0x6d },
};
#elif defined(CONFIG_FLOW3R_HW_GEN_P3)
#if defined(CONFIG_FLOW3R_HW_GEN_P3)
const flow3r_i2c_addressdef flow3r_i2c_addresses = {
.codec = 0x10,
.touch_top = 0x2d,
......@@ -43,7 +36,6 @@ const flow3r_i2c_addressdef flow3r_i2c_addresses = {
#error "i2c not implemented for this badge generation"
#endif
#if defined(CONFIG_FLOW3R_HW_GEN_P3) || defined(CONFIG_FLOW3R_HW_GEN_P4) || defined(CONFIG_FLOW3R_HW_GEN_P6)
static i2c_config_t i2c_conf = {
.mode = I2C_MODE_MASTER,
.sda_io_num = 2,
......@@ -52,18 +44,6 @@ static i2c_config_t i2c_conf = {
.scl_pullup_en = GPIO_PULLUP_ENABLE,
.master.clk_speed = 400000,
};
#elif defined(CONFIG_FLOW3R_HW_GEN_P1)
static i2c_config_t i2c_conf = {
.mode = I2C_MODE_MASTER,
.sda_io_num = 10,
.scl_io_num = 9,
.sda_pullup_en = GPIO_PULLUP_ENABLE,
.scl_pullup_en = GPIO_PULLUP_ENABLE,
.master.clk_speed = 400000,
};
#else
#error "i2c not implemented for this badge generation"
#endif
void flow3r_bsp_i2c_init(void) {
if (mutex != NULL) {
......@@ -125,4 +105,4 @@ void flow3r_bsp_i2c_scan(flow3r_bsp_i2c_scan_result_t *res) {
}
}
ESP_LOGI(TAG, "Scan: done.");
}
\ No newline at end of file
}
#include "flow3r_bsp.h"
#if defined(CONFIG_FLOW3R_HW_GEN_P1)
#include "flow3r_bsp_spiled.h"
esp_err_t flow3r_bsp_leds_init(void) {
return flow3r_bsp_spiled_init(FLOW3R_BSP_LED_COUNT);
}
void flow3r_bsp_leds_set_pixel(uint32_t index, uint32_t red, uint32_t green, uint32_t blue) {
flow3r_bsp_spiled_set_pixel(index, red, green, blue);
}
esp_err_t flow3r_bsp_leds_refresh(TickType_t timeout_ms) {
return flow3r_bsp_spiled_refresh(timeout_ms);
}
#elif defined(CONFIG_FLOW3R_HW_GEN_P3) || defined(CONFIG_FLOW3R_HW_GEN_P4) || defined(CONFIG_FLOW3R_HW_GEN_P6)
#include "flow3r_bsp_rmtled.h"
esp_err_t flow3r_bsp_leds_init(void) {
......@@ -31,7 +13,3 @@ void flow3r_bsp_leds_set_pixel(uint32_t index, uint32_t red, uint32_t green, uin
esp_err_t flow3r_bsp_leds_refresh(TickType_t timeout_ms) {
return flow3r_bsp_rmtled_refresh(timeout_ms);
}
#else
#error "leds not implemented for this badge generation"
#endif
\ No newline at end of file
// Driver for APA102-style LEDs, using SPI peripheral.
#include "flow3r_bsp_spiled.h"
#include <string.h>
#include "driver/spi_master.h"
#include "esp_log.h"
static const char *TAG = "flow3r-spiled";
static spi_bus_config_t buscfg;
static spi_device_interface_config_t devcfg;
static spi_device_handle_t spi_led;
static spi_transaction_t spi_trans_object;
typedef struct {
uint16_t num_leds;
uint8_t *buffer;
} flow3r_bsp_spiled_t;
static flow3r_bsp_spiled_t spiled;
esp_err_t flow3r_bsp_spiled_init(uint16_t num_leds) {
// Set up the Bus Config struct
buscfg.miso_io_num = -1;
buscfg.mosi_io_num = 18;
buscfg.sclk_io_num = 8;
buscfg.quadwp_io_num = -1;
buscfg.quadhd_io_num = -1;
buscfg.max_transfer_sz = 8000;
// Set up the SPI Device Configuration Struct
devcfg.clock_speed_hz = 10000000;
devcfg.mode = 0;
devcfg.spics_io_num = -1;
devcfg.queue_size = 1;
// Initialize the SPI driver
esp_err_t ret = spi_bus_initialize(SPI2_HOST, &buscfg, SPI_DMA_CH_AUTO);
if (ret != ESP_OK) {
ESP_LOGE(TAG, "spi_bus_initialize: %s", esp_err_to_name(ret));
return ret;
}
// Add SPI port to bus
ret = spi_bus_add_device(SPI2_HOST, &devcfg, &spi_led);
if (ret != ESP_OK) {
ESP_LOGE(TAG, "spi_bus_add_device: %s", esp_err_to_name(ret));
return ret;
}
spiled.num_leds = num_leds;
spiled.buffer = calloc(4, num_leds + 2);
if (spiled.buffer == NULL) {
ESP_LOGE(TAG, "buffer allocation failed");
return ESP_ERR_NO_MEM;
}
// Start Frame
spiled.buffer[0] = 0;
spiled.buffer[1] = 0;
spiled.buffer[2] = 0;
spiled.buffer[3] = 0;
// Global brightness.
for (int i = 0; i < num_leds; i++) {
spiled.buffer[i * 4 + 4] = 255;
}
// End Frame (this only works with up to 64 LEDs, meh).
int i = num_leds * 4 + 8;
spiled.buffer[i + 0] = 255;
spiled.buffer[i + 1] = 255;
spiled.buffer[i + 2] = 255;
spiled.buffer[i + 3] = 255;
memset(&spi_trans_object, 0, sizeof(spi_trans_object));
spi_trans_object.length = (4 * (num_leds+2))* 8;
spi_trans_object.tx_buffer = spiled.buffer;
return ESP_OK;
}
void flow3r_bsp_spiled_set_pixel(uint32_t index, uint32_t red, uint32_t green, uint32_t blue) {
if (spiled.buffer == NULL) {
return;
}
if (index >= spiled.num_leds) {
return;
}
uint32_t start = index * 4 + 4;
spiled.buffer[start + 1] = blue & 0xFF;
spiled.buffer[start + 2] = green & 0xFF;
spiled.buffer[start + 3] = red & 0xFF;
}
esp_err_t flow3r_bsp_spiled_refresh(int32_t timeout_ms) {
return spi_device_queue_trans(spi_led, &spi_trans_object, timeout_ms);
}
\ No newline at end of file
#pragma once
#include "esp_err.h"
esp_err_t flow3r_bsp_spiled_init(uint16_t num_leds);
void flow3r_bsp_spiled_set_pixel(uint32_t index, uint32_t red, uint32_t green, uint32_t blue);
esp_err_t flow3r_bsp_spiled_refresh(int32_t timeout_ms);
\ No newline at end of file
......@@ -50,37 +50,7 @@ typedef struct {
flow3r_bsp_iopin_t jacksense_right;
} flow3r_bsp_iodef_t;
#if defined(CONFIG_FLOW3R_HW_GEN_P1)
static const flow3r_bsp_iodef_t iodef = {
.tripos_left = {
.left = IPEX(37, 1, .invert = true),
.mid = IESP(0, false, .invert = true),
.right = IPEX(35, 1, .invert = true),
},
.tripos_right = {
.left = IESP(7, 1, .invert = true),
.mid = IESP(6, true, .invert = true),
.right = IESP(5, 1, .invert = true),
},
.trrs_left = {
.tip_badgelink_enable = IODUMMY,
.ring_badgelink_enable = IODUMMY,
},
.trrs_right = {
.tip_badgelink_enable = IODUMMY,
.ring_badgelink_enable = IODUMMY,
},
.charger_state = IODUMMY,
.jacksense_right = IODUMMY,
};
const flow3r_bsp_spio_programmable_pins_t flow3r_bsp_spio_programmable_pins = {
.badgelink_left_tip = 6,
.badgelink_left_ring = 7,
.badgelink_right_tip = 4,
.badgelink_right_ring = 5,
};
#define PORTEXP_NONE
#elif defined(CONFIG_FLOW3R_HW_GEN_P4) || defined(CONFIG_FLOW3R_HW_GEN_P3)
#if defined(CONFIG_FLOW3R_HW_GEN_P4) || defined(CONFIG_FLOW3R_HW_GEN_P3)
static const flow3r_bsp_iodef_t iodef = {
.tripos_left = {
.left = IESP(3, true, .invert = true),
......@@ -196,14 +166,6 @@ static esp_err_t _portexp_update(void) {
}
#endif
#ifdef PORTEXP_NONE
static esp_err_t _portexp_init(void) { return ESP_OK; }
static void _iopin_portexp_init(const flow3r_bsp_iopin_t *iopin) {}
static bool _iopin_portexp_get_pin(const flow3r_bsp_iopin_t *iopin) { return false; }
static void _iopin_portexp_set_pin(const flow3r_bsp_iopin_t *iopin, bool on) {}
static esp_err_t _portexp_update(void) { return ESP_OK; }
#endif
static esp_err_t _iopin_esp32_init(const flow3r_bsp_iopin_t *iopin) {
gpio_config_t cfg = {
.pin_bit_mask = 1 << iopin->pin,
......
......@@ -14,7 +14,6 @@ def action_extensions(base_actions, project_path=os.getcwd()):
# Map from canonical name to user-supported names.
GENERATIONS = {
'p1': ['proto1'],
'p3': ['proto3'],
'p4': ['proto4'],
'p6': ['proto6'],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment