Exemple #1
0
bool hal_aci_tl_send(hal_aci_data_t *p_aci_cmd)
{
  uint8_t length = p_aci_cmd->buffer[0];
  if (!spi_transmit_requested)
  {
//    ASSERT(ERROR_CODE_HAL_ACI_TL_OVERFLOW,(p_aci_cmd->buffer[0] <= HAL_ACI_MAX_LENGTH));
    if (length > HAL_ACI_MAX_LENGTH)
    {
      return(false);
    }
    {
      bool  is_interrupt_enabled_before_send = ARE_INTERRUPTS_ENABLED();
      DISABLE_INTERRUPTS();                           /*disable interrupts to protects the modification of the buffer pointer*/
      lib_mem_copy((uint8_t *) data_to_send.buffer, p_aci_cmd->buffer, length+1);
      spi_transmit_requested = true; // Request transmission
      if (is_interrupt_enabled_before_send)
      {
        ENABLE_INTERRUPTS();                         /*eventually re-enable the interrupts if they were enabled*/
      }
    }

    digitalWrite(reqn, LOW);

    return(true);
  }
  else
  {
    return(false);
  }
}
Exemple #2
0
void data_recv(unsigned char *data, unsigned char len)
{
	lib_mem_copy(&read_buf[read_len], data, len);
	read_len+=len;
}