9 Commits

24 changed files with 370857 additions and 6915 deletions

View File

@ -14,8 +14,8 @@ cturing Information (PMI)---4.0---2014-10-13',
/* implementation_level */ '2;1');
FILE_NAME(
/* name */ '62ebc0e691c8e9784977d474',
/* time_stamp */ '2022-08-04T12:51:51+00:00',
/* name */ '637eac238791062a77bbc103',
/* time_stamp */ '2022-11-23T23:26:28+00:00',
/* author */ (''),
/* organization */ (''),
/* preprocessor_version */ 'ST-DEVELOPER v18.102',
@ -1255,26 +1255,26 @@ DATA;
#1232=CARTESIAN_POINT('',(-3.46944695195361E-18,0.0025,0.00012));
#1233=CARTESIAN_POINT('',(-3.46944695195361E-18,0.0025,0.));
#1234=CARTESIAN_POINT('',(-3.46944695195361E-18,0.0025,0.00012));
#1235=CARTESIAN_POINT('',(0.019,0.011,0.00012));
#1236=CARTESIAN_POINT('',(0.019,0.011,0.00012));
#1237=CARTESIAN_POINT('',(0.02075,0.011,0.00012));
#1238=CARTESIAN_POINT('',(0.019,0.011,0.));
#1239=CARTESIAN_POINT('',(0.02075,0.011,0.));
#1240=CARTESIAN_POINT('',(-0.019,0.011,0.00012));
#1241=CARTESIAN_POINT('',(-0.019,0.011,0.00012));
#1242=CARTESIAN_POINT('',(-0.01725,0.011,0.00012));
#1243=CARTESIAN_POINT('',(-0.019,0.011,0.));
#1244=CARTESIAN_POINT('',(-0.01725,0.011,0.));
#1245=CARTESIAN_POINT('',(-0.019,-0.011,0.00012));
#1246=CARTESIAN_POINT('',(-0.019,-0.011,0.00012));
#1247=CARTESIAN_POINT('',(-0.01725,-0.011,0.00012));
#1248=CARTESIAN_POINT('',(-0.019,-0.011,0.));
#1249=CARTESIAN_POINT('',(-0.01725,-0.011,0.));
#1250=CARTESIAN_POINT('',(0.019,-0.011,0.00012));
#1251=CARTESIAN_POINT('',(0.019,-0.011,0.00012));
#1252=CARTESIAN_POINT('',(0.02075,-0.011,0.00012));
#1253=CARTESIAN_POINT('',(0.019,-0.011,0.));
#1254=CARTESIAN_POINT('',(0.02075,-0.011,0.));
#1235=CARTESIAN_POINT('',(0.0195,0.0115,0.00012));
#1236=CARTESIAN_POINT('',(0.0195,0.0115,0.00012));
#1237=CARTESIAN_POINT('',(0.02125,0.0115,0.00012));
#1238=CARTESIAN_POINT('',(0.0195,0.0115,0.));
#1239=CARTESIAN_POINT('',(0.02125,0.0115,0.));
#1240=CARTESIAN_POINT('',(-0.0195,0.0115,0.00012));
#1241=CARTESIAN_POINT('',(-0.0195,0.0115,0.00012));
#1242=CARTESIAN_POINT('',(-0.01775,0.0115,0.00012));
#1243=CARTESIAN_POINT('',(-0.0195,0.0115,0.));
#1244=CARTESIAN_POINT('',(-0.01775,0.0115,0.));
#1245=CARTESIAN_POINT('',(-0.0195,-0.0115,0.00012));
#1246=CARTESIAN_POINT('',(-0.0195,-0.0115,0.00012));
#1247=CARTESIAN_POINT('',(-0.01775,-0.0115,0.00012));
#1248=CARTESIAN_POINT('',(-0.0195,-0.0115,0.));
#1249=CARTESIAN_POINT('',(-0.01775,-0.0115,0.));
#1250=CARTESIAN_POINT('',(0.0195,-0.0115,0.00012));
#1251=CARTESIAN_POINT('',(0.0195,-0.0115,0.00012));
#1252=CARTESIAN_POINT('',(0.02125,-0.0115,0.00012));
#1253=CARTESIAN_POINT('',(0.0195,-0.0115,0.));
#1254=CARTESIAN_POINT('',(0.02125,-0.0115,0.));
#1255=CARTESIAN_POINT('',(-0.007175,0.009,0.00012));
#1256=CARTESIAN_POINT('',(-0.007175,0.009,0.));
#1257=CARTESIAN_POINT('',(-0.007175,0.009,0.00012));

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,10 @@
{
"board": {
"active_layer": 0,
"active_layer": 36,
"active_layer_preset": "",
"auto_track_width": false,
"hidden_nets": [],
"high_contrast_mode": 0,
"high_contrast_mode": 1,
"net_color_mode": 1,
"opacity": {
"pads": 1.0,
@ -62,7 +62,7 @@
35,
36
],
"visible_layers": "ffcffff_ffffffff",
"visible_layers": "ff4ffff_ffffffff",
"zone_display_mode": 0
},
"meta": {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,18 @@
(footprint "Alignment_hole" (version 20211014) (generator pcbnew)
(layer "F.Cu")
(tedit 0)
(attr through_hole exclude_from_pos_files exclude_from_bom)
(fp_text reference "REF**" (at 0 -2 unlocked) (layer "F.SilkS")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp fa4317a5-84bf-4bc5-a76e-39c9dc74322a)
)
(fp_text value "Alignment_hole" (at 0 3.5 unlocked) (layer "F.Fab")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp 5c6e8499-7ddb-488e-b28a-698103ce6e3c)
)
(fp_text user "${REFERENCE}" (at 0 5 unlocked) (layer "F.Fab")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp 15e51ca5-9eb7-44d4-880d-ebea60015cd4)
)
(pad "" thru_hole circle (at 0 0) (size 1.8 1.8) (drill 1) (layers *.Cu *.Mask) (tstamp b1f6e753-2943-4966-9a1d-84d501867e27))
)

View File

@ -45,64 +45,24 @@
(fp_arc (start -23 -13) (mid -22.414214 -14.414214) (end -21 -15) (layer "Dwgs.User") (width 0.1) (tstamp 4d123677-82ba-40d7-b06e-329a209c99e5))
(fp_arc (start -6.25 -0.5) (mid -5.664214 -1.914214) (end -4.25 -2.5) (layer "Dwgs.User") (width 0.1) (tstamp ed372a68-ac06-4910-b679-3abb459c4053))
(fp_arc (start 23 13) (mid 22.414214 14.414214) (end 21 15) (layer "Dwgs.User") (width 0.1) (tstamp f397ea00-77b3-4e52-8c1f-f40fbefb4c5a))
(fp_circle (center 19 -11) (end 20.75 -11) (layer "Dwgs.User") (width 0.1) (fill none) (tstamp 44be3ae8-2900-4186-bdf3-aa0df1b60494))
(fp_circle (center -19 -11) (end -17.25 -11) (layer "Dwgs.User") (width 0.1) (fill none) (tstamp 69d5781c-ea7a-40e7-b059-5c794936e027))
(fp_circle (center 19 11) (end 20.75 11) (layer "Dwgs.User") (width 0.1) (fill none) (tstamp e2e72bf3-dc42-417c-ad1e-89b7265ae9a4))
(fp_circle (center -19 11) (end -17.25 11) (layer "Dwgs.User") (width 0.1) (fill none) (tstamp f8dcb164-b515-4358-89d4-593010f27b67))
(fp_circle (center 19.5 -11.5) (end 21.25 -11.5) (layer "Dwgs.User") (width 0.1) (fill none) (tstamp 44be3ae8-2900-4186-bdf3-aa0df1b60494))
(fp_circle (center -19.5 -11.5) (end -17.75 -11.5) (layer "Dwgs.User") (width 0.1) (fill none) (tstamp 69d5781c-ea7a-40e7-b059-5c794936e027))
(fp_circle (center 19.5 11.5) (end 21.25 11.5) (layer "Dwgs.User") (width 0.1) (fill none) (tstamp e2e72bf3-dc42-417c-ad1e-89b7265ae9a4))
(fp_circle (center -19.5 11.5) (end -17.75 11.5) (layer "Dwgs.User") (width 0.1) (fill none) (tstamp f8dcb164-b515-4358-89d4-593010f27b67))
(fp_rect (start -7.175 -11.4) (end -6.825 -6.6) (layer "User.2") (width 0.01) (fill solid) (tstamp 15cec376-0cc5-4fb9-9546-200acbadd4c3))
(fp_rect (start 6.825 -11.4) (end 7.175 -6.6) (layer "User.2") (width 0.01) (fill solid) (tstamp 2b145196-0d0e-4b3a-a10d-f603e04431b2))
(fp_rect (start 15.1 0.175) (end 19.9 -0.175) (layer "User.2") (width 0.01) (fill solid) (tstamp 65179cb2-be1e-4398-a5c0-b1ccfeb04f75))
(fp_rect (start -4.25 -2.5) (end 4.25 10) (layer "User.2") (width 0.01) (fill solid) (tstamp 7a34eea2-a6e8-4a3b-96ce-95ae0942333a))
(fp_rect (start -19.9 0.175) (end -15.1 -0.175) (layer "User.2") (width 0.01) (fill solid) (tstamp 94f3ef5d-a92b-4037-9ba0-96a63bb9f2cf))
(fp_rect (start -6.25 -0.5) (end 6.25 8) (layer "User.2") (width 0.01) (fill solid) (tstamp 97e33b51-4c2e-434b-811f-517d98fdabf8))
(fp_circle (center 19 11) (end 20.75 11) (layer "User.2") (width 0.01) (fill solid) (tstamp 02ebc153-06e5-42e5-ae0e-95cf53d2686e))
(fp_circle (center -19 -11) (end -17.25 -11) (layer "User.2") (width 0.01) (fill solid) (tstamp 1d2e485c-13d9-491b-b9b1-d7cdb1ddacd4))
(fp_circle (center 19 -11) (end 20.75 -11) (layer "User.2") (width 0.01) (fill solid) (tstamp 4f064766-fcbe-42b2-9cf1-e3ce1c52823d))
(fp_circle (center 19.5 11.5) (end 21.25 11.5) (layer "User.2") (width 0.01) (fill solid) (tstamp 02ebc153-06e5-42e5-ae0e-95cf53d2686e))
(fp_circle (center -19.5 -11.5) (end -17.75 -11.5) (layer "User.2") (width 0.01) (fill solid) (tstamp 1d2e485c-13d9-491b-b9b1-d7cdb1ddacd4))
(fp_circle (center 19.5 -11.5) (end 21.25 -11.5) (layer "User.2") (width 0.01) (fill solid) (tstamp 4f064766-fcbe-42b2-9cf1-e3ce1c52823d))
(fp_circle (center 4.25 8) (end 6.25 8) (layer "User.2") (width 0.01) (fill solid) (tstamp b2368e7f-0f40-4282-af0f-69e4749fe499))
(fp_circle (center -19 11) (end -17.25 11) (layer "User.2") (width 0.01) (fill solid) (tstamp b4e0236b-b4d5-4fe0-a283-ecee8bcceaba))
(fp_circle (center -19.5 11.5) (end -17.75 11.5) (layer "User.2") (width 0.01) (fill solid) (tstamp b4e0236b-b4d5-4fe0-a283-ecee8bcceaba))
(fp_circle (center 4.25 -0.5) (end 6.25 -0.5) (layer "User.2") (width 0.01) (fill solid) (tstamp b5fb8139-8b3b-4c94-9ad9-eb356c47c480))
(fp_circle (center -4.25 8.000001) (end -2.25 8.000001) (layer "User.2") (width 0.01) (fill solid) (tstamp c8e2cfaa-51bd-4851-a6ce-1afe5d99229f))
(fp_circle (center -4.25 -0.5) (end -2.25 -0.5) (layer "User.2") (width 0.01) (fill solid) (tstamp f2088203-ec06-4532-9ae1-2f2a4395cba9))
(group "Edges" (id 5f068654-7d13-4c99-823f-ca04be378f88)
(members
02f7b83b-69e5-402a-97cd-2ab9ae004365
0e956636-6ecf-40f5-b446-5a28641115e4
139f406e-f1be-4460-bd37-ea8577c4c405
1f015c40-87c5-446d-9682-a71c8c78a240
40bed328-bcff-4a79-862f-05ffa9f0851e
413987a6-e7ff-431f-a102-4d44d813b7bf
43985166-a138-4b16-8f05-eaa329c21854
44be3ae8-2900-4186-bdf3-aa0df1b60494
4d123677-82ba-40d7-b06e-329a209c99e5
562392bc-7fdc-42fb-acf8-8f876fb4baee
6093230f-7da9-436b-a565-22d094506fe8
640cd49d-8be5-4b08-b630-e5f8f8377094
69d5781c-ea7a-40e7-b059-5c794936e027
6c0fac88-9a87-4a51-b33d-184c9ee1cbe4
7126884e-33f6-4742-990f-12a47d411edf
730eedee-9a7c-4f43-8635-69482b5c5018
7f8d4600-f7b7-4961-826b-537479190fec
809ec121-7a00-407b-9216-a6d943033b14
a222aa4e-c344-46b7-bf55-3c6a0aa0a374
a2af30a0-1af5-4580-a31f-0dd5c5ff6734
aa48cd2b-dfd1-49b6-83ee-da5bce84fcd5
aca2d6e2-fe5d-4a12-a499-e4f77b3547cc
ae18f94e-c1fd-4c12-8c06-ff09a4e6e190
bea27199-2194-4f85-a1b7-c8be78ada6e8
c9dd16cc-624b-413b-a0b9-6f812f8a3f7d
d71880c6-495a-4f68-ae0e-ff186b05c077
e2e72bf3-dc42-417c-ad1e-89b7265ae9a4
e7b98613-f8b3-4a0f-a012-c3972828c1f8
ebde6eb6-c376-45f3-8cf1-68b9dd545362
ed372a68-ac06-4910-b679-3abb459c4053
f397ea00-77b3-4e52-8c1f-f40fbefb4c5a
f8a2ccf5-c0e1-49c1-a842-399a9e338537
f8dcb164-b515-4358-89d4-593010f27b67
fce5c3c5-c70c-4ae2-bcfa-1f6bf6b5df83
fe4338d1-8013-48f5-8247-78ece50c7ade
fedfbe41-eacd-4c64-8365-aaee91c517dc
)
)
(model "/home/petr/work/butcube/modules/Sun_sensor/Stencil.step"
(offset (xyz 0 0 0))
(scale (xyz 1 1 1))

File diff suppressed because it is too large Load Diff

View File

@ -1,2 +1,3 @@
(fp_lib_table
(lib (name "Sun_shield")(type "KiCad")(uri "${KIPRJMOD}/Sun_shield.pretty")(options "")(descr ""))
)

1
modules/Sun_sensor/fw/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
build/

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,19 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "cortex-debug",
"request": "launch",
"servertype": "openocd",
"cwd": "${workspaceRoot}",
"executable": "${workspaceRoot}/build/Sun_sensor.elf",
"name": "GDB + OpenOCD",
"device": "STM32L432",
"configFiles": [
"interface/stlink.cfg",
"target/stm32l4x.cfg"
]
}
]
}

View File

@ -0,0 +1,83 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License.
Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License.
Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution.
You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
1.You must give any other recipients of the Work or Derivative Works a copy of this License; and
2.You must cause any modified files to carry prominent notices stating that You changed the files; and
3.You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
4.If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions.
Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
6. Trademarks.
This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty.
Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
8. Limitation of Liability.
In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability.
While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX:
Copyright [2019] [STMicroelectronics]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -0,0 +1,6 @@
This software component is provided to you as part of a software package and
applicable license terms are in the Package_license file. If you received this
software component outside of a package or without applicable license terms,
the terms of the BSD-3-Clause license shall apply.
You may obtain a copy of the BSD-3-Clause at:
https://opensource.org/licenses/BSD-3-Clause

View File

@ -0,0 +1,3 @@
# Copyright (c) 2017 STMicroelectronics
This software component is licensed by STMicroelectronics under the **BSD 3-Clause** license. You may not use this file except in compliance with this license. You may obtain a copy of the license [here](https://opensource.org/licenses/BSD-3-Clause).

View File

@ -60,6 +60,30 @@ void Error_Handler(void);
/* Private defines -----------------------------------------------------------*/
#define RCC_HSE_Pin GPIO_PIN_0
#define RCC_HSE_GPIO_Port GPIOA
#define FR_RDY__1_Pin GPIO_PIN_1
#define FR_RDY__1_GPIO_Port GPIOA
#define CS__1_Pin GPIO_PIN_4
#define CS__1_GPIO_Port GPIOA
#define FRAM_CS_Pin GPIO_PIN_1
#define FRAM_CS_GPIO_Port GPIOB
#define FR_RDY__2_Pin GPIO_PIN_9
#define FR_RDY__2_GPIO_Port GPIOA
#define CS__2_Pin GPIO_PIN_10
#define CS__2_GPIO_Port GPIOA
#define CAN_RS_Pin GPIO_PIN_15
#define CAN_RS_GPIO_Port GPIOA
#define LED2_Pin GPIO_PIN_3
#define LED2_GPIO_Port GPIOB
#define LED1_Pin GPIO_PIN_4
#define LED1_GPIO_Port GPIOB
#define CS__3_Pin GPIO_PIN_5
#define CS__3_GPIO_Port GPIOB
#define FR_RDY__3_Pin GPIO_PIN_6
#define FR_RDY__3_GPIO_Port GPIOB
#define CS__4_Pin GPIO_PIN_7
#define CS__4_GPIO_Port GPIOB
#define FR_RDY__4_Pin GPIO_PIN_3
#define FR_RDY__4_GPIO_Port GPIOH
/* USER CODE BEGIN Private defines */
/* USER CODE END Private defines */

View File

@ -0,0 +1,78 @@
#include "MLX75306.hpp"
MLX75306::MLX75306(SPI_HandleTypeDef SPI_handle, Chip_select_pin SPI_CS) :
SPI_handle(SPI_handle), SPI_CS(SPI_CS){ }
void MLX75306::Init(){
Reset();
}
void MLX75306::Reset(){
Command(Commands::Chip_reset, { 0, 0 });
}
void MLX75306::Wake_up(){
Command(Commands::Wake_up, { 0, 0 });
}
void MLX75306::Zebra_pattern_1(){
Command(Commands::Test_zebra_pattern_1, { 0, 0 });
}
array<uint8_t, 159> MLX75306::Read_all_8bit(){
// Command is set to read all pixels
return Command<159>(Commands::Read_out_8b, { 0x02, 0x8f });
}
void MLX75306::Integrate(double time_us){
const unsigned int f_RCO = 10000000;
const double min_time_us = 0.1;
const double max_time_us = 100000;
int64_t integration_register = 0;
// Cap values
if (time_us < min_time_us) {
time_us = min_time_us;
}
if (time_us > max_time_us) {
time_us = max_time_us;
}
// Calculate value for short integration
integration_register = ((time_us / 1000000) * f_RCO) + 4;
// If integration time is longer then maximal short integration time used long integration command
if (integration_register > ((1 << 16) - (11 * 16))) {
integration_register = (((time_us / 1000000) * f_RCO) - 11) / 16;
// Handle overflow and underflow of integration register
if (integration_register > (1 << 16)) {
integration_register = (1 << 16) - 1;
} else if (integration_register < 0) {
integration_register = 1;
}
// Long integration
Command(Commands::Start_integration_long,
{
static_cast<uint8_t>((integration_register & 0xff00) >> 8),
static_cast<uint8_t>(integration_register & 0xff)
}
);
} else {
// Short integration
Command(Commands::Start_integration,
{
static_cast<uint8_t>((integration_register & 0xff00) >> 8),
static_cast<uint8_t>(integration_register & 0xff)
}
);
}
} // MLX75306::Integrate
MLX75306::Status_byte MLX75306::Status(){
array<uint8_t, 2> payload = { 0, 0 };
auto status = Command(Commands::Idle, payload)[0];
Status_byte status_struct = *((Status_byte *) &(status));
return status_struct;
}

View File

@ -0,0 +1,186 @@
/**
* @file SPI_camera.hpp
* @author Petr Malaník (TheColonelYoung(at)gmail(dot)com)
* @brief
* @version 0.1
* @date 1.03.2023
*/
#pragma once
#include "stm32l4xx_hal.h"
#include <array>
using namespace std;
typedef unsigned int uint;
/**
* @brief Linear optical sensor array, including a 142 x 1 array of photodiodes
* associated charge amplifier circuitry and a pixel data-hold function that
* provides simultaneous integration start and stop times for all pixels.
*/
class MLX75306
{
public:
/**
* @brief Describes GPIO which serves as SPI chip select pin
*/
struct Chip_select_pin {
GPIO_TypeDef *port;
uint16_t pin;
};
/**
* @brief Command for MLX75306, whole command composes of 3 bytes, first byte is from enum below
* Other two bytes are payload which could be command specific or empty
*/
enum class Commands: uint8_t {
Idle = 0b00000000,
Chip_reset = 0b11110000,
Read_thresholds = 0b11011000,
Write_thresholds = 0b11001100,
Start_integration = 0b10111000,
Start_integration_long = 0b10110100,
Read_out_1b = 0b10011100,
Read_out_1b5 = 0b10010110,
Read_out_4b = 0b10010011,
Read_out_8b = 0b10011001,
Test_zebra_pattern_1 = 0b11101000,
Test_zebra_pattern_2 = 0b11100100,
Test_zebra_pattern_12 = 0b11100010,
Test_zebra_pattern_0 = 0b11100001,
Sleep_mode = 0b11000110,
Wake_up = 0b11000011,
};
/**
* @brief Structure of MLX75306 status byte
*/
struct __attribute__((packed)) __attribute__((__may_alias__)) Status_byte{
uint8_t command_counter : 5; // Counter of valid commands
uint8_t device_mode : 1; // Device mode: 0-Test 1-User
uint8_t power_up_in_progress : 1; // Set after first Chip_reset command, clear after power-up
uint8_t operational_mode : 1; // Device operational mode: 0-Sleep 1-Normal
};
protected:
/*
* @brief HAL handle of SPI to which is ArduChip connected
*/
SPI_HandleTypeDef SPI_handle;
/**
* @brief GPIO description which serves as SPI Chip select
*/
Chip_select_pin SPI_CS;
public:
/**
* @brief Construct a new MLX75306 object
*
* @param SPI_handle HAL handle of SPI to which is sensor connected
* @param SPI_CS GPIO description which serves as SPI Chip select
*/
MLX75306(SPI_HandleTypeDef SPI_handle, Chip_select_pin SPI_CS);
/**
* @brief Initialize sensor by reset
*/
void Init();
/**
* @brief Reset sensor, reset must be done after power-up, reset all registers
*/
void Reset();
/**
* @brief Change operational mode of sensor to Normal
* During normal mode an integration and readout could be performed.
*/
void Wake_up();
/**
* @brief Change operational mode of sensor to Sleep
* During sleep mode an integration and readout could not be performed.
* But power draw of sensor is reduced.
*/
void Sleep_mode();
/**
* @brief Sensor will charge photodiodes to defined levels to create test pattern
* Every odd pixel is charged to high level of charge, even pixel to low level of charge
* This command is used instead of Integration start
*/
void Zebra_pattern_1();
/**
* @brief Time in micro second to integrate charge photodiodes
* The shortest time is 0.1 us, the longest is 100 ms, values above or below are capped
*/
void Integrate(double time_us);
/**
* @brief Reads Status byte of sensor by using Idle command
*
* @return Status_byte Structured status byte of sensor
*/
Status_byte Status();
/**
* @brief Perform readout of all output registers and pixels from sensor
*
* @return array<uint8_t, 159> Output registers of sensor containing metadata and pixels
*/
array<uint8_t, 159> Read_all_8bit();
protected:
/**
* @brief Send command to sensor and return answer (mostly status byte and empty bytes)
*
* @tparam array_size Size of returned answer on bytes, default is 3
* @param command Command from available Commands of sensor
* @param payload Payload (parameters) of command, mostly empty but could contain integration time, atc.
* @return array<uint8_t, array_size> Answer to command, example: status byte, readout bytes, etc.
*/
template <size_t array_size = 3>
array<uint8_t, array_size> Command(Commands command, array<uint8_t, 2> payload){
array<uint8_t, array_size> byte_stream = { 0 };
byte_stream[0] = (uint8_t) command;
byte_stream[1] = payload[0];
byte_stream[2] = payload[1];
return Transmit_and_receive(byte_stream);
}
/**
* @brief Transmit bytes to sensor and receive answer
*
* @tparam array_size Amount of bytes to transfer and receive
* @param byte_stream Array of bytes to transmit
* @return array<uint8_t, array_size> Array of received bytes
*/
template <size_t array_size>
array<uint8_t, array_size> Transmit_and_receive(array<uint8_t, array_size> &byte_stream){
array<uint8_t, array_size> received = { 0 };
CS_enable();
HAL_SPI_TransmitReceive(&SPI_handle, byte_stream.data(), received.data(), byte_stream.size(), byte_stream.size());
CS_disable();
return received;
}
/**
* @brief Enables communication with sensor via SPI, CS signal is active low
*/
void CS_enable(){ HAL_GPIO_WritePin(SPI_CS.port, SPI_CS.pin, GPIO_PIN_RESET); };
/**
* @brief Disables communication with sensor via SPI, CS signal is active low
*/
void CS_disable(){ HAL_GPIO_WritePin(SPI_CS.port, SPI_CS.pin, GPIO_PIN_SET); };
};

View File

@ -1,5 +1,5 @@
##########################################################################################################################
# File automatically-generated by tool: [projectgenerator] version: [3.13.0-B3] date: [Thu Jul 28 23:53:52 CEST 2022]
# File automatically-generated by tool: [projectgenerator] version: [3.18.0-B7] date: [Mon Mar 06 11:36:24 CET 2023]
##########################################################################################################################
# ------------------------------------------------
@ -24,6 +24,9 @@ DEBUG = 1
# optimization
OPT = -Og
ifndef VERBOSE
MAKEFLAGS += --no-print-directory
endif
#######################################
# paths
@ -35,36 +38,36 @@ BUILD_DIR = build
# source
######################################
# C sources
C_SOURCES = \
Src/main.c \
Src/stm32l4xx_it.c \
Src/stm32l4xx_hal_msp.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_can.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c_ex.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc_ex.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ex.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ramfunc.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_gpio.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma_ex.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr_ex.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cortex.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_exti.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi_ex.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim_ex.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart_ex.c \
Src/system_stm32l4xx.c
C_SOURCES = \
Src/main.c \
Src/stm32l4xx_it.c \
Src/stm32l4xx_hal_msp.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_can.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c_ex.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc_ex.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ex.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ramfunc.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_gpio.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma_ex.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr_ex.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cortex.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_exti.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi_ex.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim_ex.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart_ex.c \
Src/system_stm32l4xx.c
# ASM sources
ASM_SOURCES = \
ASM_SOURCES = \
startup_stm32l432xx.s
@ -72,22 +75,15 @@ startup_stm32l432xx.s
# binaries
#######################################
PREFIX = arm-none-eabi-
# The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx)
# either it can be added to the PATH environment variable.
ifdef GCC_PATH
CC = $(GCC_PATH)/$(PREFIX)gcc
AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp
CP = $(GCC_PATH)/$(PREFIX)objcopy
SZ = $(GCC_PATH)/$(PREFIX)size
else
CC = $(PREFIX)gcc
AS = $(PREFIX)gcc -x assembler-with-cpp
CP = $(PREFIX)objcopy
SZ = $(PREFIX)size
endif
HEX = $(CP) -O ihex
BIN = $(CP) -O binary -S
CC = $(BINPATH)$(PREFIX)gcc
CP = $(BINPATH)$(PREFIX)g++
AS = $(BINPATH)$(PREFIX)g++ -x assembler-with-cpp
CO = $(BINPATH)$(PREFIX)objcopy
AR = $(BINPATH)$(PREFIX)ar
SZ = $(BINPATH)$(PREFIX)size
HEX = $(CO) -O ihex
BIN = $(CO) -O binary -S
#######################################
# CFLAGS
#######################################
@ -105,39 +101,44 @@ MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI)
# macros for gcc
# AS defines
AS_DEFS =
AS_DEFS =
# C defines
C_DEFS = \
-DUSE_HAL_DRIVER \
C_DEFS = \
-DSTM32_L4 \
-DUSE_HAL_DRIVER \
-DSTM32L432xx
# AS includes
AS_INCLUDES =
AS_INCLUDES =
# C includes
C_INCLUDES = \
-IInc \
-IDrivers/STM32L4xx_HAL_Driver/Inc \
-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy \
-IDrivers/CMSIS/Device/ST/STM32L4xx/Include \
-IDrivers/CMSIS/Include
C_INCLUDES = \
-IInc \
-IDrivers/STM32L4xx_HAL_Driver/Inc \
-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy \
-IDrivers/CMSIS/Device/ST/STM32L4xx/Include \
-IDrivers/CMSIS/Include \
-IMLX75306
# compile gcc flags
ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
BOTHFLAGS = -Wno-write-strings -specs=nano.specs -specs=nosys.specs $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
ifeq ($(DEBUG), 1)
CFLAGS += -g -gdwarf-2
BOTHFLAGS += -g -gdwarf-2
endif
CFLAGS = $(MCU) -std=c++17 -Wno-register $(BOTHFLAGS) -fno-exceptions -fno-asynchronous-unwind-tables
CDFLAGS = $(MCU) -std=c17 $(BOTHFLAGS)
# Generate dependency information
CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)"
$(eval CPP_SOURCES=$(shell $(CC) $(C_INCLUDES) $(C_DEFS) -MM Src/main.c | sed 's/\\/\\n/g' | sed 's/\s/ /g' | sed 's/ /\n/g' | grep hpp | sed 's/hpp/cpp/g' | sort -u ))
#######################################
# LDFLAGS
@ -146,13 +147,19 @@ CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)"
LDSCRIPT = STM32L432KCUx_FLASH.ld
# libraries
LIBS = -lc -lm -lnosys
LIBDIR =
LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections
LIBS = -lc -lm -lnosys
LIBDIR =
LDFLAGS = $(MCU) -Wl,--no-wchar-size-warning -specs=nosys.specs -specs=nano.specs -u _printf_float -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections
# default action: build all
all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin
all:
@printf "Dependencies:\n$(shell echo $(CPP_SOURCES) | sed 's/ /\\n/g' | sed 's/alohal\///g')\n=================================================\n"
@make bin -j$(nproc)
flash_build:
@make bin -j$(nproc)
bin: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin
#######################################
# build the application
@ -160,38 +167,65 @@ all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET
# list of objects
OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
vpath %.c $(sort $(dir $(C_SOURCES)))
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(CPP_SOURCES:.cpp=.o)))
vpath %.cpp $(sort $(dir $(CPP_SOURCES)))
# list of ASM program objects
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o)))
vpath %.s $(sort $(dir $(ASM_SOURCES)))
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
@echo "CC " $<
@$(CC) -c $(CDFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
$(BUILD_DIR)/%.o: %.cpp Makefile | $(BUILD_DIR)
@echo "CP " $<
@$(CP) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.cpp=.lst)) $< -o $@
$(BUILD_DIR)/main.o: Src/main.c Makefile | $(BUILD_DIR)
@echo "CP " $<
@$(CP) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.cpp=.lst)) $< -o $@
$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
$(AS) -c $(CFLAGS) $< -o $@
@echo "AS " $<
@$(AS) -c $(CFLAGS) $< -o $@
$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile
$(CC) $(OBJECTS) $(LDFLAGS) -o $@
$(SZ) $@
$(BUILD_DIR)/$(TARGET).elf: $(DEPS) $(OBJECTS) Makefile
@echo "LD " $<
@$(CP) $(OBJECTS) $(LDFLAGS) -o $@
@$(SZ) $@
$(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
$(HEX) $< $@
@echo "HEX " $@
@$(HEX) $< $@
$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
$(BIN) $< $@
@echo "BIN " $@
@$(BIN) $< $@
$(BUILD_DIR):
mkdir $@
mkdir $@
#######################################
# clean up
#######################################
clean:
-rm -fR $(BUILD_DIR)
#######################################
# dependencies
#######################################
-include $(wildcard $(BUILD_DIR)/*.d)
DEPENDENCIES := $(OBJECTS:.o=.d)
# *** EOF ***
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
-include $(DEPENDENCIES)
# Flash
flash: flash_build
openocd -f interface/stlink.cfg -f target/stm32l4x.cfg -c "program build/$(TARGET).bin verify reset exit 0x08000000"
reset:
openocd -f interface/stlink.cfg -f target/stm32l4x.cfg -c init -c "reset halt"
# *** EOF ***

View File

@ -1,4 +1,5 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file : main.c
@ -22,7 +23,7 @@
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "MLX75306.hpp"
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
@ -41,10 +42,8 @@
/* Private variables ---------------------------------------------------------*/
CAN_HandleTypeDef hcan1;
SPI_HandleTypeDef hspi1;
UART_HandleTypeDef huart1;
UART_HandleTypeDef huart2;
/* USER CODE BEGIN PV */
@ -55,7 +54,7 @@ void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_CAN1_Init(void);
static void MX_SPI1_Init(void);
static void MX_USART1_UART_Init(void);
static void MX_USART2_UART_Init(void);
/* USER CODE BEGIN PFP */
/* USER CODE END PFP */
@ -63,143 +62,184 @@ static void MX_USART1_UART_Init(void);
/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
void UART_print(string message){
message += "\r\n";
HAL_UART_Transmit(&huart2, (const uint8_t *) message.c_str(), message.length(), message.length());
}
void Print_status(MLX75306::Status_byte status){
UART_print("MLX75306 Status:");
string op_mode = status.operational_mode ? "Normal" : "Sleep";
UART_print("Operational Mode: " + op_mode);
string power_up_state = status.power_up_in_progress ? "Done" : "In progress";
UART_print("Power up: " + power_up_state);
string device_mode = status.device_mode ? "User" : "Test";
UART_print("Device mode: " + device_mode);
UART_print("Command counter " + to_string(status.command_counter));
}
/* USER CODE END 0 */
/**
* @brief The application entry point.
* @retval int
*/
int main(void)
{
/* USER CODE BEGIN 1 */
int main(void){
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_CAN1_Init();
MX_SPI1_Init();
MX_USART1_UART_Init();
/* USER CODE BEGIN 2 */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_CAN1_Init();
MX_SPI1_Init();
MX_USART2_UART_Init();
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
UART_print("\r\nBUTCube Sun Sensor module is ready ...\r\n");
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
auto sensor = new MLX75306(hspi1, MLX75306::Chip_select_pin{ GPIOA, GPIO_PIN_4 });
sensor->Init();
sensor->Wake_up();
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}
sensor->Zebra_pattern_1();
HAL_Delay(10);
Print_status(sensor->Status());
auto readout = sensor->Read_all_8bit();
UART_print("\r\nBytes of zebra pattern 1:");
for (auto &byte:readout) {
UART_print(to_string(byte));
}
sensor->Integrate(1000);
HAL_Delay(50);
readout = sensor->Read_all_8bit();
UART_print("\r\nBytes of integrated image:");
for (auto &byte:readout) {
UART_print(to_string(byte));
}
UART_print(""); // EOL
Print_status(sensor->Status());
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1) {
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
HAL_GPIO_WritePin(GPIOB, LED2_Pin, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOB, LED1_Pin, GPIO_PIN_SET);
HAL_Delay(100);
HAL_GPIO_WritePin(GPIOB, LED2_Pin, GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOB, LED1_Pin, GPIO_PIN_RESET);
HAL_Delay(100);
}
/* USER CODE END 3 */
} // main
/**
* @brief System Clock Configuration
* @retval None
*/
void SystemClock_Config(void)
{
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
void SystemClock_Config(void){
RCC_OscInitTypeDef RCC_OscInitStruct = { 0 };
RCC_ClkInitTypeDef RCC_ClkInitStruct = { 0 };
RCC_PeriphCLKInitTypeDef PeriphClkInit = { 0 };
/** Initializes the RCC Oscillators according to the specified parameters
* in the RCC_OscInitTypeDef structure.
*/
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
RCC_OscInitStruct.PLL.PLLM = 1;
RCC_OscInitStruct.PLL.PLLN = 10;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV7;
RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV2;
RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}
/** Initializes the CPU, AHB and APB buses clocks
*/
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
/** Initializes the RCC Oscillators according to the specified parameters
* in the RCC_OscInitTypeDef structure.
*/
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
RCC_OscInitStruct.PLL.PLLM = 1;
RCC_OscInitStruct.PLL.PLLN = 10;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV7;
RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV2;
RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
Error_Handler();
}
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_4) != HAL_OK)
{
Error_Handler();
}
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART1;
PeriphClkInit.Usart1ClockSelection = RCC_USART1CLKSOURCE_PCLK2;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
{
Error_Handler();
}
/** Configure the main internal regulator output voltage
*/
if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1) != HAL_OK)
{
Error_Handler();
}
}
/** Initializes the CPU, AHB and APB buses clocks
*/
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
| RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_4) != HAL_OK) {
Error_Handler();
}
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART2;
PeriphClkInit.Usart2ClockSelection = RCC_USART2CLKSOURCE_PCLK1;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) {
Error_Handler();
}
/** Configure the main internal regulator output voltage
*/
if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1) != HAL_OK) {
Error_Handler();
}
} // SystemClock_Config
/**
* @brief CAN1 Initialization Function
* @param None
* @retval None
*/
static void MX_CAN1_Init(void)
{
static void MX_CAN1_Init(void){
/* USER CODE BEGIN CAN1_Init 0 */
/* USER CODE BEGIN CAN1_Init 0 */
/* USER CODE END CAN1_Init 0 */
/* USER CODE END CAN1_Init 0 */
/* USER CODE BEGIN CAN1_Init 1 */
/* USER CODE BEGIN CAN1_Init 1 */
/* USER CODE END CAN1_Init 1 */
hcan1.Instance = CAN1;
hcan1.Init.Prescaler = 32;
hcan1.Init.Mode = CAN_MODE_NORMAL;
hcan1.Init.SyncJumpWidth = CAN_SJW_1TQ;
hcan1.Init.TimeSeg1 = CAN_BS1_1TQ;
hcan1.Init.TimeSeg2 = CAN_BS2_1TQ;
hcan1.Init.TimeTriggeredMode = DISABLE;
hcan1.Init.AutoBusOff = DISABLE;
hcan1.Init.AutoWakeUp = DISABLE;
hcan1.Init.AutoRetransmission = DISABLE;
hcan1.Init.ReceiveFifoLocked = DISABLE;
hcan1.Init.TransmitFifoPriority = DISABLE;
if (HAL_CAN_Init(&hcan1) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN CAN1_Init 2 */
/* USER CODE END CAN1_Init 2 */
/* USER CODE END CAN1_Init 1 */
hcan1.Instance = CAN1;
hcan1.Init.Prescaler = 32;
hcan1.Init.Mode = CAN_MODE_NORMAL;
hcan1.Init.SyncJumpWidth = CAN_SJW_1TQ;
hcan1.Init.TimeSeg1 = CAN_BS1_1TQ;
hcan1.Init.TimeSeg2 = CAN_BS2_1TQ;
hcan1.Init.TimeTriggeredMode = DISABLE;
hcan1.Init.AutoBusOff = DISABLE;
hcan1.Init.AutoWakeUp = DISABLE;
hcan1.Init.AutoRetransmission = DISABLE;
hcan1.Init.ReceiveFifoLocked = DISABLE;
hcan1.Init.TransmitFifoPriority = DISABLE;
if (HAL_CAN_Init(&hcan1) != HAL_OK) {
Error_Handler();
}
/* USER CODE BEGIN CAN1_Init 2 */
/* USER CODE END CAN1_Init 2 */
}
/**
@ -207,74 +247,66 @@ static void MX_CAN1_Init(void)
* @param None
* @retval None
*/
static void MX_SPI1_Init(void)
{
static void MX_SPI1_Init(void){
/* USER CODE BEGIN SPI1_Init 0 */
/* USER CODE BEGIN SPI1_Init 0 */
/* USER CODE END SPI1_Init 0 */
/* USER CODE END SPI1_Init 0 */
/* USER CODE BEGIN SPI1_Init 1 */
/* USER CODE BEGIN SPI1_Init 1 */
/* USER CODE END SPI1_Init 1 */
/* SPI1 parameter configuration*/
hspi1.Instance = SPI1;
hspi1.Init.Mode = SPI_MODE_MASTER;
hspi1.Init.Direction = SPI_DIRECTION_2LINES;
hspi1.Init.DataSize = SPI_DATASIZE_4BIT;
hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;
hspi1.Init.CLKPhase = SPI_PHASE_1EDGE;
hspi1.Init.NSS = SPI_NSS_SOFT;
hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_2;
hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
hspi1.Init.TIMode = SPI_TIMODE_DISABLE;
hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
hspi1.Init.CRCPolynomial = 7;
hspi1.Init.CRCLength = SPI_CRC_LENGTH_DATASIZE;
hspi1.Init.NSSPMode = SPI_NSS_PULSE_ENABLE;
if (HAL_SPI_Init(&hspi1) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN SPI1_Init 2 */
/* USER CODE END SPI1_Init 2 */
/* USER CODE END SPI1_Init 1 */
/* SPI1 parameter configuration*/
hspi1.Instance = SPI1;
hspi1.Init.Mode = SPI_MODE_MASTER;
hspi1.Init.Direction = SPI_DIRECTION_2LINES;
hspi1.Init.DataSize = SPI_DATASIZE_8BIT;
hspi1.Init.CLKPolarity = SPI_POLARITY_HIGH;
hspi1.Init.CLKPhase = SPI_PHASE_2EDGE;
hspi1.Init.NSS = SPI_NSS_SOFT;
hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_256;
hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
hspi1.Init.TIMode = SPI_TIMODE_DISABLE;
hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
hspi1.Init.CRCPolynomial = 7;
hspi1.Init.CRCLength = SPI_CRC_LENGTH_DATASIZE;
hspi1.Init.NSSPMode = SPI_NSS_PULSE_DISABLE;
if (HAL_SPI_Init(&hspi1) != HAL_OK) {
Error_Handler();
}
/* USER CODE BEGIN SPI1_Init 2 */
/* USER CODE END SPI1_Init 2 */
}
/**
* @brief USART1 Initialization Function
* @brief USART2 Initialization Function
* @param None
* @retval None
*/
static void MX_USART1_UART_Init(void)
{
static void MX_USART2_UART_Init(void){
/* USER CODE BEGIN USART2_Init 0 */
/* USER CODE BEGIN USART1_Init 0 */
/* USER CODE END USART2_Init 0 */
/* USER CODE END USART1_Init 0 */
/* USER CODE BEGIN USART2_Init 1 */
/* USER CODE BEGIN USART1_Init 1 */
/* USER CODE END USART1_Init 1 */
huart1.Instance = USART1;
huart1.Init.BaudRate = 115200;
huart1.Init.WordLength = UART_WORDLENGTH_8B;
huart1.Init.StopBits = UART_STOPBITS_1;
huart1.Init.Parity = UART_PARITY_NONE;
huart1.Init.Mode = UART_MODE_TX_RX;
huart1.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart1.Init.OverSampling = UART_OVERSAMPLING_16;
huart1.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
huart1.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
if (HAL_UART_Init(&huart1) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN USART1_Init 2 */
/* USER CODE END USART1_Init 2 */
/* USER CODE END USART2_Init 1 */
huart2.Instance = USART2;
huart2.Init.BaudRate = 115200;
huart2.Init.WordLength = UART_WORDLENGTH_8B;
huart2.Init.StopBits = UART_STOPBITS_1;
huart2.Init.Parity = UART_PARITY_NONE;
huart2.Init.Mode = UART_MODE_TX_RX;
huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart2.Init.OverSampling = UART_OVERSAMPLING_16;
huart2.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
huart2.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
if (HAL_UART_Init(&huart2) != HAL_OK) {
Error_Handler();
}
/* USER CODE BEGIN USART2_Init 2 */
/* USER CODE END USART2_Init 2 */
}
/**
@ -282,15 +314,63 @@ static void MX_USART1_UART_Init(void)
* @param None
* @retval None
*/
static void MX_GPIO_Init(void)
{
static void MX_GPIO_Init(void){
GPIO_InitTypeDef GPIO_InitStruct = { 0 };
/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
__HAL_RCC_GPIOH_CLK_ENABLE();
}
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOA, CS__1_Pin | CS__2_Pin | CAN_RS_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOB, FRAM_CS_Pin | LED2_Pin | LED1_Pin | CS__3_Pin
| CS__4_Pin, GPIO_PIN_RESET);
/*Configure GPIO pins : FR_RDY__1_Pin FR_RDY__2_Pin */
GPIO_InitStruct.Pin = FR_RDY__1_Pin | FR_RDY__2_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/*Configure GPIO pin : CS__1_Pin */
GPIO_InitStruct.Pin = CS__1_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(CS__1_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pins : FRAM_CS_Pin LED2_Pin LED1_Pin CS__3_Pin
CS__4_Pin */
GPIO_InitStruct.Pin = FRAM_CS_Pin | LED2_Pin | LED1_Pin | CS__3_Pin
| CS__4_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/*Configure GPIO pins : CS__2_Pin CAN_RS_Pin */
GPIO_InitStruct.Pin = CS__2_Pin | CAN_RS_Pin;
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);
/*Configure GPIO pin : FR_RDY__3_Pin */
GPIO_InitStruct.Pin = FR_RDY__3_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(FR_RDY__3_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pin : FR_RDY__4_Pin */
GPIO_InitStruct.Pin = FR_RDY__4_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(FR_RDY__4_GPIO_Port, &GPIO_InitStruct);
} // MX_GPIO_Init
/* USER CODE BEGIN 4 */
@ -300,18 +380,16 @@ static void MX_GPIO_Init(void)
* @brief This function is executed in case of error occurrence.
* @retval None
*/
void Error_Handler(void)
{
/* USER CODE BEGIN Error_Handler_Debug */
/* User can add his own implementation to report the HAL error return state */
__disable_irq();
while (1)
{
}
/* USER CODE END Error_Handler_Debug */
void Error_Handler(void){
/* USER CODE BEGIN Error_Handler_Debug */
/* User can add his own implementation to report the HAL error return state */
__disable_irq();
while (1) { }
/* USER CODE END Error_Handler_Debug */
}
#ifdef USE_FULL_ASSERT
/**
* @brief Reports the name of the source file and the source line number
* where the assert_param error has occurred.
@ -319,13 +397,14 @@ void Error_Handler(void)
* @param line: assert_param error line source number
* @retval None
*/
void assert_failed(uint8_t *file, uint32_t line)
{
/* USER CODE BEGIN 6 */
/* User can add his own implementation to report the file name and line number,
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
/* USER CODE END 6 */
void assert_failed(uint8_t *file, uint32_t line){
/* USER CODE BEGIN 6 */
/* User can add his own implementation to report the file name and line number,
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
/* USER CODE END 6 */
}
#endif /* USE_FULL_ASSERT */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -218,29 +218,29 @@ void HAL_SPI_MspDeInit(SPI_HandleTypeDef* hspi)
void HAL_UART_MspInit(UART_HandleTypeDef* huart)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
if(huart->Instance==USART1)
if(huart->Instance==USART2)
{
/* USER CODE BEGIN USART1_MspInit 0 */
/* USER CODE BEGIN USART2_MspInit 0 */
/* USER CODE END USART1_MspInit 0 */
/* USER CODE END USART2_MspInit 0 */
/* Peripheral clock enable */
__HAL_RCC_USART1_CLK_ENABLE();
__HAL_RCC_USART2_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
/**USART1 GPIO Configuration
PB6 ------> USART1_TX
PB7 ------> USART1_RX
__HAL_RCC_GPIOA_CLK_ENABLE();
/**USART2 GPIO Configuration
PA2 ------> USART2_TX
PA3 ------> USART2_RX
*/
GPIO_InitStruct.Pin = GPIO_PIN_6|GPIO_PIN_7;
GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_3;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF7_USART1;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
GPIO_InitStruct.Alternate = GPIO_AF7_USART2;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/* USER CODE BEGIN USART1_MspInit 1 */
/* USER CODE BEGIN USART2_MspInit 1 */
/* USER CODE END USART1_MspInit 1 */
/* USER CODE END USART2_MspInit 1 */
}
}
@ -253,23 +253,23 @@ void HAL_UART_MspInit(UART_HandleTypeDef* huart)
*/
void HAL_UART_MspDeInit(UART_HandleTypeDef* huart)
{
if(huart->Instance==USART1)
if(huart->Instance==USART2)
{
/* USER CODE BEGIN USART1_MspDeInit 0 */
/* USER CODE BEGIN USART2_MspDeInit 0 */
/* USER CODE END USART1_MspDeInit 0 */
/* USER CODE END USART2_MspDeInit 0 */
/* Peripheral clock disable */
__HAL_RCC_USART1_CLK_DISABLE();
__HAL_RCC_USART2_CLK_DISABLE();
/**USART1 GPIO Configuration
PB6 ------> USART1_TX
PB7 ------> USART1_RX
/**USART2 GPIO Configuration
PA2 ------> USART2_TX
PA3 ------> USART2_RX
*/
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_6|GPIO_PIN_7);
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_2|GPIO_PIN_3);
/* USER CODE BEGIN USART1_MspDeInit 1 */
/* USER CODE BEGIN USART2_MspDeInit 1 */
/* USER CODE END USART1_MspDeInit 1 */
/* USER CODE END USART2_MspDeInit 1 */
}
}

View File

@ -1,13 +1,17 @@
#MicroXplorer Configuration settings - do not modify
CAD.formats=
CAD.pinconfig=
CAD.provider=
CAN1.BS1=CAN_BS1_1TQ
CAN1.CalculateBaudRate=833333
CAN1.CalculateTimeBit=1200.00
CAN1.CalculateTimeBit=1200
CAN1.CalculateTimeQuantum=400.0
CAN1.IPParameters=CalculateTimeQuantum,BS1,CalculateTimeBit,CalculateBaudRate,Prescaler
CAN1.Prescaler=32
File.Version=6
GPIO.groupedBy=
GPIO.groupedBy=Group By Peripherals
KeepUserPlacement=false
Mcu.CPN=STM32L432KCU3
Mcu.Family=STM32L4
Mcu.IP0=CAN1
Mcu.IP1=NVIC
@ -48,17 +52,17 @@ Mcu.UserConstants=
Mcu.UserName=STM32L432KCUx
MxCube.Version=6.2.1
MxDb.Version=DB.6.0.21
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
NVIC.ForceEnableDMAVector=true
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false
NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false
NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false
NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true\:false\:true
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true\:false\:true\:false
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
PA0.GPIOParameters=GPIO_Label
PA0.GPIO_Label=RCC_HSE
PA0.Mode=HSE-External-Clock-Source-for-LittleOrca
@ -87,15 +91,22 @@ PA2.Mode=Asynchronous
PA2.Signal=USART2_TX
PA3.Mode=Asynchronous
PA3.Signal=USART2_RX
PA4.GPIOParameters=GPIO_Label
PA4.GPIOParameters=GPIO_PuPd,GPIO_Label
PA4.GPIO_Label=CS_\#1
PA4.GPIO_PuPd=GPIO_PULLUP
PA4.Locked=true
PA4.Signal=GPIO_Output
PA5.GPIOParameters=GPIO_PuPd
PA5.GPIO_PuPd=GPIO_NOPULL
PA5.Locked=true
PA5.Mode=Full_Duplex_Master
PA5.Signal=SPI1_SCK
PA6.GPIOParameters=GPIO_PuPd
PA6.GPIO_PuPd=GPIO_NOPULL
PA6.Mode=Full_Duplex_Master
PA6.Signal=SPI1_MISO
PA7.GPIOParameters=GPIO_PuPd
PA7.GPIO_PuPd=GPIO_NOPULL
PA7.Mode=Full_Duplex_Master
PA7.Signal=SPI1_MOSI
PA9.GPIOParameters=GPIO_Label
@ -160,7 +171,7 @@ ProjectManager.StackSize=0x400
ProjectManager.TargetToolchain=Makefile
ProjectManager.ToolChainLocation=
ProjectManager.UnderRoot=false
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_CAN1_Init-CAN1-false-HAL-true,4-MX_SPI1_Init-SPI1-false-HAL-true,5-MX_USART1_UART_Init-USART1-false-HAL-true
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_CAN1_Init-CAN1-false-HAL-true,4-MX_SPI1_Init-SPI1-false-HAL-true,5-MX_USART2_UART_Init-USART2-false-HAL-true
RCC.ADCFreq_Value=64000000
RCC.AHBFreq_Value=80000000
RCC.APB1Freq_Value=80000000
@ -205,10 +216,13 @@ RCC.USBFreq_Value=64000000
RCC.VCOInputFreq_Value=16000000
RCC.VCOOutputFreq_Value=160000000
RCC.VCOSAI1OutputFreq_Value=128000000
SPI1.BaudRatePrescaler=SPI_BAUDRATEPRESCALER_2
SPI1.CalculateBaudRate=40.0 MBits/s
SPI1.BaudRatePrescaler=SPI_BAUDRATEPRESCALER_256
SPI1.CLKPhase=SPI_PHASE_2EDGE
SPI1.CLKPolarity=SPI_POLARITY_HIGH
SPI1.CalculateBaudRate=312.5 KBits/s
SPI1.DataSize=SPI_DATASIZE_8BIT
SPI1.Direction=SPI_DIRECTION_2LINES
SPI1.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate,BaudRatePrescaler
SPI1.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate,BaudRatePrescaler,DataSize,CLKPolarity,CLKPhase
SPI1.Mode=SPI_MODE_MASTER
SPI1.VirtualType=VM_MASTER
USART2.IPParameters=VirtualMode-Asynchronous