├── firmware
├── CHANGELOG.md
├── release
│ ├── Reload Pro latest.hex
│ ├── Reload Pro latest.cyacd
│ ├── Reload Pro v1.11.elf
│ └── README.md
├── Parts.cylib
│ ├── Parts.cyversion
│ └── ST7528
│ │ ├── ST7528.cysch
│ │ ├── ST7528.cysym
│ │ └── API
│ │ ├── font.h
│ │ ├── ST7528.h
│ │ └── ST7528.c
├── Bootloader.cydsn
│ ├── Bootloader.cyversion
│ ├── Bootloader.cydwr
│ ├── Bootloader.cyfit
│ ├── TopDesign
│ │ └── TopDesign.cysch
│ ├── main.c
│ └── Export
│ │ └── PSoCCreatorExportIDE.xml
├── Reload Pro.cydsn
│ ├── Reload Pro.cyversion
│ ├── Bootloader.elf
│ ├── Reload Pro.cydwr
│ ├── TopDesign
│ │ └── TopDesign.cysch
│ ├── splashscreen.h
│ ├── calibrate.h
│ ├── comms.h
│ ├── device.h
│ ├── tasks.h
│ ├── utils.c
│ ├── calibrate.c
│ ├── lzfx.h
│ ├── main.c
│ ├── freertos
│ │ ├── include
│ │ │ ├── projdefs.h
│ │ │ ├── portmacro.h
│ │ │ ├── mpu_wrappers.h
│ │ │ └── StackMacros.h
│ │ └── src
│ │ │ ├── heap_1.c
│ │ │ └── list.c
│ ├── config.h
│ ├── FreeRTOSConfig.h
│ ├── adctask.c
│ ├── commands.h
│ ├── Reload Pro_PSoC4lib.uvopt
│ ├── comms.c
│ └── lzfx.c
├── Reload Pro FTDI Config.xml
├── Reload Pro.cywrk
└── ComponentUpdateLog.txt
├── README.md
├── User Manual.indd
├── User Manual.pdf
├── models
├── AEH087.dxf
├── Box.AD_PRT
├── LCD.AD_PRT
├── PCB.AD_PRT
├── Knob.AD_PRT
├── TO220.AD_PRT
├── USB B.AD_PRT
├── Encoder.AD_PRT
├── Front Panel.dwg
├── Heatsink.AD_DRW
├── Heatsink.AD_PRT
├── Fan Plate.AD_DRW
├── Banana Jack.AD_PRT
├── Front Panel.AD_DRW
├── Front Panel.AD_PRT
├── New Part (1).AD_PRT
├── Reload Pro Heatsink.dwg
└── Reload Pro Enclosure.AD_ASM
├── pcb
├── pcb render.png
├── reload pro .dip
├── reload pro.dch
├── fan expansion.dch
├── fan expansion.dip
├── Reload Pro Schematic.pdf
├── reloadpro.backsilk.gbo
├── reloadpro.backpaste.gbp
├── fanexpansion.drl
├── reloadpro.outline.gm1
├── reloadpro.backmask.gbs
├── reloadpro.Through.drl
├── reloadpro.frontpaste.gtp
├── board outline.dxf
└── reloadpro.frontmask.gts
├── tools
├── fontmaker.pyc
├── reload font.png
├── splashscreen.gif
├── serial_keywords
├── fontmaker.py
├── imageformatter.py
└── calibrate.py
├── Warning Hot Stickers.ai
├── .gitignore
└── LICENSE
/firmware/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | release/README.md
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | reload-pro
2 | ==========
3 |
--------------------------------------------------------------------------------
/firmware/release/Reload Pro latest.hex:
--------------------------------------------------------------------------------
1 | Reload Pro v1.11.hex
--------------------------------------------------------------------------------
/firmware/release/Reload Pro latest.cyacd:
--------------------------------------------------------------------------------
1 | Reload Pro v1.11.cyacd
--------------------------------------------------------------------------------
/firmware/Parts.cylib/Parts.cyversion:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/firmware/Bootloader.cydsn/Bootloader.cyversion:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/firmware/Reload Pro.cydsn/Reload Pro.cyversion:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/User Manual.indd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/User Manual.indd
--------------------------------------------------------------------------------
/User Manual.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/User Manual.pdf
--------------------------------------------------------------------------------
/models/AEH087.dxf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/models/AEH087.dxf
--------------------------------------------------------------------------------
/models/Box.AD_PRT:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/models/Box.AD_PRT
--------------------------------------------------------------------------------
/models/LCD.AD_PRT:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/models/LCD.AD_PRT
--------------------------------------------------------------------------------
/models/PCB.AD_PRT:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/models/PCB.AD_PRT
--------------------------------------------------------------------------------
/models/Knob.AD_PRT:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/models/Knob.AD_PRT
--------------------------------------------------------------------------------
/models/TO220.AD_PRT:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/models/TO220.AD_PRT
--------------------------------------------------------------------------------
/models/USB B.AD_PRT:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/models/USB B.AD_PRT
--------------------------------------------------------------------------------
/pcb/pcb render.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/pcb/pcb render.png
--------------------------------------------------------------------------------
/pcb/reload pro .dip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/pcb/reload pro .dip
--------------------------------------------------------------------------------
/pcb/reload pro.dch:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/pcb/reload pro.dch
--------------------------------------------------------------------------------
/tools/fontmaker.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/tools/fontmaker.pyc
--------------------------------------------------------------------------------
/models/Encoder.AD_PRT:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/models/Encoder.AD_PRT
--------------------------------------------------------------------------------
/models/Front Panel.dwg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/models/Front Panel.dwg
--------------------------------------------------------------------------------
/models/Heatsink.AD_DRW:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/models/Heatsink.AD_DRW
--------------------------------------------------------------------------------
/models/Heatsink.AD_PRT:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/models/Heatsink.AD_PRT
--------------------------------------------------------------------------------
/pcb/fan expansion.dch:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/pcb/fan expansion.dch
--------------------------------------------------------------------------------
/pcb/fan expansion.dip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/pcb/fan expansion.dip
--------------------------------------------------------------------------------
/tools/reload font.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/tools/reload font.png
--------------------------------------------------------------------------------
/tools/splashscreen.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/tools/splashscreen.gif
--------------------------------------------------------------------------------
/Warning Hot Stickers.ai:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/Warning Hot Stickers.ai
--------------------------------------------------------------------------------
/models/Fan Plate.AD_DRW:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/models/Fan Plate.AD_DRW
--------------------------------------------------------------------------------
/models/Banana Jack.AD_PRT:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/models/Banana Jack.AD_PRT
--------------------------------------------------------------------------------
/models/Front Panel.AD_DRW:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/models/Front Panel.AD_DRW
--------------------------------------------------------------------------------
/models/Front Panel.AD_PRT:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/models/Front Panel.AD_PRT
--------------------------------------------------------------------------------
/models/New Part (1).AD_PRT:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/models/New Part (1).AD_PRT
--------------------------------------------------------------------------------
/pcb/Reload Pro Schematic.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/pcb/Reload Pro Schematic.pdf
--------------------------------------------------------------------------------
/models/Reload Pro Heatsink.dwg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/models/Reload Pro Heatsink.dwg
--------------------------------------------------------------------------------
/models/Reload Pro Enclosure.AD_ASM:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/models/Reload Pro Enclosure.AD_ASM
--------------------------------------------------------------------------------
/firmware/Reload Pro FTDI Config.xml:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/firmware/Reload Pro FTDI Config.xml
--------------------------------------------------------------------------------
/firmware/release/Reload Pro v1.11.elf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/firmware/release/Reload Pro v1.11.elf
--------------------------------------------------------------------------------
/firmware/Bootloader.cydsn/Bootloader.cydwr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/firmware/Bootloader.cydsn/Bootloader.cydwr
--------------------------------------------------------------------------------
/firmware/Bootloader.cydsn/Bootloader.cyfit:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/firmware/Bootloader.cydsn/Bootloader.cyfit
--------------------------------------------------------------------------------
/firmware/Parts.cylib/ST7528/ST7528.cysch:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/firmware/Parts.cylib/ST7528/ST7528.cysch
--------------------------------------------------------------------------------
/firmware/Parts.cylib/ST7528/ST7528.cysym:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/firmware/Parts.cylib/ST7528/ST7528.cysym
--------------------------------------------------------------------------------
/firmware/Reload Pro.cydsn/Bootloader.elf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/firmware/Reload Pro.cydsn/Bootloader.elf
--------------------------------------------------------------------------------
/firmware/Reload Pro.cydsn/Reload Pro.cydwr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/firmware/Reload Pro.cydsn/Reload Pro.cydwr
--------------------------------------------------------------------------------
/firmware/Bootloader.cydsn/TopDesign/TopDesign.cysch:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/firmware/Bootloader.cydsn/TopDesign/TopDesign.cysch
--------------------------------------------------------------------------------
/firmware/Reload Pro.cydsn/TopDesign/TopDesign.cysch:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arachnidlabs/reload-pro/HEAD/firmware/Reload Pro.cydsn/TopDesign/TopDesign.cysch
--------------------------------------------------------------------------------
/pcb/reloadpro.backsilk.gbo:
--------------------------------------------------------------------------------
1 | G04 DipTrace 2.3.1.0*
2 | %INreloadpro.backsilk.gbo*%
3 | %MOIN*%
4 | %FSLAX44Y44*%
5 | G04*
6 | G70*
7 | G90*
8 | G75*
9 | G01*
10 | %LNBotSilk*%
11 | %LPD*%
12 | M02*
13 |
--------------------------------------------------------------------------------
/pcb/reloadpro.backpaste.gbp:
--------------------------------------------------------------------------------
1 | G04 DipTrace 2.3.1.0*
2 | %INreloadpro.backpaste.gbp*%
3 | %MOIN*%
4 | %FSLAX44Y44*%
5 | G04*
6 | G70*
7 | G90*
8 | G75*
9 | G01*
10 | %LNBotPaste*%
11 | %LPD*%
12 | M02*
13 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Object files
2 | *.o
3 | *.ko
4 |
5 | # Libraries
6 | *.lib
7 | *.a
8 |
9 | # Shared objects (inc. Windows DLLs)
10 | *.dll
11 | *.so
12 | *.so.*
13 | *.dylib
14 |
15 | # Executables
16 | *.exe
17 | *.out
18 | *.app
19 | *.dipb?
20 | codegentemp
21 | CortexM0/
22 | *.log
23 | *.cyfit
24 | *.rpt
25 | *_timing.html
26 |
27 | Generated_Source/
28 | .DS_Store
29 | ~*~
30 | *.zip
31 | *.cyprj.*
32 | *.cywrk.*
33 |
--------------------------------------------------------------------------------
/firmware/Reload Pro.cydsn/splashscreen.h:
--------------------------------------------------------------------------------
1 | /* ========================================
2 | *
3 | * Copyright YOUR COMPANY, THE YEAR
4 | * All Rights Reserved
5 | * UNPUBLISHED, LICENSED SOFTWARE.
6 | *
7 | * CONFIDENTIAL AND PROPRIETARY INFORMATION
8 | * WHICH IS THE PROPERTY OF your company.
9 | *
10 | * ========================================
11 | */
12 |
13 | #include
14 |
15 | extern const uint8 splashscreen_data[];
16 | extern const int16 splashscreen_indexes[];
17 |
18 | #define SPLASHSCREEN_PAGES 8
19 |
20 | void load_splashscreen();
21 |
22 | /* [] END OF FILE */
23 |
--------------------------------------------------------------------------------
/pcb/fanexpansion.drl:
--------------------------------------------------------------------------------
1 | M48
2 | INCH
3 | T01C0.0118
4 | T02C0.0354
5 | T03C0.0402
6 | T04C0.0433
7 | %
8 | T01
9 | X+011022Y+006919
10 | X+012187Y+009187
11 | X+009937Y+011812
12 | X+008062Y+009187
13 | X+006937Y+006025
14 | X+005312Y+006937
15 | X+005812Y+011937
16 | T02
17 | X+012937Y+008062
18 | X+012937Y+009062
19 | X+012937Y+010062
20 | X+012937Y+011062
21 | X+004937Y+011062
22 | X+004937Y+010062
23 | X+004937Y+009062
24 | X+004937Y+008062
25 | T03
26 | X+007187Y+015062
27 | X+006187Y+015062
28 | X+010687Y+015062
29 | X+011687Y+015062
30 | T04
31 | X+008437Y+005562
32 | X+009437Y+005562
33 | T00
34 | M30
35 |
--------------------------------------------------------------------------------
/firmware/Reload Pro.cydsn/calibrate.h:
--------------------------------------------------------------------------------
1 | #ifndef CALIBRATE_H
2 | #define CALIBRATE_H
3 |
4 | #include "config.h"
5 |
6 | typedef void (*progress_callback_t)(int,int);
7 | void calibrate_offsets(settings_t *newsettings);
8 | void calibrate_voltage(settings_t *newsettings, int microvolts);
9 | void calibrate_current(settings_t *newsettings, int microamps);
10 | void calibrate_opamp_offset_trim(settings_t *newsettings, int microamps, progress_callback_t progress_callback);
11 | void calibrate_dacs(settings_t *newsettings, int microamps);
12 | void set_opamp_offset_trim(settings_t *newsettings, int trim);
13 |
14 | #define MAX_OA_OFFSET_STEPS 64
15 |
16 | #endif
17 |
--------------------------------------------------------------------------------
/pcb/reloadpro.outline.gm1:
--------------------------------------------------------------------------------
1 | G04 DipTrace 2.3.1.0*
2 | %INreloadpro.outline.gm1*%
3 | %MOIN*%
4 | %ADD11C,0.0055*%
5 | %FSLAX44Y44*%
6 | G04*
7 | G70*
8 | G90*
9 | G75*
10 | G01*
11 | %LNBoardOutline*%
12 | %LPD*%
13 | X4134Y3937D2*
14 | D11*
15 | G02X3937Y4134I5J202D01*
16 | G01*
17 | Y34843D1*
18 | G02X4187Y35062I240J-21D01*
19 | G01*
20 | X44312D1*
21 | G02X44488Y34843I-36J-209D01*
22 | G01*
23 | Y4134D1*
24 | G02X44291Y3937I-202J5D01*
25 | G01*
26 | X36312D1*
27 | G02X36062Y4187I-31J219D01*
28 | G01*
29 | Y7000D1*
30 | G03X35937Y7125I-94J31D01*
31 | G01*
32 | X12000D1*
33 | G03X11812Y6937I31J-219D01*
34 | G01*
35 | X11811Y4134D1*
36 | G02X11614Y3937I-202J5D01*
37 | G01*
38 | X4134D1*
39 | M02*
40 |
--------------------------------------------------------------------------------
/firmware/Reload Pro.cydsn/comms.h:
--------------------------------------------------------------------------------
1 | /* ========================================
2 | *
3 | * Copyright YOUR COMPANY, THE YEAR
4 | * All Rights Reserved
5 | * UNPUBLISHED, LICENSED SOFTWARE.
6 | *
7 | * CONFIDENTIAL AND PROPRIETARY INFORMATION
8 | * WHICH IS THE PROPERTY OF your company.
9 | *
10 | * ========================================
11 | */
12 | #ifndef COMMS_H
13 | #define COMMS_H
14 |
15 | #define MAX_RESPONSE_LENGTH 80
16 |
17 | // Use this function for "printf" style debugging
18 | // under the hood it uses vsnprintf to format output string
19 | // You must add your own \r\n
20 | // maximum length of string that can be output is MAX_RESPONSE_LENGTH
21 |
22 | void uart_printf(char *fmt, ...);
23 |
24 | #endif
25 | /* [] END OF FILE */
26 |
--------------------------------------------------------------------------------
/firmware/Reload Pro.cydsn/device.h:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * This file is automatically generated by PSoC Creator
3 | * and should not be edited by hand.
4 | *
5 | * This file is necessary for your project to build.
6 | * Please do not delete it.
7 | ********************************************************************************
8 | * Copyright 2008-2011, Cypress Semiconductor Corporation. All rights reserved.
9 | * You may use this file only in accordance with the license, terms, conditions,
10 | * disclaimers, and limitations in the end user license agreement accompanying
11 | * the software package with which this file was provided.
12 | *******************************************************************************/
13 | #ifndef DEVICE_H
14 | #define DEVICE_H
15 | #include
16 |
17 | #endif
18 | /* [] END OF FILE */
19 |
--------------------------------------------------------------------------------
/firmware/Parts.cylib/ST7528/API/font.h:
--------------------------------------------------------------------------------
1 | /* ========================================
2 | *
3 | * Copyright Arachnid Labs, 2013
4 | * All Rights Reserved
5 | * UNPUBLISHED, LICENSED SOFTWARE.
6 | *
7 | * CONFIDENTIAL AND PROPRIETARY INFORMATION
8 | * WHICH IS THE PROPERTY OF your company.
9 | *
10 | * ========================================
11 | */
12 |
13 | #define FONT_GLYPH_PAGES 2
14 | #define FONT_GLYPH_COLUMNS 12
15 | #define FONT_GLYPH_COUNT 192
16 | #define FONT_GLYPH_OFFSET 32
17 | #define FONT_BIGDIGIT_OFFSET (96 + FONT_GLYPH_OFFSET)
18 | #define FONT_BIGDIGIT_ROW_WIDTH 32
19 |
20 | #define GLYPH_CHAR(x) (x[0])
21 | #define FONT_GLYPH_BIGPERIOD "\xDE"
22 | #define FONT_GLYPH_LARR "\x9E"
23 | #define FONT_GLYPH_RARR "\x9F"
24 | #define FONT_GLYPH_UARR "\xBE"
25 | #define FONT_GLYPH_DARR "\xBF"
26 | #define FONT_GLYPH_ENTER "\xDF"
27 | #define FONT_GLYPH_OHM "\x7F"
28 |
29 | extern char glyphs[192][FONT_GLYPH_PAGES][FONT_GLYPH_COLUMNS];
30 |
31 | /* [] END OF FILE */
32 |
--------------------------------------------------------------------------------
/firmware/Parts.cylib/ST7528/API/ST7528.h:
--------------------------------------------------------------------------------
1 | /* ========================================
2 | *
3 | * Copyright YOUR COMPANY, THE YEAR
4 | * All Rights Reserved
5 | * UNPUBLISHED, LICENSED SOFTWARE.
6 | *
7 | * CONFIDENTIAL AND PROPRIETARY INFORMATION
8 | * WHICH IS THE PROPERTY OF your company.
9 | *
10 | * ========================================
11 | */
12 | #include
13 |
14 | void `$INSTANCE_NAME`_Start();
15 | void `$INSTANCE_NAME`_Setup();
16 | void `$INSTANCE_NAME`_WritePixels(uint8 data[], int len);
17 | void `$INSTANCE_NAME`_SetCursorPosition(uint8 page, uint8 col);
18 | void `$INSTANCE_NAME`_SetContrast(uint8 contrast_level);
19 | void `$INSTANCE_NAME`_DrawText(uint8 start_page, uint8 start_col, const char *text, uint8 inverse);
20 | void `$INSTANCE_NAME`_DrawBigNumbers(uint8 start_page, uint8 start_col, const char *nums);
21 | void `$INSTANCE_NAME`_ClearAll();
22 | void `$INSTANCE_NAME`_Clear(uint8 start_row, uint8 start_col, uint8 end_row, uint8 end_col, uint8 value);
23 | /* [] END OF FILE */
24 |
--------------------------------------------------------------------------------
/tools/serial_keywords:
--------------------------------------------------------------------------------
1 | %{
2 | typedef void (*command_func)(char *);
3 |
4 | typedef struct command_def {
5 | const char *name;
6 | command_func handler;
7 | } command_def;
8 |
9 | void command_mode(char*);
10 | void command_set(char *);
11 | void command_reset(char *);
12 | void command_read(char *);
13 | void command_monitor(char *);
14 | void command_debug(char *);
15 | void command_calibrate(char *);
16 | void command_bootloader(char *);
17 | void command_dump(char *);
18 | void command_version(char *);
19 | void command_uvlo(char *);
20 | void command_on(char *);
21 | void command_off(char *);
22 | void command_clear(char *);
23 |
24 | %}
25 | struct command_def;
26 | %struct-type
27 | %includes
28 | %language=ANSI-C
29 | %7bit
30 | %readonly-tables
31 | %switch=1
32 | %%
33 | mode,command_mode
34 | set,command_set
35 | reset,command_reset
36 | read,command_read
37 | monitor,command_monitor
38 | debug,command_debug
39 | cal,command_calibrate
40 | bl,command_bootloader
41 | dump,command_dump
42 | version,command_version
43 | uvlo,command_uvlo
44 | on,command_on
45 | off,command_off
46 | clear,command_clear
47 |
--------------------------------------------------------------------------------
/tools/fontmaker.py:
--------------------------------------------------------------------------------
1 | from PIL import Image
2 |
3 |
4 | GLYPH_WIDTH = 12 # Pixels
5 | GLYPH_ROWS = 2 # Bytes
6 |
7 |
8 | def build_column(img, x, y):
9 | ret = 0
10 | for i in range(8):
11 | ret = (ret << 1) | (0 if img.getpixel((x, y + (7 - i))) else 1)
12 | return ret
13 |
14 |
15 | def main():
16 | img = Image.open("reload font.png")
17 | width, height = img.size
18 | x_glyphs = width / GLYPH_WIDTH
19 | y_glyphs = height / (GLYPH_ROWS * 8)
20 |
21 | out = open('font.c', 'w')
22 | out.write("const char glyphs[%d][%d][%d] = {\n" % (x_glyphs * y_glyphs, GLYPH_ROWS, GLYPH_WIDTH))
23 |
24 | for y in range(y_glyphs):
25 | for x in range(x_glyphs):
26 | out.write(" {\n")
27 | for row in range(GLYPH_ROWS):
28 | columns = [build_column(img, x * GLYPH_WIDTH + i, (y * GLYPH_ROWS + row) * 8) for i in range(GLYPH_WIDTH)]
29 | out.write(" {%s},\n" % (", ".join("0x%X" % column for column in columns)))
30 | out.write(" },\n")
31 |
32 | out.write("};\n")
33 |
34 |
35 | if __name__ == '__main__':
36 | main()
37 |
--------------------------------------------------------------------------------
/firmware/Reload Pro.cydsn/tasks.h:
--------------------------------------------------------------------------------
1 | /* ========================================
2 | *
3 | * Copyright Arachnid Labs, 2013
4 | * All Rights Reserved
5 | * UNPUBLISHED, LICENSED SOFTWARE.
6 | *
7 | * CONFIDENTIAL AND PROPRIETARY INFORMATION
8 | * WHICH IS THE PROPERTY OF your company.
9 | *
10 | * ========================================
11 | */
12 |
13 | #include
14 | #include
15 | #include
16 |
17 | extern xTaskHandle comms_task;
18 | extern xTaskHandle ui_task;
19 |
20 | extern xQueueHandle ui_queue;
21 | extern xQueueHandle comms_queue;
22 |
23 | typedef enum {
24 | UI_EVENT_NONE,
25 | UI_EVENT_BUTTONPRESS,
26 | UI_EVENT_LONG_BUTTONPRESS,
27 | UI_EVENT_UPDOWN,
28 | UI_EVENT_TICK,
29 | UI_EVENT_LIMIT,
30 | UI_EVENT_BOOTLOAD,
31 | } ui_event_type;
32 |
33 | typedef enum {
34 | LIMIT_TYPE_OVERTEMP,
35 | LIMIT_TYPE_UNDERVOLT,
36 | } limit_type;
37 |
38 | typedef struct {
39 | ui_event_type type;
40 | int int_arg;
41 | portTickType duration;
42 | portTickType when;
43 | } ui_event;
44 |
45 | #define MAX_COMMS_LINE_LENGTH 40
46 |
47 | typedef enum {
48 | COMMS_EVENT_LINE_RX,
49 | COMMS_EVENT_MONITOR_DATA,
50 | COMMS_EVENT_OVERTEMP,
51 | COMMS_EVENT_UNDERVOLT,
52 | } comms_event_type;
53 |
54 | typedef struct {
55 | comms_event_type type;
56 | } comms_event;
57 |
58 |
59 | void vTaskUI(void *pvParameters);
60 | void vTaskComms(void *pvParameters);
61 | void start_adc();
62 |
63 | /* [] END OF FILE */
64 |
--------------------------------------------------------------------------------
/firmware/Reload Pro.cywrk:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/pcb/reloadpro.backmask.gbs:
--------------------------------------------------------------------------------
1 | G04 DipTrace 2.3.1.0*
2 | %INreloadpro.backmask.gbs*%
3 | %MOIN*%
4 | %ADD50R,0.0472X0.0472*%
5 | %ADD59C,0.0374*%
6 | %ADD70C,0.0472*%
7 | %ADD80C,0.126*%
8 | %ADD82C,0.0866*%
9 | %ADD83C,0.0709*%
10 | %ADD84C,0.0669*%
11 | %ADD86R,0.0669X0.0669*%
12 | %ADD96C,0.0827*%
13 | %ADD97R,0.0827X0.0827*%
14 | %ADD102C,0.3228*%
15 | %ADD104C,0.1378*%
16 | %FSLAX44Y44*%
17 | G04*
18 | G70*
19 | G90*
20 | G75*
21 | G01*
22 | %LNBotMask*%
23 | %LPD*%
24 | G36*
25 | X8798Y9512D2*
26 | X8525D1*
27 | X8331Y9706D1*
28 | Y9979D1*
29 | X8525Y10173D1*
30 | X8798D1*
31 | X8992Y9979D1*
32 | Y9706D1*
33 | X8798Y9512D1*
34 | G37*
35 | D83*
36 | X7677Y9843D3*
37 | Y9055D3*
38 | X8661D3*
39 | D104*
40 | X5799Y7988D3*
41 | X10539D3*
42 | D102*
43 | X34687Y15687D3*
44 | X39062D3*
45 | D97*
46 | X23213Y33937D3*
47 | D96*
48 | X24213D3*
49 | X25213D3*
50 | D86*
51 | X9449Y12992D3*
52 | D84*
53 | X10449D3*
54 | X12449D3*
55 | X13449D3*
56 | X14449D3*
57 | D82*
58 | X40679Y5733D3*
59 | X39695D3*
60 | X38710D3*
61 | X40679Y6718D3*
62 | X38710D3*
63 | D80*
64 | X42195Y7111D3*
65 | X37195D3*
66 | D59*
67 | X19437Y30437D3*
68 | X17437Y30037D3*
69 | Y30837D3*
70 | D84*
71 | X5937Y29875D3*
72 | Y28875D3*
73 | Y27875D3*
74 | Y26875D3*
75 | X13937D3*
76 | Y27875D3*
77 | Y28875D3*
78 | Y29875D3*
79 | D102*
80 | X30312Y15687D3*
81 | D50*
82 | X19437Y32687D3*
83 | D70*
84 | Y32187D3*
85 | X18937Y32687D3*
86 | Y32187D3*
87 | X18437Y32687D3*
88 | Y32187D3*
89 | X17937Y32687D3*
90 | Y32187D3*
91 | X17437Y32687D3*
92 | Y32187D3*
93 | M02*
94 |
--------------------------------------------------------------------------------
/firmware/Bootloader.cydsn/main.c:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | void CyBtldrCommStart(void) {
4 | UART_Start();
5 | }
6 |
7 | void CyBtldrCommStop (void) {
8 | UART_Stop();
9 | }
10 |
11 | void CyBtldrCommReset(void) {
12 | UART_SpiUartClearRxBuffer();
13 | UART_SpiUartClearTxBuffer();
14 | }
15 |
16 | cystatus CyBtldrCommWrite(uint8* buffer, uint16 size, uint16* count, uint8 timeOut) {
17 | for(*count = 0; *count < size; (*count)++) {
18 | UART_UartPutChar(buffer[*count]);
19 | }
20 |
21 | return CYRET_SUCCESS;
22 | }
23 |
24 | cystatus CyBtldrCommRead (uint8* buffer, uint16 size, uint16* count, uint8 timeOut) {
25 | int timeoutUs = timeOut * 10000;
26 | cystatus status = CYRET_TIMEOUT;
27 |
28 | *count = 0;
29 | while(*count < size && timeoutUs >= 0) {
30 | if(UART_SpiUartGetRxBufferSize() > 0) {
31 | buffer[(*count)++] = UART_UartGetByte();
32 | // Switch to byte-to-byte timeout and mark as success
33 | timeoutUs = 10000; //10mS
34 | status = CYRET_SUCCESS;
35 | } else {
36 | CyDelayUs(10);
37 | timeoutUs -= 10;
38 | }
39 | }
40 |
41 | return status;
42 | }
43 |
44 | void main()
45 | {
46 | if(Bootloader_GET_RUN_TYPE == Bootloader_START_BTLDR)
47 | Bootloader_Start();
48 |
49 | CyDelay(1);
50 | if(Button_Read()) {
51 | // No button press, run app
52 | Bootloader_SET_RUN_TYPE(Bootloader_START_APP);
53 | } else {
54 | // Button is being pressed; start bootloader
55 | Bootloader_SET_RUN_TYPE(Bootloader_START_BTLDR);
56 | }
57 | Bootloader_Start();
58 | }
59 |
60 | /* [] END OF FILE */
61 |
--------------------------------------------------------------------------------
/tools/imageformatter.py:
--------------------------------------------------------------------------------
1 | from PIL import Image
2 | import lzf
3 | import numpy
4 |
5 |
6 | def main():
7 | img = Image.open("splashscreen.gif")
8 |
9 | # Convert to an array of gray values - data[row, column]
10 | data = numpy.asarray(img.convert('L'))
11 |
12 | # Flip
13 | data = data[::-1]
14 |
15 | # Invert
16 | data = numpy.subtract(255, data)
17 |
18 | # Split up into pages - pages[page, page_row:8, column]
19 | pages = numpy.array_split(data, range(8, img.size[1], 8), 0)
20 |
21 | # Reverse order of pages, too
22 | pages = pages[::-1]
23 |
24 | # Rearrange each page to be column-major - pages[page, column, page_row:8]
25 | pages = numpy.transpose(pages, (0, 2, 1))
26 |
27 | # Unpack into bits - pages[page, column, page_row:8, pixel_bit:8]
28 | pages = numpy.expand_dims(pages, 3)
29 | pages = numpy.unpackbits(pages, 3)
30 |
31 | # Truncate to 4bpp - pages[page, column, page_row:8, pixel_bit:4]
32 | pages = pages[:, :, :, :4]
33 |
34 | # Transpose into bit planes - pages[page, column, pixel_bit:4, page_row:8]
35 | pages = numpy.transpose(pages, (0, 1, 3, 2))
36 |
37 | # Collapse bit-planes - pages[page, column, pixel_bit:4, value:1]
38 | pages = numpy.packbits(pages, 3)
39 |
40 | # Flatten into pages - pages[page, byte]
41 | pages = numpy.reshape(pages, (pages.shape[0], -1))
42 |
43 | # Compress each page - pages[page]
44 | pages = [lzf.compress(page.tostring('C')) for page in pages]
45 |
46 | # Neatly format the image for output
47 | indexes = [0]
48 | for i in range(len(pages)):
49 | indexes.append(indexes[i] + len(pages[i]))
50 |
51 | out = open('splashscreen.c', 'w')
52 | out.write('#include "splashscreen.h"\n\n')
53 | out.write("const uint8 splashscreen_data[] = {\n")
54 | for i, page in enumerate(pages):
55 | out.write(" // %d-%d: Page %d\n" % (indexes[i], indexes[i + 1] - 1, i))
56 | for line in range(0, len(page), 10):
57 | value = ''.join('0x%02X, ' % ord(x) for x in page[line:line + 10]).strip()
58 | out.write(" %s\n" % (value,))
59 | out.write("};\n\n")
60 |
61 | out.write("const int16 splashscreen_indexes[] = {%s};\n" % (', '.join(str(x) for x in indexes)))
62 | out.close()
63 |
64 | print "Image output in %d bytes" % (sum(len(page) + 2 for page in pages) + 2,)
65 |
66 | if __name__ == '__main__':
67 | main()
68 |
--------------------------------------------------------------------------------
/firmware/release/README.md:
--------------------------------------------------------------------------------
1 | # Release Notes
2 |
3 | # v1.11
4 | - Further debounce improvements
5 | - When showing actual current, switch to setpoint when knob is turned
6 | - Increase stack size on comms task to prevent stack overflow
7 |
8 | ## v1.10
9 | - Fixed ohms symbol in font so it's not a spider
10 | - Added support to toggle load on and off (@zardam)
11 | - Support for long presses to toggle load (@zardam)
12 | - Much improved calibration (@zardam)
13 |
14 | ## v1.9
15 | - Fixed background glitches in menu (@zardam; #39)
16 | - Implemented acceleration for quadrature decoder (@raivisr)
17 | - Reduced minimum current step to 10mA from 20mA
18 | - Improved button debounce (@raivisr)
19 | - Add 'exit' option to menus
20 | - Reduced display update rate to 2hz from 10hz
21 | - Added correction factor for voltage based on current drawn
22 | - Added 'uvlo' serial command for setting and checking min voltage
23 | - Added parameterless 'set' for retrieving set current
24 |
25 | ## v1.8
26 | - Expanded opamp offset calibration range to 0-63
27 | - Output current setpoint over serial in response to UI actions (#19)
28 | - Add range checking for 'set' command (#38)
29 | - Progress bar for final calibration step
30 |
31 | ## v1.7
32 | - Fixed bug in calibration routine that caused crashes
33 | - Added 'cal t' command
34 |
35 | ## v1.6
36 | - Rewrote opamp offset calibration routine to use measured output values
37 | - Added 'cal O' command
38 |
39 | ## v1.5
40 | - Substantially improved calibration routine
41 | - Software feedback loop so set vs actual current tracks better
42 |
43 | ## v1.4
44 | - Improved display layout
45 | - Fixed display initialisation issues in some units
46 | - Undervoltage cutoff for discharging batteries
47 |
48 | ## v1.3
49 | - Minor bugfixes identified during production run
50 |
51 | ## v1.0
52 | - First production release
53 |
54 | ## v0.13
55 | - Fixed some calibration issues.
56 | - Fixed an issue with some units drawing max current after being set to 0 post-calibration.
57 | - Implemented overtemperature shutdown detection and reset.
58 | - Implemented watchdog timer to automatically reset firmware if the UI task locks up.
59 | - Implemented factory reset
60 | - Fixed watt hour readout
61 |
62 | ## v0.12
63 | - Fixed boot issues in v0.1.1
64 |
65 | ## v0.11
66 | - Fixed bug causing the Re:load Pro to stop at the bootloader after display settings have been changed
67 | - Added version number to bootup splashscreen
68 | - Improved button debounce
--------------------------------------------------------------------------------
/pcb/reloadpro.Through.drl:
--------------------------------------------------------------------------------
1 | M48
2 | INCH
3 | T01C0.0118
4 | T02C0.0197
5 | T03C0.0236
6 | T04C0.0295
7 | T05C0.0354
8 | T06C0.0362
9 | T07C0.0374
10 | T08C0.0394
11 | T09C0.0433
12 | T10C0.0827
13 | T11C0.0906
14 | T12C0.126
15 | %
16 | T01
17 | X+024312Y+011812
18 | X+025812Y+011062
19 | X+027062Y+010937
20 | X+024312Y+009750
21 | X+025937Y+013937
22 | X+026062Y+014562
23 | X+025687Y+021687
24 | X+025687Y+024937
25 | X+025312Y+025812
26 | X+026812Y+027312
27 | X+025187Y+028187
28 | X+025187Y+029937
29 | X+023062Y+028687
30 | X+023062Y+026187
31 | X+021562Y+025812
32 | X+021437Y+024062
33 | X+022062Y+023937
34 | X+020062Y+021812
35 | X+018937Y+023687
36 | X+016062Y+023687
37 | X+015687Y+021687
38 | X+015687Y+021187
39 | X+016500Y+021187
40 | X+016750Y+021687
41 | X+016750Y+017559
42 | X+018437Y+017559
43 | X+018437Y+013562
44 | X+012937Y+018687
45 | X+009937Y+020937
46 | X+009312Y+020562
47 | X+008687Y+021437
48 | X+008687Y+022062
49 | X+008937Y+022437
50 | X+006312Y+022437
51 | X+005187Y+024062
52 | X+006437Y+020425
53 | X+007187Y+019812
54 | X+007687Y+019437
55 | X+007437Y+018687
56 | X+006562Y+019312
57 | X+017937Y+026562
58 | X+019937Y+026562
59 | X+018437Y+029437
60 | X+019187Y+030937
61 | X+017937Y+031062
62 | X+033687Y+018437
63 | T02
64 | X+034687Y+016687
65 | X+033937Y+016437
66 | X+033687Y+015687
67 | X+033937Y+014937
68 | X+034687Y+014687
69 | X+035437Y+014937
70 | X+035687Y+015687
71 | X+035437Y+016437
72 | X+038062Y+015687
73 | X+038312Y+014937
74 | X+039062Y+014687
75 | X+039812Y+014937
76 | X+040062Y+015687
77 | X+039812Y+016437
78 | X+039062Y+016687
79 | X+038312Y+016437
80 | X+031312Y+015687
81 | X+031062Y+016437
82 | X+030312Y+016687
83 | X+029562Y+016437
84 | X+029312Y+015687
85 | X+029562Y+014937
86 | X+030312Y+014687
87 | X+031062Y+014937
88 | T03
89 | X+019437Y+032687
90 | X+019437Y+032187
91 | X+018937Y+032187
92 | X+018937Y+032687
93 | X+018437Y+032687
94 | X+018437Y+032187
95 | X+017937Y+032187
96 | X+017937Y+032687
97 | X+017437Y+032687
98 | X+017437Y+032187
99 | T04
100 | X+005937Y+029875
101 | X+005937Y+028875
102 | X+005937Y+027875
103 | X+005937Y+026875
104 | X+013937Y+026875
105 | X+013937Y+027875
106 | X+013937Y+028875
107 | X+013937Y+029875
108 | T05
109 | X+009449Y+012992
110 | X+010449Y+012992
111 | X+012449Y+012992
112 | X+013449Y+012992
113 | X+014449Y+012992
114 | T06
115 | X+008661Y+009843
116 | X+008661Y+009055
117 | X+007677Y+009055
118 | X+007677Y+009843
119 | T07
120 | X+019437Y+030437
121 | X+017437Y+030037
122 | X+017437Y+030837
123 | T08
124 | X+040679Y+005733
125 | X+039695Y+005733
126 | X+038710Y+005733
127 | X+038710Y+006718
128 | X+040679Y+006718
129 | T09
130 | X+023213Y+033937
131 | X+024213Y+033937
132 | X+025213Y+033937
133 | T10
134 | X+042195Y+007111
135 | X+037195Y+007111
136 | T11
137 | X+005799Y+007988
138 | X+010539Y+007988
139 | T12
140 | X+034687Y+015687
141 | X+030312Y+015687
142 | X+039062Y+015687
143 | T00
144 | M30
145 |
--------------------------------------------------------------------------------
/tools/calibrate.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | import argparse
3 | import logging
4 | import re
5 | import serial
6 | import time
7 |
8 |
9 | logging.basicConfig(level=logging.DEBUG)
10 |
11 |
12 | parser = argparse.ArgumentParser(description="Test and calibrate the Re:load Pro")
13 | parser.add_argument('--baud', metavar='BAUD', type=int, help="Baud rate", default=115200)
14 | parser.add_argument('port', metavar='PORT', help="Serial port")
15 | parser.add_argument('--current', '-i', metavar='I', type=int, help="Calibration current in microamps")
16 | parser.add_argument('--voltage', '-v', metavar='V', type=int, help="Calibration voltage in microvolts")
17 |
18 |
19 | class QuitError(Exception): pass
20 |
21 | def expect(value, expectation):
22 | if value != expectation:
23 | logging.error("Expected %r, got %r", expectation, value)
24 | raise QuitError()
25 |
26 |
27 | def read_adcs(ser):
28 | ser.write("read\n")
29 | line = ser.readline()
30 | match = re.search("^read (-?\d+) (-?\d+)\r\n$", line)
31 | if not match:
32 | logging.error("Expected read response, got %r", line)
33 | raise QuitError()
34 | return map(int, match.groups())
35 |
36 |
37 | def basic_test(args, ser):
38 | volts, amps = read_adcs(ser)
39 | if abs(volts) > 10000:
40 | logging.error("Offset voltage %d is greater than 10mV", volts)
41 | raise QuitError()
42 | if abs(amps) > 10000:
43 | logging.error("Offset current %d is greater than 10mA", amps)
44 | raise QuitError()
45 | logging.info("Communications okay")
46 | logging.info("Offsets okay")
47 |
48 |
49 | def calibrate_offset(args, ser):
50 | ser.write("set 0\n")
51 | expect(ser.readline(), "set 0\r\n")
52 | ser.write("cal o\n")
53 | expect(ser.readline(), "ok\r\n")
54 | logging.info("Calibrated offsets")
55 |
56 |
57 | def calibrate_voltage(args, ser):
58 | raw_input("Connect voltage source and press enter to continue.")
59 | volts, amps = read_adcs(ser)
60 | if args.voltage * 0.8 < volts < args.voltage * 1.2:
61 | logging.error("Initial voltage more than 20% out: %d", volts)
62 | raise QuitError()
63 | ser.write("cal v %d\n" % (args.voltage,))
64 | expect(ser.readline(), "ok\r\n")
65 | logging.info("Calibrated voltage")
66 |
67 |
68 | def calibrate_current(args, ser):
69 | ser.write("set 6000\n")
70 | expect(ser.readline(), "set 6000\r\n")
71 | time.sleep(2.0)
72 | volts, amps = read_adcs(ser)
73 | if args.current * 0.8 < amps < args.current * 1.2:
74 | logging.error("Initial current more than 20% out: %d", amps)
75 | raise QuitError()
76 | ser.write("cal i %d\n" % (args.current,))
77 | expect(ser.readline(), "ok\r\n")
78 | logging.info("Calibrated current")
79 |
80 |
81 | def calibrate_dacs(args, ser):
82 | ser.write("cal d %d\n" % (args.current * 0.8,))
83 | expect(ser.readline(), "ok\r\n")
84 | time.sleep(2.0)
85 | logging.info("Calibrated DACs")
86 |
87 |
88 | def main(args):
89 | ser = serial.Serial(args.port, args.baud, timeout=1)
90 |
91 | basic_test(args, ser)
92 | calibrate_offset(args, ser)
93 | calibrate_voltage(args, ser)
94 | calibrate_current(args, ser)
95 | calibrate_dacs(args, ser)
96 | logging.info("Done!")
97 |
98 |
99 | if __name__ == '__main__':
100 | try:
101 | main(parser.parse_args())
102 | except QuitError:
103 | pass
104 |
--------------------------------------------------------------------------------
/firmware/Reload Pro.cydsn/utils.c:
--------------------------------------------------------------------------------
1 | /* ========================================
2 | *
3 | * Copyright YOUR COMPANY, THE YEAR
4 | * All Rights Reserved
5 | * UNPUBLISHED, LICENSED SOFTWARE.
6 | *
7 | * CONFIDENTIAL AND PROPRIETARY INFORMATION
8 | * WHICH IS THE PROPERTY OF your company.
9 | *
10 | * ========================================
11 | */
12 |
13 | #include
14 | #include
15 | #include "config.h"
16 |
17 | #ifdef USE_SPLASHSCREEN
18 | #include "splashscreen.h"
19 | #include "lzfx.h"
20 | #endif
21 |
22 | void setup() {
23 | state.current_setpoint = -1;
24 | state.lower_voltage_limit = -1;
25 |
26 | set_current(0);
27 |
28 | CY_SET_REG32(Opamp_cy_psoc4_abuf__OA_OFFSET_TRIM, settings->calibration_settings.opamp_offset_trim);
29 | }
30 |
31 | void set_current(int setpoint) {
32 | if(setpoint < 0)
33 | setpoint = 0;
34 | if (setpoint > CURRENT_MAX)
35 | setpoint = CURRENT_MAX;
36 | state.current_setpoint = setpoint;
37 |
38 | setpoint -= settings->calibration_settings.dac_offset;
39 | setpoint -= get_dac_offset_correction();
40 | if(setpoint < 0)
41 | setpoint = 0;
42 |
43 | IDAC_High_SetValue(setpoint / settings->calibration_settings.dac_high_gain);
44 | IDAC_Low_SetValue((setpoint % settings->calibration_settings.dac_high_gain) / settings->calibration_settings.dac_low_gain);
45 | }
46 |
47 | int get_current_setpoint() {
48 | return state.current_setpoint;
49 | }
50 |
51 | // Loads the splashscreen image
52 | // ONLY RUN BEFORE STARTING THE RTOS KERNEL!
53 | // (And after initializing the display)
54 | #ifdef USE_SPLASHSCREEN
55 |
56 | #define Bootloader_MD_SIZEOF (64u)
57 | #define APP_VER_OFFSET (CYDEV_FLASH_SIZE - Bootloader_MD_SIZEOF + Bootloadable_META_APP_VER_OFFSET)
58 |
59 | uint8 get_major_version() {
60 | return Bootloadable_GET_CODE_DATA(APP_VER_OFFSET + 1);
61 | }
62 |
63 | uint8 get_minor_version() {
64 | return Bootloadable_GET_CODE_DATA(APP_VER_OFFSET);
65 | }
66 |
67 | void load_splashscreen() {
68 | // Allocate a buffer to decompress stripes of image to
69 | uint8 *page = pvPortMalloc(160 * 4);
70 |
71 | // Descompress each stripe and write it to the display
72 | Display_SetCursorPosition(0, 0);
73 | for(int i = 0; i < 8; i++) {
74 | lzfx_decompress(
75 | splashscreen_data + splashscreen_indexes[i],
76 | splashscreen_indexes[i + 1] - splashscreen_indexes[i],
77 | page, &(unsigned int){160 * 4});
78 | Display_WritePixels(page, 160 * 4);
79 | CyDelay(1);
80 | }
81 |
82 | // Write the version to the lower left
83 | char buf[9];
84 | sprintf(buf, "v%hd.%hd", get_major_version(), get_minor_version());
85 | Display_DrawText(6, 0, buf, 0);
86 |
87 | // Reset the heap to free the memory we used
88 | vPortInitialiseBlocks();
89 | }
90 | #endif
91 |
92 | static output_mode current_output_mode = OUTPUT_MODE_FEEDBACK;
93 |
94 | void set_output_mode(output_mode mode) {
95 | current_output_mode = mode;
96 | switch(mode) {
97 | case OUTPUT_MODE_OFF:
98 | // Pull the gate low
99 | Opamp_Stop();
100 | Opamp_Out_Write(0);
101 | Opamp_Out_SetDriveMode(Opamp_Out_DM_STRONG);
102 | break;
103 | case OUTPUT_MODE_ON:
104 | // Stop the opamp and set the gate high
105 | Opamp_Stop();
106 | Opamp_Out_Write(1);
107 | Opamp_Out_SetDriveMode(Opamp_Out_DM_STRONG);
108 | break;
109 | case OUTPUT_MODE_FEEDBACK:
110 | // Start the opamp and set the pin to hi-z
111 | Opamp_Out_SetDriveMode(Opamp_Out_DM_ALG_HIZ);
112 | Opamp_Start();
113 | break;
114 | }
115 | }
116 |
117 | output_mode get_output_mode() {
118 | return current_output_mode;
119 | }
120 |
121 | /* [] END OF FILE */
122 |
--------------------------------------------------------------------------------
/firmware/Reload Pro.cydsn/calibrate.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include "calibrate.h"
4 | #include "config.h"
5 |
6 | void calibrate_offsets(settings_t *newsettings) {
7 | newsettings->calibration_settings.adc_voltage_offset = get_raw_voltage();
8 | newsettings->calibration_settings.adc_current_offset = get_raw_current_usage();
9 | }
10 |
11 | void calibrate_voltage(settings_t *newsettings, int microvolts) {
12 | newsettings->calibration_settings.adc_voltage_gain = microvolts / (get_raw_voltage() - newsettings->calibration_settings.adc_voltage_offset) ;
13 | }
14 |
15 | void calibrate_current(settings_t *newsettings, int microamps) {
16 | newsettings->calibration_settings.adc_current_gain = microamps / (get_raw_current_usage() - newsettings->calibration_settings.adc_current_offset);
17 | }
18 |
19 | void calibrate_opamp_offset_trim(settings_t *newsettings, int microamps, progress_callback_t progress_callback) {
20 | state.calibrating = 1;
21 | int high_value = microamps / DEFAULT_DAC_HIGH_GAIN;
22 | int low_value = 100000 / DEFAULT_DAC_HIGH_GAIN; // Approx 100mA
23 | int high_current, low_current;
24 | IDAC_Low_SetValue(0);
25 |
26 | // Find the best setting for the opamp trim
27 | int min_offset = INT_MIN;
28 | int min_offset_idx = 0;
29 |
30 | for(int i = 0; i < MAX_OA_OFFSET_STEPS; i++) {
31 | progress_callback(i+1,MAX_OA_OFFSET_STEPS);
32 | CY_SET_REG32(Opamp_cy_psoc4_abuf__OA_OFFSET_TRIM, i);
33 |
34 | IDAC_High_SetValue(high_value);
35 | vTaskDelay(configTICK_RATE_HZ);
36 | high_current = get_raw_current_usage() - newsettings->calibration_settings.adc_current_offset;
37 |
38 | IDAC_High_SetValue(low_value);
39 | vTaskDelay(configTICK_RATE_HZ);
40 | low_current = get_raw_current_usage() - newsettings->calibration_settings.adc_current_offset;
41 |
42 | int offset = (high_value * low_current - low_value * high_current) / (high_value - low_value);
43 | if(offset <= 0 && offset > min_offset) {
44 | min_offset = offset;
45 | min_offset_idx = i;
46 | }
47 | }
48 | set_opamp_offset_trim(newsettings, min_offset_idx);
49 |
50 | set_current(0);
51 | state.calibrating = 0;
52 | }
53 |
54 | void calibrate_dacs(settings_t *newsettings, int microamps) {
55 | state.calibrating = 1;
56 | int high_value = microamps / DEFAULT_DAC_HIGH_GAIN;
57 | int low_value = 100000 / DEFAULT_DAC_HIGH_GAIN; // Approx 100mA
58 | int high_current, low_current;
59 |
60 | IDAC_Low_SetValue(0);
61 |
62 | // Calculate offset and gain for IDAC_High
63 | IDAC_High_SetValue(high_value);
64 | vTaskDelay(configTICK_RATE_HZ * 2);
65 | high_current = (get_raw_current_usage() - newsettings->calibration_settings.adc_current_offset) * settings->calibration_settings.adc_current_gain;
66 |
67 | IDAC_High_SetValue(low_value);
68 | vTaskDelay(configTICK_RATE_HZ * 2);
69 | low_current = (get_raw_current_usage() - newsettings->calibration_settings.adc_current_offset) * settings->calibration_settings.adc_current_gain;
70 |
71 | newsettings->calibration_settings.dac_high_gain = (high_current - low_current) / (high_value - low_value);
72 | newsettings->calibration_settings.dac_offset = high_current - high_value * newsettings->calibration_settings.dac_high_gain;
73 |
74 | // Calculate gain for IDAC_Low
75 | IDAC_Low_SetValue(127);
76 | vTaskDelay(configTICK_RATE_HZ * 4);
77 | newsettings->calibration_settings.dac_low_gain = ((get_raw_current_usage() - newsettings->calibration_settings.adc_current_offset) * settings->calibration_settings.adc_current_gain - low_current) / 127;
78 |
79 | // Reset for 0 output
80 | set_current(0);
81 | state.calibrating = 0;
82 | }
83 |
84 | void set_opamp_offset_trim(settings_t *newsettings, int trim) {
85 | newsettings->calibration_settings.opamp_offset_trim = trim;
86 | CY_SET_REG32(Opamp_cy_psoc4_abuf__OA_OFFSET_TRIM, newsettings->calibration_settings.opamp_offset_trim);
87 | }
88 |
--------------------------------------------------------------------------------
/firmware/Reload Pro.cydsn/lzfx.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009 Andrew Collette
3 | * http://lzfx.googlecode.com
4 | *
5 | * Implements an LZF-compatible compressor/decompressor based on the liblzf
6 | * codebase written by Marc Lehmann. This code is released under the BSD
7 | * license. License and original copyright statement follow.
8 | *
9 | *
10 | * Copyright (c) 2000-2008 Marc Alexander Lehmann
11 | *
12 | * Redistribution and use in source and binary forms, with or without modifica-
13 | * tion, are permitted provided that the following conditions are met:
14 | *
15 | * 1. Redistributions of source code must retain the above copyright notice,
16 | * this list of conditions and the following disclaimer.
17 | *
18 | * 2. Redistributions in binary form must reproduce the above copyright
19 | * notice, this list of conditions and the following disclaimer in the
20 | * documentation and/or other materials provided with the distribution.
21 | *
22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
24 | * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
25 | * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE-
26 | * CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH-
30 | * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31 | * OF THE POSSIBILITY OF SUCH DAMAGE.
32 | */
33 |
34 | #ifndef LZFX_H
35 | #define LZFX_H
36 |
37 | #ifdef __cplusplus
38 | extern "C" {
39 | #endif
40 |
41 | /* Documented behavior, including function signatures and error codes,
42 | is guaranteed to remain unchanged for releases with the same major
43 | version number. Releases of the same major version are also able
44 | to read each other's output, although the output itself is not
45 | guaranteed to be byte-for-byte identical.
46 | */
47 | #define LZFX_VERSION_MAJOR 0
48 | #define LZFX_VERSION_MINOR 1
49 | #define LZFX_VERSION_STRING "0.1"
50 |
51 | /* Hashtable size (2**LZFX_HLOG entries) */
52 | #ifndef LZFX_HLOG
53 | # define LZFX_HLOG 16
54 | #endif
55 |
56 | /* Predefined errors. */
57 | #define LZFX_ESIZE -1 /* Output buffer too small */
58 | #define LZFX_ECORRUPT -2 /* Invalid data for decompression */
59 | #define LZFX_EARGS -3 /* Arguments invalid (NULL) */
60 |
61 | /* Buffer-to buffer compression.
62 |
63 | Supply pre-allocated input and output buffers via ibuf and obuf, and
64 | their size in bytes via ilen and olen. Buffers may not overlap.
65 |
66 | On success, the function returns a non-negative value and the argument
67 | olen contains the compressed size in bytes. On failure, a negative
68 | value is returned and olen is not modified.
69 | */
70 | int lzfx_compress(const void* ibuf, unsigned int ilen,
71 | void* obuf, unsigned int *olen);
72 |
73 | /* Buffer-to-buffer decompression.
74 |
75 | Supply pre-allocated input and output buffers via ibuf and obuf, and
76 | their size in bytes via ilen and olen. Buffers may not overlap.
77 |
78 | On success, the function returns a non-negative value and the argument
79 | olen contains the uncompressed size in bytes. On failure, a negative
80 | value is returned.
81 |
82 | If the failure code is LZFX_ESIZE, olen contains the minimum buffer size
83 | required to hold the decompressed data. Otherwise, olen is not modified.
84 |
85 | Supplying a zero *olen is a valid and supported strategy to determine the
86 | required buffer size. This does not require decompression of the entire
87 | stream and is consequently very fast. Argument obuf may be NULL in
88 | this case only.
89 | */
90 | int lzfx_decompress(const void* ibuf, unsigned int ilen,
91 | void* obuf, unsigned int *olen);
92 |
93 |
94 | #ifdef __cplusplus
95 | } /* extern "C" */
96 | #endif
97 |
98 | #endif
99 |
--------------------------------------------------------------------------------
/firmware/Reload Pro.cydsn/main.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include "tasks.h"
6 | #include "config.h"
7 | #include "splashscreen.h"
8 |
9 | state_t state;
10 | xTaskHandle adc_task;
11 | xTaskHandle comms_task;
12 | xTaskHandle ui_task;
13 |
14 | const settings_t default_settings = {
15 | .settings_version = 0x04,
16 | .lcd_contrast = 26,
17 | .display_settings = {
18 | .named = {
19 | .cc = {
20 | .readouts = {READOUT_CURRENT_SETPOINT, READOUT_CURRENT_USAGE, READOUT_VOLTAGE},
21 | },
22 | },
23 | },
24 | .calibration_settings = {
25 | .dac_low_gain = DEFAULT_DAC_LOW_GAIN,
26 | .dac_high_gain = DEFAULT_DAC_HIGH_GAIN,
27 | .dac_offset = DEFAULT_DAC_OFFSET,
28 | .opamp_offset_trim = DEFAULT_OPAMP_OFFSET_TRIM,
29 |
30 | .adc_current_offset = DEFAULT_ADC_CURRENT_OFFSET,
31 | .adc_current_gain = DEFAULT_ADC_CURRENT_GAIN,
32 |
33 | .adc_voltage_offset = DEFAULT_ADC_VOLTAGE_OFFSET,
34 | .adc_voltage_gain = DEFAULT_ADC_VOLTAGE_GAIN,
35 |
36 | .voltage_correction_ratio = DEFAULT_VOLTAGE_CORRECTION_RATIO,
37 | },
38 | };
39 |
40 | void factory_reset() {
41 | EEPROM_Write((const uint8*)&default_settings, (const uint8*)settings, sizeof(settings_t));
42 | }
43 |
44 | #ifdef Bootloadable_START_BTLDR
45 | const settings_t *settings = (settings_t*)0x00000B80;
46 | #else
47 | static const settings_t settings_data = {.settings_version = 0};
48 | const settings_t *settings = &settings_data;
49 | #endif
50 |
51 | void prvHardwareSetup();
52 |
53 | void main()
54 | {
55 | CyGlobalIntEnable;
56 |
57 | #if USE_WATCHDOG
58 | // Enable watchdog timer for every 2 seconds
59 | CySysWdtWriteMode(0, CY_SYS_WDT_MODE_RESET);
60 | CySysWdtWriteMatch(0, 0xFFFF);
61 | CySysWdtEnable(CY_SYS_WDT_COUNTER0_MASK);
62 | #endif
63 |
64 | if(settings->settings_version < default_settings.settings_version)
65 | factory_reset();
66 | Backlight_Write(1);
67 | disp_reset_Write(0);
68 | CyDelayUs(10);
69 | disp_reset_Write(1);
70 | CyDelayUs(10);
71 | Display_Start();
72 | Display_SetContrast(settings->lcd_contrast);
73 |
74 | #ifdef USE_SPLASHSCREEN
75 | load_splashscreen();
76 | #endif
77 |
78 | IDAC_High_Start();
79 | IDAC_Low_Start();
80 | state.calibrating = 0;
81 | set_current(0);
82 | set_output_mode(OUTPUT_MODE_FEEDBACK);
83 | start_adc();
84 | setup();
85 | //Create the two tasks
86 | xTaskCreate(vTaskUI, (signed portCHAR *) "UI", 178, NULL, tskIDLE_PRIORITY + 2, &ui_task);
87 | xTaskCreate(vTaskComms, (signed portCHAR *) "UART", 180, NULL, tskIDLE_PRIORITY + 2, &comms_task);
88 |
89 | prvHardwareSetup();
90 | vTaskStartScheduler();
91 | }
92 |
93 | /* ---------------------------------------------------------------------------
94 | * FreeRTOS support and configuration functions
95 | * --------------------------------------------------------------------------- */
96 |
97 | void prvHardwareSetup( void )
98 | {
99 | /* Port layer functions that need to be copied into the vector table. */
100 | extern void xPortPendSVHandler( void );
101 | extern void xPortSysTickHandler( void );
102 | extern void vPortSVCHandler( void );
103 | extern cyisraddress CyRamVectors[];
104 |
105 | /* Install the OS Interrupt Handlers. */
106 | CyRamVectors[ 11 ] = ( cyisraddress ) vPortSVCHandler;
107 | CyRamVectors[ 14 ] = ( cyisraddress ) xPortPendSVHandler;
108 | CyRamVectors[ 15 ] = ( cyisraddress ) xPortSysTickHandler;
109 | }
110 |
111 | void vApplicationStackOverflowHook( xTaskHandle pxTask, signed char *pcTaskName )
112 | {
113 | /* The stack space has been execeeded for a task, considering allocating more. */
114 | taskDISABLE_INTERRUPTS();
115 | for( ;; ) {
116 | Backlight_Write(0);
117 | CyDelay(500);
118 | Backlight_Write(1);
119 | CyDelay(500);
120 | }
121 | }
122 |
123 | void vApplicationMallocFailedHook( void )
124 | {
125 | /* The heap space has been execeeded. */
126 | taskDISABLE_INTERRUPTS();
127 | for( ;; ){
128 | Backlight_Write(0);
129 | CyDelay(2000);
130 | Backlight_Write(1);
131 | CyDelay(2000);
132 | }
133 | }
134 |
135 | /* [] END OF FILE */
136 |
--------------------------------------------------------------------------------
/firmware/Reload Pro.cydsn/freertos/include/projdefs.h:
--------------------------------------------------------------------------------
1 | /*
2 | FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
3 | All rights reserved
4 |
5 | VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
6 |
7 | ***************************************************************************
8 | * *
9 | * FreeRTOS provides completely free yet professionally developed, *
10 | * robust, strictly quality controlled, supported, and cross *
11 | * platform software that has become a de facto standard. *
12 | * *
13 | * Help yourself get started quickly and support the FreeRTOS *
14 | * project by purchasing a FreeRTOS tutorial book, reference *
15 | * manual, or both from: http://www.FreeRTOS.org/Documentation *
16 | * *
17 | * Thank you! *
18 | * *
19 | ***************************************************************************
20 |
21 | This file is part of the FreeRTOS distribution.
22 |
23 | FreeRTOS is free software; you can redistribute it and/or modify it under
24 | the terms of the GNU General Public License (version 2) as published by the
25 | Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
26 |
27 | >>! NOTE: The modification to the GPL is included to allow you to distribute
28 | >>! a combined work that includes FreeRTOS without being obliged to provide
29 | >>! the source code for proprietary components outside of the FreeRTOS
30 | >>! kernel.
31 |
32 | FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
33 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
34 | FOR A PARTICULAR PURPOSE. Full license text is available from the following
35 | link: http://www.freertos.org/a00114.html
36 |
37 | 1 tab == 4 spaces!
38 |
39 | ***************************************************************************
40 | * *
41 | * Having a problem? Start by reading the FAQ "My application does *
42 | * not run, what could be wrong?" *
43 | * *
44 | * http://www.FreeRTOS.org/FAQHelp.html *
45 | * *
46 | ***************************************************************************
47 |
48 | http://www.FreeRTOS.org - Documentation, books, training, latest versions,
49 | license and Real Time Engineers Ltd. contact details.
50 |
51 | http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
52 | including FreeRTOS+Trace - an indispensable productivity tool, a DOS
53 | compatible FAT file system, and our tiny thread aware UDP/IP stack.
54 |
55 | http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
56 | Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
57 | licenses offer ticketed support, indemnification and middleware.
58 |
59 | http://www.SafeRTOS.com - High Integrity Systems also provide a safety
60 | engineered and independently SIL3 certified version for use in safety and
61 | mission critical applications that require provable dependability.
62 |
63 | 1 tab == 4 spaces!
64 | */
65 |
66 | #ifndef PROJDEFS_H
67 | #define PROJDEFS_H
68 |
69 | /* Defines the prototype to which task functions must conform. */
70 | typedef void (*pdTASK_CODE)( void * );
71 |
72 | #define pdFALSE ( ( portBASE_TYPE ) 0 )
73 | #define pdTRUE ( ( portBASE_TYPE ) 1 )
74 |
75 | #define pdPASS ( pdTRUE )
76 | #define pdFAIL ( pdFALSE )
77 | #define errQUEUE_EMPTY ( ( portBASE_TYPE ) 0 )
78 | #define errQUEUE_FULL ( ( portBASE_TYPE ) 0 )
79 |
80 | /* Error definitions. */
81 | #define errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY ( -1 )
82 | #define errNO_TASK_TO_RUN ( -2 )
83 | #define errQUEUE_BLOCKED ( -4 )
84 | #define errQUEUE_YIELD ( -5 )
85 |
86 | #endif /* PROJDEFS_H */
87 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/pcb/reloadpro.frontpaste.gtp:
--------------------------------------------------------------------------------
1 | G04 DipTrace 2.3.1.0*
2 | %INreloadpro.frontpaste.gtp*%
3 | %MOIN*%
4 | %ADD32R,0.0709X0.0157*%
5 | %ADD55R,0.0394X0.0394*%
6 | %ADD74R,0.0138X0.0295*%
7 | %ADD76R,0.0354X0.0157*%
8 | %ADD78R,0.0551X0.0512*%
9 | %ADD89R,0.0709X0.1102*%
10 | %ADD91R,0.0039X0.0413*%
11 | %ADD93R,0.063X0.1181*%
12 | %ADD95R,0.0335X0.0177*%
13 | %ADD99R,0.0177X0.0335*%
14 | %ADD101R,0.3071X0.0787*%
15 | %ADD108R,0.063X0.0079*%
16 | %ADD109R,0.0157X0.0157*%
17 | %ADD111R,0.0354X0.0315*%
18 | %ADD113R,0.0315X0.0354*%
19 | %FSLAX44Y44*%
20 | G04*
21 | G70*
22 | G90*
23 | G75*
24 | G01*
25 | %LNTopPaste*%
26 | %LPD*%
27 | D113*
28 | X7437Y17437D3*
29 | Y18106D3*
30 | X6687Y17437D3*
31 | Y18106D3*
32 | D111*
33 | X6812Y23187D3*
34 | X7481D3*
35 | X6812Y22437D3*
36 | X7481D3*
37 | X6812Y21687D3*
38 | X7481D3*
39 | D113*
40 | X10562Y16062D3*
41 | Y15393D3*
42 | D111*
43 | X9449Y14173D3*
44 | X10118D3*
45 | X14107Y18687D3*
46 | X13437D3*
47 | X19437Y24437D3*
48 | X20106D3*
49 | X19437Y23687D3*
50 | X20106D3*
51 | X19437Y22937D3*
52 | X20106D3*
53 | X19437Y22187D3*
54 | X20106D3*
55 | X14187Y14187D3*
56 | X13518D3*
57 | X22062Y24437D3*
58 | X21393D3*
59 | D113*
60 | X18902Y12850D3*
61 | Y13519D3*
62 | X19652Y12850D3*
63 | Y13519D3*
64 | X20402Y12850D3*
65 | Y13519D3*
66 | X21152Y12850D3*
67 | Y13519D3*
68 | X21902Y12850D3*
69 | Y13519D3*
70 | X22652Y12850D3*
71 | Y13519D3*
72 | X23402Y12850D3*
73 | Y13519D3*
74 | D109*
75 | X14187Y19687D3*
76 | X13321D3*
77 | D108*
78 | X5963Y20937D3*
79 | Y20681D3*
80 | Y20425D3*
81 | Y20169D3*
82 | Y19913D3*
83 | Y19657D3*
84 | Y19402D3*
85 | Y19146D3*
86 | X8246D3*
87 | Y19402D3*
88 | Y19657D3*
89 | Y19913D3*
90 | Y20169D3*
91 | Y20425D3*
92 | Y20681D3*
93 | Y20937D3*
94 | D32*
95 | X10687Y22187D3*
96 | Y21687D3*
97 | Y21187D3*
98 | Y20687D3*
99 | X12813D3*
100 | Y21187D3*
101 | Y21687D3*
102 | Y22187D3*
103 | D101*
104 | X13815Y15315D3*
105 | Y17559D3*
106 | D111*
107 | X24772Y29977D3*
108 | X24102D3*
109 | X24772Y28227D3*
110 | X24102D3*
111 | D99*
112 | X9843Y16142D3*
113 | X9094D3*
114 | X9469Y15236D3*
115 | D95*
116 | X26127Y15025D3*
117 | Y14277D3*
118 | X27033Y14651D3*
119 | D113*
120 | X5937Y17437D3*
121 | Y18106D3*
122 | X8187Y17437D3*
123 | Y18106D3*
124 | D111*
125 | X9843Y17717D3*
126 | X9173D3*
127 | X9843Y16929D3*
128 | X9173D3*
129 | D93*
130 | X37914Y18914D3*
131 | X35710D3*
132 | D111*
133 | X24772Y24022D3*
134 | X24102D3*
135 | Y26522D3*
136 | X24772D3*
137 | Y25772D3*
138 | X24102D3*
139 | D113*
140 | X27687Y14609D3*
141 | Y13940D3*
142 | D111*
143 | X24102Y22397D3*
144 | X24772D3*
145 | D108*
146 | X22187Y25187D3*
147 | Y25443D3*
148 | Y25699D3*
149 | Y25955D3*
150 | Y26211D3*
151 | Y26467D3*
152 | Y26722D3*
153 | Y26978D3*
154 | Y27234D3*
155 | Y27490D3*
156 | Y27746D3*
157 | Y28002D3*
158 | Y28258D3*
159 | Y28514D3*
160 | X19352D3*
161 | Y28258D3*
162 | Y28002D3*
163 | Y27746D3*
164 | Y27490D3*
165 | Y27234D3*
166 | Y26978D3*
167 | Y26722D3*
168 | Y26467D3*
169 | Y26211D3*
170 | Y25955D3*
171 | Y25699D3*
172 | Y25443D3*
173 | Y25187D3*
174 | D91*
175 | X26852Y10225D3*
176 | X26656D3*
177 | X26459D3*
178 | X26262D3*
179 | X26065D3*
180 | X25868D3*
181 | X25671D3*
182 | X25474D3*
183 | X25278D3*
184 | X25081D3*
185 | X24884D3*
186 | X24687D3*
187 | X24490D3*
188 | X24293D3*
189 | X24096D3*
190 | X23900D3*
191 | X23703D3*
192 | X23506D3*
193 | X23309D3*
194 | X23112D3*
195 | X22915D3*
196 | X22719D3*
197 | X22522D3*
198 | X22325D3*
199 | X22128D3*
200 | X21931D3*
201 | X21734D3*
202 | X21537D3*
203 | X21341D3*
204 | X21144D3*
205 | D89*
206 | X27459Y9309D3*
207 | X20537D3*
208 | D55*
209 | X27852Y13225D3*
210 | D78*
211 | X27459Y11957D3*
212 | D55*
213 | X27065Y13224D3*
214 | D111*
215 | X24772Y23147D3*
216 | X24103D3*
217 | D113*
218 | X25462Y14315D3*
219 | Y14984D3*
220 | D55*
221 | X24062Y24937D3*
222 | X25164D3*
223 | D111*
224 | X24772Y27352D3*
225 | X24102D3*
226 | X24772Y29102D3*
227 | X24102D3*
228 | X25687Y27312D3*
229 | X26356D3*
230 | D76*
231 | X25719Y12813D3*
232 | Y13187D3*
233 | Y13561D3*
234 | X24656D3*
235 | Y12813D3*
236 | D113*
237 | X26312Y13522D3*
238 | Y12853D3*
239 | X24062Y12852D3*
240 | Y13521D3*
241 | D74*
242 | X23812Y11437D3*
243 | X24127D3*
244 | X24442D3*
245 | X24757D3*
246 | Y12146D3*
247 | X24442D3*
248 | X24127D3*
249 | X23812D3*
250 | D55*
251 | X24187Y21687D3*
252 | X25289D3*
253 | D111*
254 | X24102Y20897D3*
255 | X24772D3*
256 | M02*
257 |
--------------------------------------------------------------------------------
/firmware/ComponentUpdateLog.txt:
--------------------------------------------------------------------------------
1 | Last Modified Date & Time: 01/16/2015 21:40:59
2 |
3 | Project : Reload Pro
4 | Schematic : TopDesign
5 |
6 | idac_low_out v 2.0tv 2.5
7 | idac_hi_out v 2.0tv 2.5
8 | opamp_pos v 2.0tv 2.5
9 | Opamp_Out v 2.0tv 2.5
10 | opamp_neg v 2.0tv 2.5
11 | Voltage_Sense v 2.0tv 2.5
12 | Current_Sense v 2.0tv 2.5
13 | disp_ss v 2.0tv 2.5
14 | disp_mosi v 2.0tv 2.5
15 | disp_sclk v 2.0tv 2.5
16 | Quadrature v 2.0tv 2.5
17 | disp_reset v 2.0tv 2.5
18 | QuadButton v 2.0tv 2.5
19 | Gate_Sense_Low v 2.0tv 2.5
20 | opamp_pos_sense v 2.0tv 2.5
21 | Backlight v 2.0tv 2.5
22 |
23 | Project : Bootloader
24 | Schematic : TopDesign
25 |
26 | Button v 2.0tv 2.5
27 | Backlight v 2.0tv 2.5
28 |
29 | Project : Reload Pro
30 | Design Wide APIs
31 |
32 | cy_boot v 4.10 v 4.11
33 |
34 | Project : Bootloader
35 | Design Wide APIs
36 |
37 | cy_boot v 4.10 v 4.11
38 |
39 |
40 | Last Modified Date & Time: 02/12/2015 21:26:07
41 |
42 | Reload Pro: TopDesign
43 | idac_low_out [v2.5] to [v2.10]
44 | idac_hi_out [v2.5] to [v2.10]
45 | opamp_pos [v2.5] to [v2.10]
46 | Opamp_Out [v2.5] to [v2.10]
47 | opamp_neg [v2.5] to [v2.10]
48 | Voltage_Sense [v2.5] to [v2.10]
49 | Current_Sense [v2.5] to [v2.10]
50 | disp_ss [v2.5] to [v2.10]
51 | disp_mosi [v2.5] to [v2.10]
52 | disp_sclk [v2.5] to [v2.10]
53 | Quadrature [v2.5] to [v2.10]
54 | disp_reset [v2.5] to [v2.10]
55 | QuadButton [v2.5] to [v2.10]
56 | Gate_Sense_Low [v2.5] to [v2.10]
57 | opamp_pos_sense [v2.5] to [v2.10]
58 | Backlight [v2.5] to [v2.10]
59 | Opamp [v1.0] to [v1.10]
60 | ADC [v1.10] to [v2.0]
61 | UART [v1.20] to [v2.0]
62 | Bootloadable [v1.20] to [v1.30]
63 |
64 | Bootloader: TopDesign
65 | Bootloader [v1.20] to [v1.30]
66 | UART [v1.20] to [v2.0]
67 | Button [v2.5] to [v2.10]
68 | Backlight [v2.5] to [v2.10]
69 |
70 | Reload Pro: Design Wide APIs
71 | cy_boot [v4.11] to [v4.20]
72 |
73 | Bootloader: Design Wide APIs
74 | cy_boot [v4.11] to [v4.20]
75 |
76 |
77 | Last Modified Date & Time: 02/13/2015 10:39:02
78 |
79 | Reload Pro: TopDesign
80 | idac_low_out [v2.0] to [v2.10]
81 | idac_hi_out [v2.0] to [v2.10]
82 | opamp_pos [v2.0] to [v2.10]
83 | Opamp_Out [v2.0] to [v2.10]
84 | opamp_neg [v2.0] to [v2.10]
85 | Voltage_Sense [v2.0] to [v2.10]
86 | Current_Sense [v2.0] to [v2.10]
87 | disp_ss [v2.0] to [v2.10]
88 | disp_mosi [v2.0] to [v2.10]
89 | disp_sclk [v2.0] to [v2.10]
90 | Quadrature [v2.0] to [v2.10]
91 | disp_reset [v2.0] to [v2.10]
92 | QuadButton [v2.0] to [v2.10]
93 | Gate_Sense_Low [v2.0] to [v2.10]
94 | opamp_pos_sense [v2.0] to [v2.10]
95 | Backlight [v2.0] to [v2.10]
96 | Opamp [v1.0] to [v1.10]
97 | ADC [v1.10] to [v2.0]
98 | UART [v1.20] to [v2.0]
99 | Bootloadable [v1.20] to [v1.30]
100 |
101 | Bootloader: TopDesign
102 | Bootloader [v1.20] to [v1.30]
103 | UART [v1.20] to [v2.0]
104 | Button [v2.0] to [v2.10]
105 | Backlight [v2.0] to [v2.10]
106 |
107 | Reload Pro: Design Wide APIs
108 | cy_boot [v4.10] to [v4.20]
109 |
110 | Bootloader: Design Wide APIs
111 | cy_boot [v4.10] to [v4.20]
112 |
113 |
114 | Last Modified Date & Time: 02/14/2015 09:35:51
115 |
116 | Reload Pro: TopDesign
117 | idac_low_out [v2.5] to [v2.10]
118 | idac_hi_out [v2.5] to [v2.10]
119 | opamp_pos [v2.5] to [v2.10]
120 | Opamp_Out [v2.5] to [v2.10]
121 | opamp_neg [v2.5] to [v2.10]
122 | Voltage_Sense [v2.5] to [v2.10]
123 | Current_Sense [v2.5] to [v2.10]
124 | disp_ss [v2.5] to [v2.10]
125 | disp_mosi [v2.5] to [v2.10]
126 | disp_sclk [v2.5] to [v2.10]
127 | Quadrature [v2.5] to [v2.10]
128 | disp_reset [v2.5] to [v2.10]
129 | QuadButton [v2.5] to [v2.10]
130 | Gate_Sense_Low [v2.5] to [v2.10]
131 | opamp_pos_sense [v2.5] to [v2.10]
132 | Backlight [v2.5] to [v2.10]
133 | Opamp [v1.0] to [v1.10]
134 | ADC [v1.10] to [v2.0]
135 | UART [v1.20] to [v2.0]
136 | Bootloadable [v1.20] to [v1.30]
137 |
138 | Bootloader: TopDesign
139 | Bootloader [v1.20] to [v1.30]
140 | UART [v1.20] to [v2.0]
141 | Button [v2.5] to [v2.10]
142 | Backlight [v2.5] to [v2.10]
143 |
144 | Reload Pro: Design Wide APIs
145 | cy_boot [v4.11] to [v4.20]
146 |
147 | Bootloader: Design Wide APIs
148 | cy_boot [v4.11] to [v4.20]
149 |
150 |
151 | Last Modified Date & Time: 06/25/2015 19:42:30
152 |
153 | Reload Pro: TopDesign
154 | ADC [v2.0] to [v2.10]
155 |
156 | Parts: ST7528
157 | SPI [v2.40] to [v2.50]
158 | SS_Reg [v1.70] to [v1.80]
159 |
160 |
161 | Last Modified Date & Time: 06/25/2015 20:03:26
162 |
163 | Reload Pro: TopDesign
164 | ADC [v2.0] to [v2.10]
165 |
166 | Parts: ST7528
167 | SPI [v2.40] to [v2.50]
168 | SS_Reg [v1.70] to [v1.80]
169 |
170 |
171 |
--------------------------------------------------------------------------------
/firmware/Reload Pro.cydsn/config.h:
--------------------------------------------------------------------------------
1 | /* ========================================
2 | *
3 | * Copyright YOUR COMPANY, THE YEAR
4 | * All Rights Reserved
5 | * UNPUBLISHED, LICENSED SOFTWARE.
6 | *
7 | * CONFIDENTIAL AND PROPRIETARY INFORMATION
8 | * WHICH IS THE PROPERTY OF your company.
9 | *
10 | * ========================================
11 | */
12 |
13 | #include
14 |
15 | #ifndef CONFIG_H
16 | #define CONFIG_H
17 |
18 | typedef enum {
19 | ADC_CHAN_CURRENT_SENSE = 0,
20 | ADC_CHAN_VOLTAGE_SENSE = 1,
21 | ADC_CHAN_OPAMP_OUT = 2,
22 | ADC_CHAN_FET_IN = 3,
23 | ADC_CHAN_TEMP = 4,
24 | ADC_CHAN_CURRENT_SET = 5,
25 | } adc_channel;
26 |
27 | #define UI_TASK_FREQUENCY 2 // hz
28 |
29 | #define USE_WATCHDOG 0
30 |
31 | // How much does one encoder detent adjust the current?
32 | #define CURRENT_STEP 10000 // 10mA
33 | #define ENCODER_ACCEL_CONSTANT 400 // Defines the encoder acceleration speed; if steps are closer than 400ms, increase the rate of change
34 |
35 | // Current induces voltage drop in the wires.
36 | // This correction factor offsets that to get the correct voltage across the terminals.
37 | // Expressed in 1024ths
38 | #define DEFAULT_VOLTAGE_CORRECTION_RATIO 40 // 51/1024 = ~0.05 ohms
39 |
40 | // What's the maximum current?
41 | #define CURRENT_MAX 6000000 // 6A
42 | #define VOLTAGE_MAX 60000000 // 60 volts
43 |
44 | #define DEFAULT_DAC_HIGH_GAIN 21157//23718 // 1.2uA over 996 ohms, 0.05 ohm shunt = 23.718 milliamps per count
45 | #define DEFAULT_DAC_LOW_GAIN 186 // 1.2uA over 996 ohms, 0.05 ohm shunt = 0.186 milliamps per count
46 | #define DEFAULT_OPAMP_OFFSET_TRIM 0x24
47 | #define DEFAULT_DAC_OFFSET 0
48 | #define DEFAULT_ADC_CURRENT_OFFSET 0
49 | #define DEFAULT_ADC_CURRENT_GAIN 599 // 1.024 volts / (1 microamp * 0.05 ohms) / 2048 / 16 = 625 microamps per count
50 | #define DEFAULT_ADC_VOLTAGE_OFFSET 0
51 | #define DEFAULT_ADC_VOLTAGE_GAIN 2008 // 1.024 volts / (1 microvolt * (5.23 kiloohms / 205.23 kiloohms)) / 2048 / 16 = 1226 microvolts per count
52 |
53 | #define ADC_MIX_RATIO 4 // 1 / 2^4 = 6.25%
54 |
55 | #define DAC_EC_FEEDBACK
56 | #define DAC_EC_MIX_RATIO 2
57 | #define MAX_DAC_EC 100000
58 |
59 | extern uint8 adc_mix_ratio;
60 |
61 | #ifndef DEBUG
62 | // No splashscreen in debug builds
63 | #define USE_SPLASHSCREEN 1
64 | #endif
65 |
66 | typedef struct {
67 | int current_setpoint;
68 | int lower_voltage_limit;
69 | uint8_t calibrating;
70 | } state_t;
71 |
72 | extern state_t state;
73 |
74 | typedef enum {
75 | READOUT_NONE = 0,
76 | READOUT_CURRENT_SETPOINT = 1,
77 | READOUT_CURRENT_USAGE = 2,
78 | READOUT_VOLTAGE = 3,
79 | READOUT_POWER = 4,
80 | READOUT_RESISTANCE = 5,
81 | READOUT_TOTAL_CURRENT = 6,
82 | READOUT_TOTAL_POWER = 7,
83 | } readout_function;
84 |
85 | // Configuration for one display readout
86 | typedef struct {
87 | const readout_function readouts[3];
88 | } display_config_t;
89 |
90 | // Configuration for all displays
91 | typedef union {
92 | struct {
93 | display_config_t cc;
94 | } named;
95 | display_config_t numbered[1];
96 | } display_settings_t;
97 |
98 | typedef struct {
99 | int dac_low_gain; // Microamps per DAC count
100 | int dac_high_gain; // Microamps per DAC count
101 | int dac_offset; // Microamps
102 | int opamp_offset_trim; // Offset trim value for opamp
103 |
104 | int adc_current_offset; // ADC current reading offset in counts
105 | int adc_current_gain; // Microamps per ADC count
106 |
107 | int adc_voltage_offset; // ADC voltage reading offset in counts
108 | int adc_voltage_gain; // Microvolts per ADC count
109 |
110 | int voltage_correction_ratio;
111 | } calibration_settings_t;
112 |
113 | typedef struct {
114 | uint8_t settings_version;
115 | int lcd_contrast; // 0-63
116 | display_settings_t display_settings;
117 | calibration_settings_t calibration_settings;
118 | } settings_t;
119 |
120 | extern const settings_t *settings;
121 | extern const settings_t default_settings;
122 |
123 | void set_current(int setpoint);
124 | int get_current_setpoint();
125 | int16 get_raw_current_usage();
126 | int get_current_usage();
127 | int16 get_raw_voltage();
128 | int get_voltage();
129 | int get_power();
130 | int get_microamp_hours();
131 | int get_microwatt_hours();
132 | int get_dac_offset_correction();
133 | void reset_running_totals();
134 | void factory_reset();
135 | uint8 get_minor_version();
136 | uint8 get_major_version();
137 |
138 | typedef enum {
139 | OUTPUT_MODE_OFF,
140 | OUTPUT_MODE_ON,
141 | OUTPUT_MODE_FEEDBACK,
142 | } output_mode;
143 |
144 | void set_output_mode(output_mode);
145 | output_mode get_output_mode();
146 |
147 | void setup();
148 |
149 | #endif
150 | /* [] END OF FILE */
151 |
--------------------------------------------------------------------------------
/firmware/Reload Pro.cydsn/FreeRTOSConfig.h:
--------------------------------------------------------------------------------
1 | /*
2 | FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
3 | All rights reserved
4 |
5 | VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
6 |
7 | ***************************************************************************
8 | * *
9 | * FreeRTOS provides completely free yet professionally developed, *
10 | * robust, strictly quality controlled, supported, and cross *
11 | * platform software that has become a de facto standard. *
12 | * *
13 | * Help yourself get started quickly and support the FreeRTOS *
14 | * project by purchasing a FreeRTOS tutorial book, reference *
15 | * manual, or both from: http://www.FreeRTOS.org/Documentation *
16 | * *
17 | * Thank you! *
18 | * *
19 | ***************************************************************************
20 |
21 | This file is part of the FreeRTOS distribution.
22 |
23 | FreeRTOS is free software; you can redistribute it and/or modify it under
24 | the terms of the GNU General Public License (version 2) as published by the
25 | Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
26 |
27 | >>! NOTE: The modification to the GPL is included to allow you to distribute
28 | >>! a combined work that includes FreeRTOS without being obliged to provide
29 | >>! the source code for proprietary components outside of the FreeRTOS
30 | >>! kernel.
31 |
32 | FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
33 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
34 | FOR A PARTICULAR PURPOSE. Full license text is available from the following
35 | link: http://www.freertos.org/a00114.html
36 |
37 | 1 tab == 4 spaces!
38 |
39 | ***************************************************************************
40 | * *
41 | * Having a problem? Start by reading the FAQ "My application does *
42 | * not run, what could be wrong?" *
43 | * *
44 | * http://www.FreeRTOS.org/FAQHelp.html *
45 | * *
46 | ***************************************************************************
47 |
48 | http://www.FreeRTOS.org - Documentation, books, training, latest versions,
49 | license and Real Time Engineers Ltd. contact details.
50 |
51 | http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
52 | including FreeRTOS+Trace - an indispensable productivity tool, a DOS
53 | compatible FAT file system, and our tiny thread aware UDP/IP stack.
54 |
55 | http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
56 | Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
57 | licenses offer ticketed support, indemnification and middleware.
58 |
59 | http://www.SafeRTOS.com - High Integrity Systems also provide a safety
60 | engineered and independently SIL3 certified version for use in safety and
61 | mission critical applications that require provable dependability.
62 |
63 | 1 tab == 4 spaces!
64 | */
65 |
66 | #ifndef FREERTOS_CONFIG_H
67 | #define FREERTOS_CONFIG_H
68 |
69 | /*-----------------------------------------------------------
70 | * Application specific definitions.
71 | *
72 | * These definitions should be adjusted for your particular hardware and
73 | * application requirements.
74 | *
75 | * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
76 | * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
77 | *----------------------------------------------------------*/
78 |
79 | #include
80 |
81 | #define configUSE_PREEMPTION 1
82 | #define configUSE_IDLE_HOOK 0
83 | #define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 4 )
84 | #define configUSE_TICK_HOOK 1
85 | #define configCPU_CLOCK_HZ ( ( unsigned long ) 24000000L )
86 | #define configTICK_RATE_HZ ( ( portTickType ) 100 )
87 | #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 50 )
88 | #define configTOTAL_HEAP_SIZE ( ( size_t ) ( 2176 ) )
89 | #define configMAX_TASK_NAME_LEN ( 8 )
90 | #define configUSE_TRACE_FACILITY 0
91 | #define configUSE_16_BIT_TICKS 0
92 | #define configIDLE_SHOULD_YIELD 0
93 | #define configUSE_CO_ROUTINES 0
94 | #define configUSE_MUTEXES 1
95 |
96 | #define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
97 |
98 | #define configUSE_COUNTING_SEMAPHORES 0
99 | #define configUSE_ALTERNATIVE_API 0
100 | #define configCHECK_FOR_STACK_OVERFLOW 2
101 | #define configUSE_RECURSIVE_MUTEXES 0
102 | #define configQUEUE_REGISTRY_SIZE 10
103 | #define configGENERATE_RUN_TIME_STATS 0
104 | #define configUSE_MALLOC_FAILED_HOOK 1
105 |
106 | /* Set the following definitions to 1 to include the API function, or zero
107 | to exclude the API function. */
108 |
109 | #define INCLUDE_vTaskPrioritySet 0
110 | #define INCLUDE_uxTaskPriorityGet 0
111 | #define INCLUDE_vTaskDelete 0
112 | #define INCLUDE_vTaskCleanUpResources 0
113 | #define INCLUDE_vTaskSuspend 1
114 | #define INCLUDE_vTaskDelayUntil 1
115 | #define INCLUDE_vTaskDelay 1
116 | #define INCLUDE_uxTaskGetStackHighWaterMark 1
117 |
118 | #define configPRIO_BITS __NVIC_PRIO_BITS /* 4 priority levels */
119 | #define MIN_PRIORITY ((1 << configPRIO_BITS) - 1)
120 |
121 | /* The lowest priority. */
122 | #define configKERNEL_INTERRUPT_PRIORITY ( MIN_PRIORITY << (8 - configPRIO_BITS) )
123 |
124 | /* Priority 2, or 128 as only the top two bits are implemented. */
125 | /* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
126 | See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
127 | #define configMAX_SYSCALL_INTERRUPT_PRIORITY ( 2 << (8 - configPRIO_BITS) )
128 |
129 | #endif /* FREERTOS_CONFIG_H */
130 |
--------------------------------------------------------------------------------
/firmware/Reload Pro.cydsn/freertos/include/portmacro.h:
--------------------------------------------------------------------------------
1 | /*
2 | FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
3 | All rights reserved
4 |
5 | VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
6 |
7 | ***************************************************************************
8 | * *
9 | * FreeRTOS provides completely free yet professionally developed, *
10 | * robust, strictly quality controlled, supported, and cross *
11 | * platform software that has become a de facto standard. *
12 | * *
13 | * Help yourself get started quickly and support the FreeRTOS *
14 | * project by purchasing a FreeRTOS tutorial book, reference *
15 | * manual, or both from: http://www.FreeRTOS.org/Documentation *
16 | * *
17 | * Thank you! *
18 | * *
19 | ***************************************************************************
20 |
21 | This file is part of the FreeRTOS distribution.
22 |
23 | FreeRTOS is free software; you can redistribute it and/or modify it under
24 | the terms of the GNU General Public License (version 2) as published by the
25 | Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
26 |
27 | >>! NOTE: The modification to the GPL is included to allow you to distribute
28 | >>! a combined work that includes FreeRTOS without being obliged to provide
29 | >>! the source code for proprietary components outside of the FreeRTOS
30 | >>! kernel.
31 |
32 | FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
33 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
34 | FOR A PARTICULAR PURPOSE. Full license text is available from the following
35 | link: http://www.freertos.org/a00114.html
36 |
37 | 1 tab == 4 spaces!
38 |
39 | ***************************************************************************
40 | * *
41 | * Having a problem? Start by reading the FAQ "My application does *
42 | * not run, what could be wrong?" *
43 | * *
44 | * http://www.FreeRTOS.org/FAQHelp.html *
45 | * *
46 | ***************************************************************************
47 |
48 | http://www.FreeRTOS.org - Documentation, books, training, latest versions,
49 | license and Real Time Engineers Ltd. contact details.
50 |
51 | http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
52 | including FreeRTOS+Trace - an indispensable productivity tool, a DOS
53 | compatible FAT file system, and our tiny thread aware UDP/IP stack.
54 |
55 | http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
56 | Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
57 | licenses offer ticketed support, indemnification and middleware.
58 |
59 | http://www.SafeRTOS.com - High Integrity Systems also provide a safety
60 | engineered and independently SIL3 certified version for use in safety and
61 | mission critical applications that require provable dependability.
62 |
63 | 1 tab == 4 spaces!
64 | */
65 |
66 |
67 | #ifndef PORTMACRO_H
68 | #define PORTMACRO_H
69 |
70 | #ifdef __cplusplus
71 | extern "C" {
72 | #endif
73 |
74 | /*-----------------------------------------------------------
75 | * Port specific definitions.
76 | *
77 | * The settings in this file configure FreeRTOS correctly for the
78 | * given hardware and compiler.
79 | *
80 | * These settings should not be altered.
81 | *-----------------------------------------------------------
82 | */
83 |
84 | /* Type definitions. */
85 | #define portCHAR char
86 | #define portFLOAT float
87 | #define portDOUBLE double
88 | #define portLONG long
89 | #define portSHORT short
90 | #define portSTACK_TYPE unsigned portLONG
91 | #define portBASE_TYPE long
92 |
93 | #if( configUSE_16_BIT_TICKS == 1 )
94 | typedef unsigned portSHORT portTickType;
95 | #define portMAX_DELAY ( portTickType ) 0xffff
96 | #else
97 | typedef unsigned portLONG portTickType;
98 | #define portMAX_DELAY ( portTickType ) 0xffffffff
99 | #endif
100 | /*-----------------------------------------------------------*/
101 |
102 | /* Architecture specifics. */
103 | #define portSTACK_GROWTH ( -1 )
104 | #define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
105 | #define portBYTE_ALIGNMENT 8
106 | /*-----------------------------------------------------------*/
107 |
108 |
109 | /* Scheduler utilities. */
110 | extern void vPortYield( void );
111 | #define portNVIC_INT_CTRL_REG ( * ( ( volatile unsigned long * ) 0xe000ed04 ) )
112 | #define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
113 | #define portYIELD() vPortYield()
114 | #define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT
115 | #define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
116 | /*-----------------------------------------------------------*/
117 |
118 |
119 | /* Critical section management. */
120 | extern void vPortEnterCritical( void );
121 | extern void vPortExitCritical( void );
122 | extern unsigned long ulSetInterruptMaskFromISR( void ) __attribute__((naked));
123 | extern void vClearInterruptMaskFromISR( unsigned long ulMask ) __attribute__((naked));
124 |
125 | #define portSET_INTERRUPT_MASK_FROM_ISR() ulSetInterruptMaskFromISR()
126 | #define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) vClearInterruptMaskFromISR( x )
127 | #define portDISABLE_INTERRUPTS() __asm volatile ( " cpsid i " )
128 | #define portENABLE_INTERRUPTS() __asm volatile ( " cpsie i " )
129 | #define portENTER_CRITICAL() vPortEnterCritical()
130 | #define portEXIT_CRITICAL() vPortExitCritical()
131 |
132 | /*-----------------------------------------------------------*/
133 |
134 | /* Task function macros as described on the FreeRTOS.org WEB site. */
135 | #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters )
136 | #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )
137 |
138 | #define portNOP()
139 |
140 | #ifdef __cplusplus
141 | }
142 | #endif
143 |
144 | #endif /* PORTMACRO_H */
145 |
146 |
--------------------------------------------------------------------------------
/firmware/Reload Pro.cydsn/adctask.c:
--------------------------------------------------------------------------------
1 | /* ========================================
2 | *
3 | * Copyright YOUR COMPANY, THE YEAR
4 | * All Rights Reserved
5 | * UNPUBLISHED, LICENSED SOFTWARE.
6 | *
7 | * CONFIDENTIAL AND PROPRIETARY INFORMATION
8 | * WHICH IS THE PROPERTY OF your company.
9 | *
10 | * ========================================
11 | */
12 | #include "project.h"
13 | #include
14 | #include
15 | #include
16 | #include "tasks.h"
17 | #include "config.h"
18 |
19 | static int total_voltage = 0;
20 | static int total_current = 0;
21 | static int total_microwatt_hours = 0;
22 | static int remainder_microwatt_ticks = 0;
23 | static int total_microamp_hours = 0;
24 | static int remainder_microamp_ticks = 0;
25 | static int dac_offset_correction = 0;
26 | static portTickType last_update = 0;
27 | static uint8 conversion_counter = 0;
28 |
29 | uint8 adc_mix_ratio = ADC_MIX_RATIO;
30 |
31 | #define TICK_RATE_HR (3600 * configTICK_RATE_HZ);
32 |
33 | CY_ISR(ADC_ISR_func) {
34 | uint32 isr_flags = ADC_SAR_INTR_MASKED_REG;
35 | if(isr_flags & ADC_EOS_MASK) {
36 | if(conversion_counter < 100) {
37 | // Regular ADC
38 | // Update IIR values for current and voltage
39 | total_current = total_current - (total_current >> adc_mix_ratio) + ADC_GetResult16(ADC_CHAN_CURRENT_SENSE);
40 | total_voltage = total_voltage - (total_voltage >> adc_mix_ratio) + ADC_GetResult16(ADC_CHAN_VOLTAGE_SENSE);
41 |
42 | #ifdef DAC_EC_FEEDBACK
43 | if(!state.calibrating) {
44 | int error = get_current_usage() - get_current_setpoint();
45 | dac_offset_correction += error >> DAC_EC_MIX_RATIO;
46 | if(dac_offset_correction > MAX_DAC_EC) {
47 | dac_offset_correction = MAX_DAC_EC;
48 | } else if(dac_offset_correction < -MAX_DAC_EC) {
49 | dac_offset_correction = -MAX_DAC_EC;
50 | }
51 | set_current(state.current_setpoint);
52 | }
53 | #endif
54 |
55 | // Update running totals of microamp-ticks and microwatt-ticks
56 | portTickType now = xTaskGetTickCount();
57 | if(now > last_update) {
58 | int current = get_current_usage();
59 | int voltage = get_voltage();
60 |
61 | remainder_microamp_ticks += current * (now - last_update);
62 | total_microamp_hours += remainder_microamp_ticks / TICK_RATE_HR;
63 | remainder_microamp_ticks %= TICK_RATE_HR;
64 |
65 | remainder_microwatt_ticks += (current / 1000) * (voltage / 1000) * (now - last_update);
66 | total_microwatt_hours += remainder_microwatt_ticks / TICK_RATE_HR;
67 | remainder_microwatt_ticks %= TICK_RATE_HR;
68 |
69 | last_update = now;
70 | }
71 |
72 | if(conversion_counter == 99) {
73 | // Switch to measuring FET current draw for overtemp; skip next conversion as inaccurate
74 | ADC_SetChanMask((1 << ADC_CHAN_OPAMP_OUT) | (1 << ADC_CHAN_FET_IN));
75 | ADC_SAR_CTRL_REG = (ADC_SAR_CTRL_REG & ~ADC_VREF_INTERNAL1024BYPASSED) | ADC_VREF_VDDA;
76 | }
77 | } else if(conversion_counter == 101) {
78 | if(get_output_mode() == OUTPUT_MODE_FEEDBACK) {
79 | // Undervolt detection.
80 | if(state.lower_voltage_limit != -1 && get_current_setpoint() > 0 && get_voltage() < state.lower_voltage_limit) {
81 | set_output_mode(OUTPUT_MODE_OFF);
82 | set_current(0);
83 | xQueueSendToBackFromISR(ui_queue, &((ui_event){
84 | .type=UI_EVENT_LIMIT,
85 | .int_arg=LIMIT_TYPE_UNDERVOLT,
86 | .when=xTaskGetTickCountFromISR()
87 | }), NULL);
88 | xQueueOverwriteFromISR(comms_queue, &((comms_event){
89 | .type=COMMS_EVENT_UNDERVOLT,
90 | }), NULL);
91 | } else {
92 | // Overtemp detection.
93 | int16 opamp_out = ADC_GetResult16(ADC_CHAN_OPAMP_OUT);
94 | int16 fet_in = ADC_GetResult16(ADC_CHAN_FET_IN);
95 | if(abs(opamp_out - fet_in) > 4) {
96 | set_output_mode(OUTPUT_MODE_OFF);
97 | set_current(0);
98 |
99 | xQueueSendToBackFromISR(ui_queue, &((ui_event){
100 | .type=UI_EVENT_LIMIT,
101 | .int_arg=LIMIT_TYPE_OVERTEMP,
102 | .when=xTaskGetTickCountFromISR()
103 | }), NULL);
104 | xQueueOverwriteFromISR(comms_queue, &((comms_event){
105 | .type=COMMS_EVENT_OVERTEMP,
106 | }), NULL);
107 | }
108 | }
109 | }
110 | ADC_SetChanMask((1 << ADC_CHAN_CURRENT_SENSE) | (1 << ADC_CHAN_VOLTAGE_SENSE) | (1 << ADC_CHAN_TEMP) | (1 << ADC_CHAN_CURRENT_SET));
111 | ADC_SAR_CTRL_REG = (ADC_SAR_CTRL_REG & ~ADC_VREF_VDDA) | ADC_VREF_INTERNAL1024BYPASSED;
112 | } else if(conversion_counter == 102) {
113 | // Switch back to regular measurement; discard reading as inaccurate
114 | conversion_counter = 0;
115 | }
116 | conversion_counter++;
117 | }
118 | ADC_SAR_INTR_REG = isr_flags;
119 | }
120 |
121 | void start_adc() {
122 | ADC_Start();
123 | //ADC_SAR_INTR_MASK_REG = ADC_EOS_MASK;
124 | ADC_IRQ_StartEx(ADC_ISR_func);
125 | ADC_StartConvert();
126 | }
127 |
128 | int16 get_raw_current_usage() {
129 | return total_current >> adc_mix_ratio;
130 | }
131 |
132 | int get_current_usage() {
133 | int ret = ((total_current >> adc_mix_ratio) - settings->calibration_settings.adc_current_offset) * settings->calibration_settings.adc_current_gain;
134 | return (ret < 0)?0:ret;
135 | }
136 |
137 | int16 get_raw_voltage() {
138 | return total_voltage >> adc_mix_ratio;
139 | }
140 |
141 | int get_voltage() {
142 | int ret = ((total_voltage >> adc_mix_ratio) - settings->calibration_settings.adc_voltage_offset) * settings->calibration_settings.adc_voltage_gain;
143 | ret += (get_current_usage() / 1024) * settings->calibration_settings.voltage_correction_ratio;
144 | return (ret < 0)?0:ret;
145 | }
146 |
147 | int get_microamp_hours() {
148 | return total_microamp_hours;
149 | }
150 |
151 | int get_microwatt_hours() {
152 | return total_microwatt_hours;
153 | }
154 |
155 | int get_dac_offset_correction() {
156 | return dac_offset_correction;
157 | }
158 |
159 | void reset_running_totals() {
160 | total_microamp_hours = 0;
161 | total_microwatt_hours = 0;
162 | }
163 |
164 | /* [] END OF FILE */
165 |
--------------------------------------------------------------------------------
/firmware/Reload Pro.cydsn/commands.h:
--------------------------------------------------------------------------------
1 | /* ANSI-C code produced by gperf version 3.0.4 */
2 | /* Command-line: gperf -m 100 tools/serial_keywords */
3 | /* Computed positions: -k'1' */
4 |
5 | #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
6 | && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
7 | && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
8 | && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
9 | && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
10 | && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
11 | && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
12 | && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
13 | && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
14 | && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
15 | && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
16 | && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
17 | && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
18 | && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
19 | && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
20 | && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
21 | && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
22 | && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
23 | && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
24 | && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
25 | && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
26 | && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
27 | && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
28 | /* The character set is not based on ISO-646. */
29 | #error "gperf generated tables don't work with this execution character set. Please report a bug to ."
30 | #endif
31 |
32 | #line 1 "tools/serial_keywords"
33 |
34 | typedef void (*command_func)(char *);
35 |
36 | typedef struct command_def {
37 | const char *name;
38 | command_func handler;
39 | } command_def;
40 |
41 | void command_mode(char*);
42 | void command_set(char *);
43 | void command_reset(char *);
44 | void command_read(char *);
45 | void command_monitor(char *);
46 | void command_debug(char *);
47 | void command_calibrate(char *);
48 | void command_bootloader(char *);
49 | void command_dump(char *);
50 | void command_version(char *);
51 | void command_uvlo(char *);
52 | void command_on(char *);
53 | void command_off(char *);
54 | void command_clear(char *);
55 |
56 | #line 25 "tools/serial_keywords"
57 | struct command_def;
58 | #include
59 |
60 | #define TOTAL_KEYWORDS 14
61 | #define MIN_WORD_LENGTH 2
62 | #define MAX_WORD_LENGTH 7
63 | #define MIN_HASH_VALUE 2
64 | #define MAX_HASH_VALUE 15
65 | /* maximum key range = 14, duplicates = 0 */
66 |
67 | #ifdef __GNUC__
68 | __inline
69 | #else
70 | #ifdef __cplusplus
71 | inline
72 | #endif
73 | #endif
74 | static unsigned int
75 | hash (register const char *str, register unsigned int len)
76 | {
77 | static const unsigned char asso_values[] =
78 | {
79 | 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
80 | 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
81 | 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
82 | 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
83 | 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
84 | 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
85 | 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
86 | 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
87 | 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
88 | 16, 16, 16, 16, 16, 16, 16, 16, 13, 7,
89 | 3, 16, 16, 16, 16, 16, 16, 16, 16, 2,
90 | 16, 0, 16, 16, 0, 11, 16, 9, 4, 16,
91 | 16, 16, 16, 16, 16, 16, 16, 16
92 | };
93 | return len + asso_values[(unsigned char)str[0]];
94 | }
95 |
96 | #ifdef __GNUC__
97 | __inline
98 | #if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
99 | __attribute__ ((__gnu_inline__))
100 | #endif
101 | #endif
102 | const struct command_def *
103 | in_word_set (register const char *str, register unsigned int len)
104 | {
105 | static const struct command_def wordlist[] =
106 | {
107 | #line 44 "tools/serial_keywords"
108 | {"on",command_on},
109 | #line 45 "tools/serial_keywords"
110 | {"off",command_off},
111 | #line 36 "tools/serial_keywords"
112 | {"read",command_read},
113 | #line 35 "tools/serial_keywords"
114 | {"reset",command_reset},
115 | #line 33 "tools/serial_keywords"
116 | {"mode",command_mode},
117 | #line 41 "tools/serial_keywords"
118 | {"dump",command_dump},
119 | #line 38 "tools/serial_keywords"
120 | {"debug",command_debug},
121 | #line 37 "tools/serial_keywords"
122 | {"monitor",command_monitor},
123 | #line 39 "tools/serial_keywords"
124 | {"cal",command_calibrate},
125 | #line 42 "tools/serial_keywords"
126 | {"version",command_version},
127 | #line 46 "tools/serial_keywords"
128 | {"clear",command_clear},
129 | #line 43 "tools/serial_keywords"
130 | {"uvlo",command_uvlo},
131 | #line 34 "tools/serial_keywords"
132 | {"set",command_set},
133 | #line 40 "tools/serial_keywords"
134 | {"bl",command_bootloader}
135 | };
136 |
137 | if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
138 | {
139 | register int key = hash (str, len);
140 |
141 | if (key <= MAX_HASH_VALUE && key >= MIN_HASH_VALUE)
142 | {
143 | register const struct command_def *resword;
144 |
145 | switch (key - 2)
146 | {
147 | case 0:
148 | resword = &wordlist[0];
149 | goto compare;
150 | case 1:
151 | resword = &wordlist[1];
152 | goto compare;
153 | case 2:
154 | resword = &wordlist[2];
155 | goto compare;
156 | case 3:
157 | resword = &wordlist[3];
158 | goto compare;
159 | case 4:
160 | resword = &wordlist[4];
161 | goto compare;
162 | case 5:
163 | resword = &wordlist[5];
164 | goto compare;
165 | case 6:
166 | resword = &wordlist[6];
167 | goto compare;
168 | case 7:
169 | resword = &wordlist[7];
170 | goto compare;
171 | case 8:
172 | resword = &wordlist[8];
173 | goto compare;
174 | case 9:
175 | resword = &wordlist[9];
176 | goto compare;
177 | case 10:
178 | resword = &wordlist[10];
179 | goto compare;
180 | case 11:
181 | resword = &wordlist[11];
182 | goto compare;
183 | case 12:
184 | resword = &wordlist[12];
185 | goto compare;
186 | case 13:
187 | resword = &wordlist[13];
188 | goto compare;
189 | }
190 | return 0;
191 | compare:
192 | {
193 | register const char *s = resword->name;
194 |
195 | if (*str == *s && !strcmp (str + 1, s + 1))
196 | return resword;
197 | }
198 | }
199 | }
200 | return 0;
201 | }
202 |
--------------------------------------------------------------------------------
/firmware/Reload Pro.cydsn/freertos/src/heap_1.c:
--------------------------------------------------------------------------------
1 | /*
2 | FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
3 | All rights reserved
4 |
5 | VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
6 |
7 | ***************************************************************************
8 | * *
9 | * FreeRTOS provides completely free yet professionally developed, *
10 | * robust, strictly quality controlled, supported, and cross *
11 | * platform software that has become a de facto standard. *
12 | * *
13 | * Help yourself get started quickly and support the FreeRTOS *
14 | * project by purchasing a FreeRTOS tutorial book, reference *
15 | * manual, or both from: http://www.FreeRTOS.org/Documentation *
16 | * *
17 | * Thank you! *
18 | * *
19 | ***************************************************************************
20 |
21 | This file is part of the FreeRTOS distribution.
22 |
23 | FreeRTOS is free software; you can redistribute it and/or modify it under
24 | the terms of the GNU General Public License (version 2) as published by the
25 | Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
26 |
27 | >>! NOTE: The modification to the GPL is included to allow you to distribute
28 | >>! a combined work that includes FreeRTOS without being obliged to provide
29 | >>! the source code for proprietary components outside of the FreeRTOS
30 | >>! kernel.
31 |
32 | FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
33 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
34 | FOR A PARTICULAR PURPOSE. Full license text is available from the following
35 | link: http://www.freertos.org/a00114.html
36 |
37 | 1 tab == 4 spaces!
38 |
39 | ***************************************************************************
40 | * *
41 | * Having a problem? Start by reading the FAQ "My application does *
42 | * not run, what could be wrong?" *
43 | * *
44 | * http://www.FreeRTOS.org/FAQHelp.html *
45 | * *
46 | ***************************************************************************
47 |
48 | http://www.FreeRTOS.org - Documentation, books, training, latest versions,
49 | license and Real Time Engineers Ltd. contact details.
50 |
51 | http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
52 | including FreeRTOS+Trace - an indispensable productivity tool, a DOS
53 | compatible FAT file system, and our tiny thread aware UDP/IP stack.
54 |
55 | http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
56 | Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
57 | licenses offer ticketed support, indemnification and middleware.
58 |
59 | http://www.SafeRTOS.com - High Integrity Systems also provide a safety
60 | engineered and independently SIL3 certified version for use in safety and
61 | mission critical applications that require provable dependability.
62 |
63 | 1 tab == 4 spaces!
64 | */
65 |
66 |
67 | /*
68 | * The simplest possible implementation of pvPortMalloc(). Note that this
69 | * implementation does NOT allow allocated memory to be freed again.
70 | *
71 | * See heap_2.c, heap_3.c and heap_4.c for alternative implementations, and the
72 | * memory management pages of http://www.FreeRTOS.org for more information.
73 | */
74 | #include
75 |
76 | /* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining
77 | all the API functions to use the MPU wrappers. That should only be done when
78 | task.h is included from an application file. */
79 | #define MPU_WRAPPERS_INCLUDED_FROM_API_FILE
80 |
81 | #include "FreeRTOS.h"
82 | #include "task.h"
83 |
84 | #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
85 |
86 | /* A few bytes might be lost to byte aligning the heap start address. */
87 | #define configADJUSTED_HEAP_SIZE ( configTOTAL_HEAP_SIZE - portBYTE_ALIGNMENT )
88 |
89 | /* Allocate the memory for the heap. */
90 | static unsigned char ucHeap[ configTOTAL_HEAP_SIZE ];
91 | static size_t xNextFreeByte = ( size_t ) 0;
92 |
93 | /*-----------------------------------------------------------*/
94 |
95 | void *pvPortMalloc( size_t xWantedSize )
96 | {
97 | void *pvReturn = NULL;
98 | static unsigned char *pucAlignedHeap = NULL;
99 |
100 | /* Ensure that blocks are always aligned to the required number of bytes. */
101 | #if portBYTE_ALIGNMENT != 1
102 | if( xWantedSize & portBYTE_ALIGNMENT_MASK )
103 | {
104 | /* Byte alignment required. */
105 | xWantedSize += ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) );
106 | }
107 | #endif
108 |
109 | vTaskSuspendAll();
110 | {
111 | if( pucAlignedHeap == NULL )
112 | {
113 | /* Ensure the heap starts on a correctly aligned boundary. */
114 | pucAlignedHeap = ( unsigned char * ) ( ( ( portPOINTER_SIZE_TYPE ) &ucHeap[ portBYTE_ALIGNMENT ] ) & ( ( portPOINTER_SIZE_TYPE ) ~portBYTE_ALIGNMENT_MASK ) );
115 | }
116 |
117 | /* Check there is enough room left for the allocation. */
118 | if( ( ( xNextFreeByte + xWantedSize ) < configADJUSTED_HEAP_SIZE ) &&
119 | ( ( xNextFreeByte + xWantedSize ) > xNextFreeByte ) )/* Check for overflow. */
120 | {
121 | /* Return the next free byte then increment the index past this
122 | block. */
123 | pvReturn = pucAlignedHeap + xNextFreeByte;
124 | xNextFreeByte += xWantedSize;
125 | }
126 |
127 | traceMALLOC( pvReturn, xWantedSize );
128 | }
129 | xTaskResumeAll();
130 |
131 | #if( configUSE_MALLOC_FAILED_HOOK == 1 )
132 | {
133 | if( pvReturn == NULL )
134 | {
135 | extern void vApplicationMallocFailedHook( void );
136 | vApplicationMallocFailedHook();
137 | }
138 | }
139 | #endif
140 |
141 | return pvReturn;
142 | }
143 | /*-----------------------------------------------------------*/
144 |
145 | void vPortFree( void *pv )
146 | {
147 | /* Memory cannot be freed using this scheme. See heap_2.c, heap_3.c and
148 | heap_4.c for alternative implementations, and the memory management pages of
149 | http://www.FreeRTOS.org for more information. */
150 | ( void ) pv;
151 |
152 | /* Force an assert as it is invalid to call this function. */
153 | configASSERT( pv == NULL );
154 | }
155 | /*-----------------------------------------------------------*/
156 |
157 | void vPortInitialiseBlocks( void )
158 | {
159 | /* Only required when static memory is not cleared. */
160 | xNextFreeByte = ( size_t ) 0;
161 | }
162 | /*-----------------------------------------------------------*/
163 |
164 | size_t xPortGetFreeHeapSize( void )
165 | {
166 | return ( configADJUSTED_HEAP_SIZE - xNextFreeByte );
167 | }
168 |
169 |
170 |
171 |
--------------------------------------------------------------------------------
/firmware/Parts.cylib/ST7528/API/ST7528.c:
--------------------------------------------------------------------------------
1 | /* ========================================
2 | *
3 | * Copyright YOUR COMPANY, THE YEAR
4 | * All Rights Reserved
5 | * UNPUBLISHED, LICENSED SOFTWARE.
6 | *
7 | * CONFIDENTIAL AND PROPRIETARY INFORMATION
8 | * WHICH IS THE PROPERTY OF your company.
9 | *
10 | * ========================================
11 | */
12 | #include "`$INSTANCE_NAME`.h"
13 | #include "`$INSTANCE_NAME`_font.h"
14 | #include "`$INSTANCE_NAME`_SPI.h"
15 | #include "`$INSTANCE_NAME`_SS_Reg.h"
16 | #include
17 | #include
18 |
19 | #define COMMAND_SET_MODE 0x38
20 | #define COMMAND_WRITE_DATA 0xE8
21 | #define COMMAND_SET_PAGE 0xB0
22 | #define COMMAND_SET_COLUMN_MSB 0x10
23 | #define COMMAND_SET_COLUMN_LSB 0x00
24 | #define COMMAND_DISPLAY_ON 0xAE
25 | #define COMMAND_POWER_CONTROL 0x28
26 | #define COMMAND_SELECT_STEPUP 0x64
27 | #define COMMAND_SELECT_REGULATOR 0x20
28 | #define COMMAND_SET_CONTRAST 0x81
29 | #define COMMAND_SET_BIAS 0x50
30 | #define COMMAND_OSCILLATOR_ON 0xAB
31 | #define COMMAND_SET_PARTIAL_DISPLAY 0x48
32 | #define COMMAND_SET_COM0 0x44
33 | #define COMMAND_SELECT_ADC_NORMAL 0xA0
34 | #define COMMAND_SET_COM_SCAN_DIR_REVERSE 0xC8
35 | #define COMMAND_EXT_SET_GRAY_LEVEL 0x80
36 |
37 | #define MODE_NORMAL 0x60
38 | #define MODE_EXT 0x65
39 |
40 | #define DEFAULT_STEPUP 0x2
41 | #define DEFAULT_LCD_BIAS 0x4
42 | #define DEFAULT_REGULATOR_RESISTOR 0x5
43 | #define DEFAULT_CONTRAST_LEVEL 0x20
44 | #define DEFAULT_COM0 0x12
45 |
46 | static void begin_transaction() {
47 | `$INSTANCE_NAME``[SS_Reg]`Write(0);
48 | }
49 |
50 | static void end_transaction() {
51 | `$INSTANCE_NAME``[SS_Reg]`Write(1);
52 | }
53 | static void send_commands(uint8 commands[], int len) {
54 | begin_transaction();
55 | `$INSTANCE_NAME``[SPI]`PutArray(commands, len);
56 | end_transaction();
57 | }
58 |
59 | static void configure_grays() {
60 | send_commands((uint8[]) {
61 | COMMAND_SET_MODE, MODE_EXT,
62 | }, 2);
63 | for(int i = 0; i < 64; i += 4) {
64 | uint8 gray = (i * 0x2D) / 60;
65 | send_commands((uint8[]) {
66 | COMMAND_EXT_SET_GRAY_LEVEL | i,
67 | gray,
68 | COMMAND_EXT_SET_GRAY_LEVEL | (i + 1),
69 | gray,
70 | COMMAND_EXT_SET_GRAY_LEVEL | (i + 2),
71 | gray,
72 | COMMAND_EXT_SET_GRAY_LEVEL | (i + 3),
73 | gray
74 | }, 8);
75 | }
76 | send_commands((uint8[]) {
77 | COMMAND_SET_MODE, MODE_NORMAL
78 | }, 2);
79 | }
80 |
81 | static bool display_configured = 0;
82 |
83 | void `$INSTANCE_NAME`_Setup() {
84 | send_commands((uint8[]) {
85 | COMMAND_SET_MODE, MODE_NORMAL, // 68Hz frequency, booster efficiency 2, standard commands
86 | COMMAND_OSCILLATOR_ON,
87 | COMMAND_SET_COM0, DEFAULT_COM0,
88 | COMMAND_SELECT_ADC_NORMAL,
89 | COMMAND_SET_COM_SCAN_DIR_REVERSE,
90 | COMMAND_SELECT_STEPUP | DEFAULT_STEPUP, // 5 x boost
91 | COMMAND_SET_BIAS | DEFAULT_LCD_BIAS, // 1/9 bias
92 | COMMAND_SET_PARTIAL_DISPLAY, 64, // Only use the first 64 lines
93 | COMMAND_SELECT_REGULATOR | DEFAULT_REGULATOR_RESISTOR,
94 | }, 14);
95 |
96 | if(!display_configured)
97 | send_commands((uint8[]) {
98 | COMMAND_POWER_CONTROL | 0xC, // VC on
99 | }, 1);
100 |
101 | `$INSTANCE_NAME`_SetContrast(DEFAULT_CONTRAST_LEVEL);
102 |
103 | configure_grays();
104 |
105 | if(!display_configured) {
106 | CyDelay(200);
107 | send_commands((uint8[]) {
108 | COMMAND_POWER_CONTROL | 0xE, // VC, VR on
109 | }, 1);
110 |
111 | CyDelay(200);
112 | send_commands((uint8[]) {
113 | COMMAND_POWER_CONTROL | 0xF, // VC, VR, VF on
114 | COMMAND_DISPLAY_ON | 1, // Display on
115 | }, 2);
116 | }
117 |
118 | display_configured = 1;
119 | }
120 |
121 | void `$INSTANCE_NAME`_Start() {
122 | `$INSTANCE_NAME``[SPI]`Start();
123 | `$INSTANCE_NAME`_Setup();
124 | }
125 |
126 | void write_pixels_begin(uint8 len) {
127 | begin_transaction();
128 | `$INSTANCE_NAME``[SPI]`PutArray((uint8[]){COMMAND_WRITE_DATA, len - 1}, 2);
129 | }
130 |
131 | void write_pixels_end() {
132 | end_transaction();
133 | }
134 |
135 | void `$INSTANCE_NAME`_WritePixels(uint8 data[], int len) {
136 | for(int i = 0; i < len; i += 255) {
137 | int write_size = len - i;
138 | if(write_size > 255)
139 | write_size = 255;
140 | write_pixels_begin((uint8)write_size);
141 | `$INSTANCE_NAME``[SPI]`PutArray(data + i, (uint8)write_size);
142 | write_pixels_end();
143 | }
144 | }
145 |
146 | void `$INSTANCE_NAME`_SetCursorPosition(uint8 page, uint8 col) {
147 | send_commands((uint8[]) {
148 | COMMAND_SET_PAGE | (page & 0xF),
149 | COMMAND_SET_COLUMN_MSB | ((col >> 4) & 0xF),
150 | COMMAND_SET_COLUMN_LSB | (col & 0xF)
151 | }, 3);
152 | }
153 |
154 | void `$INSTANCE_NAME`_SetContrast(uint8 contrast_level) {
155 | send_commands((uint8[]) {
156 | COMMAND_SET_CONTRAST, contrast_level & 0x3F
157 | }, 2);
158 | }
159 |
160 | static void draw_text_slice(char c, uint8 row, uint8 inverse) {
161 | write_pixels_begin(FONT_GLYPH_COLUMNS * 4);
162 | for(int8 i = 0; i < FONT_GLYPH_COLUMNS; i++) {
163 | char col = glyphs[c - FONT_GLYPH_OFFSET][row][i];
164 | if(inverse)
165 | col = ~col;
166 | uint8 pixels[4] = {col, col, col, col};
167 | `$INSTANCE_NAME``[SPI]`PutArray(pixels, 4);
168 | }
169 | write_pixels_end();
170 | }
171 |
172 | void `$INSTANCE_NAME`_Clear(uint8 start_row, uint8 start_col, uint8 end_row, uint8 end_col, uint8 value) {
173 | for(uint8 row = start_row; row < end_row; row++) {
174 | `$INSTANCE_NAME`_SetCursorPosition(row, start_col);
175 | for(uint8 col = start_col; col < end_col; col++) {
176 | `$INSTANCE_NAME`_WritePixels((uint8[]){value, value, value, value}, 4);
177 | }
178 | }
179 | }
180 |
181 | void `$INSTANCE_NAME`_ClearAll() {
182 | `$INSTANCE_NAME`_Clear(0, 0, 8, 160, 0);
183 | }
184 |
185 | void `$INSTANCE_NAME`_DrawText(uint8 start_page, uint8 start_col, const char *text, uint8 inverse) {
186 | for(uint8 row = 0; row < 2; row++) {
187 | `$INSTANCE_NAME`_SetCursorPosition(start_page + row, start_col);
188 | for(const char *c = text; *c != '\0'; c++) {
189 | draw_text_slice(*c, row, inverse);
190 | }
191 | }
192 | }
193 |
194 | void `$INSTANCE_NAME`_DrawBigNumbers(uint8 start_page, uint8 start_col, const char *nums) {
195 | // Big numbers are 3 glyphs tall
196 | for(uint8 vglyph = 0; vglyph < 3; vglyph++) {
197 | for(uint8 row = 0; row < 2; row++) {
198 | `$INSTANCE_NAME`_SetCursorPosition(start_page + vglyph * 2 + row, start_col);
199 | // Big numbers are 3 glyphs wide
200 | for(const char *c = nums; *c != '\0'; c++) {
201 | for(uint8 hglyph = 0; hglyph < 3; hglyph++) {
202 | if(*c >= '0' && *c <= '9') {
203 | // Determine glyph based on provided number, which glyph we're drawing vertically,
204 | // and which glyph we're drawing horizontally
205 | uint8 glyphnum = FONT_BIGDIGIT_OFFSET
206 | + (*c - '0') * 3
207 | + FONT_BIGDIGIT_ROW_WIDTH * vglyph
208 | + hglyph;
209 | draw_text_slice(glyphnum, row, 0);
210 | } else {
211 | hglyph = 2; // Other glyphs are only 1 glyph wide
212 | if(vglyph == 2) {
213 | draw_text_slice((*c == '.')?GLYPH_CHAR(FONT_GLYPH_BIGPERIOD):*c, row, 0);
214 | } else if(*c == '.') {
215 | draw_text_slice(' ', row, 0);
216 | }
217 | }
218 | }
219 | }
220 | }
221 | }
222 | }
223 |
224 | /* [] END OF FILE */
225 |
--------------------------------------------------------------------------------
/firmware/Reload Pro.cydsn/freertos/include/mpu_wrappers.h:
--------------------------------------------------------------------------------
1 | /*
2 | FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
3 | All rights reserved
4 |
5 | VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
6 |
7 | ***************************************************************************
8 | * *
9 | * FreeRTOS provides completely free yet professionally developed, *
10 | * robust, strictly quality controlled, supported, and cross *
11 | * platform software that has become a de facto standard. *
12 | * *
13 | * Help yourself get started quickly and support the FreeRTOS *
14 | * project by purchasing a FreeRTOS tutorial book, reference *
15 | * manual, or both from: http://www.FreeRTOS.org/Documentation *
16 | * *
17 | * Thank you! *
18 | * *
19 | ***************************************************************************
20 |
21 | This file is part of the FreeRTOS distribution.
22 |
23 | FreeRTOS is free software; you can redistribute it and/or modify it under
24 | the terms of the GNU General Public License (version 2) as published by the
25 | Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
26 |
27 | >>! NOTE: The modification to the GPL is included to allow you to distribute
28 | >>! a combined work that includes FreeRTOS without being obliged to provide
29 | >>! the source code for proprietary components outside of the FreeRTOS
30 | >>! kernel.
31 |
32 | FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
33 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
34 | FOR A PARTICULAR PURPOSE. Full license text is available from the following
35 | link: http://www.freertos.org/a00114.html
36 |
37 | 1 tab == 4 spaces!
38 |
39 | ***************************************************************************
40 | * *
41 | * Having a problem? Start by reading the FAQ "My application does *
42 | * not run, what could be wrong?" *
43 | * *
44 | * http://www.FreeRTOS.org/FAQHelp.html *
45 | * *
46 | ***************************************************************************
47 |
48 | http://www.FreeRTOS.org - Documentation, books, training, latest versions,
49 | license and Real Time Engineers Ltd. contact details.
50 |
51 | http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
52 | including FreeRTOS+Trace - an indispensable productivity tool, a DOS
53 | compatible FAT file system, and our tiny thread aware UDP/IP stack.
54 |
55 | http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
56 | Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
57 | licenses offer ticketed support, indemnification and middleware.
58 |
59 | http://www.SafeRTOS.com - High Integrity Systems also provide a safety
60 | engineered and independently SIL3 certified version for use in safety and
61 | mission critical applications that require provable dependability.
62 |
63 | 1 tab == 4 spaces!
64 | */
65 |
66 | #ifndef MPU_WRAPPERS_H
67 | #define MPU_WRAPPERS_H
68 |
69 | /* This file redefines API functions to be called through a wrapper macro, but
70 | only for ports that are using the MPU. */
71 | #ifdef portUSING_MPU_WRAPPERS
72 |
73 | /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE will be defined when this file is
74 | included from queue.c or task.c to prevent it from having an effect within
75 | those files. */
76 | #ifndef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
77 |
78 | #define xTaskGenericCreate MPU_xTaskGenericCreate
79 | #define vTaskAllocateMPURegions MPU_vTaskAllocateMPURegions
80 | #define vTaskDelete MPU_vTaskDelete
81 | #define vTaskDelayUntil MPU_vTaskDelayUntil
82 | #define vTaskDelay MPU_vTaskDelay
83 | #define uxTaskPriorityGet MPU_uxTaskPriorityGet
84 | #define vTaskPrioritySet MPU_vTaskPrioritySet
85 | #define eTaskGetState MPU_eTaskGetState
86 | #define vTaskSuspend MPU_vTaskSuspend
87 | #define xTaskIsTaskSuspended MPU_xTaskIsTaskSuspended
88 | #define vTaskResume MPU_vTaskResume
89 | #define vTaskSuspendAll MPU_vTaskSuspendAll
90 | #define xTaskResumeAll MPU_xTaskResumeAll
91 | #define xTaskGetTickCount MPU_xTaskGetTickCount
92 | #define uxTaskGetNumberOfTasks MPU_uxTaskGetNumberOfTasks
93 | #define vTaskList MPU_vTaskList
94 | #define vTaskGetRunTimeStats MPU_vTaskGetRunTimeStats
95 | #define vTaskSetApplicationTaskTag MPU_vTaskSetApplicationTaskTag
96 | #define xTaskGetApplicationTaskTag MPU_xTaskGetApplicationTaskTag
97 | #define xTaskCallApplicationTaskHook MPU_xTaskCallApplicationTaskHook
98 | #define uxTaskGetStackHighWaterMark MPU_uxTaskGetStackHighWaterMark
99 | #define xTaskGetCurrentTaskHandle MPU_xTaskGetCurrentTaskHandle
100 | #define xTaskGetSchedulerState MPU_xTaskGetSchedulerState
101 | #define xTaskGetIdleTaskHandle MPU_xTaskGetIdleTaskHandle
102 | #define uxTaskGetSystemState MPU_uxTaskGetSystemState
103 |
104 | #define xQueueGenericCreate MPU_xQueueGenericCreate
105 | #define xQueueCreateMutex MPU_xQueueCreateMutex
106 | #define xQueueGiveMutexRecursive MPU_xQueueGiveMutexRecursive
107 | #define xQueueTakeMutexRecursive MPU_xQueueTakeMutexRecursive
108 | #define xQueueCreateCountingSemaphore MPU_xQueueCreateCountingSemaphore
109 | #define xQueueGenericSend MPU_xQueueGenericSend
110 | #define xQueueAltGenericSend MPU_xQueueAltGenericSend
111 | #define xQueueAltGenericReceive MPU_xQueueAltGenericReceive
112 | #define xQueueGenericReceive MPU_xQueueGenericReceive
113 | #define uxQueueMessagesWaiting MPU_uxQueueMessagesWaiting
114 | #define vQueueDelete MPU_vQueueDelete
115 | #define xQueueGenericReset MPU_xQueueGenericReset
116 | #define xQueueCreateSet MPU_xQueueCreateSet
117 | #define xQueueSelectFromSet MPU_xQueueSelectFromSet
118 | #define xQueueAddToSet MPU_xQueueAddToSet
119 | #define xQueueRemoveFromSet MPU_xQueueRemoveFromSet
120 | #define xQueuePeekFromISR MPU_xQueuePeekFromISR
121 |
122 | #define pvPortMalloc MPU_pvPortMalloc
123 | #define vPortFree MPU_vPortFree
124 | #define xPortGetFreeHeapSize MPU_xPortGetFreeHeapSize
125 | #define vPortInitialiseBlocks MPU_vPortInitialiseBlocks
126 |
127 | #if configQUEUE_REGISTRY_SIZE > 0
128 | #define vQueueAddToRegistry MPU_vQueueAddToRegistry
129 | #define vQueueUnregisterQueue MPU_vQueueUnregisterQueue
130 | #endif
131 |
132 | /* Remove the privileged function macro. */
133 | #define PRIVILEGED_FUNCTION
134 |
135 | #else /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE */
136 |
137 | /* Ensure API functions go in the privileged execution section. */
138 | #define PRIVILEGED_FUNCTION __attribute__((section("privileged_functions")))
139 | #define PRIVILEGED_DATA __attribute__((section("privileged_data")))
140 |
141 | #endif /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE */
142 |
143 | #else /* portUSING_MPU_WRAPPERS */
144 |
145 | #define PRIVILEGED_FUNCTION
146 | #define PRIVILEGED_DATA
147 | #define portUSING_MPU_WRAPPERS 0
148 |
149 | #endif /* portUSING_MPU_WRAPPERS */
150 |
151 |
152 | #endif /* MPU_WRAPPERS_H */
153 |
154 |
--------------------------------------------------------------------------------
/pcb/board outline.dxf:
--------------------------------------------------------------------------------
1 | 0
2 | SECTION
3 | 2
4 | HEADER
5 | 9
6 | $ACADVER
7 | 1
8 | AC1009
9 | 9
10 | $ANGDIR
11 | 70
12 | 0
13 | 9
14 | $CECOLOR
15 | 62
16 | 256
17 | 9
18 | $CELTYPE
19 | 6
20 | BYLAYER
21 | 9
22 | $EXTMIN
23 | 10
24 | 0.0
25 | 20
26 | 0.0
27 | 9
28 | $EXTMAX
29 | 10
30 | 4.0551
31 | 20
32 | 3.1102
33 | 9
34 | $FILLMODE
35 | 70
36 | 1
37 | 9
38 | $MIRRTEXT
39 | 70
40 | 0
41 | 0
42 | ENDSEC
43 | 0
44 | SECTION
45 | 2
46 | TABLES
47 | 0
48 | TABLE
49 | 2
50 | LAYER
51 | 70
52 | 17
53 | 0
54 | LAYER
55 | 2
56 | Drill_Top
57 | 70
58 | 64
59 | 62
60 | 7
61 | 6
62 | CONTINUOUS
63 | 0
64 | LAYER
65 | 2
66 | Board_Outline
67 | 70
68 | 64
69 | 62
70 | 13
71 | 6
72 | CONTINUOUS
73 | 0
74 | ENDTAB
75 | 0
76 | ENDSEC
77 | 0
78 | SECTION
79 | 2
80 | ENTITIES
81 | 0
82 | CIRCLE
83 | 8
84 | Drill_Top
85 | 10
86 | 0.4724
87 | 20
88 | 0.5906
89 | 40
90 | 0.0181
91 | 0
92 | CIRCLE
93 | 8
94 | Drill_Top
95 | 10
96 | 0.374
97 | 20
98 | 0.5906
99 | 40
100 | 0.0181
101 | 0
102 | CIRCLE
103 | 8
104 | Drill_Top
105 | 10
106 | 0.374
107 | 20
108 | 0.5118
109 | 40
110 | 0.0181
111 | 0
112 | CIRCLE
113 | 8
114 | Drill_Top
115 | 10
116 | 0.4724
117 | 20
118 | 0.5118
119 | 40
120 | 0.0181
121 | 0
122 | CIRCLE
123 | 8
124 | Drill_Top
125 | 10
126 | 0.1862
127 | 20
128 | 0.4051
129 | 40
130 | 0.0453
131 | 0
132 | CIRCLE
133 | 8
134 | Drill_Top
135 | 10
136 | 0.6602
137 | 20
138 | 0.4051
139 | 40
140 | 0.0453
141 | 0
142 | CIRCLE
143 | 8
144 | Drill_Top
145 | 10
146 | 1.4625
147 | 20
148 | 2.7875
149 | 40
150 | 0.02
151 | 0
152 | CIRCLE
153 | 8
154 | Drill_Top
155 | 10
156 | 1.5025
157 | 20
158 | 2.5875
159 | 40
160 | 0.02
161 | 0
162 | CIRCLE
163 | 8
164 | Drill_Top
165 | 10
166 | 1.5625
167 | 20
168 | 2.7875
169 | 40
170 | 0.0467
171 | 0
172 | CIRCLE
173 | 8
174 | Drill_Top
175 | 10
176 | 1.3625
177 | 20
178 | 2.788
179 | 40
180 | 0.0467
181 | 0
182 | CIRCLE
183 | 8
184 | Drill_Top
185 | 10
186 | 1.3625
187 | 20
188 | 2.663
189 | 40
190 | 0.0467
191 | 0
192 | CIRCLE
193 | 8
194 | Drill_Top
195 | 10
196 | 1.5625
197 | 20
198 | 2.663
199 | 40
200 | 0.0467
201 | 0
202 | CIRCLE
203 | 8
204 | Drill_Top
205 | 10
206 | 1.4225
207 | 20
208 | 2.5875
209 | 40
210 | 0.02
211 | 0
212 | CIRCLE
213 | 8
214 | Drill_Top
215 | 10
216 | 3.225
217 | 20
218 | 1.125
219 | 40
220 | 0.063
221 | 0
222 | CIRCLE
223 | 8
224 | Drill_Top
225 | 10
226 | 3.6625
227 | 20
228 | 1.125
229 | 40
230 | 0.063
231 | 0
232 | CIRCLE
233 | 8
234 | Drill_Top
235 | 10
236 | 1.9276
237 | 20
238 | 3.0
239 | 40
240 | 0.0217
241 | 0
242 | CIRCLE
243 | 8
244 | Drill_Top
245 | 10
246 | 2.0276
247 | 20
248 | 3.0
249 | 40
250 | 0.0217
251 | 0
252 | CIRCLE
253 | 8
254 | Drill_Top
255 | 10
256 | 2.1276
257 | 20
258 | 3.0
259 | 40
260 | 0.0217
261 | 0
262 | CIRCLE
263 | 8
264 | Drill_Top
265 | 10
266 | 3.3789
267 | 20
268 | 0.2537
269 | 40
270 | 0.0236
271 | 0
272 | CIRCLE
273 | 8
274 | Drill_Top
275 | 10
276 | 3.4773
277 | 20
278 | 0.3561
279 | 40
280 | 0.0236
281 | 0
282 | CIRCLE
283 | 8
284 | Drill_Top
285 | 10
286 | 3.5758
287 | 20
288 | 0.2537
289 | 40
290 | 0.0236
291 | 0
292 | CIRCLE
293 | 8
294 | Drill_Top
295 | 10
296 | 3.6742
297 | 20
298 | 0.3561
299 | 40
300 | 0.0236
301 | 0
302 | CIRCLE
303 | 8
304 | Drill_Top
305 | 10
306 | 3.7726
307 | 20
308 | 0.2537
309 | 40
310 | 0.0236
311 | 0
312 | CIRCLE
313 | 8
314 | Drill_Top
315 | 10
316 | 0.5512
317 | 20
318 | 0.9055
319 | 40
320 | 0.0177
321 | 0
322 | CIRCLE
323 | 8
324 | Drill_Top
325 | 10
326 | 0.6512
327 | 20
328 | 0.9055
329 | 40
330 | 0.0177
331 | 0
332 | CIRCLE
333 | 8
334 | Drill_Top
335 | 10
336 | 0.8512
337 | 20
338 | 0.9055
339 | 40
340 | 0.0177
341 | 0
342 | CIRCLE
343 | 8
344 | Drill_Top
345 | 10
346 | 0.9512
347 | 20
348 | 0.9055
349 | 40
350 | 0.0177
351 | 0
352 | CIRCLE
353 | 8
354 | Drill_Top
355 | 10
356 | 1.0512
357 | 20
358 | 0.9055
359 | 40
360 | 0.0177
361 | 0
362 | POLYLINE
363 | 8
364 | Board_Outline
365 | 6
366 | CONTINUOUS
367 | 66
368 | 1
369 | 70
370 | 0
371 | 40
372 | 0.0055
373 | 41
374 | 0.0055
375 | 0
376 | VERTEX
377 | 8
378 | Board_Outline
379 | 10
380 | 3.2136
381 | 20
382 | 0.4171
383 | 42
384 | 0
385 | 0
386 | VERTEX
387 | 8
388 | Board_Outline
389 | 10
390 | 3.2923
391 | 20
392 | 0.4171
393 | 42
394 | 0
395 | 0
396 | VERTEX
397 | 8
398 | Board_Outline
399 | 10
400 | 3.2923
401 | 20
402 | 0.3345
403 | 42
404 | 0
405 | 0
406 | VERTEX
407 | 8
408 | Board_Outline
409 | 10
410 | 3.2136
411 | 20
412 | 0.3345
413 | 42
414 | 0
415 | 0
416 | VERTEX
417 | 8
418 | Board_Outline
419 | 10
420 | 3.2136
421 | 20
422 | 0.4171
423 | 42
424 | 0
425 | 0
426 | SEQEND
427 | 0
428 | POLYLINE
429 | 8
430 | Board_Outline
431 | 6
432 | CONTINUOUS
433 | 66
434 | 1
435 | 70
436 | 0
437 | 40
438 | 0.0055
439 | 41
440 | 0.0055
441 | 0
442 | VERTEX
443 | 8
444 | Board_Outline
445 | 10
446 | 3.8592
447 | 20
448 | 0.4171
449 | 42
450 | 0
451 | 0
452 | VERTEX
453 | 8
454 | Board_Outline
455 | 10
456 | 3.938
457 | 20
458 | 0.4171
459 | 42
460 | 0
461 | 0
462 | VERTEX
463 | 8
464 | Board_Outline
465 | 10
466 | 3.938
467 | 20
468 | 0.3345
469 | 42
470 | 0
471 | 0
472 | VERTEX
473 | 8
474 | Board_Outline
475 | 10
476 | 3.8592
477 | 20
478 | 0.3345
479 | 42
480 | 0
481 | 0
482 | VERTEX
483 | 8
484 | Board_Outline
485 | 10
486 | 3.8592
487 | 20
488 | 0.4171
489 | 42
490 | 0
491 | 0
492 | SEQEND
493 | 0
494 | POLYLINE
495 | 8
496 | Board_Outline
497 | 6
498 | CONTINUOUS
499 | 66
500 | 1
501 | 70
502 | 0
503 | 40
504 | 0.0055
505 | 41
506 | 0.0055
507 | 0
508 | VERTEX
509 | 8
510 | Board_Outline
511 | 10
512 | 0.0
513 | 20
514 | 0.0
515 | 42
516 | 0
517 | 0
518 | VERTEX
519 | 8
520 | Board_Outline
521 | 10
522 | 0.0
523 | 20
524 | 3.1102
525 | 42
526 | 0
527 | 0
528 | VERTEX
529 | 8
530 | Board_Outline
531 | 10
532 | 4.0551
533 | 20
534 | 3.1102
535 | 42
536 | 0
537 | 0
538 | VERTEX
539 | 8
540 | Board_Outline
541 | 10
542 | 4.0551
543 | 20
544 | 0.0
545 | 42
546 | 0
547 | 0
548 | VERTEX
549 | 8
550 | Board_Outline
551 | 10
552 | 3.2087
553 | 20
554 | 0.0
555 | 42
556 | 0
557 | 0
558 | VERTEX
559 | 8
560 | Board_Outline
561 | 10
562 | 3.2087
563 | 20
564 | 0.689
565 | 42
566 | 0
567 | 0
568 | VERTEX
569 | 8
570 | Board_Outline
571 | 10
572 | 0.7874
573 | 20
574 | 0.689
575 | 42
576 | 0
577 | 0
578 | VERTEX
579 | 8
580 | Board_Outline
581 | 10
582 | 0.7874
583 | 20
584 | 0.0
585 | 42
586 | 0
587 | 0
588 | VERTEX
589 | 8
590 | Board_Outline
591 | 10
592 | 0.0
593 | 20
594 | 0.0
595 | 42
596 | 0
597 | 0
598 | SEQEND
599 | 0
600 | POLYLINE
601 | 8
602 | Board_Outline
603 | 6
604 | CONTINUOUS
605 | 66
606 | 1
607 | 70
608 | 0
609 | 40
610 | 0.0098
611 | 41
612 | 0.0098
613 | 0
614 | VERTEX
615 | 8
616 | Board_Outline
617 | 10
618 | 3.2136
619 | 20
620 | 0.4171
621 | 42
622 | 0
623 | 0
624 | VERTEX
625 | 8
626 | Board_Outline
627 | 10
628 | 3.2923
629 | 20
630 | 0.4171
631 | 42
632 | 0
633 | 0
634 | VERTEX
635 | 8
636 | Board_Outline
637 | 10
638 | 3.2923
639 | 20
640 | 0.3345
641 | 42
642 | 0
643 | 0
644 | VERTEX
645 | 8
646 | Board_Outline
647 | 10
648 | 3.2136
649 | 20
650 | 0.3345
651 | 42
652 | 0
653 | 0
654 | VERTEX
655 | 8
656 | Board_Outline
657 | 10
658 | 3.2136
659 | 20
660 | 0.4171
661 | 42
662 | 0
663 | 0
664 | SEQEND
665 | 0
666 | POLYLINE
667 | 8
668 | Board_Outline
669 | 6
670 | CONTINUOUS
671 | 66
672 | 1
673 | 70
674 | 0
675 | 40
676 | 0.0098
677 | 41
678 | 0.0098
679 | 0
680 | VERTEX
681 | 8
682 | Board_Outline
683 | 10
684 | 3.8592
685 | 20
686 | 0.4171
687 | 42
688 | 0
689 | 0
690 | VERTEX
691 | 8
692 | Board_Outline
693 | 10
694 | 3.938
695 | 20
696 | 0.4171
697 | 42
698 | 0
699 | 0
700 | VERTEX
701 | 8
702 | Board_Outline
703 | 10
704 | 3.938
705 | 20
706 | 0.3345
707 | 42
708 | 0
709 | 0
710 | VERTEX
711 | 8
712 | Board_Outline
713 | 10
714 | 3.8592
715 | 20
716 | 0.3345
717 | 42
718 | 0
719 | 0
720 | VERTEX
721 | 8
722 | Board_Outline
723 | 10
724 | 3.8592
725 | 20
726 | 0.4171
727 | 42
728 | 0
729 | 0
730 | SEQEND
731 | 0
732 | ENDSEC
733 | 0
734 | EOF
735 |
--------------------------------------------------------------------------------
/firmware/Reload Pro.cydsn/Reload Pro_PSoC4lib.uvopt:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 1.0
5 |
6 | ### uVision Project, (C) Keil Software
7 |
8 |
9 | *.c
10 | *.s*; *.src; *.a*
11 | *.obj
12 | *.lib
13 | *.txt; *.h; *.inc
14 | *.plm
15 | *.cpp
16 |
17 |
18 |
19 | 0
20 | 0
21 |
22 |
23 |
24 | Debug
25 | 0x0
26 | MCS-51
27 |
28 | 20000000
29 |
30 | 0
31 | 1
32 | 1
33 | 0
34 |
35 |
36 | 0
37 | 65535
38 | 0
39 | 0
40 | 0
41 |
42 |
43 | 120
44 | 65
45 | 8
46 | .\MCS-51\Debug\
47 |
48 |
49 | 1
50 | 1
51 | 1
52 | 0
53 | 1
54 | 1
55 | 0
56 | 1
57 | 0
58 | 0
59 | 0
60 | 0
61 |
62 |
63 | 1
64 | 1
65 | 1
66 | 1
67 | 1
68 | 1
69 | 1
70 | 0
71 | 0
72 |
73 |
74 | 0
75 | 0
76 | 1
77 |
78 | 0
79 |
80 | S8051.DLL
81 |
82 | DP51.DLL
83 | -p51R
84 | S8051.DLL
85 |
86 | TP51.DLL
87 | -p51R
88 |
89 |
90 | 0
91 | 1
92 | 1
93 | 1
94 | 1
95 | 1
96 | 1
97 | 1
98 | 1
99 | 1
100 | 0
101 | 1
102 | 1
103 | 1
104 | 0
105 | 1
106 | 0
107 | 0
108 | -1
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 | 0
123 | 0
124 | 0
125 | 0
126 | 0
127 | 0
128 | 0
129 | 0
130 | 0
131 | 0
132 | 0
133 | 0
134 | 0
135 | 0
136 | 0
137 | 0
138 | 0
139 | 0
140 | 0
141 | 0
142 | 0
143 | 0
144 | 0
145 | 0
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 | Release
154 | 0x0
155 | MCS-51
156 |
157 | 20000000
158 |
159 | 0
160 | 1
161 | 1
162 | 0
163 |
164 |
165 | 0
166 | 65535
167 | 0
168 | 0
169 | 0
170 |
171 |
172 | 120
173 | 65
174 | 8
175 | .\MCS-51\Release\
176 |
177 |
178 | 1
179 | 1
180 | 1
181 | 0
182 | 1
183 | 1
184 | 0
185 | 1
186 | 0
187 | 0
188 | 0
189 | 0
190 |
191 |
192 | 1
193 | 1
194 | 1
195 | 1
196 | 1
197 | 1
198 | 1
199 | 0
200 | 0
201 |
202 |
203 | 0
204 | 0
205 | 0
206 |
207 | 0
208 |
209 | S8051.DLL
210 |
211 | DP51.DLL
212 | -p51R
213 | S8051.DLL
214 |
215 | TP51.DLL
216 | -p51R
217 |
218 |
219 | 0
220 | 1
221 | 1
222 | 1
223 | 1
224 | 1
225 | 1
226 | 1
227 | 1
228 | 1
229 | 0
230 | 1
231 | 1
232 | 1
233 | 0
234 | 1
235 | 0
236 | 0
237 | -1
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 | 0
252 | 0
253 | 0
254 | 0
255 | 0
256 | 0
257 | 0
258 | 0
259 | 0
260 | 0
261 | 0
262 | 0
263 | 0
264 | 0
265 | 0
266 | 0
267 | 0
268 | 0
269 | 0
270 | 0
271 | 0
272 | 0
273 | 0
274 | 0
275 |
276 |
277 |
278 |
279 |
280 |
281 |
--------------------------------------------------------------------------------
/firmware/Reload Pro.cydsn/freertos/include/StackMacros.h:
--------------------------------------------------------------------------------
1 | /*
2 | FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
3 | All rights reserved
4 |
5 | VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
6 |
7 | ***************************************************************************
8 | * *
9 | * FreeRTOS provides completely free yet professionally developed, *
10 | * robust, strictly quality controlled, supported, and cross *
11 | * platform software that has become a de facto standard. *
12 | * *
13 | * Help yourself get started quickly and support the FreeRTOS *
14 | * project by purchasing a FreeRTOS tutorial book, reference *
15 | * manual, or both from: http://www.FreeRTOS.org/Documentation *
16 | * *
17 | * Thank you! *
18 | * *
19 | ***************************************************************************
20 |
21 | This file is part of the FreeRTOS distribution.
22 |
23 | FreeRTOS is free software; you can redistribute it and/or modify it under
24 | the terms of the GNU General Public License (version 2) as published by the
25 | Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
26 |
27 | >>! NOTE: The modification to the GPL is included to allow you to distribute
28 | >>! a combined work that includes FreeRTOS without being obliged to provide
29 | >>! the source code for proprietary components outside of the FreeRTOS
30 | >>! kernel.
31 |
32 | FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
33 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
34 | FOR A PARTICULAR PURPOSE. Full license text is available from the following
35 | link: http://www.freertos.org/a00114.html
36 |
37 | 1 tab == 4 spaces!
38 |
39 | ***************************************************************************
40 | * *
41 | * Having a problem? Start by reading the FAQ "My application does *
42 | * not run, what could be wrong?" *
43 | * *
44 | * http://www.FreeRTOS.org/FAQHelp.html *
45 | * *
46 | ***************************************************************************
47 |
48 | http://www.FreeRTOS.org - Documentation, books, training, latest versions,
49 | license and Real Time Engineers Ltd. contact details.
50 |
51 | http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
52 | including FreeRTOS+Trace - an indispensable productivity tool, a DOS
53 | compatible FAT file system, and our tiny thread aware UDP/IP stack.
54 |
55 | http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
56 | Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
57 | licenses offer ticketed support, indemnification and middleware.
58 |
59 | http://www.SafeRTOS.com - High Integrity Systems also provide a safety
60 | engineered and independently SIL3 certified version for use in safety and
61 | mission critical applications that require provable dependability.
62 |
63 | 1 tab == 4 spaces!
64 | */
65 |
66 | #ifndef STACK_MACROS_H
67 | #define STACK_MACROS_H
68 |
69 | /*
70 | * Call the stack overflow hook function if the stack of the task being swapped
71 | * out is currently overflowed, or looks like it might have overflowed in the
72 | * past.
73 | *
74 | * Setting configCHECK_FOR_STACK_OVERFLOW to 1 will cause the macro to check
75 | * the current stack state only - comparing the current top of stack value to
76 | * the stack limit. Setting configCHECK_FOR_STACK_OVERFLOW to greater than 1
77 | * will also cause the last few stack bytes to be checked to ensure the value
78 | * to which the bytes were set when the task was created have not been
79 | * overwritten. Note this second test does not guarantee that an overflowed
80 | * stack will always be recognised.
81 | */
82 |
83 | /*-----------------------------------------------------------*/
84 |
85 | #if( configCHECK_FOR_STACK_OVERFLOW == 0 )
86 |
87 | /* FreeRTOSConfig.h is not set to check for stack overflows. */
88 | #define taskFIRST_CHECK_FOR_STACK_OVERFLOW()
89 | #define taskSECOND_CHECK_FOR_STACK_OVERFLOW()
90 |
91 | #endif /* configCHECK_FOR_STACK_OVERFLOW == 0 */
92 | /*-----------------------------------------------------------*/
93 |
94 | #if( configCHECK_FOR_STACK_OVERFLOW == 1 )
95 |
96 | /* FreeRTOSConfig.h is only set to use the first method of
97 | overflow checking. */
98 | #define taskSECOND_CHECK_FOR_STACK_OVERFLOW()
99 |
100 | #endif
101 | /*-----------------------------------------------------------*/
102 |
103 | #if( ( configCHECK_FOR_STACK_OVERFLOW > 0 ) && ( portSTACK_GROWTH < 0 ) )
104 |
105 | /* Only the current stack state is to be checked. */
106 | #define taskFIRST_CHECK_FOR_STACK_OVERFLOW() \
107 | { \
108 | /* Is the currently saved stack pointer within the stack limit? */ \
109 | if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack ) \
110 | { \
111 | vApplicationStackOverflowHook( ( xTaskHandle ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
112 | } \
113 | }
114 |
115 | #endif /* configCHECK_FOR_STACK_OVERFLOW > 0 */
116 | /*-----------------------------------------------------------*/
117 |
118 | #if( ( configCHECK_FOR_STACK_OVERFLOW > 0 ) && ( portSTACK_GROWTH > 0 ) )
119 |
120 | /* Only the current stack state is to be checked. */
121 | #define taskFIRST_CHECK_FOR_STACK_OVERFLOW() \
122 | { \
123 | \
124 | /* Is the currently saved stack pointer within the stack limit? */ \
125 | if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack ) \
126 | { \
127 | vApplicationStackOverflowHook( ( xTaskHandle ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
128 | } \
129 | }
130 |
131 | #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */
132 | /*-----------------------------------------------------------*/
133 |
134 | #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) )
135 |
136 | #define taskSECOND_CHECK_FOR_STACK_OVERFLOW() \
137 | { \
138 | static const unsigned char ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
139 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
140 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
141 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
142 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE }; \
143 | \
144 | \
145 | /* Has the extremity of the task stack ever been written over? */ \
146 | if( memcmp( ( void * ) pxCurrentTCB->pxStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \
147 | { \
148 | vApplicationStackOverflowHook( ( xTaskHandle ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
149 | } \
150 | }
151 |
152 | #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
153 | /*-----------------------------------------------------------*/
154 |
155 | #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH > 0 ) )
156 |
157 | #define taskSECOND_CHECK_FOR_STACK_OVERFLOW() \
158 | { \
159 | char *pcEndOfStack = ( char * ) pxCurrentTCB->pxEndOfStack; \
160 | static const unsigned char ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
161 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
162 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
163 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
164 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE }; \
165 | \
166 | \
167 | pcEndOfStack -= sizeof( ucExpectedStackBytes ); \
168 | \
169 | /* Has the extremity of the task stack ever been written over? */ \
170 | if( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \
171 | { \
172 | vApplicationStackOverflowHook( ( xTaskHandle ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
173 | } \
174 | }
175 |
176 | #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
177 | /*-----------------------------------------------------------*/
178 |
179 | #endif /* STACK_MACROS_H */
180 |
181 |
--------------------------------------------------------------------------------
/firmware/Reload Pro.cydsn/freertos/src/list.c:
--------------------------------------------------------------------------------
1 | /*
2 | FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
3 | All rights reserved
4 |
5 | VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
6 |
7 | ***************************************************************************
8 | * *
9 | * FreeRTOS provides completely free yet professionally developed, *
10 | * robust, strictly quality controlled, supported, and cross *
11 | * platform software that has become a de facto standard. *
12 | * *
13 | * Help yourself get started quickly and support the FreeRTOS *
14 | * project by purchasing a FreeRTOS tutorial book, reference *
15 | * manual, or both from: http://www.FreeRTOS.org/Documentation *
16 | * *
17 | * Thank you! *
18 | * *
19 | ***************************************************************************
20 |
21 | This file is part of the FreeRTOS distribution.
22 |
23 | FreeRTOS is free software; you can redistribute it and/or modify it under
24 | the terms of the GNU General Public License (version 2) as published by the
25 | Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
26 |
27 | >>! NOTE: The modification to the GPL is included to allow you to distribute
28 | >>! a combined work that includes FreeRTOS without being obliged to provide
29 | >>! the source code for proprietary components outside of the FreeRTOS
30 | >>! kernel.
31 |
32 | FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
33 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
34 | FOR A PARTICULAR PURPOSE. Full license text is available from the following
35 | link: http://www.freertos.org/a00114.html
36 |
37 | 1 tab == 4 spaces!
38 |
39 | ***************************************************************************
40 | * *
41 | * Having a problem? Start by reading the FAQ "My application does *
42 | * not run, what could be wrong?" *
43 | * *
44 | * http://www.FreeRTOS.org/FAQHelp.html *
45 | * *
46 | ***************************************************************************
47 |
48 | http://www.FreeRTOS.org - Documentation, books, training, latest versions,
49 | license and Real Time Engineers Ltd. contact details.
50 |
51 | http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
52 | including FreeRTOS+Trace - an indispensable productivity tool, a DOS
53 | compatible FAT file system, and our tiny thread aware UDP/IP stack.
54 |
55 | http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
56 | Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
57 | licenses offer ticketed support, indemnification and middleware.
58 |
59 | http://www.SafeRTOS.com - High Integrity Systems also provide a safety
60 | engineered and independently SIL3 certified version for use in safety and
61 | mission critical applications that require provable dependability.
62 |
63 | 1 tab == 4 spaces!
64 | */
65 |
66 |
67 | #include
68 | #include "FreeRTOS.h"
69 | #include "list.h"
70 |
71 | /*-----------------------------------------------------------
72 | * PUBLIC LIST API documented in list.h
73 | *----------------------------------------------------------*/
74 |
75 | void vListInitialise( xList * const pxList )
76 | {
77 | /* The list structure contains a list item which is used to mark the
78 | end of the list. To initialise the list the list end is inserted
79 | as the only list entry. */
80 | pxList->pxIndex = ( xListItem * ) &( pxList->xListEnd ); /*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */
81 |
82 | /* The list end value is the highest possible value in the list to
83 | ensure it remains at the end of the list. */
84 | pxList->xListEnd.xItemValue = portMAX_DELAY;
85 |
86 | /* The list end next and previous pointers point to itself so we know
87 | when the list is empty. */
88 | pxList->xListEnd.pxNext = ( xListItem * ) &( pxList->xListEnd ); /*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */
89 | pxList->xListEnd.pxPrevious = ( xListItem * ) &( pxList->xListEnd );/*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */
90 |
91 | pxList->uxNumberOfItems = ( unsigned portBASE_TYPE ) 0U;
92 | }
93 | /*-----------------------------------------------------------*/
94 |
95 | void vListInitialiseItem( xListItem * const pxItem )
96 | {
97 | /* Make sure the list item is not recorded as being on a list. */
98 | pxItem->pvContainer = NULL;
99 | }
100 | /*-----------------------------------------------------------*/
101 |
102 | void vListInsertEnd( xList * const pxList, xListItem * const pxNewListItem )
103 | {
104 | xListItem * pxIndex;
105 |
106 | /* Insert a new list item into pxList, but rather than sort the list,
107 | makes the new list item the last item to be removed by a call to
108 | pvListGetOwnerOfNextEntry. */
109 | pxIndex = pxList->pxIndex;
110 |
111 | pxNewListItem->pxNext = pxIndex;
112 | pxNewListItem->pxPrevious = pxIndex->pxPrevious;
113 | pxIndex->pxPrevious->pxNext = pxNewListItem;
114 | pxIndex->pxPrevious = pxNewListItem;
115 |
116 | /* Remember which list the item is in. */
117 | pxNewListItem->pvContainer = ( void * ) pxList;
118 |
119 | ( pxList->uxNumberOfItems )++;
120 | }
121 | /*-----------------------------------------------------------*/
122 |
123 | void vListInsert( xList * const pxList, xListItem * const pxNewListItem )
124 | {
125 | xListItem *pxIterator;
126 | portTickType xValueOfInsertion;
127 |
128 | /* Insert the new list item into the list, sorted in ulListItem order. */
129 | xValueOfInsertion = pxNewListItem->xItemValue;
130 |
131 | /* If the list already contains a list item with the same item value then
132 | the new list item should be placed after it. This ensures that TCB's which
133 | are stored in ready lists (all of which have the same ulListItem value)
134 | get an equal share of the CPU. However, if the xItemValue is the same as
135 | the back marker the iteration loop below will not end. This means we need
136 | to guard against this by checking the value first and modifying the
137 | algorithm slightly if necessary. */
138 | if( xValueOfInsertion == portMAX_DELAY )
139 | {
140 | pxIterator = pxList->xListEnd.pxPrevious;
141 | }
142 | else
143 | {
144 | /* *** NOTE ***********************************************************
145 | If you find your application is crashing here then likely causes are:
146 | 1) Stack overflow -
147 | see http://www.freertos.org/Stacks-and-stack-overflow-checking.html
148 | 2) Incorrect interrupt priority assignment, especially on Cortex-M3
149 | parts where numerically high priority values denote low actual
150 | interrupt priories, which can seem counter intuitive. See
151 | configMAX_SYSCALL_INTERRUPT_PRIORITY on http://www.freertos.org/a00110.html
152 | 3) Calling an API function from within a critical section or when
153 | the scheduler is suspended, or calling an API function that does
154 | not end in "FromISR" from an interrupt.
155 | 4) Using a queue or semaphore before it has been initialised or
156 | before the scheduler has been started (are interrupts firing
157 | before vTaskStartScheduler() has been called?).
158 | See http://www.freertos.org/FAQHelp.html for more tips.
159 | **********************************************************************/
160 |
161 | for( pxIterator = ( xListItem * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext ) /*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */
162 | {
163 | /* There is nothing to do here, we are just iterating to the
164 | wanted insertion position. */
165 | }
166 | }
167 |
168 | pxNewListItem->pxNext = pxIterator->pxNext;
169 | pxNewListItem->pxNext->pxPrevious = pxNewListItem;
170 | pxNewListItem->pxPrevious = pxIterator;
171 | pxIterator->pxNext = pxNewListItem;
172 |
173 | /* Remember which list the item is in. This allows fast removal of the
174 | item later. */
175 | pxNewListItem->pvContainer = ( void * ) pxList;
176 |
177 | ( pxList->uxNumberOfItems )++;
178 | }
179 | /*-----------------------------------------------------------*/
180 |
181 | unsigned portBASE_TYPE uxListRemove( xListItem * const pxItemToRemove )
182 | {
183 | xList * pxList;
184 |
185 | pxItemToRemove->pxNext->pxPrevious = pxItemToRemove->pxPrevious;
186 | pxItemToRemove->pxPrevious->pxNext = pxItemToRemove->pxNext;
187 |
188 | /* The list item knows which list it is in. Obtain the list from the list
189 | item. */
190 | pxList = ( xList * ) pxItemToRemove->pvContainer;
191 |
192 | /* Make sure the index is left pointing to a valid item. */
193 | if( pxList->pxIndex == pxItemToRemove )
194 | {
195 | pxList->pxIndex = pxItemToRemove->pxPrevious;
196 | }
197 |
198 | pxItemToRemove->pvContainer = NULL;
199 | ( pxList->uxNumberOfItems )--;
200 |
201 | return pxList->uxNumberOfItems;
202 | }
203 | /*-----------------------------------------------------------*/
204 |
205 |
--------------------------------------------------------------------------------
/firmware/Reload Pro.cydsn/comms.c:
--------------------------------------------------------------------------------
1 | /* ========================================
2 | *
3 | * Copyright YOUR COMPANY, THE YEAR
4 | * All Rights Reserved
5 | * UNPUBLISHED, LICENSED SOFTWARE.
6 | *
7 | * CONFIDENTIAL AND PROPRIETARY INFORMATION
8 | * WHICH IS THE PROPERTY OF your company.
9 | *
10 | * ========================================
11 | */
12 |
13 | #include
14 | #include
15 | #include
16 | #include
17 | #include
18 | #include "project.h"
19 | #include "tasks.h"
20 | #include "config.h"
21 | #include "commands.h"
22 | #include "calibrate.h"
23 | #include "semphr.h"
24 | #include "comms.h"
25 |
26 | #define ARGUMENT_SEPERATORS " "
27 |
28 | xQueueHandle comms_queue;
29 |
30 | // mutex to guard uart_printf, so that it can be used from both GUI and comms task
31 | xSemaphoreHandle uart_write_mutex = NULL;
32 |
33 | static char *current_line;
34 |
35 | void UART_ISR_func() {
36 | static char lines[2][MAX_COMMS_LINE_LENGTH];
37 | static uint8 bufidx = 0;
38 | static uint8 lineidx = 0;
39 |
40 | uint32 nchars = UART_SpiUartGetRxBufferSize();
41 | for(int i = 0; i < (int)nchars; i++) {
42 | char c = UART_UartGetChar();
43 | switch(c) {
44 | case '\n':
45 | case '\r':
46 | if(bufidx > 0) {
47 | lines[lineidx][bufidx] = 0;
48 | if(xQueueSendToBackFromISR(comms_queue, &(comms_event){.type=COMMS_EVENT_LINE_RX}, NULL) == pdPASS) {
49 | current_line = lines[lineidx];
50 | lineidx = (lineidx + 1) % 2;
51 | }
52 | bufidx = 0;
53 | }
54 | break;
55 | case 0:
56 | break;
57 | default:
58 | lines[lineidx][bufidx++] = c;
59 | break;
60 | }
61 | }
62 |
63 | UART_ClearRxInterruptSource(UART_GetRxInterruptSourceMasked());
64 | }
65 |
66 | void uart_printf(char *fmt, ...) {
67 | static char formatted_string[MAX_RESPONSE_LENGTH + 1];
68 |
69 | if(uart_write_mutex != NULL) {
70 |
71 | // since INCLUDE_vTaskSuspend is set to 1, this will block until mutex is available
72 | xSemaphoreTake(uart_write_mutex, portMAX_DELAY);
73 |
74 | va_list argptr;
75 | va_start(argptr, fmt);
76 | vsnprintf(formatted_string, sizeof(formatted_string), fmt, argptr);
77 | va_end(argptr);
78 | UART_UartPutString(formatted_string);
79 |
80 | // release the krak^H^H^H^Hmutex!
81 | xSemaphoreGive(uart_write_mutex);
82 | }
83 | }
84 |
85 | static portTickType tick_interval = portMAX_DELAY;
86 |
87 | static void next_event(comms_event *event, portTickType interval) {
88 | static portTickType last_tick = 0;
89 |
90 | portTickType now = xTaskGetTickCount();
91 | if(now - last_tick > interval || !xQueueReceive(comms_queue, event, interval - (now - last_tick))) {
92 | last_tick = xTaskGetTickCount();
93 | event->type = COMMS_EVENT_MONITOR_DATA;
94 | }
95 | }
96 |
97 | void write_state_data() {
98 | uart_printf("read %d %d %d %d\r\n", get_current_usage() / 1000, get_voltage() / 1000,get_microamp_hours(),get_microwatt_hours());
99 | }
100 |
101 | void write_invalid_command(const char *cmdname) {
102 | uart_printf("err Unknown command '%.7s'\r\n", cmdname);
103 | }
104 |
105 | void command_mode(char *args) {
106 | uart_printf("mode cc\r\n");
107 | }
108 |
109 | void command_set(char *args) {
110 | if(args[0] != 0) {
111 | int newcurrent = atoi(args);
112 | if(newcurrent < 0 || newcurrent * 1000 > CURRENT_MAX) {
113 | uart_printf("err set current must be between 0 and %d\r\n", CURRENT_MAX / 1000);
114 | } else {
115 | set_current(newcurrent * 1000);
116 | }
117 | }
118 | uart_printf("set %d\r\n", state.current_setpoint / 1000);
119 | }
120 |
121 | void command_reset(char *args) {
122 | set_output_mode(OUTPUT_MODE_FEEDBACK);
123 | uart_printf("ok\r\n");
124 | }
125 |
126 | void command_read(char *args) {
127 | write_state_data();
128 | }
129 |
130 | void command_clear(char *args) {
131 | reset_running_totals();
132 | uart_printf("ok\r\n");
133 | }
134 |
135 | void command_monitor(char *args) {
136 | char *newinterval = strsep(&args, ARGUMENT_SEPERATORS);
137 | if(newinterval[0] == 0) {
138 | uart_printf("err monitor expects at least one argument\r\n");
139 | } else {
140 | int interval = atoi(newinterval);
141 | if(interval == 0) {
142 | tick_interval = portMAX_DELAY;
143 | } else {
144 | tick_interval = (configTICK_RATE_HZ * interval) / 1000;
145 | }
146 | }
147 | }
148 |
149 | void command_debug(char *args) {
150 | uart_printf("info ui stack %d\r\n", (int)uxTaskGetStackHighWaterMark(ui_task));
151 | uart_printf("info comms stack %d\r\n", (int)uxTaskGetStackHighWaterMark(comms_task));
152 | uart_printf("info heap free %d\r\n", (int)xPortGetFreeHeapSize());
153 | uart_printf("info fet %d %d\r\n", (int)ADC_GetResult16(ADC_CHAN_OPAMP_OUT), (int)ADC_GetResult16(ADC_CHAN_FET_IN));
154 | }
155 |
156 | void command_calibration_progress(int current, int all) {
157 | // empty function to satisfy callback requirement
158 | }
159 |
160 | void command_calibrate(char *args) {
161 | char *subcommand = strsep(&args, ARGUMENT_SEPERATORS);
162 | if(subcommand[0] == '\0') {
163 | uart_printf("err cal expects at least one argument\r\n");
164 | return;
165 | } else if(subcommand[1] != '\0') {
166 | uart_printf("err cal: unrecognised subcommand\r\n");
167 | return;
168 | }
169 |
170 | settings_t new_settings;
171 | memcpy(&new_settings, settings, sizeof(settings_t));
172 | switch(subcommand[0]) {
173 | case 'o': // Offset calibration
174 | calibrate_offsets(&new_settings);
175 | break;
176 | case 'v': // ADC voltage calibration
177 | calibrate_voltage(&new_settings, atoi(args));
178 | break;
179 | case 'i': // ADC current calibration
180 | calibrate_current(&new_settings, atoi(args));
181 | break;
182 | case 'd': // DAC calibration
183 | calibrate_dacs(&new_settings, atoi(args));
184 | break;
185 | case 'O': // Set opamp offset trim
186 | if(args[0] == '\0') {
187 | uart_printf("cal O %d\r\n", settings->calibration_settings.opamp_offset_trim);
188 | return;
189 | } else {
190 | set_opamp_offset_trim(&new_settings, atoi(args));
191 | }
192 | break;
193 | case 't': // Calibrate opamp offset trim
194 | calibrate_opamp_offset_trim(&new_settings, atoi(args), command_calibration_progress);
195 | break;
196 | case 'x':
197 | uart_printf("dac_low_gain %12d\r\n", settings->calibration_settings.dac_low_gain);
198 | uart_printf("dac_high_gain %12d\r\n", settings->calibration_settings.dac_high_gain);
199 | uart_printf("dac_offset %12d\r\n", settings->calibration_settings.dac_offset);
200 | uart_printf("opamp_offset_trim %12d\r\n", settings->calibration_settings.opamp_offset_trim);
201 | uart_printf("adc_current_offset %12d\r\n", settings->calibration_settings.adc_current_offset);
202 | uart_printf("adc_current_gain %12d\r\n", settings->calibration_settings.adc_current_gain);
203 | uart_printf("adc_voltage_offset %12d\r\n", settings->calibration_settings.adc_voltage_offset);
204 | uart_printf("adc_voltage_gain %12d\r\n", settings->calibration_settings.adc_voltage_gain);
205 | uart_printf("vc_ratio %12d\r\n", settings->calibration_settings.voltage_correction_ratio);
206 | uart_printf("raw_current_usage %12d\r\n", get_raw_current_usage());
207 | uart_printf("raw_voltage %12d\r\n", get_raw_voltage());
208 | uart_printf("ok\r\n");
209 | return;
210 | default:
211 | uart_printf("err cal: unrecognised subcommand\r\n");
212 | return;
213 | }
214 | EEPROM_Write((uint8*)&new_settings, (uint8*)settings, sizeof(settings_t));
215 | uart_printf("ok\r\n");
216 | }
217 |
218 | void command_bootloader(char *buf) {
219 | uart_printf("ok\r\n");
220 | ui_event event;
221 | event.type = UI_EVENT_BOOTLOAD;
222 | xQueueSend(ui_queue, &event, 0);
223 | }
224 |
225 | void command_dump(char *buf) {
226 | }
227 |
228 | void command_version(char *buf) {
229 | #ifdef USE_SPLASHSCREEN
230 | uart_printf("version %hd.%hd\r\n", get_major_version(), get_minor_version());
231 | #endif
232 | }
233 |
234 | void command_uvlo(char *args) {
235 | if(args[0] != '\0') {
236 | int uvlovolts = atoi(args);
237 | if(uvlovolts < 0 || uvlovolts * 1000 > VOLTAGE_MAX) {
238 | uart_printf("err uvlo must be between 0 and %d\r\n", VOLTAGE_MAX / 1000);
239 | } else {
240 | if(uvlovolts==0)
241 | state.lower_voltage_limit=-1;//disable uvlo
242 | else
243 | state.lower_voltage_limit = uvlovolts * 1000;
244 | }
245 | }
246 | uart_printf("uvlo %d\r\n", state.lower_voltage_limit / 1000);
247 | }
248 |
249 | void command_on(char *args) {
250 | set_output_mode(OUTPUT_MODE_FEEDBACK);
251 | uart_printf("ok\r\n");
252 | }
253 |
254 | void command_off(char *args) {
255 | set_output_mode(OUTPUT_MODE_OFF);
256 | uart_printf("ok\r\n");
257 | }
258 |
259 | void handle_command(char *buf) {
260 | char *cmdname = strsep(&buf, ARGUMENT_SEPERATORS);
261 | const command_def *cmd = in_word_set(cmdname, strlen(cmdname));
262 |
263 | if(cmd == NULL) {
264 | write_invalid_command(cmdname);
265 | } else {
266 | cmd->handler(buf);
267 | }
268 | }
269 |
270 | void vTaskComms(void *pvParameters) {
271 | comms_queue = xQueueCreate(1, sizeof(comms_event));
272 | uart_write_mutex = xSemaphoreCreateMutex();
273 |
274 | UART_ISR_StartEx(UART_ISR_func);
275 | UART_Start();
276 |
277 | while(1) {
278 | comms_event event;
279 |
280 | next_event(&event, tick_interval);
281 | switch(event.type) {
282 | case COMMS_EVENT_MONITOR_DATA:
283 | write_state_data();
284 | break;
285 | case COMMS_EVENT_LINE_RX:
286 | handle_command(current_line);
287 | break;
288 | case COMMS_EVENT_OVERTEMP:
289 | uart_printf("overtemp\r\n");
290 | break;
291 | case COMMS_EVENT_UNDERVOLT:
292 | uart_printf("undervolt\r\n");
293 | break;
294 | }
295 | }
296 | }
297 |
298 | /* [] END OF FILE */
299 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright {yyyy} {name of copyright owner}
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
203 |
--------------------------------------------------------------------------------
/pcb/reloadpro.frontmask.gts:
--------------------------------------------------------------------------------
1 | G04 DipTrace 2.3.1.0*
2 | %INreloadpro.frontmask.gts*%
3 | %MOIN*%
4 | %ADD33R,0.0787X0.0236*%
5 | %ADD50R,0.0472X0.0472*%
6 | %ADD59C,0.0374*%
7 | %ADD70C,0.0472*%
8 | %ADD72R,0.0315X0.0315*%
9 | %ADD73R,0.0295X0.0453*%
10 | %ADD75R,0.0512X0.0315*%
11 | %ADD77R,0.0709X0.0669*%
12 | %ADD79R,0.0551X0.0551*%
13 | %ADD80C,0.126*%
14 | %ADD82C,0.0866*%
15 | %ADD83C,0.0709*%
16 | %ADD84C,0.0669*%
17 | %ADD86R,0.0669X0.0669*%
18 | %ADD88R,0.0866X0.126*%
19 | %ADD90R,0.0197X0.0571*%
20 | %ADD92R,0.0787X0.1339*%
21 | %ADD94R,0.0492X0.0335*%
22 | %ADD96C,0.0827*%
23 | %ADD97R,0.0827X0.0827*%
24 | %ADD98R,0.0335X0.0492*%
25 | %ADD100R,0.3228X0.0945*%
26 | %ADD102C,0.3228*%
27 | %ADD104C,0.1378*%
28 | %ADD107R,0.0866X0.0315*%
29 | %ADD110R,0.0512X0.0472*%
30 | %ADD112R,0.0472X0.0512*%
31 | %FSLAX44Y44*%
32 | G04*
33 | G70*
34 | G90*
35 | G75*
36 | G01*
37 | %LNTopMask*%
38 | %LPD*%
39 | D112*
40 | X7437Y17437D3*
41 | Y18106D3*
42 | X6687Y17437D3*
43 | Y18106D3*
44 | D110*
45 | X6812Y23187D3*
46 | X7481D3*
47 | X6812Y22437D3*
48 | X7481D3*
49 | X6812Y21687D3*
50 | X7481D3*
51 | D112*
52 | X10562Y16062D3*
53 | Y15393D3*
54 | D110*
55 | X9449Y14173D3*
56 | X10118D3*
57 | X14107Y18687D3*
58 | X13437D3*
59 | X19437Y24437D3*
60 | X20106D3*
61 | X19437Y23687D3*
62 | X20106D3*
63 | X19437Y22937D3*
64 | X20106D3*
65 | X19437Y22187D3*
66 | X20106D3*
67 | X14187Y14187D3*
68 | X13518D3*
69 | X22062Y24437D3*
70 | X21393D3*
71 | D112*
72 | X18902Y12850D3*
73 | Y13519D3*
74 | X19652Y12850D3*
75 | Y13519D3*
76 | X20402Y12850D3*
77 | Y13519D3*
78 | X21152Y12850D3*
79 | Y13519D3*
80 | X21902Y12850D3*
81 | Y13519D3*
82 | X22652Y12850D3*
83 | Y13519D3*
84 | X23402Y12850D3*
85 | Y13519D3*
86 | D72*
87 | X14187Y19687D3*
88 | X13321D3*
89 | D33*
90 | X5963Y20937D3*
91 | Y20681D3*
92 | Y20425D3*
93 | Y20169D3*
94 | Y19913D3*
95 | Y19657D3*
96 | Y19402D3*
97 | Y19146D3*
98 | X8246D3*
99 | Y19402D3*
100 | Y19657D3*
101 | Y19913D3*
102 | Y20169D3*
103 | Y20425D3*
104 | Y20681D3*
105 | Y20937D3*
106 | D107*
107 | X10687Y22187D3*
108 | Y21687D3*
109 | Y21187D3*
110 | Y20687D3*
111 | X12813D3*
112 | Y21187D3*
113 | Y21687D3*
114 | Y22187D3*
115 | G36*
116 | X8798Y9512D2*
117 | X8525D1*
118 | X8331Y9706D1*
119 | Y9979D1*
120 | X8525Y10173D1*
121 | X8798D1*
122 | X8992Y9979D1*
123 | Y9706D1*
124 | X8798Y9512D1*
125 | G37*
126 | D83*
127 | X7677Y9843D3*
128 | Y9055D3*
129 | X8661D3*
130 | D104*
131 | X5799Y7988D3*
132 | X10539D3*
133 | D102*
134 | X34687Y15687D3*
135 | X39062D3*
136 | D100*
137 | X13815Y15315D3*
138 | Y17559D3*
139 | D110*
140 | X24772Y29977D3*
141 | X24102D3*
142 | X24772Y28227D3*
143 | X24102D3*
144 | D98*
145 | X9843Y16142D3*
146 | X9094D3*
147 | X9469Y15236D3*
148 | D97*
149 | X23213Y33937D3*
150 | D96*
151 | X24213D3*
152 | X25213D3*
153 | D94*
154 | X26127Y15025D3*
155 | Y14277D3*
156 | X27033Y14651D3*
157 | D112*
158 | X5937Y17437D3*
159 | Y18106D3*
160 | X8187Y17437D3*
161 | Y18106D3*
162 | D110*
163 | X9843Y17717D3*
164 | X9173D3*
165 | X9843Y16929D3*
166 | X9173D3*
167 | D92*
168 | X37914Y18914D3*
169 | X35710D3*
170 | D110*
171 | X24772Y24022D3*
172 | X24102D3*
173 | Y26522D3*
174 | X24772D3*
175 | Y25772D3*
176 | X24102D3*
177 | D112*
178 | X27687Y14609D3*
179 | Y13940D3*
180 | D110*
181 | X24102Y22397D3*
182 | X24772D3*
183 | D33*
184 | X22187Y25187D3*
185 | Y25443D3*
186 | Y25699D3*
187 | Y25955D3*
188 | Y26211D3*
189 | Y26467D3*
190 | Y26722D3*
191 | Y26978D3*
192 | Y27234D3*
193 | Y27490D3*
194 | Y27746D3*
195 | Y28002D3*
196 | Y28258D3*
197 | Y28514D3*
198 | X19352D3*
199 | Y28258D3*
200 | Y28002D3*
201 | Y27746D3*
202 | Y27490D3*
203 | Y27234D3*
204 | Y26978D3*
205 | Y26722D3*
206 | Y26467D3*
207 | Y26211D3*
208 | Y25955D3*
209 | Y25699D3*
210 | Y25443D3*
211 | Y25187D3*
212 | D90*
213 | X26852Y10225D3*
214 | X26656D3*
215 | X26459D3*
216 | X26262D3*
217 | X26065D3*
218 | X25868D3*
219 | X25671D3*
220 | X25474D3*
221 | X25278D3*
222 | X25081D3*
223 | X24884D3*
224 | X24687D3*
225 | X24490D3*
226 | X24293D3*
227 | X24096D3*
228 | X23900D3*
229 | X23703D3*
230 | X23506D3*
231 | X23309D3*
232 | X23112D3*
233 | X22915D3*
234 | X22719D3*
235 | X22522D3*
236 | X22325D3*
237 | X22128D3*
238 | X21931D3*
239 | X21734D3*
240 | X21537D3*
241 | X21341D3*
242 | X21144D3*
243 | D88*
244 | X27459Y9309D3*
245 | X20537D3*
246 | D86*
247 | X9449Y12992D3*
248 | D84*
249 | X10449D3*
250 | X12449D3*
251 | X13449D3*
252 | X14449D3*
253 | D82*
254 | X40679Y5733D3*
255 | X39695D3*
256 | X38710D3*
257 | X40679Y6718D3*
258 | X38710D3*
259 | D80*
260 | X42195Y7111D3*
261 | X37195D3*
262 | D79*
263 | X27852Y13225D3*
264 | D77*
265 | X27459Y11957D3*
266 | D79*
267 | X27065Y13224D3*
268 | D110*
269 | X24772Y23147D3*
270 | X24103D3*
271 | D112*
272 | X25462Y14315D3*
273 | Y14984D3*
274 | D79*
275 | X24062Y24937D3*
276 | X25164D3*
277 | G36*
278 | X18742Y30187D2*
279 | X18745Y30153D1*
280 | X18754Y30120D1*
281 | X18769Y30090D1*
282 | X18788Y30062D1*
283 | X18812Y30038D1*
284 | X18840Y30019D1*
285 | X18870Y30004D1*
286 | X18903Y29995D1*
287 | X18937Y29992D1*
288 | D1*
289 | X18971Y29995D1*
290 | X19004Y30004D1*
291 | X19034Y30019D1*
292 | X19062Y30038D1*
293 | X19086Y30062D1*
294 | X19105Y30090D1*
295 | X19120Y30120D1*
296 | X19129Y30153D1*
297 | X19132Y30187D1*
298 | D1*
299 | X19129Y30221D1*
300 | X19120Y30254D1*
301 | X19105Y30284D1*
302 | X19086Y30312D1*
303 | X19062Y30336D1*
304 | X19034Y30355D1*
305 | X19004Y30370D1*
306 | X18971Y30379D1*
307 | X18937Y30382D1*
308 | D1*
309 | X18903Y30379D1*
310 | X18870Y30370D1*
311 | X18840Y30355D1*
312 | X18812Y30336D1*
313 | X18788Y30312D1*
314 | X18769Y30284D1*
315 | X18754Y30254D1*
316 | X18745Y30221D1*
317 | X18742Y30187D1*
318 | G37*
319 | G36*
320 | X18242D2*
321 | X18245Y30153D1*
322 | X18254Y30120D1*
323 | X18269Y30090D1*
324 | X18288Y30062D1*
325 | X18312Y30038D1*
326 | X18340Y30019D1*
327 | X18370Y30004D1*
328 | X18403Y29995D1*
329 | X18437Y29992D1*
330 | D1*
331 | X18471Y29995D1*
332 | X18504Y30004D1*
333 | X18534Y30019D1*
334 | X18562Y30038D1*
335 | X18586Y30062D1*
336 | X18605Y30090D1*
337 | X18620Y30120D1*
338 | X18629Y30153D1*
339 | X18632Y30187D1*
340 | D1*
341 | X18629Y30221D1*
342 | X18620Y30254D1*
343 | X18605Y30284D1*
344 | X18586Y30312D1*
345 | X18562Y30336D1*
346 | X18534Y30355D1*
347 | X18504Y30370D1*
348 | X18471Y30379D1*
349 | X18437Y30382D1*
350 | D1*
351 | X18403Y30379D1*
352 | X18370Y30370D1*
353 | X18340Y30355D1*
354 | X18312Y30336D1*
355 | X18288Y30312D1*
356 | X18269Y30284D1*
357 | X18254Y30254D1*
358 | X18245Y30221D1*
359 | X18242Y30187D1*
360 | G37*
361 | G36*
362 | X17742D2*
363 | X17745Y30153D1*
364 | X17754Y30120D1*
365 | X17769Y30090D1*
366 | X17788Y30062D1*
367 | X17812Y30038D1*
368 | X17840Y30019D1*
369 | X17870Y30004D1*
370 | X17903Y29995D1*
371 | X17937Y29992D1*
372 | D1*
373 | X17971Y29995D1*
374 | X18004Y30004D1*
375 | X18034Y30019D1*
376 | X18062Y30038D1*
377 | X18086Y30062D1*
378 | X18105Y30090D1*
379 | X18120Y30120D1*
380 | X18129Y30153D1*
381 | X18132Y30187D1*
382 | D1*
383 | X18129Y30221D1*
384 | X18120Y30254D1*
385 | X18105Y30284D1*
386 | X18086Y30312D1*
387 | X18062Y30336D1*
388 | X18034Y30355D1*
389 | X18004Y30370D1*
390 | X17971Y30379D1*
391 | X17937Y30382D1*
392 | D1*
393 | X17903Y30379D1*
394 | X17870Y30370D1*
395 | X17840Y30355D1*
396 | X17812Y30336D1*
397 | X17788Y30312D1*
398 | X17769Y30284D1*
399 | X17754Y30254D1*
400 | X17745Y30221D1*
401 | X17742Y30187D1*
402 | G37*
403 | G36*
404 | Y30687D2*
405 | X17745Y30653D1*
406 | X17754Y30620D1*
407 | X17769Y30590D1*
408 | X17788Y30562D1*
409 | X17812Y30538D1*
410 | X17840Y30519D1*
411 | X17870Y30504D1*
412 | X17903Y30495D1*
413 | X17937Y30492D1*
414 | D1*
415 | X17971Y30495D1*
416 | X18004Y30504D1*
417 | X18034Y30519D1*
418 | X18062Y30538D1*
419 | X18086Y30562D1*
420 | X18105Y30590D1*
421 | X18120Y30620D1*
422 | X18129Y30653D1*
423 | X18132Y30687D1*
424 | D1*
425 | X18129Y30721D1*
426 | X18120Y30754D1*
427 | X18105Y30784D1*
428 | X18086Y30812D1*
429 | X18062Y30836D1*
430 | X18034Y30855D1*
431 | X18004Y30870D1*
432 | X17971Y30879D1*
433 | X17937Y30882D1*
434 | D1*
435 | X17903Y30879D1*
436 | X17870Y30870D1*
437 | X17840Y30855D1*
438 | X17812Y30836D1*
439 | X17788Y30812D1*
440 | X17769Y30784D1*
441 | X17754Y30754D1*
442 | X17745Y30721D1*
443 | X17742Y30687D1*
444 | G37*
445 | G36*
446 | X18242D2*
447 | X18245Y30653D1*
448 | X18254Y30620D1*
449 | X18269Y30590D1*
450 | X18288Y30562D1*
451 | X18312Y30538D1*
452 | X18340Y30519D1*
453 | X18370Y30504D1*
454 | X18403Y30495D1*
455 | X18437Y30492D1*
456 | D1*
457 | X18471Y30495D1*
458 | X18504Y30504D1*
459 | X18534Y30519D1*
460 | X18562Y30538D1*
461 | X18586Y30562D1*
462 | X18605Y30590D1*
463 | X18620Y30620D1*
464 | X18629Y30653D1*
465 | X18632Y30687D1*
466 | D1*
467 | X18629Y30721D1*
468 | X18620Y30754D1*
469 | X18605Y30784D1*
470 | X18586Y30812D1*
471 | X18562Y30836D1*
472 | X18534Y30855D1*
473 | X18504Y30870D1*
474 | X18471Y30879D1*
475 | X18437Y30882D1*
476 | D1*
477 | X18403Y30879D1*
478 | X18370Y30870D1*
479 | X18340Y30855D1*
480 | X18312Y30836D1*
481 | X18288Y30812D1*
482 | X18269Y30784D1*
483 | X18254Y30754D1*
484 | X18245Y30721D1*
485 | X18242Y30687D1*
486 | G37*
487 | G36*
488 | X18742D2*
489 | X18745Y30653D1*
490 | X18754Y30620D1*
491 | X18769Y30590D1*
492 | X18788Y30562D1*
493 | X18812Y30538D1*
494 | X18840Y30519D1*
495 | X18870Y30504D1*
496 | X18903Y30495D1*
497 | X18937Y30492D1*
498 | D1*
499 | X18971Y30495D1*
500 | X19004Y30504D1*
501 | X19034Y30519D1*
502 | X19062Y30538D1*
503 | X19086Y30562D1*
504 | X19105Y30590D1*
505 | X19120Y30620D1*
506 | X19129Y30653D1*
507 | X19132Y30687D1*
508 | D1*
509 | X19129Y30721D1*
510 | X19120Y30754D1*
511 | X19105Y30784D1*
512 | X19086Y30812D1*
513 | X19062Y30836D1*
514 | X19034Y30855D1*
515 | X19004Y30870D1*
516 | X18971Y30879D1*
517 | X18937Y30882D1*
518 | D1*
519 | X18903Y30879D1*
520 | X18870Y30870D1*
521 | X18840Y30855D1*
522 | X18812Y30836D1*
523 | X18788Y30812D1*
524 | X18769Y30784D1*
525 | X18754Y30754D1*
526 | X18745Y30721D1*
527 | X18742Y30687D1*
528 | G37*
529 | D59*
530 | X19437Y30437D3*
531 | X17437Y30037D3*
532 | Y30837D3*
533 | D110*
534 | X24772Y27352D3*
535 | X24102D3*
536 | X24772Y29102D3*
537 | X24102D3*
538 | X25687Y27312D3*
539 | X26356D3*
540 | D84*
541 | X5937Y29875D3*
542 | Y28875D3*
543 | Y27875D3*
544 | Y26875D3*
545 | X13937D3*
546 | Y27875D3*
547 | Y28875D3*
548 | Y29875D3*
549 | D75*
550 | X25719Y12813D3*
551 | Y13187D3*
552 | Y13561D3*
553 | X24656D3*
554 | Y12813D3*
555 | D112*
556 | X26312Y13522D3*
557 | Y12853D3*
558 | X24062Y12852D3*
559 | Y13521D3*
560 | D73*
561 | X23812Y11437D3*
562 | X24127D3*
563 | X24442D3*
564 | X24757D3*
565 | Y12146D3*
566 | X24442D3*
567 | X24127D3*
568 | X23812D3*
569 | D102*
570 | X30312Y15687D3*
571 | D79*
572 | X24187Y21687D3*
573 | X25289D3*
574 | G36*
575 | X7037Y24232D2*
576 | X7144D1*
577 | Y23642D1*
578 | X7037D1*
579 | Y24232D1*
580 | G37*
581 | G36*
582 | X7773Y23937D2*
583 | X7728Y23769D1*
584 | X7605Y23646D1*
585 | X7442Y23602D1*
586 | X7102D1*
587 | Y24272D1*
588 | X7442D1*
589 | X7605Y24228D1*
590 | X7728Y24105D1*
591 | X7773Y23937D1*
592 | G37*
593 | G36*
594 | X6408D2*
595 | X6453Y24105D1*
596 | X6576Y24228D1*
597 | X6739Y24272D1*
598 | X7079D1*
599 | Y23602D1*
600 | X6739D1*
601 | X6576Y23646D1*
602 | X6453Y23769D1*
603 | X6408Y23937D1*
604 | G37*
605 | G36*
606 | X7037Y25107D2*
607 | X7144D1*
608 | Y24517D1*
609 | X7037D1*
610 | Y25107D1*
611 | G37*
612 | G36*
613 | X7773Y24812D2*
614 | X7728Y24644D1*
615 | X7605Y24521D1*
616 | X7442Y24477D1*
617 | X7102D1*
618 | Y25147D1*
619 | X7442D1*
620 | X7605Y25103D1*
621 | X7728Y24980D1*
622 | X7773Y24812D1*
623 | G37*
624 | G36*
625 | X6408D2*
626 | X6453Y24980D1*
627 | X6576Y25103D1*
628 | X6739Y25147D1*
629 | X7079D1*
630 | Y24477D1*
631 | X6739D1*
632 | X6576Y24521D1*
633 | X6453Y24644D1*
634 | X6408Y24812D1*
635 | G37*
636 | D110*
637 | X24102Y20897D3*
638 | X24772D3*
639 | D50*
640 | X19437Y32687D3*
641 | D70*
642 | Y32187D3*
643 | X18937Y32687D3*
644 | Y32187D3*
645 | X18437Y32687D3*
646 | Y32187D3*
647 | X17937Y32687D3*
648 | Y32187D3*
649 | X17437Y32687D3*
650 | Y32187D3*
651 | M02*
652 |
--------------------------------------------------------------------------------
/firmware/Bootloader.cydsn/Export/PSoCCreatorExportIDE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | Bootloader.svd
30 |
31 |
32 | .\Generated_Source\PSoC4\cm0gcc.ld
33 | .\Generated_Source\PSoC4\Cm0RealView.scat
34 |
35 |
36 |
37 |
38 | .\main.c
39 |
40 |
41 |
42 |
43 | .\Generated_Source\PSoC4\cyfitter_cfg.h
44 | .\Generated_Source\PSoC4\cyfitter_cfg.c
45 | .\Generated_Source\PSoC4\cymetadata.c
46 | .\Generated_Source\PSoC4\cydevice_trm.h
47 | .\Generated_Source\PSoC4\cydevicegnu_trm.inc
48 | .\Generated_Source\PSoC4\cydevicerv_trm.inc
49 | .\Generated_Source\PSoC4\cydeviceiar_trm.inc
50 | .\Generated_Source\PSoC4\cyfittergnu.inc
51 | .\Generated_Source\PSoC4\cyfitterrv.inc
52 | .\Generated_Source\PSoC4\cyfitteriar.inc
53 | .\Generated_Source\PSoC4\cyfitter.h
54 | .\Generated_Source\PSoC4\cydisabledsheets.h
55 | .\Generated_Source\PSoC4\Bootloader.h
56 | .\Generated_Source\PSoC4\Bootloader.c
57 | .\Generated_Source\PSoC4\Bootloader_PVT.h
58 | .\Generated_Source\PSoC4\UART.c
59 | .\Generated_Source\PSoC4\UART.h
60 | .\Generated_Source\PSoC4\UART_SPI_UART.h
61 | .\Generated_Source\PSoC4\UART_SPI_UART.c
62 | .\Generated_Source\PSoC4\UART_SPI_UART_INT.c
63 | .\Generated_Source\PSoC4\UART_PM.c
64 | .\Generated_Source\PSoC4\UART_UART.c
65 | .\Generated_Source\PSoC4\UART_BOOT.c
66 | .\Generated_Source\PSoC4\UART_UART_BOOT.c
67 | .\Generated_Source\PSoC4\UART_PINS.h
68 | .\Generated_Source\PSoC4\UART_SPI_UART_PVT.h
69 | .\Generated_Source\PSoC4\UART_PVT.h
70 | .\Generated_Source\PSoC4\UART_BOOT.h
71 | .\Generated_Source\PSoC4\UART_Clock.c
72 | .\Generated_Source\PSoC4\UART_Clock.h
73 | .\Generated_Source\PSoC4\Button.c
74 | .\Generated_Source\PSoC4\Button.h
75 | .\Generated_Source\PSoC4\Button_aliases.h
76 | .\Generated_Source\PSoC4\Backlight.c
77 | .\Generated_Source\PSoC4\Backlight.h
78 | .\Generated_Source\PSoC4\Backlight_aliases.h
79 | .\Generated_Source\PSoC4\UART_tx.c
80 | .\Generated_Source\PSoC4\UART_tx.h
81 | .\Generated_Source\PSoC4\UART_tx_aliases.h
82 | .\Generated_Source\PSoC4\UART_rx.c
83 | .\Generated_Source\PSoC4\UART_rx.h
84 | .\Generated_Source\PSoC4\UART_rx_aliases.h
85 | .\Generated_Source\PSoC4\Cm0Start.c
86 | .\Generated_Source\PSoC4\core_cm0_psoc4.h
87 | .\Generated_Source\PSoC4\core_cm0.h
88 | .\Generated_Source\PSoC4\CyBootAsmGnu.s
89 | .\Generated_Source\PSoC4\CyBootAsmRv.s
90 | .\Generated_Source\PSoC4\CyFlash.c
91 | .\Generated_Source\PSoC4\CyFlash.h
92 | .\Generated_Source\PSoC4\CyLib.c
93 | .\Generated_Source\PSoC4\CyLib.h
94 | .\Generated_Source\PSoC4\cyPm.c
95 | .\Generated_Source\PSoC4\cyPm.h
96 | .\Generated_Source\PSoC4\cytypes.h
97 | .\Generated_Source\PSoC4\cyutils.c
98 | .\Generated_Source\PSoC4\cypins.h
99 | .\Generated_Source\PSoC4\core_cmFunc.h
100 | .\Generated_Source\PSoC4\core_cmInstr.h
101 | .\Generated_Source\PSoC4\CyBootAsmIar.s
102 | .\Generated_Source\PSoC4\project.h
103 |
104 |
105 |
106 |
107 | .\Export\ARM_GCC_Generic\CyComponentLibrary.a
108 |
109 |
110 |
111 |
112 | .\Export\ARM_MDK_Generic\CyComponentLibrary.a
113 |
114 |
115 |
116 |
117 | .\Export\ARM_IAR_Generic\CyComponentLibrary.a
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
--------------------------------------------------------------------------------
/firmware/Reload Pro.cydsn/lzfx.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009 Andrew Collette
3 | * http://lzfx.googlecode.com
4 | *
5 | * Implements an LZF-compatible compressor/decompressor based on the liblzf
6 | * codebase written by Marc Lehmann. This code is released under the BSD
7 | * license. License and original copyright statement follow.
8 | *
9 | *
10 | * Copyright (c) 2000-2008 Marc Alexander Lehmann
11 | *
12 | * Redistribution and use in source and binary forms, with or without modifica-
13 | * tion, are permitted provided that the following conditions are met:
14 | *
15 | * 1. Redistributions of source code must retain the above copyright notice,
16 | * this list of conditions and the following disclaimer.
17 | *
18 | * 2. Redistributions in binary form must reproduce the above copyright
19 | * notice, this list of conditions and the following disclaimer in the
20 | * documentation and/or other materials provided with the distribution.
21 | *
22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
24 | * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
25 | * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE-
26 | * CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH-
30 | * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31 | * OF THE POSSIBILITY OF SUCH DAMAGE.
32 | */
33 |
34 | #include "lzfx.h"
35 |
36 | #define LZFX_HSIZE (1 << (LZFX_HLOG))
37 |
38 | /* We need this for memset */
39 | #ifdef __cplusplus
40 | # include
41 | #else
42 | # include
43 | #endif
44 |
45 | #if __GNUC__ >= 3
46 | # define fx_expect_false(expr) __builtin_expect((expr) != 0, 0)
47 | # define fx_expect_true(expr) __builtin_expect((expr) != 0, 1)
48 | #else
49 | # define fx_expect_false(expr) (expr)
50 | # define fx_expect_true(expr) (expr)
51 | #endif
52 |
53 | typedef unsigned char u8;
54 | typedef const u8 *LZSTATE[LZFX_HSIZE];
55 |
56 | /* Define the hash function */
57 | #define LZFX_FRST(p) (((p[0]) << 8) | p[1])
58 | #define LZFX_NEXT(v,p) (((v) << 8) | p[2])
59 | #define LZFX_IDX(h) ((( h >> (3*8 - LZFX_HLOG)) - h ) & (LZFX_HSIZE - 1))
60 |
61 | /* These cannot be changed, as they are related to the compressed format. */
62 | #define LZFX_MAX_LIT (1 << 5)
63 | #define LZFX_MAX_OFF (1 << 13)
64 | #define LZFX_MAX_REF ((1 << 8) + (1 << 3))
65 |
66 | static
67 | int lzfx_getsize(const void* ibuf, unsigned int ilen, unsigned int *olen);
68 |
69 | /* Compressed format
70 |
71 | There are two kinds of structures in LZF/LZFX: literal runs and back
72 | references. The length of a literal run is encoded as L - 1, as it must
73 | contain at least one byte. Literals are encoded as follows:
74 |
75 | 000LLLLL
76 |
77 | Back references are encoded as follows. The smallest possible encoded
78 | length value is 1, as otherwise the control byte would be recognized as
79 | a literal run. Since at least three bytes must match for a back reference
80 | to be inserted, the length is encoded as L - 2 instead of L - 1. The
81 | offset (distance to the desired data in the output buffer) is encoded as
82 | o - 1, as all offsets are at least 1. The binary format is:
83 |
84 | LLLooooo oooooooo for backrefs of real length < 9 (1 <= L < 7)
85 | 111ooooo LLLLLLLL oooooooo for backrefs of real length >= 9 (L > 7)
86 | */
87 | int lzfx_compress(const void *const ibuf, const unsigned int ilen,
88 | void *obuf, unsigned int *const olen){
89 |
90 | /* Hash table; an array of u8*'s which point
91 | to various locations in the input buffer */
92 | const u8 *htab[LZFX_HSIZE];
93 |
94 | const u8 **hslot; /* Pointer to entry in hash table */
95 | unsigned int hval; /* Hash value generated by macros above */
96 | const u8 *ref; /* Pointer to candidate match location in input */
97 |
98 | const u8 *ip = (const u8 *)ibuf;
99 | const u8 *const in_end = ip + ilen;
100 |
101 | u8 *op = (u8 *)obuf;
102 | const u8 *const out_end = (olen == NULL ? NULL : op + *olen);
103 |
104 | int lit; /* # of bytes in current literal run */
105 |
106 | #if defined (WIN32) && defined (_M_X64)
107 | unsigned _int64 off; /* workaround for missing POSIX compliance */
108 | #else
109 | unsigned long off;
110 | #endif
111 |
112 | if(olen == NULL) return LZFX_EARGS;
113 | if(ibuf == NULL){
114 | if(ilen != 0) return LZFX_EARGS;
115 | *olen = 0;
116 | return 0;
117 | }
118 | if(obuf == NULL) return LZFX_EARGS;
119 |
120 | memset(htab, 0, sizeof(htab));
121 |
122 | /* Start a literal run. Whenever we do this the output pointer is
123 | advanced because the current byte will hold the encoded length. */
124 | lit = 0; op++;
125 |
126 | hval = LZFX_FRST(ip);
127 |
128 | while(ip + 2 < in_end){ /* The NEXT macro reads 2 bytes ahead */
129 |
130 | hval = LZFX_NEXT(hval, ip);
131 | hslot = htab + LZFX_IDX(hval);
132 |
133 | ref = *hslot; *hslot = ip;
134 |
135 | if( ref < ip
136 | && (off = ip - ref - 1) < LZFX_MAX_OFF
137 | && ip + 4 < in_end /* Backref takes up to 3 bytes, so don't bother */
138 | && ref > (u8 *)ibuf
139 | && ref[0] == ip[0]
140 | && ref[1] == ip[1]
141 | && ref[2] == ip[2] ) {
142 |
143 | unsigned int len = 3; /* We already know 3 bytes match */
144 | const unsigned int maxlen = in_end - ip - 2 > LZFX_MAX_REF ?
145 | LZFX_MAX_REF : in_end - ip - 2;
146 |
147 | /* lit == 0: op + 3 must be < out_end (because we undo the run)
148 | lit != 0: op + 3 + 1 must be < out_end */
149 | if(fx_expect_false(op - !lit + 3 + 1 >= out_end))
150 | return LZFX_ESIZE;
151 |
152 | op [- lit - 1] = lit - 1; /* Terminate literal run */
153 | op -= !lit; /* Undo run if length is zero */
154 |
155 | /* Start checking at the fourth byte */
156 | while (len < maxlen && ref[len] == ip[len])
157 | len++;
158 |
159 | len -= 2; /* We encode the length as #octets - 2 */
160 |
161 | /* Format 1: [LLLooooo oooooooo] */
162 | if (len < 7) {
163 | *op++ = (off >> 8) + (len << 5);
164 | *op++ = off;
165 |
166 | /* Format 2: [111ooooo LLLLLLLL oooooooo] */
167 | } else {
168 | *op++ = (off >> 8) + (7 << 5);
169 | *op++ = len - 7;
170 | *op++ = off;
171 | }
172 |
173 | lit = 0; op++;
174 |
175 | ip += len + 1; /* ip = initial ip + #octets -1 */
176 |
177 | if (fx_expect_false (ip + 3 >= in_end)){
178 | ip++; /* Code following expects exit at bottom of loop */
179 | break;
180 | }
181 |
182 | hval = LZFX_FRST (ip);
183 | hval = LZFX_NEXT (hval, ip);
184 | htab[LZFX_IDX (hval)] = ip;
185 |
186 | ip++; /* ip = initial ip + #octets */
187 |
188 | } else {
189 | /* Keep copying literal bytes */
190 |
191 | if (fx_expect_false (op >= out_end)) return LZFX_ESIZE;
192 |
193 | lit++; *op++ = *ip++;
194 |
195 | if (fx_expect_false (lit == LZFX_MAX_LIT)) {
196 | op [- lit - 1] = lit - 1; /* stop run */
197 | lit = 0; op++; /* start run */
198 | }
199 |
200 | } /* if() found match in htab */
201 |
202 | } /* while(ip < ilen -2) */
203 |
204 | /* At most 3 bytes remain in input. We therefore need 4 bytes available
205 | in the output buffer to store them (3 data + ctrl byte).*/
206 | if (op + 3 > out_end) return LZFX_ESIZE;
207 |
208 | while (ip < in_end) {
209 |
210 | lit++; *op++ = *ip++;
211 |
212 | if (fx_expect_false (lit == LZFX_MAX_LIT)){
213 | op [- lit - 1] = lit - 1;
214 | lit = 0; op++;
215 | }
216 | }
217 |
218 | op [- lit - 1] = lit - 1;
219 | op -= !lit;
220 |
221 | *olen = op - (u8 *)obuf;
222 | return 0;
223 | }
224 |
225 | /* Decompressor */
226 | int lzfx_decompress(const void* ibuf, unsigned int ilen,
227 | void* obuf, unsigned int *olen){
228 |
229 | u8 const *ip = (const u8 *)ibuf;
230 | u8 const *const in_end = ip + ilen;
231 | u8 *op = (u8 *)obuf;
232 | u8 const *const out_end = (olen == NULL ? NULL : op + *olen);
233 |
234 | unsigned int remain_len = 0;
235 | int rc;
236 |
237 | if(olen == NULL) return LZFX_EARGS;
238 | if(ibuf == NULL){
239 | if(ilen != 0) return LZFX_EARGS;
240 | *olen = 0;
241 | return 0;
242 | }
243 | if(obuf == NULL){
244 | if(olen != 0) return LZFX_EARGS;
245 | return lzfx_getsize(ibuf, ilen, olen);
246 | }
247 |
248 | do {
249 | unsigned int ctrl = *ip++;
250 |
251 | /* Format 000LLLLL: a literal byte string follows, of length L+1 */
252 | if(ctrl < (1 << 5)) {
253 |
254 | ctrl++;
255 |
256 | if(fx_expect_false(op + ctrl > out_end)){
257 | --ip; /* Rewind to control byte */
258 | goto guess;
259 | }
260 | if(fx_expect_false(ip + ctrl > in_end)) return LZFX_ECORRUPT;
261 |
262 | do
263 | *op++ = *ip++;
264 | while(--ctrl);
265 |
266 | /* Format #1 [LLLooooo oooooooo]: backref of length L+1+2
267 | ^^^^^ ^^^^^^^^
268 | A B
269 | #2 [111ooooo LLLLLLLL oooooooo] backref of length L+7+2
270 | ^^^^^ ^^^^^^^^
271 | A B
272 | In both cases the location of the backref is computed from the
273 | remaining part of the data as follows:
274 |
275 | location = op - A*256 - B - 1
276 | */
277 | } else {
278 |
279 | unsigned int len = (ctrl >> 5);
280 | u8 *ref = op - ((ctrl & 0x1f) << 8) -1;
281 |
282 | if(len==7) len += *ip++; /* i.e. format #2 */
283 |
284 | len += 2; /* len is now #octets */
285 |
286 | if(fx_expect_false(op + len > out_end)){
287 | ip -= (len >= 9) ? 2 : 1; /* Rewind to control byte */
288 | goto guess;
289 | }
290 | if(fx_expect_false(ip >= in_end)) return LZFX_ECORRUPT;
291 |
292 | ref -= *ip++;
293 |
294 | if(fx_expect_false(ref < (u8*)obuf)) return LZFX_ECORRUPT;
295 |
296 | do
297 | *op++ = *ref++;
298 | while (--len);
299 | }
300 |
301 | } while (ip < in_end);
302 |
303 | *olen = op - (u8 *)obuf;
304 |
305 | return 0;
306 |
307 | guess:
308 | rc = lzfx_getsize(ip, ilen - (ip-(u8*)ibuf), &remain_len);
309 | if(rc>=0) *olen = remain_len + (op - (u8*)obuf);
310 | return rc;
311 | }
312 |
313 | /* Guess len. No parameters may be NULL; this is not checked. */
314 | static
315 | int lzfx_getsize(const void* ibuf, unsigned int ilen, unsigned int *olen){
316 |
317 | u8 const *ip = (const u8 *)ibuf;
318 | u8 const *const in_end = ip + ilen;
319 | int tot_len = 0;
320 |
321 | while (ip < in_end) {
322 |
323 | unsigned int ctrl = *ip++;
324 |
325 | if(ctrl < (1 << 5)) {
326 |
327 | ctrl++;
328 |
329 | if(ip + ctrl > in_end)
330 | return LZFX_ECORRUPT;
331 |
332 | tot_len += ctrl;
333 | ip += ctrl;
334 |
335 | } else {
336 |
337 | unsigned int len = (ctrl >> 5);
338 |
339 | if(len==7){ /* i.e. format #2 */
340 | len += *ip++;
341 | }
342 |
343 | len += 2; /* len is now #octets */
344 |
345 | if(ip >= in_end) return LZFX_ECORRUPT;
346 |
347 | ip++; /* skip the ref byte */
348 |
349 | tot_len += len;
350 |
351 | }
352 |
353 | }
354 |
355 | *olen = tot_len;
356 |
357 | return 0;
358 | }
359 |
360 |
361 |
362 |
363 |
--------------------------------------------------------------------------------