tweaked i2c timings

haven't verified against a scope but they "work for me"

running at 24MHz at all times now for best energy use per watt before sleeping
This commit is contained in:
true 2026-05-08 17:44:56 -07:00
parent abd985e3a1
commit 7827085947
3 changed files with 13 additions and 12 deletions

View File

@ -26,9 +26,9 @@
* - there is no ack on address. code always assumes slave is responding.
*/
#define i2c_init() i2cm_init()
#define i2c_start() { SetSysClock_HSI(HCLK_24MHZ); i2cm_start(); }
#define i2c_start() { /*SetSysClock_HSI(HCLK_24MHZ);*/ i2cm_start(); }
#define i2c_restart() i2cm_restart()
#define i2c_stop() { i2cm_stop(); SetSysClock_HSI(HCLK_8MHZ); }
#define i2c_stop() { i2cm_stop(); /*SetSysClock_HSI(HCLK_16MHZ);*/ }
#define i2c_rd(ack) i2cm_rd(ack)
#define i2c_wr(dat) i2cm_wr(dat)
#define i2c_addr(a, w) i2c_start(); i2cm_addr(a, w)

View File

@ -28,20 +28,20 @@
#define CYCLES_TO_HI 2
#define CYCLES_TO_LO 0
#define CYCLES_TO_HI 1 // was 2
#define CYCLES_TO_LO 0 // was 0
//#define CYCLES_RD 2 // cycles spent in read routine
//#define CYCLES_WR_HI 2 // extra cycles spent in write routine
//#define CYCLES_RD 2 // cycles spent in read routine
//#define CYCLES_WR_HI 2 // extra cycles spent in write routine
//#define CYCLES_WR_LO 4
#define bit_delay_hi() { spin = delay_hi; while(spin--); }
#define bit_delay_lo() { spin = delay_lo; while(spin--); }
#define bit_delay_hi() { spin = delay_hi; while(spin--); }
#define bit_delay_lo() { spin = delay_lo; while(spin--); }
#define rd_delay() bit_delay_hi()
#define rd_delay() bit_delay_hi()
#define wr_delay_hi() bit_delay_hi()
#define wr_delay_lo() bit_delay_hi() // spin = delay_hi - CYCLES_EXTRA_WR_HI; while(spin--)
#define wr_delay_hi() bit_delay_hi()
#define wr_delay_lo() bit_delay_hi() // spin = delay_hi - CYCLES_EXTRA_WR_HI; while(spin--)
#define SDA_PIN 9

View File

@ -29,7 +29,7 @@ uint8_t awled_fade[AW20X_FADE_COUNT];
static uint8_t led_matrix_needs_update = 0;
const LedMap led_map = {
// map is 1-based to match part numbers on the board
// map is 1-based to match LED refdegs on the board
.ribbon = { // ribbon
13, 25, 1, 49,
37, 14,
@ -71,6 +71,7 @@ const LedMap led_map = {
}
};
LedMap led_set;