◆ adc_in_out()
Definition at line 96 of file mcp3208.cpp.
100 int result =
state->results[0];
121 print(
"ch0=%d adj %d ", f0, f0 * 5000 / 4096);
123 print(
"ch1=%d adj %d\r\n", f1, f1 * 5000 / 4096);
static int adcEventCounter
static int adcErrorCounter
static int getValue(McpAdcState *state, int channel)
◆ createRequest()
static void createRequest |
( |
McpAdcState * |
state, |
|
|
int |
channel |
|
) |
| |
|
static |
◆ getMcp3208adc()
int getMcp3208adc |
( |
int |
channel | ) |
|
◆ getNextChannel()
static int getNextChannel |
( |
void |
| ) |
|
|
static |
◆ getValue()
static int getValue |
( |
McpAdcState * |
state, |
|
|
int |
channel |
|
) |
| |
|
static |
◆ init_adc_mcp3208()
void init_adc_mcp3208 |
( |
McpAdcState * |
state, |
|
|
SPIDriver * |
driver |
|
) |
| |
Definition at line 126 of file mcp3208.cpp.
127 state->driver = driver;
128 state->tx_buff[2] = 0;
132 todo: convert to
new API, todo: array of CS
133 mySetPadMod(
"ext adc chip select", MCP3208_CS_PORT, MCP3208_CS_PIN, PAL_STM32_MODE_OUTPUT);
136 spiStart(driver, &
spicfg);
static const SPIConfig spicfg
◆ requestAdcValue()
void requestAdcValue |
( |
McpAdcState * |
state, |
|
|
int |
channel |
|
) |
| |
Definition at line 80 of file mcp3208.cpp.
83 spiSelect(
state->driver);
static void createRequest(McpAdcState *state, int channel)
◆ requestAdcValueI()
void requestAdcValueI |
( |
McpAdcState * |
state, |
|
|
int |
channel |
|
) |
| |
◆ spiCallback()
static void spiCallback |
( |
SPIDriver * |
spip | ) |
|
|
static |
Definition at line 33 of file mcp3208.cpp.
41 if (
state->rx_buff[0] != 255) {
46 if ((
state->rx_buff[1] & 0xE0) != 0xE0) {
53 int result = (
state->rx_buff[0] << 16) + (
state->rx_buff[1] << 8) +
state->rx_buff[2];
54 state->results[
state->requestedChannel] = result;
void requestAdcValueI(McpAdcState *state, int channel)
static int getNextChannel(void)
MCP3208 ADC chip driver structure.
◆ adcErrorCounter
◆ adcEventCounter
◆ hack
◆ spicfg
Initial value:
MCP3208_CS_PORT,
MCP3208_CS_PIN,
SPI_CR1_BR_0 | SPI_CR1_BR_1 | SPI_CR1_BR_2
}
static void spiCallback(SPIDriver *spip)
Definition at line 62 of file mcp3208.cpp.
Referenced by init_adc_mcp3208().
Go to the source code of this file.