以led点亮为例。
STM32 裸机 C编程需要设置时钟,管脚。
static void MX_GPIO_Init(void)
{GPIO_InitTypeDef GPIO_InitStruct = {0};// GPIO端口时钟使能__HAL_RCC_GPIOA_CLK_ENABLE();// 配置PA5为推挽输出模式GPIO_InitStruct.Pin = GPIO_PIN_5;GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;GPIO_InitStruct.Pull = GPIO_NOPULL;GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
}
点亮led:
// 点亮LED(PA5)HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET);
micropython编程:
from pyb import Pinp_out = Pin('X1', Pin.OUT_PP)
p_out.high()
p_out.low()
linux python,管脚按顺序来设置:
from machine import Pin #导入Pin模块
from machine import FPIOA
import time#将GPIO52配置为普通GPIO
fpioa = FPIOA()
fpioa.set_function(52,FPIOA.GPIO52)LED=Pin(52,Pin.OUT) #构建led对象,GPIO52,输出
LED.value(1) #点亮LED,也可以使用led.on()
在01科技 k230 的api手册介绍网页2.11 Timer 模块API手册 — K230 CanMV 中提到了:
timer = Timer(index, mode=Timer.PERIODIC, freq=-1, period=-1, callback=None, arg=None) 【参数】
-
index: Timer号,取值:[-1,5],-1代表软件定时器
-
mode: 运行模式,单次或周期,可选参数
-
freq: Timer运行频率,支持浮点,单位Hz,可选参数,优先级高于
period
-
period: Timer运行周期,单位ms,可选参数
-
callback: 超时回调函数,必须设置,要带一个参数
-
arg: 超时回调函数参数,可选参数
注意: [0-5]硬件Timer暂不可用
这是被藏起来了?
在野火linux教学视频中,你看看led相关内容在哪里,在第22讲,时长6分钟。
个人之见,相对比较起来,openmv的资料还真是最全的。
某宝上的卡片电脑已经有算力到10TOP的了,名字很接地气地瓜机器人。
罗里吧嗦的写了这么多。感慨非网络专业的我,很多linux名词都看不懂。时代在进步,与时俱进不容易。