#include "transmission_interface.hpp"

#include "FreeRTOS.h"
#include "queue.h"

void GobotRPC_TI_Hardware_RP2040_I2C::raiseTranmissionError(bool rx, uint32_t addr) {
    CI_Instruction_Transport ciInstruction;
    ciInstruction.type = CI_INSTRUCTION_SEND_TRANMISSION_ERROR;
    ciInstruction.data[0] = rx;
    ciInstruction.data[1] = addr & 0xff;
    ciInstruction.data[2] = (addr >> 8) & 0xff;
    ciInstruction.data[3] = (addr >> 16) & 0xff;
    ciInstruction.data[4] = (addr >> 24) & 0xff;
    
    this->pushCIInstructionCB(&ciInstruction, pushCIInstructionCBArgs);
}

void GobotRPC_TI_Hardware_RP2040_I2C::raiseTransmissionSuceess(uint32_t addr) {
    CI_Instruction_Transport ciInstruction;
    ciInstruction.type = CI_INSTRUCTION_SEND_TRANMISSION_SUCCESS;
    ciInstruction.data[0] = addr & 0xff;
    ciInstruction.data[1] = (addr >> 8) & 0xff;
    ciInstruction.data[2] = (addr >> 16) & 0xff;
    ciInstruction.data[3] = (addr >> 24) & 0xff;
    
    this->pushCIInstructionCB(&ciInstruction, pushCIInstructionCBArgs);
}