|
3 | 3 |
|
4 | 4 | #define MP_DEFINE_BYTES_OBJ(obj_name, bin) mp_obj_str_t obj_name = {{&mp_type_bytes}, 0, sizeof(bin) - 1, (const byte *)bin}
|
5 | 5 |
|
6 |
| -STATIC MP_DEFINE_BYTES_OBJ(i2c_init_byte_obj, |
7 |
| - "\2\2\0" // set data inversion register (no inversions) |
8 |
| - "\2\1\xfe" // set output data (CLK idle low, all others high) |
9 |
| - "\2\3\x78" // set direction register (cs, mosi, clk, reset as outputs) |
10 |
| - ); |
| 6 | +static const char i2c_bus_init_sequence[] = { |
| 7 | + 2, 3, 0x78, // set GPIO direction |
| 8 | + 2, 2, 0, // disable all output inversion |
| 9 | + 0, // trailing NUL for python bytes() representation |
| 10 | +}; |
| 11 | +STATIC MP_DEFINE_BYTES_OBJ(i2c_init_byte_obj, i2c_bus_init_sequence); |
11 | 12 |
|
12 | 13 | STATIC const mp_rom_map_elem_t tft_io_expander_table[] = {
|
13 |
| - { MP_ROM_QSTR(MP_QSTR_i2c_address), MP_ROM_INT(0x38)}, |
| 14 | + { MP_ROM_QSTR(MP_QSTR_i2c_address), MP_ROM_INT(0x3f)}, |
14 | 15 | { MP_ROM_QSTR(MP_QSTR_gpio_address), MP_ROM_INT(1)},
|
15 | 16 | { MP_ROM_QSTR(MP_QSTR_gpio_data_len), MP_ROM_INT(1)},
|
16 | 17 | { MP_ROM_QSTR(MP_QSTR_gpio_data), MP_ROM_INT(0xFD)},
|
|
0 commit comments