Spoerle
Junior Member level 2
Apologize in advance for a perhaps somewhat philosophical question, but I've been scratching my head for a few days and I haven't found an answer to it
I'm a bit frozen in time, I started on 8-bit Intel 8052.
That's probably why I'm used to save on MCU memory and performance.
To the point.
I want to create a reusable library for the Precision Thermocouple to Digital Converter MAX31856, First, the circuit must be initialized, at least the CR0 and CR1 registers must be set.
My solution will be minimalistic, with the datasheet in hand I will create an init function
It's minimalistic, but difficult to modify without a datasheet
possible modification
etc,
possible modification
for example, for the type of thermocouple (10 options) create an enumeration type ppus create a structure for all registries MAX31856 etc.
This will increase the consumption of MCU memory, we are not sure if this will improve clarity, etc.
I know this is somewhat of a philosophical question, but I would like to know what approach you take?
I'm a bit frozen in time, I started on 8-bit Intel 8052.
That's probably why I'm used to save on MCU memory and performance.
To the point.
I want to create a reusable library for the Precision Thermocouple to Digital Converter MAX31856, First, the circuit must be initialized, at least the CR0 and CR1 registers must be set.
My solution will be minimalistic, with the datasheet in hand I will create an init function
Code:
void initMAX31856 (void
(
CS_Low;
writetoSPI( 0x80, 0x01): // CR0 onestot mode,, 50Hz filter
writetoSPI( 0x81, 0x03): // CR1 1sample averaged , K type TC
CS_High;
)
possible modification
Code:
#define MAX31856_CR0 0x80
#define MAX31856_CR1 0x81
possible modification
for example, for the type of thermocouple (10 options) create an enumeration type ppus create a structure for all registries MAX31856 etc.
This will increase the consumption of MCU memory, we are not sure if this will improve clarity, etc.
I know this is somewhat of a philosophical question, but I would like to know what approach you take?