Changed address of keyboard device and added reboot command to i2c upload
This commit is contained in:
parent
9eb63608ea
commit
96058f06c2
|
@ -114,15 +114,16 @@ void handle_io_read() {
|
|||
/* write_data(0x01); */
|
||||
/* break; */
|
||||
|
||||
// Stand in for the keyboard hardware
|
||||
/* Stand in for the keyboard hardware */
|
||||
/* case 0x1E: */
|
||||
/* write_data(control.input.c); */
|
||||
/* control.input.received = 0; */
|
||||
/* write_data(char_c); */
|
||||
/* char_r = 0; */
|
||||
/* break; */
|
||||
|
||||
// Stand in for the keyboard hardware
|
||||
/* Stand in for the keyboard hardware */
|
||||
/* case 0x1F: */
|
||||
/* write_data(0x01 * control.input.received); */
|
||||
/* #<{(| write_data(0x01 * char_r); |)}># */
|
||||
/* write_data(0x00); */
|
||||
/* break; */
|
||||
|
||||
case 0x08:
|
||||
|
|
|
@ -43,9 +43,15 @@ void firmware_update() {
|
|||
control_program_eeprom(data, length);
|
||||
break;
|
||||
case TARGET_I2C: {
|
||||
// Make sure tell the device to enter bootloader mode first
|
||||
// Upload the application
|
||||
printf("Restarting target to bootloader...\n\r");
|
||||
// @todo Make sure that the address to reset to bootloader is the same as the bootloader address
|
||||
uint8_t reboot_command[] = {0x07};
|
||||
HAL_I2C_Master_Transmit(&hi2c1, address << 1, reboot_command, sizeof(reboot_command), 1000);
|
||||
|
||||
for (volatile int i = 0; i < 10000000; ++i) {}
|
||||
|
||||
printf("Uploading to target...\n\r");
|
||||
|
||||
uint8_t upload_command[4 + length];
|
||||
upload_command[0] = 0x02;
|
||||
upload_command[1] = 0x01;
|
||||
|
|
|
@ -123,7 +123,7 @@ void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) {
|
|||
if (!is_command) {
|
||||
// ONLY SEND THE FIRST CHAR
|
||||
if (cmd_buffer_len > 0) {
|
||||
HAL_I2C_Master_Transmit(&hi2c1, 0x04 << 1, &byte, 1, 1000);
|
||||
HAL_I2C_Master_Transmit(&hi2c1, 0x29 << 1, &byte, 1, 1000);
|
||||
}
|
||||
cmd_buffer_len = 0;
|
||||
} else if (handle_command && is_command) {
|
||||
|
@ -148,7 +148,7 @@ void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) {
|
|||
break;
|
||||
|
||||
case '#':
|
||||
HAL_I2C_Master_Transmit(&hi2c1, 0x04 << 1, &byte, 1, 1000);
|
||||
HAL_I2C_Master_Transmit(&hi2c1, 0x29 << 1, &byte, 1, 1000);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
Loading…
Reference in New Issue
Block a user