Skip to content

Instantly share code, notes, and snippets.

@agrif
Created May 21, 2024 06:38
Show Gist options
  • Save agrif/ddc356d740e265d649c4fafff373cfd7 to your computer and use it in GitHub Desktop.
Save agrif/ddc356d740e265d649c4fafff373cfd7 to your computer and use it in GitHub Desktop.
const INITREGS: &[u16] = &[
0x0008, // 0x00 (r) : unknown 0
0x1080, // 0x01 (r) : chip id
// 0x02 (rw): power
// [ 15] DSMUTE = 0 (enable soft mute)
// [ 14] MUTE = 0 (disable mute)
// [ 13] MONO = 0 (stereo)
// [ 12] CKSEL = 0 (external clock)
// [ 11] reserved = 0
// [ 10] SKMODE = 0 (wrap)
// [ 9] SEEKUP = 1 (seek up)
// [ 8] SEEK = 0 (disabled)
// [ 7] reserved = 0
// [ 6] DISABLE = 0
// [ 5: 1] reserved = 0
// [ 0] ENABLE = 1
0x0201,
// 0x03 (rw): channel
// [ 15] TUNE = 0 (disable)
// [14:10] reserved = 0
// [ 9: 0] CHAN = 0
0x0000,
// 0x04 (rw): system 1
// [ 15] reserved = 0
// [ 14]: STCIEN = 1 (enable interrupt)
// [ 13]: DEBPS = 0 (enable de-emphasis filter)
// [ 12]: reserved = 0
// [ 11]: DE = 0 (75 us de-emphasis, USA)
// [ 10]: AGCD = 0 (AGC enabled)
// [ 9: 8]: reserved = 0
// [ 7: 6]: BLNDADJ = 0b11 (25-43 RSSI dBuV (-6dB) stereo blend)
// [ 5: 4]: GPIO3 = 0b00 (high impedence)
// [ 3: 2]: GPIO2 = 0b00 (high impedence)
// [ 1: 0]: GPIO1 = 0b00 (high impedence)
0x40C0,
// 0x05 (rw): system 2
// [15: 8]: SEEKTH = 0x0a (rssi seek threshold)
// [ 7: 6]: BAND = 0b00 (87.5 - 108 MHz, USA/Europe)
// [ 5: 4]: SPACE = 0b01 (100 kHz, Europe/Japan)
// [ 3: 0]: VOLUME = 0b111 (0dB full scale)
0x0A1F,
// 0x06 (rw): system 3
// [15:14]: SMUTER = 0b00 (fastest soft mute)
// [13:12]: SMUTEA = 0b00 (16dB soft mute)
// [11: 8]: reserved = 0
// [ 7: 4]: SKSNR = 0b0010 (almost all stops while seeking)
// [ 3: 0]: SKCNT = 0b1110 (almost minimum impulses for seek)
0x002E,
// 0x07 (rw): test 1
// [15: 4]: FREQD = 0x2f, 148Hz "on bit"
// [ 3: 0]: SNR = 0xf (??)
0x02FF,
// 0x08 (rw): test 2
// [ 15]: reserved = 0
// [14: 0]: reserved = 0x5b11 (should be same as startup)
0x5B11,
// 0x09 (rw): boot
// [15: 0]: boot = 0x0000 (should be same as startup)
0x0000,
// 0x0a (r) : rssi
// [ 15]: reserved = 0
// [ 14]: STC = 1 (seek/tune complete)
// [ 13]: SF/BL = 0 (seek successful)
// [ 12]: AFCRL = 0 (AFC not railed, channel valid)
// [11:10]: reserved = 0b00
// [ 9]: STEN = 1 (stereo indicator on)
// [ 8]: ST = 0 (mono)
// [ 7: 0]: RSSI = 0x1e (0x00 to 0xff)
0x411E,
// 0x0b (r) : read channel
// [15:14]: reserved = 0b00
// [13:10]: IMPC = 0b0000
// [ 9: 0]: READCHAN = 0
0x0000,
//
// the rest are reserved
//
0xCE00, // 0x0c (r) : reserved 0, always 0
0x0000, // 0x0d (r) : reserved 1, always 0
0x0000, // 0x0e (r) : reserved 2, always 0
0x1000, // 0x0f (r) : reserved 3, always 0
//
// the rest are internal registers
//
0x3197, 0x0000, 0x13FF, 0x9852, 0x0000, 0x0000, 0x0008, 0x0000, 0x51E1, 0xA8BC, 0x2645,
0x00E4, 0x1CD8, 0x3A50, 0xEAE0, 0x3000, 0x0200, 0x0000,
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment