加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
config.json 43.57 KB
一键复制 编辑 原始数据 按行查看 历史
GeekROS 提交于 2022-04-03 09:48 . 1.0.0
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038
{
"version": "2.0.0",
"hardware": {
"status": true,
"build": "gcc"
},
"software": {
"status": true,
"build": "python"
},
"blocks": {
"status": true
},
"guide": [
{
"id": "basic",
"title": "基础",
"colours": {
"primary": "#58C0A6"
},
"blocks": [
{
"name": "board_open",
"disabled": false,
"function": {
"message0": "设置开发板串口地址为%1",
"args0": [
{
"type": "input_value",
"name": "port_data",
"check": "String",
"default": "/dev/ttyACM0"
}
]
},
"code": "sdk.board.init({port_data})\n",
"tips": {
"python": {
"label": "sdk.board.init(port:string)",
"kind": "function",
"insertText": "sdk.board.init(${1:port})",
"detail": "设置串口地址,port为字符串类型的串口地址或端口"
}
}
},
{
"name": "board_version",
"disabled": false,
"function": {
"message0": "开发板版本信息",
"args0": [],
"output": "String"
},
"code": "sdk.board.version.get_version()",
"tips": {
"python": {
"label": "sdk.board.version.get_version()",
"kind": "variable",
"insertText": "sdk.board.version.get_version()",
"detail": "获取开发板版本信息"
},
"hardware": {
"label": "Board_Version()",
"kind": "variable",
"insertText": "char version = Board_Version()",
"detail": "获取开发板版本信息"
}
}
},
{
"name": "time_state",
"disabled": false,
"function": {
"message0": "设置计时器状态为%1",
"args0": [
{
"type": "field_down",
"name": "time_state",
"check": "String",
"options":[
[
"开始",
"start"
],
[
"暂停",
"pause"
],
[
"结束",
"end"
]
]
}
]
},
"code": "sdk.common.time.set_state({time_state})\n",
"tips": {
"python": {
"label": "sdk.common.time.set_state(state:string)",
"kind": "function",
"insertText": "sdk.common.time.set_state(${1:state})",
"detail": "设置计时器状态:start|pause|end"
}
}
},
{
"name": "time_data",
"disabled": false,
"function": {
"message0": "当前计时器数值",
"args0": [],
"output": "Number"
},
"code": "sdk.common.time.millisecond",
"tips": {
"python": {
"label": "sdk.common.time.millisecond",
"kind": "function",
"insertText": "sdk.common.time.millisecond",
"detail": "获取当前计时器数值"
}
}
},
{
"name": "log_string",
"disabled": false,
"function": {
"message0": "输出日志%1",
"args0": [
{
"type": "input_value",
"name": "content",
"check": "String",
"default": "日志内容"
}
]
},
"code": "sdk.common.socket.log({content})\n",
"tips": {
"python": {
"label": "sdk.common.socket.log(content:string)",
"kind": "function",
"insertText": "sdk.common.socket.log(${1:content})",
"detail": "输出字符串日志,content为字符串类型"
}
}
},
{
"name": "log_number",
"disabled": false,
"function": {
"message0": "输出日志%1",
"args0": [
{
"type": "input_value",
"name": "content",
"check": "Number",
"default": 0,
"precision": 0.001
}
]
},
"code": "sdk.common.socket.log({content})\n",
"tips": {
"python": {
"label": "sdk.common.socket.log(content:string)",
"kind": "function",
"insertText": "sdk.common.socket.log(${1:content})",
"detail": "输出数字日志,content为数字类型"
}
}
}
]
},
{
"id": "adc_power",
"title": "ADC电源",
"colours": {
"primary": "#F56C6C"
},
"blocks": [
{
"name": "power_state",
"disabled": false,
"function": {
"message0": "设置%1电源通道%2状态为%3",
"args0": [
{
"type": "field_down",
"name": "channel",
"check": "Number",
"options": [
[
"5v",
"5"
],
[
"24v",
"24"
]
]
},
{
"type": "field_down",
"name": "id",
"check": "Number",
"options": [
[
"所有通道",
"0"
],
[
"通道一",
"1"
],
[
"通道二",
"2"
],
[
"通道三",
"3"
],
[
"通道四",
"4"
]
]
},
{
"type": "field_down",
"name": "state",
"check": "String",
"options": [
[
"打开",
"on"
],
[
"关闭",
"off"
]
]
}
]
},
"code": "sdk.board.power.set_state({channel}, {id}, {state})\n",
"tips": {
"python": {
"label": "sdk.board.power.set_state(channel:int, id:int, state:string)",
"kind": "function",
"insertText": "sdk.board.power.set_state(${1:channel}, ${2:id}, ${3:state})",
"detail": "可控电源状态控制,channel为电源通道:5|24,id为ID:1-4,state为状态:on|off"
},
"hardware": {
"label": "Power_State(channel:int, id:int, state:char)",
"kind": "function",
"insertText": "Power_State(${1:channel}, ${2:id}, ${3:state})",
"detail": "可控电源状态控制,channel为电源通道:5|24,id为ID:1-4,state为状态:on|off"
}
}
},
{
"name": "set_low_voltage",
"disabled": false,
"function": {
"message0": "设置电压报警阈值为%1",
"args0": [
{
"type": "input_value",
"name": "voltage",
"check": "Number",
"default": 0,
"min": 0,
"max": 24,
"precision": 0.001
}
]
},
"code": "sdk.board.adc.set_low_voltage({voltage})\n",
"tips": {
"python": {
"label": "sdk.board.adc.set_low_voltage(voltage:float)",
"kind": "function",
"insertText": "sdk.board.adc.set_low_voltage(${1:voltage})",
"detail": "设置电压报警阈值,voltage为低电压报警值,数字类型"
},
"hardware": {
"label": "Adc_Low_Voltage(voltage:float)",
"kind": "function",
"insertText": "Adc_Low_Voltage(${1:voltage})",
"detail": "设置电压报警阈值,voltage为低电压报警值,数字类型"
}
}
},
{
"name": "read_board_voltage",
"disabled": false,
"function": {
"message0": "读取开发板电压",
"args0": []
},
"code": "sdk.board.adc.get_board_voltage()\n",
"tips": {
"python": {
"label": "sdk.board.adc.get_board_voltage()",
"kind": "function",
"insertText": "sdk.board.adc.get_board_voltage()",
"detail": "读取开发板电压"
},
"hardware": {
"label": "Adc_Board_Voltage()",
"kind": "function",
"insertText": "float board_voltage = Adc_Board_Voltage()",
"detail": "读取开发板电压"
}
}
},
{
"name": "board_voltage",
"disabled": false,
"function": {
"message0": "当前开发板电压值",
"args0": [],
"output": "Number"
},
"code": "sdk.board.adc.voltage",
"tips": {
"python": {
"label": "sdk.board.adc.voltage",
"kind": "variable",
"insertText": "sdk.board.adc.voltage",
"detail": "当前开发板电压"
}
}
},
{
"name": "read_pwm_voltage",
"disabled": false,
"function": {
"message0": "当前开发板PWM电压",
"args0": []
},
"code": "sdk.board.adc.get_pwm_voltage()\n",
"tips": {
"python": {
"label": "sdk.board.adc.get_pwm_voltage()",
"kind": "function",
"insertText": "sdk.board.adc.get_pwm_voltage()",
"detail": "当前开发板PWM电压"
},
"hardware": {
"label": "Adc_Pwm_Voltage()",
"kind": "function",
"insertText": "float pwm_voltage = Adc_Pwm_Voltage()",
"detail": "读取开发板PWM电压"
}
}
},
{
"name": "pwm_voltage",
"disabled": false,
"function": {
"message0": "当前开发板PWM电压值",
"args0": [],
"output": "Number"
},
"code": "sdk.board.adc.pwm_voltage",
"tips": {
"python": {
"label": "sdk.board.adc.pwm_voltage",
"kind": "variable",
"insertText": "sdk.board.adc.pwm_voltage",
"detail": "当前开发板PWM电压"
}
}
},
{
"name": "read_cpu_temperature",
"disabled": false,
"function": {
"message0": "读取开发板芯片温度",
"args0": []
},
"code": "sdk.board.cpu.get_temperature()\n",
"tips": {
"python": {
"label": "sdk.board.cpu.get_temperature()",
"kind": "function",
"insertText": "sdk.board.cpu.get_temperature()",
"detail": "读取开发板芯片温度"
},
"hardware": {
"label": "Cpu_Temperature()",
"kind": "function",
"insertText": "float temperature = Cpu_Temperature()",
"detail": "读取开发板芯片温度"
}
}
},
{
"name": "cpu_temperature",
"disabled": false,
"function": {
"message0": "当前开发板CPU温度值",
"args0": [],
"output": "Number"
},
"code": "sdk.board.cpu.temperature",
"tips": {
"python": {
"label": "sdk.board.cpu.temperature",
"kind": "variable",
"insertText": "sdk.board.cpu.temperature",
"detail": "当前开发板CPU温度值"
}
}
}
]
},
{
"id": "led",
"title": "LED灯效",
"colours": {
"primary": "#F19D38"
},
"blocks": [
{
"name": "set_led_state",
"disabled": false,
"function": {
"message0": "设置%1灯的状态为%2",
"args0": [
{
"type": "field_down",
"name": "channel",
"check": "String",
"options": [
[
"全部",
"all"
],
[
"绿色",
"green"
],
[
"红色",
"red"
],
[
"蓝色",
"blue"
]
]
},
{
"type": "field_down",
"name": "state",
"check": "String",
"options": [
[
"打开",
"on"
],
[
"关闭",
"off"
],
[
"状态翻转",
"switch"
]
]
}
]
},
"code": "sdk.board.led.set_state({channel}, {state})\n",
"tips": {
"python": {
"label": "sdk.board.led.set_state(channel:string, state:string)",
"kind": "function",
"insertText": "sdk.board.led.set_state(${1:channel}, ${2:state})",
"detail": "设置LED灯状态,channel为通道:green|red|blue,state为状态:off|on|switch"
},
"hardware": {
"label": "Led_State(channel:char, state:char)",
"kind": "function",
"insertText": "Led_State(${1:channel}, ${2:state})",
"detail": "设置LED灯状态,channel为通道:green|red|blue,state为状态:off|on|switch"
}
}
}
]
},
{
"id": "key",
"title": "KEY按键",
"colours": {
"primary": "#E05788"
},
"blocks": [
{
"name": "read_key_state",
"disabled": false,
"function": {
"message0": "读取自定义按键状态",
"args0": []
},
"code": "sdk.board.key.get_state()\n",
"tips": {
"python": {
"label": "sdk.board.key.get_state()",
"kind": "function",
"insertText": "sdk.board.key.get_state()",
"detail": "读取自定义按键状态"
}
}
},
{
"name": "key_state",
"disabled": false,
"function": {
"message0": "当前自定义按键状态",
"args0": [],
"output": "Number"
},
"code": "sdk.board.key.key_state",
"tips": {
"python": {
"label": "sdk.board.key.key_state",
"kind": "function",
"insertText": "sdk.board.key.key_state",
"detail": "当前自定义按键状态:0为抬起,1为按下"
},
"hardware": {
"label": "Key_State",
"kind": "variable",
"insertText": "int key_state = Key_State",
"detail": "当前自定义按键状态:0为抬起,1为按下"
}
}
},
{
"name": "key_event",
"disabled": false,
"function": {
"message0": "当自定义按键状态为%1时",
"args0": [
{
"type": "field_down",
"name": "state",
"check": "Number",
"options": [
[
"按下",
"1"
],
[
"抬起",
"0"
]
]
}
],
"message1": "%1",
"args1": [
{
"type": "input_statement",
"name": "SUBSTACK"
}
],
"shapeType": "event"
},
"code": "def key_state_{state}_event(geek):\n{code}\n",
"tips": {
"python": {
"label": "key_state_event",
"kind": "function",
"insertText": "def key_state_${1:state}_event(geek):\npass\n",
"detail": "监听KEY自定义按键状态事件,state设置为0、1触发不同状态的事件"
}
}
}
]
},
{
"id": "io",
"title": "IO控制",
"colours": {
"primary": "#64C7DE"
},
"blocks": [
{
"name": "io_mode",
"disabled": false,
"function": {
"message0": "设置IO通道%1模式为%2",
"args0": [
{
"type": "field_down",
"name": "channel",
"check": "Number",
"options": [
[
"通道一",
"1"
],
[
"通道二",
"2"
],
[
"通道三",
"3"
],
[
"通道四",
"4"
],
[
"通道五",
"5"
],
[
"通道六",
"6"
],
[
"通道七",
"7"
],
[
"通道八",
"8"
],
[
"通道九",
"9"
],
[
"通道十",
"10"
],
[
"通道十一",
"11"
],
[
"通道十二",
"12"
],
[
"通道十三",
"13"
],
[
"通道十四",
"14"
],
[
"通道十五",
"15"
],
[
"通道十六",
"16"
],
[
"通道十七",
"17"
],
[
"通道十八",
"18"
]
]
},
{
"type": "field_down",
"name": "mode",
"check": "String",
"options": [
[
"输入模式",
"in"
],
[
"输出模式",
"out"
]
]
}
]
},
"code": "sdk.board.io.set_mode({channel}, {mode})\n",
"tips": {
"python": {
"label": "sdk.board.io.set_mode(channel:int, mode:string)",
"kind": "function",
"insertText": "sdk.board.io.set_mode(${1:channel}, ${2:mode})",
"detail": "设置IO模式,channel为通道:1-18,mode为模式:in|out"
},
"hardware": {
"label": "Io_Model",
"kind": "funtion",
"insertText": "Io_Model(${1:channel}, ${2:mode})",
"detail": "设置IO模式,channel为通道:1-18,mode为模式:in|out"
}
}
},
{
"name": "io_state",
"disabled": false,
"function": {
"message0": "设置IO通道%1状态为%2",
"args0": [
{
"type": "field_down",
"name": "channel",
"check": "Number",
"options": [
[
"通道一",
"1"
],
[
"通道二",
"2"
],
[
"通道三",
"3"
],
[
"通道四",
"4"
],
[
"通道五",
"5"
],
[
"通道六",
"6"
],
[
"通道七",
"7"
],
[
"通道八",
"8"
],
[
"通道九",
"9"
],
[
"通道十",
"10"
],
[
"通道十一",
"11"
],
[
"通道十二",
"12"
],
[
"通道十三",
"13"
],
[
"通道十四",
"14"
],
[
"通道十五",
"15"
],
[
"通道十六",
"16"
],
[
"通道十七",
"17"
],
[
"通道十八",
"18"
]
]
},
{
"type": "field_down",
"name": "state",
"check": "String",
"options": [
[
"高电平",
"high"
],
[
"低电平",
"low"
],
[
"状态反转",
"switch"
]
]
}
]
},
"code": "sdk.board.io.set_state({channel}, {state})\n",
"tips": {
"python": {
"label": "sdk.board.io.set_state(channel:int, state:string)",
"kind": "function",
"insertText": "sdk.board.io.set_state(${1:channel}, ${2:state})",
"detail": "设置IO模式,channel为通道:1-18,state为模式:high|low|switch"
},
"hardware": {
"label": "Io_State",
"kind": "funtion",
"insertText": "Io_State(${1:channel}, ${2:state})",
"detail": "设置IO模式,channel为通道:1-18,state为模式:high|low|switch"
}
}
}
]
},
{
"id": "pwm",
"title": "PWM控制",
"colours": {
"primary": "#E04C41"
},
"blocks": [
{
"name": "pwm_control",
"disabled": false,
"function": {
"message0": "设置%1频率为%2脉宽为%3",
"args0": [
{
"type": "field_down",
"name": "channel",
"check": "Number",
"options": [
[
"所有通道",
"0"
],
[
"通道一",
"1"
],
[
"通道二",
"2"
],
[
"通道三",
"3"
],
[
"通道四",
"4"
],
[
"通道五",
"5"
],
[
"通道六",
"6"
],
[
"通道七",
"7"
],
[
"通道八",
"8"
],
[
"通道九",
"9"
],
[
"通道十",
"10"
],
[
"通道十一",
"11"
],
[
"通道十二",
"12"
],
[
"通道十三",
"13"
],
[
"通道十四",
"14"
],
[
"通道十五",
"15"
],
[
"通道十六",
"16"
]
]
},
{
"type": "input_value",
"name": "rate",
"check": "Number"
},
{
"type": "input_value",
"name": "width",
"check": "Number"
}
]
},
"code": "sdk.board.pwm.pwm_control({channel}, {rate}, {width})\n",
"tips": {
"python": {
"label": "sdk.board.pwm.pwm_control(channel:int, rate:int, width:int)",
"kind": "function",
"insertText": "sdk.board.pwm.pwm_control(${1:channel}, ${2:rate}, ${2:width})",
"detail": "PWN控制,channel为通道:0-16,rate为分辨率,width为脉宽"
},
"hardware": {
"label": "Pwm_Motion(channel:int, rate:int, width:int)",
"kind": "function",
"insertText": "Pwm_Motion(${1:channel}, ${2:rate}, ${2:width})",
"detail": "PWN控制,channel为通道:0-16,rate为分辨率,width为脉宽"
}
}
}
]
},
{
"id": "sensor",
"title": "传感器",
"colours": {
"primary": "#F5C343"
},
"blocks": [
{
"name": "read_mpu_data",
"disabled": false,
"function": {
"message0": "读取MPU传感器数据",
"args0": []
},
"code": "sdk.board.mpu.read_data()\n",
"tips": {
"python": {
"label": "sdk.board.mpu.read_data()",
"kind": "function",
"insertText": "sdk.board.mpu.read_data()",
"detail": "读取MPU传感器数据"
}
}
},
{
"name": "get_mpu_data",
"disabled": false,
"function": {
"message0": "当前MPU的%1数据",
"args0": [
{
"type": "field_down",
"name": "data",
"check": "String",
"options": [
[
"pitch轴姿态",
"pit"
],
[
"yaw轴姿态",
"yaw"
],
[
"roll轴姿态",
"rol"
],
[
"环境气温",
"temperature"
],
[
"海拔高度",
"altitude"
],
[
"气压",
"pressure"
]
]
}
],
"output": "Number"
},
"code": "sdk.board.mpu.get_data({data})",
"tips": {
"python": {
"label": "sdk.board.mpu.get_data(data:string)",
"kind": "variable",
"insertText": "sdk.board.mpu.get_data(${1:data})",
"detail": "当前MPU传感器数据,data为要取出的数据:pit|yaw|pol|temperature|altitude|pressure"
},
"hardware": {
"label": "Mpu_Read_Data",
"kind": "variable",
"insertText": "Mpu_Read_Data.${1:data}",
"detail": "当前MPU传感器数据,data为要取出的数据:pit|yaw|pol|temperature|altitude|pressure"
}
}
}
]
}
]
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化