My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
/*
* This file is part of the Bus Pirate project (http://code.google.com/p/the-bus-pirate/).
*
* Written and maintained by the Bus Pirate project.
*
* To the extent possible under law, the project has
* waived all copyright and related or neighboring rights to Bus Pirate. This
* work is published from United States.
*
* For details see: http://creativecommons.org/publicdomain/zero/1.0/.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef BASE
#define BASE
#include <p24Fxxxx.h>

//this sets the hardware version
//#define BUSPIRATEV1A //http://hackaday.com/2009/01/22/how-to-bus-pirate-v1-improved-universal-serial-interface/
//#define BUSPIRATEV3 //also v2go
#define BUSPIRATEV4

#define BP_FIRMWARE_STRING "Firmware v6.0RC (r572) "

#define LANGUAGE_EN_US
//#define LANGUAGE_IT_IT
//#define LANGUAGE_ES_ES
//#define LANGUAGE_DE_DE

//include/exclude modules here
// standard protocols
//#define BP_USE_RAW2WIRE
//#define BP_USE_RAW3WIRE

#define BP_MAIN
//#define BP_ADDONS

#if defined(BP_MAIN)
#define BP_USE_1WIRE
#define BP_USE_HWUART //hardware uart (now also MIDI)
#define BP_USE_I2C
//#define BP_USE_I2C_HW
#define BP_USE_HWSPI //hardware spi
#define BP_USE_RAW2WIRE
#define BP_USE_RAW3WIRE
//#define BP_USE_PCATKB
#define BP_USE_LCD // include HD44780 LCD library
//#define BP_USE_PIC
#define BP_USE_DIO //binary mode
#elif defined(BP_ADDONS)
// most used protos
//#define BP_USE_1WIRE
//#define BP_USE_HWUART //hardware uart (now also MIDI)
//#define BP_USE_I2C
//#define BP_USE_I2C_HW
//#define BP_USE_HWSPI //hardware spi
#define BP_USE_RAW2WIRE
#define BP_USE_RAW3WIRE
#define BP_USE_PCATKB
#define BP_USE_LCD // include HD44780 LCD library
#define BP_USE_PIC
#define BP_USE_DIO //binary mode
#else
#error "No Bus Pirate configuration defined."
#endif


#define BP_USE_BASIC // basic subsystem
//#define BP_USE_BASICI2C // use an i2ceeprom for storing


// only 1 should be uncommented
//#define BASICTEST
//#define BASICTEST_I2C
//#define BASICTEST_UART
//#define BASICTEST_R3W
//#define BASICTEST_PIC10 // program blink a led
//#define BASICTEST_PIC10_2 // read whole pic

//sets the address in the bootloader to jump to on the bootloader command
//must be defined in asm
asm (".equ BLJUMPADDRESS, 0xABF8");

//
//
//
// END CONFIG AREA
//
//
//


#if defined(LANGUAGE_EN_US)
#include "translations/en_US.h"
/* my italian and spanish aint that good ;)
#elif defined(LANGUAGE_IT_IT)
#include "translations/it-IT.h"
// #include "translations/en-US.h"
#elif defined(LANGUAGE_ES_ES)
#include "translations/es-ES.h"
*/
#elif defined(LANGUAGE_DE_DE)
#include "translations/de_DE.h"
#else
#error "No language defined in base.h."
#endif


#if defined(BUSPIRATEV1A)
#include "hardwarev1a.h"
#elif defined(BUSPIRATEV3)
#define BUSPIRATEV2 //v25 (2go) and v3 are about the same, enable the same featue set for both
#include "hardwarev3.h"
#elif defined(BUSPIRATEV4)
#include "hardwarev4a.h"
#else
#error "No hardware defined in base.h."
#endif

#include "baseIO.h"
#include "baseUI.h"
#ifdef BUSPIRATEV4
#include "onboardEEPROM.h"
#endif

//these settings are destroyed between modes.
//this is used to pass stuff from protocol libraries to BP
//for example, allowpullup determines if the P menu is available
//TO DO: add global scratch buffer to setting array for use in
// 1-Wire enumeration, JTAG input buffer, etc...
struct _modeConfig {
unsigned char speed;
unsigned char numbits;
unsigned char buf[16];
unsigned char altAUX:2; // there are 4 AUX on BPv4
unsigned char periodicService:1;
unsigned char lsbEN:1;
unsigned char HiZ:1;
unsigned char int16:1; // 16 bits output?
unsigned char wwr:1; // write with read
};

struct _command {
unsigned char cmd;
unsigned int num;
unsigned int repeat;
};

unsigned int bpRevByte(unsigned int c);

//reset all peripherals before configuring a new bus protocol
void bpInit(void);

//Initialize the terminal UART for the speed currently set in bpConfig.termSpeed
void InitializeUART1(void);

//take an ADC measurement on channel c
unsigned int bpADC(unsigned char c);
//takes a measurement from the ADC probe and prints the result to the user terminal
void bpADCprobe(void);
void bpADCCprobe(void);

//print byte c to the user terminal in the format
// specified by the bpConfig.displayMode setting
void bpWbyte(unsigned int c);

//delays used by many libraries
//void bpDelayMS(const unsigned char delay);
//void bpDelayUS(const unsigned char delay);
void bpDelayMS(int delay);
void bpDelayUS(int delay);
#endif

Change log

r611 by ianlesnet on Jan 4, 2012   Diff
Final updates to BP SVN
Go to: 
Project members, sign in to write a code review

Older revisions

r572 by sjaak2...@msn.com on Nov 29, 2010   Diff
- Added compound if statements to the
scripting language
- != is replaced by <> (if statement)
- added & and | operators to the
scripting language
r564 by ianlesnet on Nov 19, 2010   Diff
German translation from Hannes
Jochriem
r559 by ianlesnet on Nov 17, 2010   Diff
applied patch to  make maxproto
automatic: http://code.google.com/p
/the-bus-
pirate/issues/detail?id=56#makechanges
All revisions of this file

File info

Size: 4878 bytes, 174 lines
Powered by Google Project Hosting