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

TINETとSocket APIなどを更新

Location:
asp3_tinet_ecnl_arm/trunk/asp3_dcre/mbed
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/mbed/hal/spi_api.h

    r352 r364  
    116116 */
    117117int  spi_master_write(spi_t *obj, int value);
     118
     119/** Write a block out in master mode and receive a value
     120 *
     121 *  The total number of bytes sent and received will be the maximum of
     122 *  tx_length and rx_length. The bytes written will be padded with the
     123 *  value 0xff.
     124 *
     125 * @param[in] obj        The SPI peripheral to use for sending
     126 * @param[in] tx_buffer  Pointer to the byte-array of data to write to the device
     127 * @param[in] tx_length  Number of bytes to write, may be zero
     128 * @param[in] rx_buffer  Pointer to the byte-array of data to read from the device
     129 * @param[in] rx_length  Number of bytes to read, may be zero
     130 * @param[in] write_fill Default data transmitted while performing a read
     131 * @returns
     132 *      The number of bytes written and read from the device. This is
     133 *      maximum of tx_length and rx_length.
     134 */
     135int spi_master_block_write(spi_t *obj, const char *tx_buffer, int tx_length, char *rx_buffer, int rx_length, char write_fill);
    118136
    119137/** Check if a value is available to read
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/mbed/platform/mbed_rtc_time.c

    r352 r364  
    4444time_t __time32(time_t *timer)
    4545#else
    46 time_t time(time_t *timer)
     46time_t get_time(time_t *timer)
    4747#endif
    4848
     
    7878}
    7979
    80 clock_t clock() {
     80clock_t get_clock() {
    8181    //_mutex->lock();
    8282    clock_t t = us_ticker_read();
  • 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.