99 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
1010 */
1111// ----------------------------------------------------------------------------
12-
13- #ifndef MODM_AVR_SPI_HPP
14- #define MODM_AVR_SPI_HPP
12+ #pragma once
1513
1614#include <avr/io.h>
1715
1816/// @cond
1917%% if partname in ["attiny40"]
2018// The avr-libc Header files for the ATtiny40 is missing the following
21- // defines although they are meantioned in the datasheet.
19+ // defines although they are mentioned in the datasheet.
2220#define SPR0 0
2321#define SPR1 1
2422#define CPHA 2
5149%% endif
5250/// @endcond
5351
54- namespace modm
55- {
56-
57- namespace platform
52+ namespace modm::platform
5853{
5954
6055/// @ingroup modm_platform_spi
@@ -71,10 +66,29 @@ struct Spi
7166 Div64 = (1 << SPR1{{ id }}),
7267 Div128 = (1 << SPR1{{ id }}) | (1 << SPR0{{ id }}),
7368 };
74- };
7569
76- } // namespace platform
70+ enum State : uint8_t {
71+ Idle = Bit6, // Transaction is running
72+ Repeat = Bit7, // Send same tx multiple times
73+ };
74+ MODM_FLAGS8(State);
75+
76+ enum DataType : uint8_t {
77+ Byte = 0, // 1 byte
78+ HalfWord = 1, // 2 bytes
79+ Word = 2, // 4 bytes
80+ // WordWord = 3 // 8 bytes
81+ };
82+ typedef Value<State_t, 2> DataType_t;
83+ };
7784
78- } // namespace modm
85+ enum Type : uint8_t {
86+ Byte = 0, // 1 byte
87+ HalfWord = 1, // 2 bytes
88+ Word = 2, // 4 bytes
89+ // WordWord = 3 // 8 bytes
90+ };
91+ typedef Value<State_t, 2> Type_t;
92+ };
7993
80- #endif // MODM_AVR_SPI_HPP
94+ } // namespace modm::platform
0 commit comments