Beispiel #1
0
uint32_t ble_error_log_write(uint32_t err_code, const uint8_t * p_message, uint16_t line_number)
{
    uint8_t  error_log_size;

    error_log_size              = CEIL_DIV(sizeof(ble_error_log_data_t), sizeof(uint32_t));
    m_ble_error_log.failure     = true;
    m_ble_error_log.err_code    = err_code;
    m_ble_error_log.line_number = line_number;

    strncpy((char *)m_ble_error_log.message, (const char *)p_message, ERROR_MESSAGE_LENGTH - 1);
    m_ble_error_log.message[ERROR_MESSAGE_LENGTH - 1] = '\0';

    fetch_stack(&m_ble_error_log);

    return ble_flash_page_write(FLASH_PAGE_ERROR_LOG,
                                (uint32_t *) &m_ble_error_log,
                                error_log_size);
}
Beispiel #2
0
uint32_t ble_central_bondmngr_store(ble_central_bondmngr_t * p_bm)
{
    uint32_t err_code;
    
    print_address(&bond_info.addr);
    
    err_code = ble_flash_page_erase(BLE_CENTRAL_BONDMNGR_PAGE_NUM);
    if (err_code != NRF_SUCCESS)
    {
        return err_code;
    }
    
    printf("Writing %d b to %d\r\n", sizeof(bond_info)/sizeof(uint32_t), BLE_CENTRAL_BONDMNGR_PAGE_NUM);
    
    err_code = ble_flash_page_write(BLE_CENTRAL_BONDMNGR_PAGE_NUM, (uint32_t *) &bond_info, sizeof(bond_info)/sizeof(uint32_t));
    if (err_code != NRF_SUCCESS)
    {
        return err_code;
    }
    
    return NRF_SUCCESS;
}