File tree Expand file tree Collapse file tree 3 files changed +2
-12
lines changed
include/libhal-arm-mcu/lpc40 Expand file tree Collapse file tree 3 files changed +2
-12
lines changed Original file line number Diff line number Diff line change @@ -29,12 +29,7 @@ class dac : public hal::dac
29
29
{
30
30
public:
31
31
32
- // TODO figure out constructors
33
- // not sure if this is a default constructor. Only one pin(i think) can do D/A in this chip
34
- // P[0]26 which i assume is port 0 pin 26
35
-
36
32
dac ();
37
-
38
33
virtual ~dac () = default ;
39
34
40
35
private:
Original file line number Diff line number Diff line change @@ -32,10 +32,6 @@ dac::dac()
32
32
void dac::driver_write (float p_percentage)
33
33
{
34
34
const auto bits_to_modify = static_cast <std::uint32_t >(p_percentage * 1023 ); // getting the 10 most significant bits to set the value
35
- // then i need to bit_modify this value on the dac_pin's converter register's
36
- // value bits.
37
-
38
35
hal::bit_modify (dac_reg->conversion_register .whole ).insert <dac_converter_register::value>(bits_to_modify);
39
-
40
36
}
41
37
} // namespace hal::lpc40
Original file line number Diff line number Diff line change @@ -14,15 +14,14 @@ struct dac_registers
14
14
volatile std::uint32_t count_value;
15
15
};
16
16
namespace dac_converter_register {
17
- // /
17
+ // Holds the value that we want in the register
18
18
static constexpr auto value = hal::bit_mask::from<6 ,15 >();
19
19
20
20
static constexpr auto bias = hal::bit_mask::from<16 >();
21
21
}
22
22
constexpr std::uintptr_t dac_address = 0x4008'C000 ;
23
23
inline auto * dac_reg = reinterpret_cast <dac_registers*>(dac_address);
24
24
25
- } // namespace hal::lpc40// Copyright 2024 Khalil Estell
26
-
25
+ } // namespace hal::lpc
27
26
28
27
You can’t perform that action at this time.
0 commit comments