Skip to content

Commit 3e3ffa5

Browse files
authored
Merge pull request #2 from harp-tech/bc-interface-autogen
Add initial schema and automatic interface generation
2 parents 1d2baaa + 6579cef commit 3e3ffa5

21 files changed

+3381
-881
lines changed

.editorconfig

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# To learn more about .editorconfig see https://aka.ms/editorconfigdocs
2+
###############################
3+
# Core EditorConfig Options #
4+
###############################
5+
# All files
6+
[*]
7+
indent_style = space
8+
9+
# XML project files
10+
[*.{csproj,vcxproj,vcxproj.filters,proj,projitems,shproj,bonsai}]
11+
indent_size = 2
12+
13+
# XML config files
14+
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
15+
indent_size = 2
16+
17+
# Code files
18+
[*.{cs,csx}]
19+
indent_size = 4
20+
insert_final_newline = true
21+
charset = utf-8-bom
22+
###############################
23+
# .NET Coding Conventions #
24+
###############################
25+
[*.{cs}]
26+
# Organize usings
27+
dotnet_sort_system_directives_first = true

.gitignore

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
2+
desktop.ini
3+
4+
# Visual studio files
15
.vs
6+
.suo
7+
.nuget
28
bin
39
obj
10+
Debug
411
packages
5-
**/Debug
6-
*.atsuo
7-
*.user
8-
*-preview*.hex
12+
*.componentinfo.xml

Assets/pcb.png

140 KB
Loading

Firmware/.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Visual studio files
2+
.vs
3+
.suo
4+
.nuget
5+
bin
6+
obj
7+
Debug
8+
packages
9+
*.componentinfo.xml

Firmware/AnalogInput/AnalogInput.cppproj

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,6 @@
118118
</avrgcccpp.linker.libraries.Libraries>
119119
<avrgcccpp.linker.libraries.LibrarySearchPaths>
120120
<ListValues>
121-
<Value>C:\Users\Filipe Carvalho\Documents\BitBucket\Device.LoadCells\Firmware\LoadCells</Value>
122-
<Value>C:\Users\OEPS\Documents\github\harp-tech\harp_analog_input\Firmware\AnalogInput</Value>
123121
</ListValues>
124122
</avrgcccpp.linker.libraries.LibrarySearchPaths>
125123
<avrgcccpp.assembler.general.IncludePaths>
@@ -182,8 +180,7 @@
182180
</avrgcccpp.linker.libraries.Libraries>
183181
<avrgcccpp.linker.libraries.LibrarySearchPaths>
184182
<ListValues>
185-
<Value>C:\Users\Filipe Carvalho\Documents\BitBucket\Device.LoadCells\Firmware\LoadCells</Value>
186-
<Value>C:\Users\OEPS\Documents\github\harp-tech\harp_analog_input\Firmware\AnalogInput</Value>
183+
<Value>..</Value>
187184
</ListValues>
188185
</avrgcccpp.linker.libraries.LibrarySearchPaths>
189186
<avrgcccpp.assembler.general.IncludePaths>

Firmware/AnalogInput/app.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ void core_callback_t_500us(void)
200200
if (app_regs.REG_SAMPLE_FREQUENCY == GM_2KHZ)
201201
{
202202
core_func_mark_user_timestamp();
203-
set_CONVST;
203+
set_CONVSTA;
204204
set_CONVSTB;
205205
switch (app_regs.REG_TRIGGER_DESTINY)
206206
{
@@ -234,7 +234,7 @@ void core_callback_t_1ms(void)
234234
if (app_regs.REG_START)
235235
{
236236
core_func_mark_user_timestamp();
237-
set_CONVST;
237+
set_CONVSTA;
238238
set_CONVSTB;
239239
switch (app_regs.REG_TRIGGER_DESTINY)
240240
{

Firmware/AnalogInput/app_ios_and_regs.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ void init_ios(void)
1616
io_set_int(&PORTD, INT_LEVEL_LOW, 0, (1<<1), false); // BUSY
1717

1818
/* Configure output pins */
19-
io_pin2out(&PORTB, 1, OUT_IO_DIGITAL, IN_EN_IO_EN); // DO3
20-
io_pin2out(&PORTA, 0, OUT_IO_DIGITAL, IN_EN_IO_EN); // DO2
19+
io_pin2out(&PORTA, 0, OUT_IO_DIGITAL, IN_EN_IO_EN); // DO0
2120
io_pin2out(&PORTA, 1, OUT_IO_DIGITAL, IN_EN_IO_EN); // DO1
22-
io_pin2out(&PORTA, 2, OUT_IO_DIGITAL, IN_EN_IO_EN); // DO0
21+
io_pin2out(&PORTA, 2, OUT_IO_DIGITAL, IN_EN_IO_EN); // DO2
22+
io_pin2out(&PORTA, 3, OUT_IO_DIGITAL, IN_EN_IO_EN); // DO3
23+
io_pin2out(&PORTC, 4, OUT_IO_DIGITAL, IN_EN_IO_EN); // CS_ADC
2324
io_pin2out(&PORTC, 0, OUT_IO_DIGITAL, IN_EN_IO_EN); // CONVSTA
2425
io_pin2out(&PORTC, 1, OUT_IO_DIGITAL, IN_EN_IO_EN); // CONVSTB
25-
io_pin2out(&PORTC, 4, OUT_IO_DIGITAL, IN_EN_IO_EN); // CS_ADC
2626
io_pin2out(&PORTC, 5, OUT_IO_DIGITAL, IN_EN_IO_DIS); // MOSI
2727
io_pin2out(&PORTC, 7, OUT_IO_DIGITAL, IN_EN_IO_DIS); // SCK
2828
io_pin2out(&PORTD, 0, OUT_IO_WIREDAND, IN_EN_IO_EN); // RESET
@@ -32,12 +32,12 @@ void init_ios(void)
3232
io_pin2out(&PORTA, 4, OUT_IO_DIGITAL, IN_EN_IO_EN); // RANGE
3333

3434
/* Initialize output pins */
35-
clr_DO3;
36-
clr_DO2;
37-
clr_DO1;
3835
clr_DO0;
36+
clr_DO1;
37+
clr_DO2;
38+
clr_DO3;
3939
set_CS_ADC;
40-
clr_CONVST;
40+
clr_CONVSTA;
4141
clr_CONVSTB;
4242
clr_MOSI;
4343
clr_SCK;

Firmware/AnalogInput/app_ios_and_regs.h

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ void init_ios(void);
1717
/************************************************************************/
1818
/* Definition of output pins */
1919
/************************************************************************/
20-
// DO3 Description: Output DO0
21-
// DO2 Description: Output DO1
22-
// DO1 Description: Output DO2
23-
// DO0 Description: Output DO3
20+
// DO0 Description: Output DO0
21+
// DO1 Description: Output DO1
22+
// DO2 Description: Output DO2
23+
// DO3 Description: Output DO3
2424
// CS_ADC Description: Chip select
25-
// CONVST Description: Convert
25+
// CONVSTA Description: Convert
26+
// CONVSTB Description: Convert
2627
// MOSI Description: Serial data input
2728
// SCK Description: Serial data clock
2829
// RESET Description: Reset
@@ -31,49 +32,48 @@ void init_ios(void);
3132
// OS2 Description: Oversampling bit 2
3233
// RANGE Description: Selects range 5 or 10V
3334

34-
/* DO3 */
35-
#define set_DO3 set_io(PORTB, 1)
36-
#define clr_DO3 clear_io(PORTB, 1)
37-
#define tgl_DO3 toggle_io(PORTB, 1)
38-
#define read_DO3 read_io(PORTB, 1)
39-
40-
/* DO2 */
41-
#define set_DO2 set_io(PORTA, 0)
42-
#define clr_DO2 clear_io(PORTA, 0)
43-
#define tgl_DO2 toggle_io(PORTA, 0)
44-
#define read_DO2 read_io(PORTA, 0)
35+
/* DO0 */
36+
#define set_DO0 set_io(PORTA, 0)
37+
#define clr_DO0 clear_io(PORTA, 0)
38+
#define tgl_DO0 toggle_io(PORTA, 0)
39+
#define read_DO0 read_io(PORTA, 0)
4540

4641
/* DO1 */
4742
#define set_DO1 set_io(PORTA, 1)
4843
#define clr_DO1 clear_io(PORTA, 1)
4944
#define tgl_DO1 toggle_io(PORTA, 1)
5045
#define read_DO1 read_io(PORTA, 1)
5146

52-
/* DO0 */
53-
#define set_DO0 set_io(PORTA, 2)
54-
#define clr_DO0 clear_io(PORTA, 2)
55-
#define tgl_DO0 toggle_io(PORTA, 2)
56-
#define read_DO0 read_io(PORTA, 2)
47+
/* DO2 */
48+
#define set_DO2 set_io(PORTA, 2)
49+
#define clr_DO2 clear_io(PORTA, 2)
50+
#define tgl_DO2 toggle_io(PORTA, 2)
51+
#define read_DO2 read_io(PORTA, 2)
52+
53+
/* DO3 */
54+
#define set_DO3 set_io(PORTA, 3)
55+
#define clr_DO3 clear_io(PORTA, 3)
56+
#define tgl_DO3 toggle_io(PORTA, 3)
57+
#define read_DO3 read_io(PORTA, 3)
5758

5859
/* CS_ADC */
59-
#define set_CS_ADC clear_io(PORTC, 4)
60+
#define set_CS_ADC clear_io(PORTC, 4)
6061
#define clr_CS_ADC set_io(PORTC, 4)
6162
#define tgl_CS_ADC toggle_io(PORTC, 4)
6263
#define read_CS_ADC read_io(PORTC, 4)
6364

6465
/* CONVSTA */
65-
#define set_CONVST set_io(PORTC, 0)
66-
#define clr_CONVST clear_io(PORTC, 0)
67-
#define tgl_CONVST toggle_io(PORTC, 0)
68-
#define read_CONVST read_io(PORTC, 0)
66+
#define set_CONVSTA set_io(PORTC, 0)
67+
#define clr_CONVSTA clear_io(PORTC, 0)
68+
#define tgl_CONVSTA toggle_io(PORTC, 0)
69+
#define read_CONVSTA read_io(PORTC, 0)
6970

7071
/* CONVSTB */
71-
#define set_CONVSTB set_io(PORTC, 1)
72+
#define set_CONVSTB set_io(PORTC, 1)
7273
#define clr_CONVSTB clear_io(PORTC, 1)
7374
#define tgl_CONVSTB toggle_io(PORTC, 1)
7475
#define read_CONVSTB read_io(PORTC, 1)
7576

76-
7777
/* MOSI */
7878
#define set_MOSI set_io(PORTC, 5)
7979
#define clr_MOSI clear_io(PORTC, 5)

Firmware/AnalogInput/interrupts.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ ISR(PORTB_INT0_vect, ISR_NAKED)
5454
break;
5555

5656
case GM_DI0_RISE_CATCH_SAMPLE:
57-
set_CONVST;
57+
set_CONVSTA;
5858
set_CONVSTB;
5959
switch (app_regs.REG_TRIGGER_DESTINY)
6060
{
@@ -89,7 +89,7 @@ ISR(PORTB_INT0_vect, ISR_NAKED)
8989
break;
9090

9191
case GM_DI0_FALL_CATCH_SAMPLE:
92-
set_CONVST;
92+
set_CONVSTA;
9393
set_CONVSTB;
9494
switch (app_regs.REG_TRIGGER_DESTINY)
9595
{
@@ -115,7 +115,7 @@ ISR(PORTD_INT0_vect, ISR_NAKED)
115115
{
116116
if (!read_BUSY)
117117
{
118-
clr_CONVST;
118+
clr_CONVSTA;
119119
clr_CONVSTB;
120120

121121
switch (app_regs.REG_TRIGGER_DESTINY)

Firmware/AnalogInput/registers.xls

512 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)