75 lines
2.2 KiB
C
75 lines
2.2 KiB
C
#ifndef CUSTOM_BOARD_H
|
|
#define CUSTOM_BOARD_H
|
|
|
|
#define NRF52840_BREAKOUT_BOARD 1
|
|
#define ADS1298 1
|
|
#if ADS1298
|
|
#define AUTO_START_ADS1298 0
|
|
#define ADS1298_STATS 0
|
|
#endif
|
|
|
|
// Debugging flags
|
|
#define DISABLE_USBD_IN_MAIN_LOOP 0
|
|
|
|
// Testing with nRF52840:
|
|
#if NRF52840_BREAKOUT_BOARD
|
|
#define ADS1298_DRDY_PIN 11
|
|
#define ADS1298_MISO_PIN 12
|
|
#define ADS1298_SCK_PIN 13
|
|
#define ADS1298_CS_PIN 14
|
|
// I don't think you're supposed to tie PWDN and reset together on ADS1298
|
|
#define ADS1298_PWDN_PIN 15
|
|
#define ADS1298_MOSI_PIN 16
|
|
|
|
// This is the packet format for data received over USB:
|
|
// [CN:4bit][TN:4bit][..data]
|
|
|
|
// COMMAND NIBBLES (4-bit definitions), CN_
|
|
#define CN_WRITE_IC_REGS 0x8 // 0b1000
|
|
#define CN_READ_IC_REGS 0x4 // 0b0100
|
|
#define CN_STREAM_CONTROL 0xB // 0b1011
|
|
#define CN_MISC_CONTROLS 0xE // 0b1110
|
|
|
|
// CTRL_REQUEST_BATTERY_LEVEL :: 0xBB
|
|
|
|
// TARGET NIBBLES (4-bit definitions)
|
|
#define TN_IC_ADS1298 0x1
|
|
#define TN_IC_EXT 0xF // Extended .. check the next byte!
|
|
|
|
#define TN_STREAM_START 0x2
|
|
#define TN_STREAM_STOP 0xF
|
|
#define TN_STREAM_REQUEST_BATTERY_LEVEL 0xB
|
|
// #define TN_STREAM_REQUEST_WHO_AM_I 0xD
|
|
#define TN_STREAM_REQUEST_PERIPHERAL_INFO 0xE
|
|
|
|
#define TN_MISC_THROUGHPUT_TEST 0xF
|
|
#define TN_MISC_RTT_REQUEST 0x1
|
|
|
|
// #################### RESPONSE CODES ####################
|
|
|
|
#define CTRL_STAT_INFO_PERIPHERALS 0x03
|
|
#define CTRL_STAT_INFO_HW_FW_VERSION 0x04
|
|
#define CTRL_STAT_INFO_WHO_AM_I 0x05
|
|
|
|
#define REGISTER_READBACK_PREFIX 0xC8
|
|
#define ID_REGISTER_READBACK_PREFIX 0xC9
|
|
#define REGISTER_READBACK_ADS1298 TN_IC_ADS1298
|
|
|
|
#define FIRST_NIBBLE(x) ((x >> 4) & 0xF)
|
|
#define SECOND_NIBBLE(x) (x & 0xF)
|
|
// For IC controls, we want to prefix the registers with the length: [u16???]
|
|
// Data format will be different for each device.
|
|
// For ADS1298
|
|
// [CN:4bit][TN:4bit][length:u8][..data]
|
|
// For other device with 1 register read/write at a time
|
|
// [CN:4bit][TN:4bit][RegisterID][RegisterData] for single register
|
|
|
|
#endif // NRF52840_BREAKOUT_BOARD
|
|
|
|
enum recording_mode_t {
|
|
RECORDING_MODE_DISABLED = 0,
|
|
RECORDING_MODE_ALL = 1
|
|
};
|
|
|
|
|
|
#endif // CUSTOM_BOARD_H
|