57 lines
1.6 KiB
C
57 lines
1.6 KiB
C
#ifndef CUSTOM_BOARD_H
|
|
#define CUSTOM_BOARD_H
|
|
|
|
#define NRF52840_BREAKOUT_BOARD 1
|
|
#define ADS1298 1
|
|
|
|
// 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
|
|
#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_INFO 0xE
|
|
|
|
// #TODO:
|
|
#define TN_MISC_THROUGHPUT_TEST 0xF
|
|
#define TN_MISC_RTT_REQUEST 0x1
|
|
|
|
#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_ALL,
|
|
RECORDING_MODE_DISABLED
|
|
};
|
|
|
|
|
|
#endif // CUSTOM_BOARD_H
|