FT2232调试记录(3)

news2024/11/28 16:25:51

FT2232调试记录(1):
FT2232调试记录(2):
FT2232调试记录(3):

FT2232 SPI读写函数:

参照SPI提供的文档:
在这里插入图片描述

工程:在这里插入图片描述

SPI 写函数:

FT_STATUS write_byte(FT_HANDLE handle,uint8_t address, uint16_t data)
{
uint32_t sizeToTransfer = 0;
uint32_t sizeTransfered=0;
//bool writeComplete=0;
//uint32_t retry=0;
//bool state;
FT_STATUS status;
/* Write command EWEN(with CS_High -> CS_Low) */
sizeToTransfer=11;
sizeTransfered=0;
byOutputBuffer[0]=0x9F;/* SPI_EWEN -> binary 10011xxxxxx (11bits) */
byOutputBuffer[1]=0xFF;
status = SPI_Write(handle, byOutputBuffer, sizeToTransfer, ( (unsigned long *)(&sizeTransfered) ),
SPI_TRANSFER_OPTIONS_SIZE_IN_BITS|
SPI_TRANSFER_OPTIONS_CHIPSELECT_ENABLE|
SPI_TRANSFER_OPTIONS_CHIPSELECT_DISABLE);
APP_CHECK_STATUS(status);

/* CS_High + Write command + Address */
sizeToTransfer=1;
sizeTransfered=0;
byOutputBuffer[0] = 0xA0;/* Write command (3bits) */
byOutputBuffer[0] = byOutputBuffer[0] | ( ( address >> 3) & 0x0F );/*5 most significant add bits*/
status = SPI_Write(handle, byOutputBuffer, sizeToTransfer, ( (unsigned long *)(&sizeTransfered) ),
SPI_TRANSFER_OPTIONS_SIZE_IN_BYTES|
SPI_TRANSFER_OPTIONS_CHIPSELECT_ENABLE);
APP_CHECK_STATUS(status);
/*Write 3 least sig address bits */
sizeToTransfer=3;
sizeTransfered=0;
byOutputBuffer[0] = ( address & 0x07 ) << 5; /* least significant 3 address bits */
status = SPI_Write(handle, byOutputBuffer, sizeToTransfer, ( (unsigned long *)(&sizeTransfered) ),
SPI_TRANSFER_OPTIONS_SIZE_IN_BITS);
APP_CHECK_STATUS(status);
/* Write 2 byte data + CS_Low */
sizeToTransfer=2;
sizeTransfered=0;
byOutputBuffer[0] = (uint8_t)(data & 0xFF);
byOutputBuffer[1] = (uint8_t)((data & 0xFF00)>>8);
status = SPI_Write(handle, byOutputBuffer, sizeToTransfer, ( (unsigned long *)(&sizeTransfered) ),
SPI_TRANSFER_OPTIONS_SIZE_IN_BYTES|
SPI_TRANSFER_OPTIONS_CHIPSELECT_DISABLE);
APP_CHECK_STATUS(status);
 /* Wait until D0 is high */
#if 1
 /* Strobe Chip Select */
sizeToTransfer=0;
sizeTransfered=0;
status = SPI_Write(handle, byOutputBuffer, sizeToTransfer, ( (unsigned long *)(&sizeTransfered) ),
SPI_TRANSFER_OPTIONS_SIZE_IN_BITS|
SPI_TRANSFER_OPTIONS_CHIPSELECT_ENABLE);
APP_CHECK_STATUS(status);
#ifndef __linux__
Sleep(10);
#endif
sizeToTransfer=0;
sizeTransfered=0;
status = SPI_Write(handle, byOutputBuffer, sizeToTransfer, ( (unsigned long *)(&sizeTransfered) ),
SPI_TRANSFER_OPTIONS_SIZE_IN_BITS|
SPI_TRANSFER_OPTIONS_CHIPSELECT_DISABLE);
APP_CHECK_STATUS(status);
#else
retry=0;
state=FALSE;
SPI_IsBusy(handle,&state);
while((FALSE==state) && (retry<SPI_WRITE_COMPLETION_RETRY))
{
printf("SPI device is busy(%u)\n",(unsigned)retry);
SPI_IsBusy(ftHandle,&state);
retry++;
}
#endif
 /* Write command EWEN(with CS_High -> CS_Low) */
sizeToTransfer=11;
sizeTransfered=0;
byOutputBuffer[0]=0x8F;/* SPI_EWEN -> binary 10011xxxxxx (11bits) */
byOutputBuffer[1]=0xFF;
status = SPI_Write(handle, byOutputBuffer, sizeToTransfer, ( (unsigned long *)(&sizeTransfered) ),
SPI_TRANSFER_OPTIONS_SIZE_IN_BITS|
SPI_TRANSFER_OPTIONS_CHIPSELECT_ENABLE|
SPI_TRANSFER_OPTIONS_CHIPSELECT_DISABLE);
APP_CHECK_STATUS(status);
return status;
}

SPI 读函数:

FT_STATUS read_byte(FT_HANDLE handle, uint8_t address, uint16_t *data)
{
uint32_t sizeToTransfer = 0;
uint32_t sizeTransfered;
//bool writeComplete=0;
//uint32_t retry=0;
//bool state;
FT_STATUS status;
/* CS_High + Write command + Address */
sizeToTransfer=1;
sizeTransfered=0;
byOutputBuffer[0] = 0xC0;/* Write command (3bits)*/
byOutputBuffer[0] = byOutputBuffer[0] | ( ( address >> 3) & 0x0F );/*5 most significant add bits*/
status = SPI_Write(handle, byOutputBuffer, sizeToTransfer, ( (unsigned long *)(&sizeTransfered) ),
SPI_TRANSFER_OPTIONS_SIZE_IN_BYTES|
SPI_TRANSFER_OPTIONS_CHIPSELECT_ENABLE);
APP_CHECK_STATUS(status);
/*Write partial address bits */
sizeToTransfer=4;
sizeTransfered=0;
byOutputBuffer[0] = ( address & 0x07 ) << 5; /* least significant 3 address bits */
status = SPI_Write(handle, byOutputBuffer, sizeToTransfer, ( (unsigned long *)(&sizeTransfered) ),
SPI_TRANSFER_OPTIONS_SIZE_IN_BITS);
APP_CHECK_STATUS(status);
/*Read 2 bytes*/
sizeToTransfer=2;
sizeTransfered=0;
status = SPI_Read(handle, byOutputBuffer, sizeToTransfer, ( (unsigned long *)(&sizeTransfered) ),
SPI_TRANSFER_OPTIONS_SIZE_IN_BYTES|
SPI_TRANSFER_OPTIONS_CHIPSELECT_DISABLE);
APP_CHECK_STATUS(status);
*data = (uint16_t)(byOutputBuffer[1]<<8);
*data = (*data & 0xFF00) | (0x00FF & (uint16_t)byOutputBuffer[0]);
return status;
}

SPI flash读写实验:

在这里插入图片描述

相关源码

bsp_ft2232.h

#ifndef BSP_FT2232_H
#define BSP_FT2232_H

#include "mainwindow.h"
//#include "ui_mainwindow.h"

#include<stdio.h>
#include<stdlib.h>
///* OS specific libraries */
#ifdef _WIN32
#include<windows.h>
#endif


#include <windows.h>


#include "../lib/ftd2xx.h"
#include "../lib/libmpsse_spi.h"
//#include "../lib/libmpsse_i2c.h"


class bsp_ft2232
{
private:



public:
     enum typePinA{pinA3=3,pinA4=4};
     enum typePinB{pinB3=3,pinB4=4};
     bsp_ft2232();
     int bsp_GetDevcieNumber();
     void bsp_ledA(enum typePinA chl,bool highlow);
     void bsp_ledB(enum typePinB chl,bool highlow);
     void bsp_ledtest(bool highlow);
};

#endif // BSP_FT2232_H

bsp_ft2232.c

#include "bsp_ft2232.h"


/******************************************************************************/
/* Macro and type defines
 */
/******************************************************************************/
/* Helper macros */
#define APP_CHECK_STATUS(exp) {                                                                              \
    if(exp!=FT_OK){                                                                                          \
                qDebug("%s:%d:%s(): status(0x%x) != FT_OK\n",__FILE__, __LINE__, __FUNCTION__,exp);          \
                exit(1);                                                                                     \
                  }else{ qDebug ("status ok!");                                                              \
                 }                                                                                           \
};
#define CHECK_NULL(exp){                                                                                     \
    if(exp==NULL){                                                                                           \
                qDebug("%s:%d:%s(): NULL expression encountered \n",__FILE__, __LINE__, __FUNCTION__);       \
                exit(1);                                                                                     \
                }else{   qDebug ("not null !");                                                              \
                }                                                                                            \
};

#define SPI_DEVICE_BUFFER_SIZE 256
FT_HANDLE ftHandle[2];
FT_STATUS status;
DWORD     numDevs;
ChannelConfig channelConf;
uint8_t gpio_setting[2]={0xff,0xff}; //0001 1000 =0x18;
uint8_t byOutputBuffer[SPI_DEVICE_BUFFER_SIZE];

DWORD dwNumBytesToSend = 0; //Index of output buffer
DWORD dwNumBytesSent = 0;
DWORD dwNumBytesRead = 0;
DWORD dwNumInputBuffer = 0;

FT_STATUS read_byte(FT_HANDLE handle, uint8_t address, uint16_t *data)
{
uint32_t sizeToTransfer = 0;
uint32_t sizeTransfered;
//bool writeComplete=0;
//uint32_t retry=0;
//bool state;
FT_STATUS status;
/* CS_High + Write command + Address */
sizeToTransfer=1;
sizeTransfered=0;
byOutputBuffer[0] = 0xC0;/* Write command (3bits)*/
byOutputBuffer[0] = byOutputBuffer[0] | ( ( address >> 3) & 0x0F );/*5 most significant add bits*/
status = SPI_Write(handle, byOutputBuffer, sizeToTransfer, ( (unsigned long *)(&sizeTransfered) ),
SPI_TRANSFER_OPTIONS_SIZE_IN_BYTES|
SPI_TRANSFER_OPTIONS_CHIPSELECT_ENABLE);
APP_CHECK_STATUS(status);
/*Write partial address bits */
sizeToTransfer=4;
sizeTransfered=0;
byOutputBuffer[0] = ( address & 0x07 ) << 5; /* least significant 3 address bits */
status = SPI_Write(handle, byOutputBuffer, sizeToTransfer, ( (unsigned long *)(&sizeTransfered) ),
SPI_TRANSFER_OPTIONS_SIZE_IN_BITS);
APP_CHECK_STATUS(status);
/*Read 2 bytes*/
sizeToTransfer=2;
sizeTransfered=0;
status = SPI_Read(handle, byOutputBuffer, sizeToTransfer, ( (unsigned long *)(&sizeTransfered) ),
SPI_TRANSFER_OPTIONS_SIZE_IN_BYTES|
SPI_TRANSFER_OPTIONS_CHIPSELECT_DISABLE);
APP_CHECK_STATUS(status);
*data = (uint16_t)(byOutputBuffer[1]<<8);
*data = (*data & 0xFF00) | (0x00FF & (uint16_t)byOutputBuffer[0]);
return status;
}








FT_STATUS write_byte(FT_HANDLE handle,uint8_t address, uint16_t data)
{
uint32_t sizeToTransfer = 0;
uint32_t sizeTransfered=0;
//bool writeComplete=0;
//uint32_t retry=0;
//bool state;
FT_STATUS status;
/* Write command EWEN(with CS_High -> CS_Low) */
sizeToTransfer=11;
sizeTransfered=0;
byOutputBuffer[0]=0x9F;/* SPI_EWEN -> binary 10011xxxxxx (11bits) */
byOutputBuffer[1]=0xFF;
status = SPI_Write(handle, byOutputBuffer, sizeToTransfer, ( (unsigned long *)(&sizeTransfered) ),
SPI_TRANSFER_OPTIONS_SIZE_IN_BITS|
SPI_TRANSFER_OPTIONS_CHIPSELECT_ENABLE|
SPI_TRANSFER_OPTIONS_CHIPSELECT_DISABLE);
APP_CHECK_STATUS(status);

/* CS_High + Write command + Address */
sizeToTransfer=1;
sizeTransfered=0;
byOutputBuffer[0] = 0xA0;/* Write command (3bits) */
byOutputBuffer[0] = byOutputBuffer[0] | ( ( address >> 3) & 0x0F );/*5 most significant add bits*/
status = SPI_Write(handle, byOutputBuffer, sizeToTransfer, ( (unsigned long *)(&sizeTransfered) ),
SPI_TRANSFER_OPTIONS_SIZE_IN_BYTES|
SPI_TRANSFER_OPTIONS_CHIPSELECT_ENABLE);
APP_CHECK_STATUS(status);
/*Write 3 least sig address bits */
sizeToTransfer=3;
sizeTransfered=0;
byOutputBuffer[0] = ( address & 0x07 ) << 5; /* least significant 3 address bits */
status = SPI_Write(handle, byOutputBuffer, sizeToTransfer, ( (unsigned long *)(&sizeTransfered) ),
SPI_TRANSFER_OPTIONS_SIZE_IN_BITS);
APP_CHECK_STATUS(status);
/* Write 2 byte data + CS_Low */
sizeToTransfer=2;
sizeTransfered=0;
byOutputBuffer[0] = (uint8_t)(data & 0xFF);
byOutputBuffer[1] = (uint8_t)((data & 0xFF00)>>8);
status = SPI_Write(handle, byOutputBuffer, sizeToTransfer, ( (unsigned long *)(&sizeTransfered) ),
SPI_TRANSFER_OPTIONS_SIZE_IN_BYTES|
SPI_TRANSFER_OPTIONS_CHIPSELECT_DISABLE);
APP_CHECK_STATUS(status);
 /* Wait until D0 is high */
#if 1
 /* Strobe Chip Select */
sizeToTransfer=0;
sizeTransfered=0;
status = SPI_Write(handle, byOutputBuffer, sizeToTransfer, ( (unsigned long *)(&sizeTransfered) ),
SPI_TRANSFER_OPTIONS_SIZE_IN_BITS|
SPI_TRANSFER_OPTIONS_CHIPSELECT_ENABLE);
APP_CHECK_STATUS(status);
#ifndef __linux__
Sleep(10);
#endif
sizeToTransfer=0;
sizeTransfered=0;
status = SPI_Write(handle, byOutputBuffer, sizeToTransfer, ( (unsigned long *)(&sizeTransfered) ),
SPI_TRANSFER_OPTIONS_SIZE_IN_BITS|
SPI_TRANSFER_OPTIONS_CHIPSELECT_DISABLE);
APP_CHECK_STATUS(status);
#else
retry=0;
state=FALSE;
SPI_IsBusy(handle,&state);
while((FALSE==state) && (retry<SPI_WRITE_COMPLETION_RETRY))
{
printf("SPI device is busy(%u)\n",(unsigned)retry);
SPI_IsBusy(ftHandle,&state);
retry++;
}
#endif
 /* Write command EWEN(with CS_High -> CS_Low) */
sizeToTransfer=11;
sizeTransfered=0;
byOutputBuffer[0]=0x8F;/* SPI_EWEN -> binary 10011xxxxxx (11bits) */
byOutputBuffer[1]=0xFF;
status = SPI_Write(handle, byOutputBuffer, sizeToTransfer, ( (unsigned long *)(&sizeTransfered) ),
SPI_TRANSFER_OPTIONS_SIZE_IN_BITS|
SPI_TRANSFER_OPTIONS_CHIPSELECT_ENABLE|
SPI_TRANSFER_OPTIONS_CHIPSELECT_DISABLE);
APP_CHECK_STATUS(status);
return status;
}


bsp_ft2232::bsp_ft2232()
{
    FT_STATUS status;

#ifdef _MSC_VER
//Init_libMPSSE();
#endif
    uint32_t channels;
    channelConf.ClockRate = 5000;
    channelConf.LatencyTimer= 255;
    channelConf.configOptions = SPI_CONFIG_OPTION_MODE0 | SPI_CONFIG_OPTION_CS_DBUS3;
    channelConf.Pin = 0x00000000;/*FinalVal-FinalDir-InitVal-InitDir (for dir 0=in, 1=out)*/

    status = SPI_GetNumChannels((DWORD *)&channels);
    APP_CHECK_STATUS(status);
    qDebug("Number of available SPI channels = %d\n",channels);

    /* Open the first available channel */
    status = SPI_OpenChannel(0,&ftHandle[0]);
    APP_CHECK_STATUS(status);
    qDebug("\nhandle=0x%x status=0x%x\n",ftHandle[0],status);
    status = SPI_InitChannel(ftHandle[0],&channelConf);
    APP_CHECK_STATUS(status);


//    status = SPI_CloseChannel(ftHandle[0]);

    /* Open the first available channel */
    status = SPI_OpenChannel(1,&ftHandle[1]);
    APP_CHECK_STATUS(status);
    qDebug("\nhandle=0x%x status=0x%x\n",ftHandle[1],status);
    status = SPI_InitChannel(ftHandle[1],&channelConf);
    APP_CHECK_STATUS(status);


//    status = SPI_CloseChannel(ftHandle[1]);




//    FT_DEVICE_LIST_INFO_NODE devList[2];
//    status = SPI_GetChannelInfo(0,&devList[0]);
//    APP_CHECK_STATUS(status);
//    qDebug("Information on channel number %d:\n",0);
//    /* print the dev info */
//    qDebug(" Flags=0x%x\n",devList[0].Flags);
//    qDebug(" Type=0x%x\n",devList[0].Type);
//    qDebug(" ID=0x%x\n",devList[0].ID);
//    qDebug(" LocId=0x%x\n",devList[0].LocId);
//    qDebug(" SerialNumber=%s\n",devList[0].SerialNumber);
//    qDebug(" Description=%s\n",devList[0].Description);
//    qDebug(" ftHandle=0x%x\n",devList[0].ftHandle);/*is 0 unless open*/

//    status = SPI_GetChannelInfo(1,&devList[1]);
//    APP_CHECK_STATUS(status);
//    qDebug("Information on channel number %d:\n",1);
//    /* print the dev info */
//    qDebug(" Flags=0x%x\n",devList[1].Flags);
//    qDebug(" Type=0x%x\n",devList[1].Type);
//    qDebug(" ID=0x%x\n",devList[1].ID);
//    qDebug(" LocId=0x%x\n",devList[1].LocId);
//    qDebug(" SerialNumber=%s\n",devList[1].SerialNumber);
//    qDebug(" Description=%s\n",devList[1].Description);
//    qDebug(" ftHandle=0x%x\n",devList[1].ftHandle);/*is 0 unless open*/



}

int bsp_ft2232::bsp_GetDevcieNumber()
{
    status = FT_CreateDeviceInfoList(&numDevs);		// Get the number of FTDI devices
    APP_CHECK_STATUS(status);
    qDebug("%d FTDI devices found - the count includes individual ports on a single chip\n", (int)numDevs);
    return  numDevs;
}

void bsp_ft2232::bsp_ledA(enum typePinA chl, bool highlow)
{
uint8_t val=0;
FT_ReadGPIO(ftHandle[0],&val);
FT_WriteGPIO(ftHandle[0],gpio_setting[0], ( highlow ? (val|(0x1<<(chl)) ) : (val&(~(0x1<<(chl))) ) ) );
}

void bsp_ft2232::bsp_ledB(enum typePinB chl, bool highlow)
{
    uint8_t val=0;
    FT_ReadGPIO(ftHandle[1],&val);
    FT_WriteGPIO(ftHandle[1],gpio_setting[1], ( highlow ? (val|(0x1<<(chl)) ) : (val&(~(0x1<<(chl))) ) ) );
}

void bsp_ft2232::bsp_ledtest(bool highlow)
{
    if(highlow)
    {
        dwNumBytesToSend = 0;
        byOutputBuffer[dwNumBytesToSend++] = 0x82;
        byOutputBuffer[dwNumBytesToSend++] = 0xFF;
        byOutputBuffer[dwNumBytesToSend++] = 0xFF;
        status = FT_Write(ftHandle[0], byOutputBuffer, dwNumBytesToSend, &dwNumBytesSent);
        qDebug("on %d\r\n",dwNumBytesSent);
        dwNumBytesSent=0;
        dwNumBytesToSend = 0;

    }else{
        dwNumBytesToSend = 0;
        byOutputBuffer[dwNumBytesToSend++] = 0x82;
        byOutputBuffer[dwNumBytesToSend++] = 0x00;
        byOutputBuffer[dwNumBytesToSend++] = 0xFF;
        status = FT_Write(ftHandle[0], byOutputBuffer, dwNumBytesToSend, &dwNumBytesSent);
        qDebug("off %d\r\n",dwNumBytesSent);
        dwNumBytesSent=0;
        dwNumBytesToSend = 0;
    }
}




本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1448242.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【2024年毕设系列】如何使用Anaconda和Pycharm

【2024年毕设系列】如何使用Anaconda和Pycharm 视频教程地址&#xff1a;【2024毕设系列】Anaconda和Pycharm如何使用_哔哩哔哩 Hi&#xff0c;各位好久不见&#xff0c;这里是肆十二&#xff0c;首先在这里给大伙拜年了。 诸位过完年之后估计又要开始为了大作业和毕业设计头疼…

Java+SpringBoot实习管理系统探秘

✍✍计算机编程指导师 ⭐⭐个人介绍&#xff1a;自己非常喜欢研究技术问题&#xff01;专业做Java、Python、微信小程序、安卓、大数据、爬虫、Golang、大屏等实战项目。 ⛽⛽实战项目&#xff1a;有源码或者技术上的问题欢迎在评论区一起讨论交流&#xff01; ⚡⚡ Java实战 |…

响应式编程四Spring WebFlux高阶实战,2W字干货!!

响应式编程四Spring WebFlux高阶实战 WebFlux作为核心响应式服务器基础响应式Web内核响应式Web和MVC框架基于WebFlux的纯函数式Web基于WebClient的非阻塞跨服务通讯Spring Web Flux 和Spring Web MVC对比 WebFlux的应用基于微服务的系统 大文件上传Spring WebFlux数据库访问集成…

“从根到叶:深入理解堆数据结构“

​​​​​​​ 一.堆的概念及实现 1.1堆的概念 在数据结构中&#xff0c;堆是一种特殊的树形数据结构。堆可以分为最大堆和最小堆两种类型。 最大堆&#xff1a;对于堆中的任意节点&#xff0c;其父节点的值都不小于它的值。换句话说&#xff0c;最大堆中的根节点是堆中的最…

【Java 数据结构】泛型进阶

泛型 1 什么是泛型2 引出泛型2.1 语法 3 泛型类的使用3.1 语法3.2 示例3.3 类型推导(Type Inference) 泛型是如何编译的擦除机制裸类型4 泛型的上界4.1 语法4.2 示例4.3 复杂示例 5 泛型方法5.1 定义语法5.2 示例5.3 使用示例-可以类型推导5.4 使用示例-不使用类型推导 6 通配符…

【电路笔记】-串联电感

串联电感 文章目录 串联电感1、概述2、电感串联示例13、互耦串联电感器4、电感串联示例25、电感串联示例36、总结当电感器以菊花链方式连接在一起并共享公共电流时,它们可以串联连接在一起。 1、概述 这些电感器的互连产生了更复杂的网络,其总电感是各个电感器的组合。 然而…

深度学习从入门到不想放弃-7

上一章的内容 深度学习从入门到不想放弃-6 (qq.com) 今天讲的也算基础(这个系列后来我一寻思,全是基础 ),但是可能要着重说下,今天讲前向计算和反向传播,在哪儿它都永远是核心,不管面对什么模型 前向计算: 有的叫也叫正向传播,正向计算的,有的直接把前向的方法梯度下…

九、优化强度(Optimizing Intensity)

7.Optimizing Intensity 七、优化强度 Researchers have known for decades that there is a relationship between the optimal intensity of attention and the complexity of the task you want to perform. 数十年来&#xff0c;研究者已经知道你想要完成的任务的复杂性与最…

【AI视野·今日CV 计算机视觉论文速览 第299期】Mon, 29 Jan 2024

AI视野今日CS.CV 计算机视觉论文速览 Mon, 29 Jan 2024 Totally 55 papers &#x1f449;上期速览✈更多精彩请移步主页 Daily Computer Vision Papers Annotated Hands for Generative Models Authors Yue Yang, Atith N Gandhi, Greg TurkGAN 和扩散模型等生成模型已经展示了…

【C/C++】2024春晚刘谦春晚魔术步骤模拟+暴力破解

在这个特别的除夕夜&#xff0c;我们不仅享受了与家人的温馨团聚&#xff0c;还被电视机前的春节联欢晚会深深吸引。特别是&#xff0c;魔术师刘谦的精彩表演&#xff0c;为我们带来了一场视觉和心灵的盛宴。在我的博客“【C/C】2024春晚刘谦春晚魔术步骤模拟暴力破解”中&…

OpenCV基础:用Python生成一幅随机的噪声图像

使用Python&#xff1a;生成一幅随机数值的灰度图像&#xff0c;图像大小为1616像素。借助OpenCV库。输出数值&#xff0c;并显示图像。 # -*- coding: utf-8 -*- """ Created on Wed Feb 14 21:49:09 2024author: 李立宗公众号&#xff1a;计算机视觉之光知识…

证明之毕达哥拉斯定理

毕达哥拉斯定理 毕达哥拉斯的著名定理所讲的是&#xff0c;假设一直角三角形的三边长为a、b和c&#xff0c;其中c是斜边长&#xff08;直角所对的边&#xff09;&#xff0c;则 a 2 b 2 c 2 a^2b^2c^2 a2b2c2。这个定理有若干种证明&#xff0c;其中有一种特别简短&#xf…

【黑马程序员】C++封装、对象特性、友元

文章目录 类和对象封装封装的意义struct和class的区别成员属性设置为私有封装练习设计立方体类点和圆的关系 对象的初始化和清理构造函数和析构函数构造函数析构函数 构造函数的分类及调用拷贝构造函数的调用时机构造函数调用规则深拷贝与浅拷贝浅拷贝深拷贝 初始化列表类对象作…

matplotlib雷达图制作具体步骤

此次我们制作的是关于护肤品下的畅销品类雷达图&#xff0c;数据如下&#xff1a; 数据预览&#xff1a; 一、代码展示 import pandas as pd import numpy as np import matplotlib.pyplot as plt plt.rcParams[font.sans-serif][SimHei] adress"D:/pandas练习文件/雷达…

JAVA设计模式之解释器模式详解

解释器模式 1 解释器模式介绍 解释器模式使用频率不算高&#xff0c;通常用来描述如何构建一个简单“语言”的语法解释器。它只在一些非常特定的领域被用到&#xff0c;比如编译器、规则引擎、正则表达式、SQL 解析等。不过&#xff0c;了解它的实现原理同样很重要&#xff0…

零基础学编程怎么入手,中文编程工具构件箱之星空构件用法教程,系统化的编程视频教程上线

零基础学编程怎么入手&#xff0c;中文编程工具构件箱之星空构件用法教程&#xff0c;系统化的编程视频教程上线 一、前言 今天给大家分享的中文编程开发语言工具资料如下&#xff1a; 编程入门视频教程链接 http://​ https://edu.csdn.net/course/detail/39036 ​ 编程…

Java17之使用Lambda表达式对对象集合中指定的字段进行排序

Java17之使用Lambda表达式对对象集合中指定的字段进行排序 文章目录 Java17之使用Lambda表达式对对象集合中指定的字段进行排序1. 集合对象排序1. Java实体类2. 正序排序3.倒序排序 1. 集合对象排序 Java8起可用 List 的 sort 方法进行排序&#xff0c;形参为函数式接口Compara…

C++ //练习 6.12 改写6.2.1节中练习6.10(第188页)的程序,使用引用而非指针交换两个整数的值。你觉得哪种方法更易于使用呢?为什么?

C Primer&#xff08;第5版&#xff09; 练习 6.12 练习 6.12 改写6.2.1节中练习6.10&#xff08;第188页&#xff09;的程序&#xff0c;使用引用而非指针交换两个整数的值。你觉得哪种方法更易于使用呢&#xff1f;为什么&#xff1f; 环境&#xff1a;Linux Ubuntu&#x…

Docker关于conda环境的导出和导入

Docker关于conda环境的导出和导入 1、常用命令&#xff1a;2、环境导出&#xff1a;3、两个服务器之间的文件传输命令&#xff1a;4、环境导入&#xff1a;5、快速进入容器6、其他问题解决记录&#xff1a; 1、常用命令&#xff1a; docker pull -- 从远程仓库将镜像下载至本地…

医疗相关名词,医疗名词整理

1.系统类&#xff1a; HIS Hospital Information System&#xff0c;医院信息系统&#xff0c;在国际学术界已公认为新兴的医学信息学(Medical Informatics)的重要分支。美国该领域的著名教授Morris.Collen于1988年曾著文为医院信息系统下了如下定义&#xff1a;利用电子计算…