Ignore:
Timestamp:
Feb 1, 2019, 9:57:09 PM (5 years ago)
Author:
coas-nagasima
Message:

TINETとSocket APIなどを更新

File:
1 edited

Legend:

Unmodified
Added
Removed
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/mbed/targets/TARGET_RENESAS/TARGET_RZ_A1H/spi_api.c

    r352 r364  
    259259    while(!spi_tend(obj));
    260260    return spi_read(obj);
     261}
     262
     263int spi_master_block_write(spi_t *obj, const char *tx_buffer, int tx_length,
     264                           char *rx_buffer, int rx_length, char write_fill) {
     265    int total = (tx_length > rx_length) ? tx_length : rx_length;
     266
     267    for (int i = 0; i < total; i++) {
     268        char out = (i < tx_length) ? tx_buffer[i] : write_fill;
     269        char in = spi_master_write(obj, out);
     270        if (i < rx_length) {
     271            rx_buffer[i] = in;
     272        }
     273    }
     274
     275    return total;
    261276}
    262277
Note: See TracChangeset for help on using the changeset viewer.