mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2026-08-21 15:09:03 +00:00
Added tabs to BHT TX and Jammer
Updated firmware binary
This commit is contained in:
@@ -29,7 +29,7 @@ using namespace portapack;
|
||||
namespace asahi_kasei {
|
||||
namespace ak4951 {
|
||||
|
||||
void AK4951::configure_digital_interface() {
|
||||
void AK4951::configure_digital_interface_i2s() {
|
||||
// Configure for external slave mode.
|
||||
map.r.mode_control_1.DIF = 0b11; // I2S compatible
|
||||
map.r.mode_control_1.BCKO = 0; // BICK = 32fs
|
||||
@@ -38,22 +38,28 @@ void AK4951::configure_digital_interface() {
|
||||
map.r.mode_control_2.CM = 0b00; // MCKI = 256fs
|
||||
map.r.mode_control_2.FS = 0b1011; // fs = 48kHz
|
||||
update(Register::ModeControl2);
|
||||
}
|
||||
|
||||
// map.r.mode_control_3.DVOLC = 1; // Control L/R channels with DVL (LchDigitalVolumeControl)
|
||||
// update(Register::ModeControl3);
|
||||
|
||||
void AK4951::configure_digital_interface_external_slave() {
|
||||
map.r.power_management_2.MS = 0; // Slave mode
|
||||
map.r.power_management_2.PMPLL = 0; // EXT mode
|
||||
update(Register::PowerManagement2);
|
||||
}
|
||||
|
||||
void AK4951::configure_digital_interface_external_master() {
|
||||
map.r.power_management_2.MS = 1; // Master mode
|
||||
map.r.power_management_2.PMPLL = 0; // EXT mode
|
||||
update(Register::PowerManagement2);
|
||||
}
|
||||
|
||||
void AK4951::init() {
|
||||
reset();
|
||||
|
||||
// Write dummy address to "release" the reset.
|
||||
write(0x00, 0x00);
|
||||
|
||||
configure_digital_interface();
|
||||
configure_digital_interface_i2s();
|
||||
configure_digital_interface_external_slave();
|
||||
|
||||
map.r.power_management_1.PMVCM = 1;
|
||||
update(Register::PowerManagement1);
|
||||
|
||||
@@ -864,7 +864,9 @@ private:
|
||||
Line,
|
||||
};
|
||||
|
||||
void configure_digital_interface();
|
||||
void configure_digital_interface_i2s();
|
||||
void configure_digital_interface_external_slave();
|
||||
void configure_digital_interface_external_master();
|
||||
void set_digtal_volume_control(const reg_t value);
|
||||
void set_dac_power(const bool enable);
|
||||
void set_headphone_power(const bool enable);
|
||||
|
||||
+6
-12
@@ -138,6 +138,7 @@ struct ConfigTX {
|
||||
uint32_t txrate;
|
||||
uint32_t txbitrate;
|
||||
uint32_t txmode;
|
||||
uint32_t sck_in_sel;
|
||||
};
|
||||
|
||||
struct ConfigRX {
|
||||
@@ -145,6 +146,7 @@ struct ConfigRX {
|
||||
uint32_t rxrate;
|
||||
uint32_t rxbitrate;
|
||||
uint32_t rxmode;
|
||||
uint32_t sck_in_sel;
|
||||
};
|
||||
|
||||
struct ConfigDMA {
|
||||
@@ -161,21 +163,13 @@ public:
|
||||
) {
|
||||
reset();
|
||||
|
||||
/* I2S operates in master mode, use PLL0AUDIO as MCLK source for TX. */
|
||||
/* NOTE: Documentation of CREG6 is quite confusing. Refer to "I2S clocking and
|
||||
* pin connections" and other I2S diagrams for more clarity.
|
||||
*/
|
||||
if( &p() == LPC_I2S0 ) {
|
||||
LPC_CREG->CREG6 |=
|
||||
(1U << 12)
|
||||
| (1U << 13)
|
||||
;
|
||||
LPC_CREG->CREG6.I2S0_TX_SCK_IN_SEL = config_tx.sck_in_sel;
|
||||
LPC_CREG->CREG6.I2S0_RX_SCK_IN_SEL = config_rx.sck_in_sel;
|
||||
}
|
||||
if( &p() == LPC_I2S1 ) {
|
||||
LPC_CREG->CREG6 |=
|
||||
(1U << 14)
|
||||
| (1U << 15)
|
||||
;
|
||||
LPC_CREG->CREG6.I2S1_TX_SCK_IN_SEL = config_tx.sck_in_sel;
|
||||
LPC_CREG->CREG6.I2S1_RX_SCK_IN_SEL = config_rx.sck_in_sel;
|
||||
}
|
||||
|
||||
p().DAO = config_tx.dao;
|
||||
|
||||
@@ -28,6 +28,12 @@
|
||||
|
||||
namespace jammer {
|
||||
|
||||
typedef struct jammer_range {
|
||||
bool enabled;
|
||||
int64_t min;
|
||||
int64_t max;
|
||||
} jammer_range_t;
|
||||
|
||||
enum JammerType : uint32_t {
|
||||
TYPE_FSK = 0,
|
||||
TYPE_TONE = 1,
|
||||
|
||||
@@ -78,7 +78,7 @@ constexpr Pin pins[] = {
|
||||
[P2_11] = { 2, 11, { .mode=0, .pd=1, .pu=0, .fast=0, .input=0, .ifilt=1 } }, /* RX_AMP/P49: U12.V1(I), U14.V3(I) */
|
||||
[P2_12] = { 2, 12, { .mode=0, .pd=0, .pu=0, .fast=0, .input=0, .ifilt=1 } }, /* !RX_AMP_PWR/P52: 10K PU, Q1.G(I), power to U13 (RX amp) */
|
||||
[P2_13] = { 2, 13, { .mode=0, .pd=0, .pu=0, .fast=0, .input=1, .ifilt=1 } }, /* P2_13: PortaPack P2_13/DIR */
|
||||
[P3_0] = { 3, 0, { .mode=2, .pd=0, .pu=1, .fast=0, .input=0, .ifilt=1 } }, /* I2S0_TX_SCK: PortaPack I2S0_TX_SCK(I) */
|
||||
[P3_0] = { 3, 0, { .mode=2, .pd=0, .pu=1, .fast=0, .input=1, .ifilt=1 } }, /* I2S0_TX_SCK: PortaPack I2S0_TX_SCK(I) */
|
||||
[P3_1] = { 3, 1, { .mode=0, .pd=0, .pu=1, .fast=0, .input=1, .ifilt=1 } }, /* I2S0_RX_WS: PortaPack I2S0_TX_WS(I). Input enabled to fold back into RX. */
|
||||
[P3_2] = { 3, 2, { .mode=0, .pd=0, .pu=1, .fast=0, .input=0, .ifilt=1 } }, /* I2S0_RX_SDA: PortaPack I2S0_TX_SDA(I) */
|
||||
//[P3_3] = { 3, 3, { .mode=3, .pd=1, .pu=0, .fast=1, .input=1, .ifilt=0 } }, /* SPIFI_SCK: W25Q80BV.CLK(I), enable input buffer for timing feedback */
|
||||
|
||||
@@ -108,7 +108,7 @@ Optional<Reading> Packet::reading_ook_8k4_schrader() const {
|
||||
* Those bits assumed to be 0b0100", which may not be entirely true...
|
||||
*/
|
||||
constexpr uint8_t first_nibble = 0x4;
|
||||
const auto system_id = (first_nibble << 20) | reader_.read(0, 20);
|
||||
// const auto system_id = (first_nibble << 20) | reader_.read(0, 20);
|
||||
const auto id = reader_.read(20, 32);
|
||||
const auto value_0 = reader_.read(52, 8);
|
||||
const auto value_1 = reader_.read(60, 8);
|
||||
|
||||
@@ -25,6 +25,30 @@
|
||||
namespace wolfson {
|
||||
namespace wm8731 {
|
||||
|
||||
void WM8731::configure_interface_i2s_slave() {
|
||||
write(DigitalAudioInterfaceFormat {
|
||||
.format = 2,
|
||||
.iwl = 0,
|
||||
.lrp = 0,
|
||||
.lrswap = 0,
|
||||
.ms = 0,
|
||||
.bclkinv = 0,
|
||||
.reserved0 = 0,
|
||||
});
|
||||
}
|
||||
|
||||
void WM8731::configure_interface_i2s_master() {
|
||||
write(DigitalAudioInterfaceFormat {
|
||||
.format = 2,
|
||||
.iwl = 0,
|
||||
.lrp = 0,
|
||||
.lrswap = 0,
|
||||
.ms = 1,
|
||||
.bclkinv = 0,
|
||||
.reserved0 = 0,
|
||||
});
|
||||
}
|
||||
|
||||
void WM8731::init() {
|
||||
reset();
|
||||
|
||||
@@ -49,15 +73,7 @@ void WM8731::init() {
|
||||
// .reserved0 = 0,
|
||||
// });
|
||||
|
||||
write(DigitalAudioInterfaceFormat {
|
||||
.format = 2,
|
||||
.iwl = 0,
|
||||
.lrp = 0,
|
||||
.lrswap = 0,
|
||||
.ms = 0,
|
||||
.bclkinv = 0,
|
||||
.reserved0 = 0,
|
||||
});
|
||||
configure_interface_i2s_slave();
|
||||
|
||||
write(DigitalAudioPathControl {
|
||||
.adchpd = 0,
|
||||
|
||||
@@ -375,6 +375,9 @@ private:
|
||||
RegisterMap map { default_after_reset };
|
||||
volume_t headphone_volume = -60.0_dB;
|
||||
|
||||
void configure_interface_i2s_slave();
|
||||
void configure_interface_i2s_master();
|
||||
|
||||
bool write(const Register reg);
|
||||
|
||||
bool write(const address_t reg_address, const reg_t value);
|
||||
|
||||
Reference in New Issue
Block a user