void send5340(uint8_t page, uint8_t reg, uint8_t reg_1, uint64_t P1, uint32_t P2) {
uint8_t x[2];
uint8_t y[7];
x[0] = 0x01;
x[1] = page;
while (HAL_I2C_Master_Transmit(&hi2c3, 0b11101000, (uint8_t *) &x, 2, 500) != HAL_OK) {
BSP_LCD_DisplayHStringAt(0, 20, "err wr 5340 page", LEFT_MODE);
};
y[0] = reg;
y[1] = (uint8_t)((P1 & 0xFF0000000000) >> 40 );
y[2] = (uint8_t)((P1 & 0x00FF00000000) >> 32 );
y[3] = (uint8_t)((P1 & 0x0000FF000000) >> 24 );
y[4] = (uint8_t)((P1 & 0x000000FF0000) >> 16 );
y[5] = (uint8_t)((P1 & 0x00000000FF00) >> 8 );
y[6] = (uint8_t)(P1 & 0x0000000000FF );
while (HAL_I2C_Master_Transmit(&hi2c3, 0b11101000, (uint8_t *) &y, 7, 500) != HAL_OK) {
BSP_LCD_DisplayHStringAt(0, 20, "err wr 5340 filling", LEFT_MODE);
};
x[0] = 0x01;
x[1] = page;
while (HAL_I2C_Master_Transmit(&hi2c3, 0b11101000, (uint8_t *) &x, 2, 500) != HAL_OK) {
BSP_LCD_DisplayHStringAt(0, 20, "err wr 5340 page", LEFT_MODE);
};
y[0] = reg_1;
y[1] = (uint8_t)((P2 & 0x0000FF000000) >> 24 );
y[2] = (uint8_t)((P2 & 0x000000FF0000) >> 16 );
y[3] = (uint8_t)((P2 & 0x00000000FF00) >> 8 );
y[4] = (uint8_t)(P2 & 0x0000000000FF );
while (HAL_I2C_Master_Transmit(&hi2c3, 0b11101000, (uint8_t *) &y, 5, 500) != HAL_OK) {
BSP_LCD_DisplayHStringAt(0, 20, "err wr 5340 filling", LEFT_MODE);
};
}
этот код не работает, оставлен для истории